From: Tino Calancha Date: Fri, 8 Jul 2016 01:55:22 +0000 (+0900) Subject: Ibuffer change marks X-Git-Tag: emacs-26.0.90~1840^2~98 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9bf31d1d3f35880c652f76509d1e27d33e454121;p=emacs.git Ibuffer change marks * lisp/ibuffer.el (ibuffer-change-marks): New command. (ibuffer-mode-map): Bind it to '* c'. (ibuffer-mode-groups-popup): Update menus. (ibuffer-mode): Update mode doc. ; * etc/NEWS: Add entry for this new feature. --- diff --git a/etc/NEWS b/etc/NEWS index deb18895555..f9fbe03e086 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -198,6 +198,9 @@ same as in modes where the character is not whitespace. ** Ibuffer +--- +*** New command 'ibuffer-change-marks'; bound to '* c'. + --- *** A new command 'ibuffer-mark-by-locked' to mark all locked buffers; bound to '% L'. diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index d67f95f8454..4f266d909e4 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el @@ -480,6 +480,7 @@ directory, like `default-directory'." (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 (kbd "* c") 'ibuffer-change-marks) (define-key map (kbd "U") 'ibuffer-unmark-all-marks) (define-key map (kbd "* M") 'ibuffer-mark-by-mode) (define-key map (kbd "* m") 'ibuffer-mark-modified-buffers) @@ -724,6 +725,9 @@ directory, like `default-directory'." (define-key-after map [menu-bar mark toggle-marks] '(menu-item "Toggle marks" ibuffer-toggle-marks :help "Unmark marked buffers, and mark unmarked buffers")) + (define-key-after map [menu-bar mark change-marks] + '(menu-item "Change marks" ibuffer-change-marks + :help "Change OLD mark for marked buffers with NEW")) (define-key-after map [menu-bar mark mark-forward] '(menu-item "Mark" ibuffer-mark-forward :help "Mark the buffer at point")) @@ -1379,6 +1383,24 @@ group." (message "%s buffers marked" count)) (ibuffer-redisplay t)) +(defun ibuffer-change-marks (&optional old new) + "Change all OLD marks to NEW marks. +OLD and NEW are both characters used to mark buffers." + (interactive + (let* ((cursor-in-echo-area t) + (old (progn (message "Change (old mark): ") (read-char))) + (new (progn (message "Change %c marks to (new mark): " old) + (read-char)))) + (list old new))) + (if (or (eq old ?\r) (eq new ?\r)) + (ding) + (let ((count + (ibuffer-map-lines + (lambda (_buf mark) + (when (eq mark old) + (ibuffer-set-mark new) t))))) + (message "%s marks changed" count)))) + (defsubst ibuffer-get-region-and-prefix () (let ((arg (prefix-numeric-value current-prefix-arg))) (if (use-region-p) (list (region-beginning) (region-end) arg) @@ -2457,6 +2479,7 @@ Marking commands: `\\[ibuffer-mark-forward]' - Mark the buffer at point. `\\[ibuffer-toggle-marks]' - Unmark all currently marked buffers, and mark all unmarked buffers. + `\\[ibuffer-change-marks]' - Change the mark used on marked buffers. `\\[ibuffer-unmark-forward]' - Unmark the buffer at point. `\\[ibuffer-unmark-backward]' - Unmark the buffer at point, and move to the previous line.