From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Julien Danjou Newsgroups: gmane.emacs.devel Subject: [PATCH] erc-track: fix tracking visibility issue Date: Mon, 7 Feb 2011 20:08:20 +0100 Message-ID: <1297105700-9801-1-git-send-email-julien@danjou.info> NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1297123167 30972 80.91.229.12 (7 Feb 2011 23:59:27 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 7 Feb 2011 23:59:27 +0000 (UTC) Cc: Julien Danjou To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 08 00:59:23 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PmazJ-0005kT-Ie for ged-emacs-devel@m.gmane.org; Tue, 08 Feb 2011 00:59:21 +0100 Original-Received: from localhost ([127.0.0.1]:40898 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PmazJ-0000VS-1w for ged-emacs-devel@m.gmane.org; Mon, 07 Feb 2011 18:59:21 -0500 Original-Received: from [140.186.70.92] (port=39052 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PmYKU-00085J-6a for emacs-devel@gnu.org; Mon, 07 Feb 2011 16:09:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PmWRn-00073N-FD for emacs-devel@gnu.org; Mon, 07 Feb 2011 14:08:28 -0500 Original-Received: from prometheus.naquadah.org ([212.85.154.174]:37712 helo=mx1.naquadah.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PmWRn-00072m-1v for emacs-devel@gnu.org; Mon, 07 Feb 2011 14:08:27 -0500 Original-Received: by mx1.naquadah.org (Postfix, from userid 8) id 08C6D5C0DE; Mon, 7 Feb 2011 20:08:25 +0100 (CET) Original-Received: from keller.adm.naquadah.org (unknown [192.168.2.14]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.naquadah.org (Postfix) with ESMTPS id 122BC5C0D8; Mon, 7 Feb 2011 20:08:23 +0100 (CET) Original-Received: from jd by keller.adm.naquadah.org with local (Exim 4.72) (envelope-from ) id 1PmWRi-0002Ye-QG; Mon, 07 Feb 2011 20:08:22 +0100 X-Mailer: git-send-email 1.7.2.3 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 212.85.154.174 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:135706 Archived-At: This fix the tracking issue that when executing a command that change window configuration and may make a ERC buffer visible, ERC would consider it as read, which is not the case. Signed-off-by: Julien Danjou --- lisp/erc/ChangeLog | 10 ++++++++++ lisp/erc/erc-track.el | 15 +++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog index ee81bc4..4f2a4c8 100644 --- a/lisp/erc/ChangeLog +++ b/lisp/erc/ChangeLog @@ -1,3 +1,13 @@ +2011-02-07 Julien Danjou + + * erc-track.el (erc-window-configuration-change): New + function. This will allow to track buffer visibility when a + command is finished to executed. Idea stolen from rcirc. + (track): Put erc-window-configuration-change in + window-configuration-change-hook. + (erc-modified-channels-update): Remove + erc-modified-channels-update from post-command-hook after update. + 2011-01-31 Antoine Levitt (tiny change) * erc-track.el (track): Don't reset erc-modified-channels-object diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el index de920eb..a89244f 100644 --- a/lisp/erc/erc-track.el +++ b/lisp/erc/erc-track.el @@ -653,7 +653,7 @@ module, otherwise the keybindings will not do anything useful." (defadvice switch-to-buffer (after erc-update (&rest args) activate) (erc-modified-channels-update)) (add-hook 'window-configuration-change-hook - 'erc-modified-channels-update)) + 'erc-window-configuration-change)) (add-hook 'erc-insert-post-hook 'erc-track-modified-channels) (add-hook 'erc-disconnected-hook 'erc-modified-channels-update)) ;; enable the tracking keybindings @@ -675,7 +675,7 @@ module, otherwise the keybindings will not do anything useful." (if (featurep 'xemacs) (ad-disable-advice 'switch-to-buffer 'after 'erc-update) (remove-hook 'window-configuration-change-hook - 'erc-modified-channels-update)) + 'erc-window-configuration-change)) (remove-hook 'erc-disconnected-hook 'erc-modified-channels-update) (remove-hook 'erc-insert-post-hook 'erc-track-modified-channels)) ;; disable the tracking keybindings @@ -730,6 +730,12 @@ only consider active buffers visible.") ;;; Tracking the channel modifications +(defun erc-window-configuration-change () + (unless (minibuffer-window-active-p (minibuffer-window)) + ;; delay this until command has finished to make sure window is + ;; actually visible before clearing activity + (add-hook 'post-command-hook 'erc-modified-channels-update))) + (defvar erc-modified-channels-update-inside nil "Variable to prevent running `erc-modified-channels-update' multiple times. Without it, you cannot debug `erc-modified-channels-display', @@ -757,8 +763,9 @@ ARGS are ignored." (erc-modified-channels-remove-buffer buffer)))) erc-modified-channels-alist) (when removed-channel - (erc-modified-channels-display) - (force-mode-line-update t))))) + (erc-modified-channels-display) + (force-mode-line-update t))) + (remove-hook 'post-command-hook 'erc-modified-channels-update))) (defvar erc-track-mouse-face (if (featurep 'xemacs) 'modeline-mousable -- 1.7.2.3