emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/ibuffer.el,v


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/ibuffer.el,v
Date: Wed, 16 Jan 2008 16:11:11 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Stefan Monnier <monnier>        08/01/16 16:11:11

Index: ibuffer.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/ibuffer.el,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -b -r1.92 -r1.93
--- ibuffer.el  8 Jan 2008 20:44:39 -0000       1.92
+++ ibuffer.el  16 Jan 2008 16:11:09 -0000      1.93
@@ -1722,7 +1722,7 @@
    ('mouse-face 'highlight
                'keymap ibuffer-mode-name-map
                'help-echo "mouse-2: filter by this mode"))
-  (format-mode-line mode-name))
+  (format-mode-line mode-name nil nil (current-buffer)))
 
 (define-ibuffer-column process
   (:summarizer
@@ -2097,29 +2097,6 @@
           (point))
         `(ibuffer-summary t)))))
 
-(defun ibuffer-update-mode-name ()
-  (setq mode-name (format "Ibuffer by %s" (if ibuffer-sorting-mode
-                                             ibuffer-sorting-mode
-                                           "view time")))
-  (when ibuffer-sorting-reversep
-    (setq mode-name (concat mode-name " [rev]")))
-  (when (and (featurep 'ibuf-ext)
-            ibuffer-auto-mode)
-    (setq mode-name (concat mode-name " (Auto)")))
-  (let ((result ""))
-    (when (featurep 'ibuf-ext)
-      (dolist (qualifier ibuffer-filtering-qualifiers)
-       (setq result
-             (concat result (ibuffer-format-qualifier qualifier))))
-      (if ibuffer-use-header-line
-         (setq header-line-format
-               (when ibuffer-filtering-qualifiers
-                 (replace-regexp-in-string "%" "%%"
-                                           (concat mode-name result))))
-       (progn
-         (setq mode-name (concat mode-name result))
-         (when (boundp 'header-line-format)
-           (setq header-line-format nil)))))))
 
 (defun ibuffer-redisplay (&optional silent)
   "Redisplay the current list of buffers.
@@ -2137,7 +2114,6 @@
          (message "No buffers! (note: filtering in effect)")
        (error "No buffers!")))
     (ibuffer-redisplay-engine blist t)
-    (ibuffer-update-mode-name)
     (unless silent
       (message "Redisplaying current buffer list...done"))
     (ibuffer-forward-line 0)))
@@ -2174,7 +2150,6 @@
     (unless silent
       (message "Updating buffer list..."))
     (ibuffer-redisplay-engine blist arg)
-    (ibuffer-update-mode-name)
     (unless silent
       (message "Updating buffer list...done")))
   (if (eq ibuffer-shrink-to-minimum-size 'onewindow)
@@ -2540,6 +2515,25 @@
   (use-local-map ibuffer-mode-map)
   (setq major-mode 'ibuffer-mode)
   (setq mode-name "Ibuffer")
+  ;; Include state info next to the mode name.
+  (set (make-local-variable mode-line-process)
+        '((ibuffer-sorting-mode (:eval (symbol-name ibuffer-sorting-mode))
+                                "view time")
+          (ibuffer-sorting-reversep " [rev]")
+          (ibuffer-auto-mode " (Auto)")
+          ;; Only list the filters if they're not already in the header-line.
+          (header-line-format
+           ""
+           (: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.
+            (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)
   (setq truncate-lines ibuffer-truncate-lines)
@@ -2578,9 +2572,7 @@
   (when ibuffer-default-directory
     (setq default-directory ibuffer-default-directory))
   (add-hook 'change-major-mode-hook 'font-lock-defontify nil t)
-  (run-mode-hooks 'ibuffer-mode-hook)
-  ;; called after mode hooks to allow the user to add filters
-  (ibuffer-update-mode-name))
+  (run-mode-hooks 'ibuffer-mode-hook))
 
 (provide 'ibuffer)
 
@@ -2590,5 +2582,5 @@
 ;; coding: iso-8859-1
 ;; End:
 
-;;; arch-tag: 72581688-0603-4954-b8cf-837c700f62e8
+;; arch-tag: 72581688-0603-4954-b8cf-837c700f62e8
 ;;; ibuffer.el ends here




reply via email to

[Prev in Thread] Current Thread [Next in Thread]