Mercurial > emacs
changeset 87791:179da0eedc24
(mode): Pass the buffer to format-mode-line.
(ibuffer-update-mode-name): Remove.
(ibuffer-redisplay, ibuffer-update, ibuffer-mode): Don't call it.
(ibuffer-mode): Use mode-line-process instead.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 16 Jan 2008 16:11:09 +0000 |
parents | d4459bad23ea |
children | c689fd3b9cfd |
files | lisp/ChangeLog lisp/ibuffer.el |
diffstat | 2 files changed, 27 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Wed Jan 16 15:57:42 2008 +0000 +++ b/lisp/ChangeLog Wed Jan 16 16:11:09 2008 +0000 @@ -1,5 +1,10 @@ 2008-01-16 Stefan Monnier <monnier@iro.umontreal.ca> + * ibuffer.el (mode): Pass the buffer to format-mode-line. + (ibuffer-update-mode-name): Remove. + (ibuffer-redisplay, ibuffer-update, ibuffer-mode): Don't call it. + (ibuffer-mode): Use mode-line-process instead. + * ibuf-ext.el (ibuffer-auto-update-changed, ibuffer-auto-mode): Use derived-mode-p. (ibuffer-mark-by-mode-regexp): Pass the buffer to format-mode-line.
--- a/lisp/ibuffer.el Wed Jan 16 15:57:42 2008 +0000 +++ b/lisp/ibuffer.el Wed Jan 16 16:11:09 2008 +0000 @@ -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