From: <sm...@wa...> - 2001-10-30 20:52:44
|
I'll send my big TODO list later, this is a short mail to see who's already subscribed :-) The following function should make erc's scrolling somewhat more like that of ordinary irc clients. I would love to see an elegant alternative; this is the only solution I could come up with. The hack for the minibuffer is there because Emacs can't perform a switch-to-buffer while in the minibuffer. Joy. I haven't tested this with multiple frames, nor with all too fancy window layouts. It seems to work pretty well, but when the cursor is NOT at the end of the buffer, it shouldn't recenter. Johnw's version for Zenirc (http://www.gci-net.com/users/j/johnw/Emacs/.zenirc.el) does take care of this by checking (eobp), but unfortunately the erc hook is called somewhere where the cursor is not at the end of the buffer :( Suggestions welcome! I've only tested this with Emacs 21, please let me know if it works or breaks in other versions. (defun erc-scroll-to-bottom (&optional start end) "A hook function for erc-insert-hook to recenter the output near the bottom of the screen." ;; it would be nice if this were only run on (eobp), but ;; unfortunately (eobp)=nil most of the time when this function is ;; called :( (let ((minibuffer-hack-p (minibuffer-window-active-p (selected-window))) (updated-buffer (current-buffer))) (when minibuffer-hack-p (other-window 1)) (let ((visual-buffer (window-buffer (selected-window)))) (switch-to-buffer updated-buffer) (recenter -1) (goto-char (point-max)) (switch-to-buffer visual-buffer) (if minibuffer-hack-p (other-window 1))))) (add-hook erc-insert-hook 'erc-scroll-to-bottom) Have a nice day, -- Tijs van Bakel, <sm...@wa...> |