** erc
+---
+*** New hook 'erc-insert-done-hook'.
+This hook is called after strings have been inserted into the buffer,
+and is free to alter point and window configurations, as it's not
+called from inside a 'save-excursion', as opposed to
+'erc-insert-post-hook'.
+
---
*** 'erc-button-google-url' has been renamed to 'erc-button-search-url'
and its value has been changed to Duck Duck Go.
(define-erc-module scrolltobottom nil
"This mode causes the prompt to stay at the end of the window."
((add-hook 'erc-mode-hook 'erc-add-scroll-to-bottom)
+ (add-hook 'erc-insert-done-hook 'erc-possibly-scroll-to-bottom)
(dolist (buffer (erc-buffer-list))
(with-current-buffer buffer
(erc-add-scroll-to-bottom))))
((remove-hook 'erc-mode-hook 'erc-add-scroll-to-bottom)
+ (remove-hook 'erc-insert-done-hook 'erc-possibly-scroll-to-bottom)
(dolist (buffer (erc-buffer-list))
(with-current-buffer buffer
(remove-hook 'post-command-hook 'erc-scroll-to-bottom t)))))
+(defun erc-possibly-scroll-to-bottom ()
+ "Like `erc-add-scroll-to-bottom', but only if window is selected."
+ (when (eq (selected-window) (get-buffer-window))
+ (erc-scroll-to-bottom)))
+
(defun erc-add-scroll-to-bottom ()
"A hook function for `erc-mode-hook' to recenter output at bottom of window.
erc-make-read-only
erc-save-buffer-in-logs))
+(defcustom erc-insert-done-hook nil
+ "This hook is called after inserting strings into the buffer.
+This hook is not called from inside `save-excursion' and should
+preserve point if needed."
+ :group 'erc-hooks
+ :version "27.1"
+ :type 'hook)
+
(defcustom erc-send-modify-hook nil
"Sending hook for functions that will change the text's appearance.
This hook is called just after `erc-send-pre-hook' when the values
(when erc-remove-parsed-property
(remove-text-properties (point-min) (point-max)
'(erc-parsed nil))))))))
+ (run-hooks 'erc-insert-done-hook)
(erc-update-undo-list (- (or (marker-position erc-insert-marker)
(point-max))
insert-position))))))