mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Make function erc-scrolltobottom-mode idempotent
* lisp/erc/erc-goodies.el (erc-scrolltobottom-mode) (erc-scrolltobottom-enable): Always remove hook functions whose membership hinges on the value of `erc-scrolltobottom-all'. In ERC 5.6, an init file's `setopt' form containing an `erc-modules' assignment before an `erc-scrolltobottom-all' one would result in conflicting sets of hook members come `erc-open'. Having such option-dependent branching in module setup, while difficult to maintain, is a long held ERC practice, as seen in functions like `erc-nickserv-identify-mode'. Making all new modules "local" may be the most manageable solution because existing global modules can't be made to require prior deactivation.
This commit is contained in:
parent
b3abbab632
commit
fca0dbe0ab
1 changed files with 5 additions and 0 deletions
|
|
@ -87,10 +87,15 @@ be experimental. It currently only works with Emacs 28+."
|
|||
(unless erc--updating-modules-p (erc-buffer-do #'erc--scrolltobottom-setup))
|
||||
(if erc-scrolltobottom-all
|
||||
(progn
|
||||
(remove-hook 'erc-insert-done-hook #'erc-possibly-scroll-to-bottom)
|
||||
(add-hook 'erc-insert-pre-hook #'erc--scrolltobottom-on-pre-insert 25)
|
||||
(add-hook 'erc-pre-send-functions #'erc--scrolltobottom-on-pre-insert)
|
||||
(add-hook 'erc-insert-done-hook #'erc--scrolltobottom-all)
|
||||
(add-hook 'erc-send-completed-hook #'erc--scrolltobottom-all))
|
||||
(remove-hook 'erc-insert-pre-hook #'erc--scrolltobottom-on-pre-insert)
|
||||
(remove-hook 'erc-pre-send-functions #'erc--scrolltobottom-on-pre-insert)
|
||||
(remove-hook 'erc-insert-done-hook #'erc--scrolltobottom-all)
|
||||
(remove-hook 'erc-send-completed-hook #'erc--scrolltobottom-all)
|
||||
(add-hook 'erc-insert-done-hook #'erc-possibly-scroll-to-bottom)))
|
||||
((remove-hook 'erc-mode-hook #'erc--scrolltobottom-setup)
|
||||
(erc-buffer-do #'erc--scrolltobottom-setup)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue