1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Use add/remove-hook on erc-pre-send-functions

* lisp/erc/erc-goodies.el (noncommands): Ditto.

* lisp/erc/erc-ring.el (ring): Use add/remove-hook.
This commit is contained in:
Lars Ingebrigtsen 2019-06-19 18:20:22 +02:00
parent fc8a8bdb7f
commit 7121444100
2 changed files with 4 additions and 6 deletions

View file

@ -177,9 +177,8 @@ does not appear in the ERC buffer after the user presses ENTER.")
"This mode distinguishes non-commands.
Commands listed in `erc-insert-this' know how to display
themselves."
((cl-pushnew 'erc-send-distinguish-noncommands erc-pre-send-functions))
((setq erc-pre-send-functions (delq 'erc-send-distinguish-noncommands
erc-pre-send-functions))))
((add-hook 'erc-pre-send-functions 'erc-send-distinguish-noncommands))
((remove-hook 'erc-pre-send-functions 'erc-send-distinguish-noncommands)))
(defun erc-send-distinguish-noncommands (state)
"If STR is an ERC non-command, set `insertp' in STATE to nil."

View file

@ -46,11 +46,10 @@
(define-erc-module ring nil
"Stores input in a ring so that previous commands and messages can
be recalled using M-p and M-n."
((cl-pushnew 'erc-add-to-input-ring erc-pre-send-functions)
((add-hook 'erc-pre-send-functions 'erc-add-to-input-ring)
(define-key erc-mode-map "\M-p" 'erc-previous-command)
(define-key erc-mode-map "\M-n" 'erc-next-command))
((setq erc-pre-send-functions (delq 'erc-add-to-input-ring
erc-pre-send-functions))
((remove-hook 'erc-pre-send-functions 'erc-add-to-input-ring)
(define-key erc-mode-map "\M-p" 'undefined)
(define-key erc-mode-map "\M-n" 'undefined)))