aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2014-09-24 13:31:59 -0400
committerStefan Monnier2014-09-24 13:31:59 -0400
commit38353b99f3288a0c98159ba9f3c0171897aca08e (patch)
tree6d0ab9f256e4432d4e9aca6dedfd593ddfdc6b48
parent5217cd83c09bf68036fc534dcc8094e0b1b35346 (diff)
downloademacs-38353b99f3288a0c98159ba9f3c0171897aca08e.tar.gz
emacs-38353b99f3288a0c98159ba9f3c0171897aca08e.zip
* lisp/erc/erc-track.el (erc-modified-channels-display): Update all mode lines
if needed. Remove call to erc-modified-channels-object where we ignored the return value. (erc-modified-channels-update): Don't force-mode-line-update here any more. Fixes: debbugs:18510
-rw-r--r--lisp/erc/ChangeLog7
-rw-r--r--lisp/erc/erc-track.el79
2 files changed, 47 insertions, 39 deletions
diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog
index 6d99fdf73d9..b3cdb067d13 100644
--- a/lisp/erc/ChangeLog
+++ b/lisp/erc/ChangeLog
@@ -1,3 +1,10 @@
12014-09-24 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * erc-track.el (erc-modified-channels-display): Update all mode lines
4 if needed (bug#18510). Remove call to erc-modified-channels-object
5 where we ignored the return value.
6 (erc-modified-channels-update): Don't force-mode-line-update here any more.
7
12014-02-25 Julien Danjou <julien@danjou.info> 82014-02-25 Julien Danjou <julien@danjou.info>
2 9
3 * erc-networks.el (erc-determine-network): Check that NETWORK as a 10 * erc-networks.el (erc-determine-network): Check that NETWORK as a
diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el
index 3f7b6a7b501..706cce2fefe 100644
--- a/lisp/erc/erc-track.el
+++ b/lisp/erc/erc-track.el
@@ -767,8 +767,7 @@ ARGS are ignored."
767 (erc-modified-channels-remove-buffer buffer)))) 767 (erc-modified-channels-remove-buffer buffer))))
768 erc-modified-channels-alist) 768 erc-modified-channels-alist)
769 (when removed-channel 769 (when removed-channel
770 (erc-modified-channels-display) 770 (erc-modified-channels-display)))
771 (force-mode-line-update t)))
772 (remove-hook 'post-command-hook 'erc-modified-channels-update))) 771 (remove-hook 'post-command-hook 'erc-modified-channels-update)))
773 772
774(defvar erc-track-mouse-face (if (featurep 'xemacs) 773(defvar erc-track-mouse-face (if (featurep 'xemacs)
@@ -825,43 +824,45 @@ Use `erc-make-mode-line-buffer-name' to create buttons."
825 ((eq 'importance erc-track-switch-direction) 824 ((eq 'importance erc-track-switch-direction)
826 (erc-track-sort-by-importance))) 825 (erc-track-sort-by-importance)))
827 (run-hooks 'erc-track-list-changed-hook) 826 (run-hooks 'erc-track-list-changed-hook)
828 (unless (eq erc-track-position-in-mode-line nil) 827 (when erc-track-position-in-mode-line
829 (if (null erc-modified-channels-alist) 828 (let* ((oldobject erc-modified-channels-object)
830 (setq erc-modified-channels-object (erc-modified-channels-object nil)) 829 (strings
831 ;; erc-modified-channels-alist contains all the data we need. To 830 (when erc-modified-channels-alist
832 ;; better understand what is going on, we split things up into 831 ;; erc-modified-channels-alist contains all the data we need. To
833 ;; four lists: BUFFERS, COUNTS, SHORT-NAMES, and FACES. These 832 ;; better understand what is going on, we split things up into
834 ;; four lists we use to create a new 833 ;; four lists: BUFFERS, COUNTS, SHORT-NAMES, and FACES. These
835 ;; `erc-modified-channels-object' using 834 ;; four lists we use to create a new
836 ;; `erc-make-mode-line-buffer-name'. 835 ;; `erc-modified-channels-object' using
837 (let* ((buffers (mapcar 'car erc-modified-channels-alist)) 836 ;; `erc-make-mode-line-buffer-name'.
838 (counts (mapcar 'cadr erc-modified-channels-alist)) 837 (let* ((buffers (mapcar 'car erc-modified-channels-alist))
839 (faces (mapcar 'cddr erc-modified-channels-alist)) 838 (counts (mapcar 'cadr erc-modified-channels-alist))
840 (long-names (mapcar #'(lambda (buf) 839 (faces (mapcar 'cddr erc-modified-channels-alist))
841 (or (buffer-name buf) 840 (long-names (mapcar #'(lambda (buf)
842 "")) 841 (or (buffer-name buf)
843 buffers)) 842 ""))
844 (short-names (if (functionp erc-track-shorten-function) 843 buffers))
845 (funcall erc-track-shorten-function 844 (short-names (if (functionp erc-track-shorten-function)
846 long-names) 845 (funcall erc-track-shorten-function
847 long-names)) 846 long-names)
848 strings) 847 long-names))
849 (while buffers 848 strings)
850 (when (car short-names) 849 (while buffers
851 (setq strings (cons (erc-make-mode-line-buffer-name 850 (when (car short-names)
852 (car short-names) 851 (setq strings (cons (erc-make-mode-line-buffer-name
853 (car buffers) 852 (car short-names)
854 (car faces) 853 (car buffers)
855 (car counts)) 854 (car faces)
856 strings))) 855 (car counts))
857 (setq short-names (cdr short-names) 856 strings)))
858 buffers (cdr buffers) 857 (setq short-names (cdr short-names)
859 counts (cdr counts) 858 buffers (cdr buffers)
860 faces (cdr faces))) 859 counts (cdr counts)
861 (when (featurep 'xemacs) 860 faces (cdr faces)))
862 (erc-modified-channels-object nil)) 861 strings)))
863 (setq erc-modified-channels-object 862 (newobject (erc-modified-channels-object strings)))
864 (erc-modified-channels-object strings)))))) 863 (unless (equal oldobject newobject)
864 (setq erc-modified-channels-object newobject)
865 (force-mode-line-update t)))))
865 866
866(defun erc-modified-channels-remove-buffer (buffer) 867(defun erc-modified-channels-remove-buffer (buffer)
867 "Remove BUFFER from `erc-modified-channels-alist'." 868 "Remove BUFFER from `erc-modified-channels-alist'."