all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* New hook for ERC
@ 2012-02-08 21:21 Deniz Dogan
  2012-02-08 22:23 ` Antoine Levitt
  2012-02-08 23:53 ` Johan Bockgård
  0 siblings, 2 replies; 13+ messages in thread
From: Deniz Dogan @ 2012-02-08 21:21 UTC (permalink / raw)
  To: emacs-devel

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



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2012-02-12 21:11 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-08 21:21 New hook for ERC Deniz Dogan
2012-02-08 22:23 ` Antoine Levitt
2012-02-08 23:32   ` Deniz Dogan
2012-02-09 10:06     ` Emacs scrolling past the end of buffer (was: New hook for ERC) Antoine Levitt
2012-02-09 12:01       ` Emacs scrolling past the end of buffer Deniz Dogan
2012-02-12 16:37       ` Deniz Dogan
2012-02-12 16:45         ` Eli Zaretskii
2012-02-12 19:52           ` Deniz Dogan
2012-02-12 21:11             ` Eli Zaretskii
2012-02-09 21:29     ` New hook for ERC Lars Ingebrigtsen
2012-02-09 22:41       ` Antoine Levitt
2012-02-08 23:53 ` Johan Bockgård
2012-02-08 23:56   ` Deniz Dogan

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.