# HG changeset patch # User Colin Walters # Date 1012795160 0 # Node ID 2a6ac08c9a187bb3999fc72301b2e9051a9ed8db # Parent 7f95aeaa47b3151040463f06c6effc6de4357d33 (ibuffer): Remove link; the "home page" for ibuffer is now the Emacs CVS tree. (ibuffer-formats): Doc fix. (ibuffer-active-formats-name, ibuffer-current-formats): New functions. (ibuffer-current-format): Use them. (ibuffer-recompile-formats): Add support for ibuffer-filter-format-alist. (ibuffer-check-formats): Ditto. (ibuffer-switch-format): Ditto. (ibuffer-update-title): Ditto. (define-ibuffer-column process): Remove unncessary consing. diff -r 7f95aeaa47b3 -r 2a6ac08c9a18 lisp/ChangeLog --- a/lisp/ChangeLog Mon Feb 04 03:57:35 2002 +0000 +++ b/lisp/ChangeLog Mon Feb 04 03:59:20 2002 +0000 @@ -1,3 +1,25 @@ +2002-02-03 Colin Walters + + * ibuf-ext.el (ibuffer-filter-format-alist, + ibuffer-cached-filter-formats, + ibuffer-compiled-filter-formats): New variables. + + * ibuffer.el (ibuffer): Remove link; the "home page" for ibuffer + is now the Emacs CVS tree. + (ibuffer-formats): Doc fix. + (ibuffer-active-formats-name, ibuffer-current-formats): New + functions. + (ibuffer-current-format): Use them. + (ibuffer-recompile-formats): Add support for + ibuffer-filter-format-alist. + (ibuffer-check-formats): Ditto. + (ibuffer-switch-format): Ditto. + (ibuffer-update-title): Ditto. + (define-ibuffer-column process): Remove unncessary consing. + + * ibuf-macs.el (define-ibuffer-column): Add beginnings of support + for a summary column. + 2002-02-03 Andreas Schwab * window.el (save-selected-window): Move macro before first use. diff -r 7f95aeaa47b3 -r 2a6ac08c9a18 lisp/ibuffer.el --- a/lisp/ibuffer.el Mon Feb 04 03:57:35 2002 +0000 +++ b/lisp/ibuffer.el Mon Feb 04 03:59:20 2002 +0000 @@ -63,7 +63,6 @@ Ibuffer allows you to operate on buffers in a manner much like Dired. Operations include sorting, marking by regular expression, and the ability to filter the displayed buffers by various criteria." - :link '(url-link "http://cvs.verbum.org/ibuffer") :group 'convenience) (defcustom ibuffer-formats '((mark modified read-only " " (name 16 16 :left :elide) @@ -116,7 +115,7 @@ This format displays the current mark (if any), its modification and read-only status, as well as the name of the buffer and its size. In this format, the name is restricted to 16 characters (longer names - will be truncated, nad shorter names will be padded with spaces), and + will be truncated, and shorter names will be padded with spaces), and the name is also aligned to the right. The size of the buffer will be padded with spaces up to a minimum of six characters, but there is no upper limit on its size. The size will also be aligned to the @@ -1183,14 +1182,35 @@ (not (buffer-live-p buf))) (error "Buffer %s has been killed!" buf)) buf)) - -(defun ibuffer-current-format () - (when (null ibuffer-formats) - (error "No format!")) - (ibuffer-check-formats) + +(defun ibuffer-active-formats-name () + (if (boundp 'ibuffer-filter-format-alist) + (let ((ret nil)) + (dolist (filter ibuffer-filtering-qualifiers ret) + (let ((val (assq (car filter) ibuffer-filter-format-alist))) + (when val + (setq ret (car filter))))) + (if ret + ret + :ibuffer-formats)) + :ibuffer-formats)) + +(defun ibuffer-current-formats (uncompiledp) + (let* ((name (ibuffer-active-formats-name))) + (ibuffer-check-formats) + (if (eq name :ibuffer-formats) + (if uncompiledp + ibuffer-formats + ibuffer-compiled-formats) + (cadr (assq name + (if uncompiledp + ibuffer-filter-format-alist + ibuffer-compiled-filter-formats)))))) + +(defun ibuffer-current-format (&optional uncompiledp) (or ibuffer-current-format (setq ibuffer-current-format 0)) - (nth ibuffer-current-format ibuffer-compiled-formats)) + (nth ibuffer-current-format (ibuffer-current-formats uncompiledp))) (defun ibuffer-expand-format-entry (form) (if (or (consp form) @@ -1363,22 +1383,37 @@ "Recompile `ibuffer-formats'." (interactive) (setq ibuffer-compiled-formats - (mapcar #'ibuffer-compile-format ibuffer-formats))) + (mapcar #'ibuffer-compile-format ibuffer-formats)) + (when (boundp 'ibuffer-filter-format-alist) + (setq ibuffer-compiled-filter-formats + (mapcar #'(lambda (entry) + (cons (car entry) + (mapcar #'(lambda (formats) + (mapcar #'ibuffer-compile-format formats)) + (cdr entry)))) + ibuffer-filter-format-alist)))) (defun ibuffer-check-formats () + (when (null ibuffer-formats) + (error "No formats!")) (when (or (null ibuffer-compiled-formats) (null ibuffer-cached-formats) - (not (equal ibuffer-cached-formats ibuffer-formats)) + (not (eq ibuffer-cached-formats ibuffer-formats)) (null ibuffer-cached-eliding-string) (not (equal ibuffer-cached-eliding-string ibuffer-eliding-string)) (eql 0 ibuffer-cached-elide-long-columns) (not (eql ibuffer-cached-elide-long-columns - ibuffer-elide-long-columns))) + ibuffer-elide-long-columns)) + (not (eq ibuffer-cached-filter-formats + ibuffer-filter-format-alist)) + (and ibuffer-filter-format-alist + (null ibuffer-compiled-filter-formats))) (message "Formats have changed, recompiling...") (ibuffer-recompile-formats) (setq ibuffer-cached-formats ibuffer-formats ibuffer-cached-eliding-string ibuffer-eliding-string - ibuffer-cached-elide-long-columns ibuffer-elide-long-columns) + ibuffer-cached-elide-long-columns ibuffer-elide-long-columns + ibuffer-cached-filter-formats ibuffer-filter-format-alist) (message "Formats have changed, recompiling...done"))) (defvar ibuffer-inline-columns nil) @@ -1415,9 +1450,9 @@ (define-ibuffer-column process () (let ((proc (get-buffer-process buffer))) - (format "%s" (if proc - (list proc (process-status proc)) - "none")))) + (if proc + (format "(%s %s)" proc (process-status proc)) + "none"))) (define-ibuffer-column filename () (let ((directory-abbrev-alist ibuffer-directory-abbrev-alist)) @@ -1659,7 +1694,7 @@ (unless (consp ibuffer-formats) (error "Ibuffer error: No formats!")) (setq ibuffer-current-format - (if (>= ibuffer-current-format (1- (length ibuffer-formats))) + (if (>= ibuffer-current-format (1- (length (ibuffer-current-formats)))) 0 (1+ ibuffer-current-format))) (ibuffer-update-format) @@ -1832,7 +1867,7 @@ (car entry) (cdr entry) --ibuffer-insert-buffers-and-marks-format))) - (ibuffer-update-title (nth ibuffer-current-format ibuffer-formats))) + (ibuffer-update-title (ibuffer-current-format t))) (setq buffer-read-only t) (set-buffer-modified-p ibuffer-did-modification) (setq ibuffer-did-modification nil)