summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/NEWS9
-rw-r--r--lisp/ibuf-ext.el18
-rw-r--r--lisp/ibuffer.el5
3 files changed, 32 insertions, 0 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 87ffb437d91..deb18895555 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -199,6 +199,15 @@ same as in modes where the character is not whitespace.
** Ibuffer
---
+*** A new command 'ibuffer-mark-by-locked' to mark
+all locked buffers; bound to '% L'.
+
+---
+*** A new option 'ibuffer-locked-char' to indicate
+locked buffers; Ibuffer shows a new column displaying
+'ibuffer-locked-char' for locked buffers.
+
+---
*** A new command 'ibuffer-unmark-all-marks' to unmark
all buffers without asking confirmation; bound to
'U'; 'ibuffer-do-replace-regexp' bound to 'r'.
diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
index 72fa8628a1f..2444dac5805 100644
--- a/lisp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -1484,6 +1484,24 @@ You can then feed the file name(s) to other commands with \\[yank]."
#'(lambda (buf)
(string-match regexp (buffer-name buf)))))
+(defun ibuffer-locked-buffer-p (&optional buf)
+ "Return non-nil if BUF is locked.
+When BUF nil, default to the buffer at current line."
+ (let ((_buffer (or buf (ibuffer-current-buffer)))
+ char)
+ (when _buffer
+ (with-current-buffer _buffer
+ (and (boundp 'emacs-lock-mode) emacs-lock-mode)))))
+
+;;;###autoload
+(defun ibuffer-mark-by-locked ()
+ "Mark all locked buffers."
+ (interactive)
+ (when (featurep 'emacs-lock)
+ (ibuffer-mark-on-buffer
+ (lambda (buf)
+ (ibuffer-locked-buffer-p buf)))))
+
;;;###autoload
(defun ibuffer-mark-by-mode-regexp (regexp)
"Mark all buffers whose major mode matches REGEXP."
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index ff1eb8b2dda..d67f95f8454 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -556,6 +556,7 @@ directory, like `default-directory'."
(define-key map (kbd "% m") 'ibuffer-mark-by-mode-regexp)
(define-key map (kbd "% f") 'ibuffer-mark-by-file-name-regexp)
(define-key map (kbd "% g") 'ibuffer-mark-by-content-regexp)
+ (define-key map (kbd "% L") 'ibuffer-mark-by-locked)
(define-key map (kbd "C-t") 'ibuffer-visit-tags-table)
@@ -782,6 +783,9 @@ directory, like `default-directory'."
'(menu-item "Mark by content (regexp)..."
ibuffer-mark-by-content-regexp
:help "Mark buffers whose content matches a regexp"))
+ (define-key-after map [menu-bar mark mark-by-locked]
+ '(menu-item "Mark by locked buffers..." ibuffer-mark-by-locked
+ :help "Mark all locked buffers"))
map))
@@ -2476,6 +2480,7 @@ Marking commands:
`\\[ibuffer-mark-by-mode-regexp]' - Mark buffers by their major mode, using a regexp.
`\\[ibuffer-mark-by-file-name-regexp]' - Mark buffers by their filename, using a regexp.
`\\[ibuffer-mark-by-content-regexp]' - Mark buffers by their content, using a regexp.
+ `\\[ibuffer-mark-by-locked]' - Mark all locked buffers.
Filtering commands: