From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Deniz Dogan Newsgroups: gmane.emacs.devel Subject: New hook for ERC Date: Wed, 08 Feb 2012 22:21:39 +0100 Message-ID: <4F32E763.1060104@dogan.se> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1328736126 20742 80.91.229.3 (8 Feb 2012 21:22:06 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 8 Feb 2012 21:22:06 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 08 22:22:03 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RvExl-0005dl-Hs for ged-emacs-devel@m.gmane.org; Wed, 08 Feb 2012 22:22:01 +0100 Original-Received: from localhost ([::1]:44439 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvExk-0000EM-FW for ged-emacs-devel@m.gmane.org; Wed, 08 Feb 2012 16:22:00 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:39254) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvExi-0000Dz-Bd for emacs-devel@gnu.org; Wed, 08 Feb 2012 16:21:59 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RvExh-0002vu-Be for emacs-devel@gnu.org; Wed, 08 Feb 2012 16:21:58 -0500 Original-Received: from ch-smtp05.sth.basefarm.net ([80.76.153.6]:55276) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvExh-0002vd-0M for emacs-devel@gnu.org; Wed, 08 Feb 2012 16:21:57 -0500 Original-Received: from c80-216-107-103.bredband.comhem.se ([80.216.107.103]:50988 helo=[192.168.0.10]) by ch-smtp05.sth.basefarm.net with esmtp (Exim 4.76) (envelope-from ) id 1RvExa-00078d-Ge for emacs-devel@gnu.org; Wed, 08 Feb 2012 22:21:54 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0) Gecko/20120129 Thunderbird/10.0 X-Originating-IP: 80.216.107.103 X-Scan-Result: No virus found in message 1RvExa-00078d-Ge. X-Scan-Signature: ch-smtp05.sth.basefarm.net 1RvExa-00078d-Ge e283fca79b879c1c33412e1c6c50500c X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.76.153.6 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:148377 Archived-At: 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