;;; ibuffer.el --- operate on buffers like dired
-;; Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
;; Author: Colin Walters <walters@verbum.org>
;; Maintainer: John Paul Wallington <jpw@gnu.org>
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."
+ :version "22.1"
:group 'convenience)
-(defcustom ibuffer-formats '((mark modified read-only " " (name 16 16 :left :elide)
- " " (size 7 -1 :right)
+(defcustom ibuffer-formats '((mark modified read-only " " (name 18 18 :left :elide)
+ " " (size 9 -1 :right)
" " (mode 16 16 :right :elide) " " filename-and-process)
(mark " " (name 16 -1) " " filename))
"A list of ways to display buffer lines.
If a function, it will be called with the buffer as an argument, and
should return non-nil if this buffer should be shown.
-Viewing of buffers hidden because of these predicates is enabled by
-giving a non-nil prefix argument to `ibuffer-update'. Note that this
-specialized filtering occurs before real filtering."
+Viewing of buffers hidden because of these predicates may be customized
+via `ibuffer-default-display-maybe-show-predicates' and is toggled by
+giving a non-nil prefix argument to `ibuffer-update'.
+Note that this specialized filtering occurs before real filtering."
:type '(repeat (choice regexp function))
:group 'ibuffer)
+(defcustom ibuffer-default-display-maybe-show-predicates nil
+ "Non-nil means show buffers that match `ibuffer-maybe-show-predicates'."
+ :type 'boolean
+ :group 'ibuffer)
+
+(defvar ibuffer-display-maybe-show-predicates nil)
+
(defvar ibuffer-current-format nil)
(defcustom ibuffer-movement-cycle t
(const :tag "Always except minibuffer" :value :nomini))
:group 'ibuffer)
+(defcustom ibuffer-jump-offer-only-visible-buffers nil
+ "If non-nil, only offer buffers visible in the Ibuffer buffer
+in completion lists of the `ibuffer-jump-to-buffer' command."
+ :type 'boolean
+ :group 'ibuffer)
+
(defcustom ibuffer-use-header-line (boundp 'header-line-format)
"If non-nil, display a header line containing current filters."
:type 'boolean
(define-key map (kbd "u") 'ibuffer-unmark-forward)
(define-key map (kbd "=") 'ibuffer-diff-with-file)
(define-key map (kbd "j") 'ibuffer-jump-to-buffer)
+ (define-key map (kbd "M-g") 'ibuffer-jump-to-buffer)
(define-key map (kbd "DEL") 'ibuffer-unmark-backward)
(define-key map (kbd "M-DEL") 'ibuffer-unmark-all)
(define-key map (kbd "* *") 'ibuffer-unmark-all)
(define-key map [down-mouse-3] 'ibuffer-mouse-popup-menu)
map))
-(defvar ibuffer-delete-window-on-quit nil
- "Whether or not to delete the window upon exiting `ibuffer'.")
+(defvar ibuffer-restore-window-config-on-quit nil
+ "If non-nil, restore previous window configuration upon exiting `ibuffer'.")
+
+(defvar ibuffer-prev-window-config nil
+ "Window configuration before starting Ibuffer.")
(defvar ibuffer-did-modification nil)
default-directory)
default-directory))))
(list (read-file-name "Find file: " default-directory)
- current-prefix-arg)))
- (find-file file (or wildcards (interactive-p))))
+ t)))
+ (find-file file wildcards))
(defun ibuffer-mouse-visit-buffer (event)
"Visit the buffer chosen with the mouse."
(dolist (string column-strings)
(setq total
;; like, ewww ...
- (+ (float (string-to-int string))
+ (+ (float (string-to-number string))
total)))
(format "%.0f" total))))
(format "%s" (buffer-size)))
-(define-ibuffer-column mode (:inline t
- :props
- ('mouse-face 'highlight
- 'keymap ibuffer-mode-name-map
- 'help-echo "mouse-2: filter by this mode"))
+(define-ibuffer-column mode
+ (:inline t
+ :props
+ ('mouse-face 'highlight
+ 'keymap ibuffer-mode-name-map
+ 'help-echo "mouse-2: filter by this mode"))
(format "%s" mode-name))
(define-ibuffer-column process
(abbreviate-file-name
(or buffer-file-name
(and (boundp 'dired-directory)
- dired-directory)
+ (if (stringp dired-directory)
+ dired-directory
+ (car dired-directory)))
""))))
(define-ibuffer-column filename-and-process
(defun ibuffer-update (arg &optional silent)
"Regenerate the list of all buffers.
-Display buffers whose name matches one of `ibuffer-maybe-show-predicates'
-iff arg ARG is non-nil.
+
+Prefix arg non-nil means to toggle whether buffers that match
+`ibuffer-maybe-show-predicates' should be displayed.
If optional arg SILENT is non-nil, do not display progress messages."
(interactive "P")
+ (if arg
+ (setq ibuffer-display-maybe-show-predicates
+ (not ibuffer-display-maybe-show-predicates)))
(ibuffer-forward-line 0)
(let* ((bufs (buffer-list))
(blist (ibuffer-filter-buffers
(caddr bufs)
(cadr bufs))
(ibuffer-current-buffers-with-marks bufs)
- arg)))
+ ibuffer-display-maybe-show-predicates)))
(when (null blist)
(if (and (featurep 'ibuf-ext)
ibuffer-filtering-qualifiers)
'ibuffer-filter-group
name)))
-(defun ibuffer-redisplay-engine (bmarklist &optional all)
+(defun ibuffer-redisplay-engine (bmarklist &optional ignore)
(assert (eq major-mode 'ibuffer-mode))
(let* ((--ibuffer-insert-buffers-and-marks-format
(ibuffer-current-format))
(member name ibuffer-hidden-filter-groups)))
(bmarklist (cdr group)))
(unless (and (null bmarklist)
+ (not disabled)
ext-loaded
(null ibuffer-show-empty-filter-groups))
(ibuffer-insert-filter-group
(defun ibuffer-quit ()
"Quit this `ibuffer' session.
-Delete the current window iff `ibuffer-delete-window-on-quit' is non-nil."
+Try to restore the previous window configuration iff
+`ibuffer-restore-window-config-on-quit' is non-nil."
(interactive)
- (if ibuffer-delete-window-on-quit
+ (if ibuffer-restore-window-config-on-quit
(progn
(bury-buffer)
(unless (= (count-windows) 1)
- (delete-window)))
+ (set-window-configuration ibuffer-prev-window-config)))
(bury-buffer)))
;;;###autoload
(interactive "P")
(when ibuffer-use-other-window
(setq other-window-p t))
+ (setq ibuffer-prev-window-config (current-window-configuration))
(let ((buf (get-buffer-create (or name "*Ibuffer*"))))
(if other-window-p
(funcall (if noselect #'(lambda (buf) (display-buffer buf t)) #'pop-to-buffer) buf)
(select-window (get-buffer-window buf))
(or (eq major-mode 'ibuffer-mode)
(ibuffer-mode))
- (setq ibuffer-delete-window-on-quit other-window-p)
+ (setq ibuffer-restore-window-config-on-quit other-window-p)
(when shrink
(setq ibuffer-shrink-to-minimum-size shrink))
(when qualifiers
ibuffer-default-sorting-reversep)
(set (make-local-variable 'ibuffer-shrink-to-minimum-size)
ibuffer-default-shrink-to-minimum-size)
+ (set (make-local-variable 'ibuffer-display-maybe-show-predicates)
+ ibuffer-default-display-maybe-show-predicates)
(set (make-local-variable 'ibuffer-filtering-qualifiers) nil)
(set (make-local-variable 'ibuffer-filter-groups) nil)
(set (make-local-variable 'ibuffer-filter-group-kill-ring) nil)
(set (make-local-variable 'ibuffer-cached-eliding-string) nil)
(set (make-local-variable 'ibuffer-cached-elide-long-columns) nil)
(set (make-local-variable 'ibuffer-current-format) nil)
- (set (make-local-variable 'ibuffer-delete-window-on-quit) nil)
+ (set (make-local-variable 'ibuffer-restore-window-config-on-quit) nil)
(set (make-local-variable 'ibuffer-did-modification) nil)
(set (make-local-variable 'ibuffer-tmp-hide-regexps) nil)
(set (make-local-variable 'ibuffer-tmp-show-regexps) nil)
(when ibuffer-default-directory
(setq default-directory ibuffer-default-directory))
(add-hook 'change-major-mode-hook 'font-lock-defontify nil t)
- (run-hooks 'ibuffer-mode-hook)
+ (run-mode-hooks 'ibuffer-mode-hook)
;; called after mode hooks to allow the user to add filters
(ibuffer-update-mode-name))
;; coding: iso-8859-1
;; End:
+;;; arch-tag: 72581688-0603-4954-b8cf-837c700f62e8
;;; ibuffer.el ends here