unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] erc-track: fix tracking visibility issue
@ 2011-02-07 19:08 Julien Danjou
  2011-02-09  0:45 ` Michael Olson
  0 siblings, 1 reply; 3+ messages in thread
From: Julien Danjou @ 2011-02-07 19:08 UTC (permalink / raw)
  To: emacs-devel; +Cc: Julien Danjou

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 <julien@danjou.info>
---
 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  <julien@danjou.info>
+
+	* 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  <antoine.levitt@gmail.com>  (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




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

* Re: [PATCH] erc-track: fix tracking visibility issue
  2011-02-07 19:08 [PATCH] erc-track: fix tracking visibility issue Julien Danjou
@ 2011-02-09  0:45 ` Michael Olson
  2011-02-09  4:09   ` Chong Yidong
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Olson @ 2011-02-09  0:45 UTC (permalink / raw)
  To: Julien Danjou; +Cc: emacs-devel

Looks good to me.

On Mon, Feb 7, 2011 at 11:08 AM, Julien Danjou <julien@danjou.info> wrote:
> 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 <julien@danjou.info>
> ---
>  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  <julien@danjou.info>
> +
> +       * 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  <antoine.levitt@gmail.com>  (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
>
>
>



-- 
Michael Olson  |  http://mwolson.org/



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

* Re: [PATCH] erc-track: fix tracking visibility issue
  2011-02-09  0:45 ` Michael Olson
@ 2011-02-09  4:09   ` Chong Yidong
  0 siblings, 0 replies; 3+ messages in thread
From: Chong Yidong @ 2011-02-09  4:09 UTC (permalink / raw)
  To: Julien Danjou; +Cc: Michael Olson, emacs-devel

Michael Olson <mwolson@gnu.org> writes:

> Looks good to me.

Committed to trunk.

Thanks for the patch, Julien.



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

end of thread, other threads:[~2011-02-09  4:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-07 19:08 [PATCH] erc-track: fix tracking visibility issue Julien Danjou
2011-02-09  0:45 ` Michael Olson
2011-02-09  4:09   ` Chong Yidong

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).