;;; ibuffer.el --- operate on buffers like dired -*- lexical-binding:t -*-
-;; Copyright (C) 2000-2015 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2016 Free Software Foundation, Inc.
;; Author: Colin Walters <walters@verbum.org>
;; Maintainer: John Paul Wallington <jpw@gnu.org>
Thus, if you wanted to use these two formats, the appropriate
value for this variable would be
- '((mark \" \" name)
+ \\='((mark \" \" name)
(mark modified read-only
(name 16 16 :left)
(size 6 -1 :right)))
(message "%s buffers marked" count))
(ibuffer-redisplay t))
-(defun ibuffer-mark-forward (arg)
- "Mark the buffer on this line, and move forward ARG lines.
+(defsubst ibuffer-get-region-and-prefix ()
+ (let ((arg (prefix-numeric-value current-prefix-arg)))
+ (if (use-region-p) (list (region-beginning) (region-end) arg)
+ (list nil nil arg))))
+
+(defun ibuffer-mark-forward (start end arg)
+ "Mark the buffers in the region, or ARG buffers.
If point is on a group name, this function operates on that group."
- (interactive "p")
- (ibuffer-mark-interactive arg ibuffer-marked-char))
+ (interactive (ibuffer-get-region-and-prefix))
+ (ibuffer-mark-region-or-n-with-char start end arg ibuffer-marked-char))
-(defun ibuffer-unmark-forward (arg)
- "Unmark the buffer on this line, and move forward ARG lines.
+(defun ibuffer-unmark-forward (start end arg)
+ "Unmark the buffers in the region, or ARG buffers.
If point is on a group name, this function operates on that group."
- (interactive "p")
- (ibuffer-mark-interactive arg ?\s))
+ (interactive (ibuffer-get-region-and-prefix))
+ (ibuffer-mark-region-or-n-with-char start end arg ?\s))
(defun ibuffer-unmark-backward (arg)
- "Unmark the buffer on this line, and move backward ARG lines.
+ "Unmark the ARG previous buffers.
If point is on a group name, this function operates on that group."
(interactive "p")
- (ibuffer-unmark-forward (- arg)))
+ (ibuffer-unmark-forward nil nil (- arg)))
+
+(defun ibuffer-mark-region-or-n-with-char (start end arg mark-char)
+ (if (use-region-p)
+ (let ((cur (point)) (line-count (count-lines start end)))
+ (goto-char start)
+ (ibuffer-mark-interactive line-count mark-char)
+ (goto-char cur))
+ (ibuffer-mark-interactive arg mark-char)))
(defun ibuffer-mark-interactive (arg mark &optional movement)
(ibuffer-assert-ibuffer-mode)
(list (ibuffer-current-buffer)
mark))))
-(defun ibuffer-mark-for-delete (arg)
- "Mark the buffers on ARG lines forward for deletion.
+(defun ibuffer-mark-for-delete (start end arg)
+ "Mark for deletion the buffers in the region, or ARG buffers.
If point is on a group name, this function operates on that group."
- (interactive "P")
- (ibuffer-mark-interactive arg ibuffer-deletion-char 1))
+ (interactive (ibuffer-get-region-and-prefix))
+ (ibuffer-mark-region-or-n-with-char start end arg ibuffer-deletion-char))
(defun ibuffer-mark-for-delete-backwards (arg)
- "Mark the buffers on ARG lines backward for deletion.
+ "Mark for deletion the ARG previous buffers.
If point is on a group name, this function operates on that group."
- (interactive "P")
+ (interactive "p")
(ibuffer-mark-interactive arg ibuffer-deletion-char -1))
(defun ibuffer-current-buffer (&optional must-be-live)
(let ((procs 0)
(files 0))
(dolist (string strings)
- (if (string-match "\\(\?:\\`(\[\[:ascii:\]\]\+)\\)" string)
+ (if (string-match "\\(?:\\`([[:ascii:]]+)\\)" string)
(progn (setq procs (1+ procs))
(if (< (match-end 0) (length string))
(setq files (1+ files))))
(defun ibuffer-update-title-and-summary (format)
(ibuffer-assert-ibuffer-mode)
;; Don't do funky font-lock stuff here
- (let ((after-change-functions nil))
+ (let ((inhibit-modification-hooks t))
(if (get-text-property (point-min) 'ibuffer-title)
(delete-region (point-min)
(next-single-property-change
(orig (count-lines (point-min) (point)))
;; Inhibit font-lock caching tricks, since we're modifying the
;; entire buffer at once
- (after-change-functions nil)
+ (inhibit-modification-hooks t)
(ext-loaded (featurep 'ibuf-ext))
(bgroups (if ext-loaded
(ibuffer-generate-filter-groups bmarklist)
(defun ibuffer (&optional other-window-p name qualifiers noselect
shrink filter-groups formats)
"Begin using Ibuffer to edit a list of buffers.
-Type ‘h’ after entering ibuffer for more information.
+Type `h' after entering ibuffer for more information.
All arguments are optional.
OTHER-WINDOW-P says to use another window.
buffers which satisfy ALL criteria on the stack. For example, suppose
you only want to see buffers in `emacs-lisp' mode, whose names begin
with \"gnus\". You can accomplish this via:
-`\\[ibuffer-filter-by-mode] emacs-lisp-mode RET
-\\[ibuffer-filter-by-name] ^gnus RET'.
+
+ \\[ibuffer-filter-by-mode] emacs-lisp-mode RET
+ \\[ibuffer-filter-by-name] ^gnus RET
Additionally, you can OR the top two filters together with
`\\[ibuffer-or-filters]'. To see all buffers in either
`emacs-lisp-mode' or `lisp-interaction-mode', type:
-`\\[ibuffer-filter-by-mode] emacs-lisp-mode RET \\[ibuffer-filter-by-mode] lisp-interaction-mode RET \\[ibuffer-or-filters]'.
+ \\[ibuffer-filter-by-mode] emacs-lisp-mode RET
+ \\[ibuffer-filter-by-mode] lisp-interaction-mode RET
+ \\[ibuffer-or-filters]
Filters can also be saved and restored using mnemonic names: see the
functions `ibuffer-save-filters' and `ibuffer-switch-to-saved-filters'.
filter, and then type `\\[ibuffer-filters-to-filter-group]'.
A quick example will make things clearer. Suppose that one wants to
-group all of one's Emacs Lisp buffers together. To do this, type
+group all of one's Emacs Lisp buffers together. To do this, type:
-`\\[ibuffer-filter-by-mode] emacs-lisp-mode RET \\[ibuffer-filters-to-filter-group] RET emacs lisp buffers RET'
+ \\[ibuffer-filter-by-mode] emacs-lisp-mode RET
+ \\[ibuffer-filters-to-filter-group] emacs lisp buffers RET
You may, of course, name the group whatever you want; it doesn't have
to be \"emacs lisp buffers\". Filter groups may be composed of any
\f
;;; Start of automatically extracted autoloads.
\f
-;;;### (autoloads nil "ibuf-ext" "ibuf-ext.el" "442bac528ce7a9a20bb191d0eb08cbd8")
+;;;### (autoloads nil "ibuf-ext" "ibuf-ext.el" "9521139d5f2ba7c870e3101fd73bb3ce")
;;; Generated autoloads from ibuf-ext.el
(autoload 'ibuffer-auto-mode "ibuf-ext" "\
(run-hooks 'ibuffer-load-hook)
-;; Local Variables:
-;; coding: utf-8
-;; End:
-
;;; ibuffer.el ends here