]> code.delx.au - gnu-emacs/blobdiff - lisp/ibuffer.el
Doc fixed for next-error-buffer-p
[gnu-emacs] / lisp / ibuffer.el
index b8c48356e06b6bf91a1d25b2a5a277f820e0b927..9d23e64cd81484be7e8fc8377ea9a5fa78211f1a 100644 (file)
@@ -1,6 +1,6 @@
 ;;; 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>
@@ -128,7 +128,7 @@ own!):
 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)))
@@ -1354,23 +1354,36 @@ group."
     (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)
@@ -1409,16 +1422,16 @@ If point is on a group name, this function operates on that group."
                       (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)
@@ -1785,7 +1798,7 @@ If point is on a group name, this function operates on that group."
      (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))))
@@ -2037,7 +2050,7 @@ the value of point at the beginning of the line for that buffer."
 (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
@@ -2244,7 +2257,7 @@ If optional arg SILENT is non-nil, do not display progress messages."
         (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)
@@ -2303,7 +2316,7 @@ buffers which are visiting a file."
 (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.
@@ -2493,14 +2506,17 @@ new filter onto the stack, and the filters combine to show just
 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'.
@@ -2518,9 +2534,10 @@ create a filter group, simply use the regular functions to create a
 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
@@ -2597,7 +2614,7 @@ will be inserted before the group at point."
 \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" "\
@@ -2974,8 +2991,4 @@ defaults to one.
 
 (run-hooks 'ibuffer-load-hook)
 
-;; Local Variables:
-;; coding: utf-8
-;; End:
-
 ;;; ibuffer.el ends here