changeset 91782:c9c3987bcc44

(ibuffer-header-line-format): New var. (ibuffer-mode): Set it instead of header-line-format. (ibuffer-update): Use it to set header-line-format.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 11 Feb 2008 18:39:22 +0000
parents a6047ef14f4c
children 3be932cc1b8a
files lisp/ChangeLog lisp/ibuffer.el
diffstat 2 files changed, 21 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Mon Feb 11 17:56:13 2008 +0000
+++ b/lisp/ChangeLog	Mon Feb 11 18:39:22 2008 +0000
@@ -1,5 +1,9 @@
 2008-02-11  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+	* ibuffer.el (ibuffer-header-line-format): New var.
+	(ibuffer-mode): Set it instead of header-line-format.
+	(ibuffer-update): Use it to set header-line-format.
+
 	* international/mule-cmds.el (ucs-insert): Inherit surrounding
 	properties like self-insert-command.
 
--- a/lisp/ibuffer.el	Mon Feb 11 17:56:13 2008 +0000
+++ b/lisp/ibuffer.el	Mon Feb 11 18:39:22 2008 +0000
@@ -49,6 +49,7 @@
 (defvar ibuffer-filter-group-kill-ring)
 (defvar ibuffer-filter-groups)
 (defvar ibuffer-filtering-qualifiers)
+(defvar ibuffer-header-line-format)
 (defvar ibuffer-hidden-filter-groups)
 (defvar ibuffer-inline-columns)
 (defvar ibuffer-show-empty-filter-groups)
@@ -2164,7 +2165,14 @@
       (ibuffer-shrink-to-fit t)
     (when ibuffer-shrink-to-minimum-size
       (ibuffer-shrink-to-fit)))
-  (ibuffer-forward-line 0))
+  (ibuffer-forward-line 0)
+  ;; I tried to update this automatically from the mode-line-process format,
+  ;; but changing nil-ness of header-line-format while computing
+  ;; mode-line-format is asking a bit too much it seems.  --Stef
+  (setq header-line-format
+        (and ibuffer-use-header-line
+             ibuffer-filtering-qualifiers
+             ibuffer-header-line-format)))
 
 (defun ibuffer-sort-bufferlist (bmarklist)
   (let* ((sortdat (assq ibuffer-sorting-mode
@@ -2537,14 +2545,14 @@
            (:eval (if (functionp 'ibuffer-format-qualifier)
                       (mapconcat 'ibuffer-format-qualifier
                                  ibuffer-filtering-qualifiers ""))))))
-  (setq header-line-format
-        (if ibuffer-use-header-line
-            ;; Display the part that won't be in the mode-line.
-            (list* "" mode-name
-                   (mapcar (lambda (elem)
-                             (if (eq (car-safe elem) 'header-line-format)
-                                 (nth 2 elem) elem))
-                           mode-line-process))))
+  ;; `ibuffer-update' puts this on header-line-format when needed.
+  (setq ibuffer-header-line-format
+        ;; Display the part that won't be in the mode-line.
+        (list* "" mode-name
+               (mapcar (lambda (elem)
+                         (if (eq (car-safe elem) 'header-line-format)
+                             (nth 2 elem) elem))
+                       mode-line-process)))
 
   (setq buffer-read-only t)
   (buffer-disable-undo)