emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

New hook for ERC


From: Deniz Dogan
Subject: New hook for ERC
Date: Wed, 08 Feb 2012 22:21:39 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0) Gecko/20120129 Thunderbird/10.0

Hi,

I've been trying to "fix" the behavior of ERC's scroll-to-bottom module by hooking into erc-insert-post-hook. I thought that the state when that hook is executed would be that point is back in the input area, but it does not seem like it.

I need point to be in the input area (after erc-input-marker) when the hook is executed to properly recenter the window. I can't seem to find a hook for when that happens, so I made a new one and run that hook as the last thing that happens in the buffer in erc-display-line-1:

...snip...
        (erc-update-undo-list (- (or (marker-position erc-insert-marker)
                                     (point-max))
                                 insert-position)))
      (run-hooks 'erc-display-post-hook)))) ;; as such!

Then I add my own function to erc-display-post-hook as such:

(defun damd-erc-display-post-hook ()
  (let ((windows (get-buffer-window-list (current-buffer) nil 'visible)))
    (dolist (w windows)
      (when (>= (point) erc-input-marker)
        (with-selected-window w
          (recenter -1))))))
(add-hook 'erc-display-post-hook 'damd-erc-display-post-hook)

Is there any way to do this without introducing yet another hook like I just did? If not, can I add the hook to trunk?

Deniz



reply via email to

[Prev in Thread] Current Thread [Next in Thread]