summaryrefslogtreecommitdiff
path: root/lisp/ibuffer.el
diff options
context:
space:
mode:
authorTino Calancha <tino.calancha@gmail.com>2018-08-13 19:24:31 +0900
committerTino Calancha <tino.calancha@gmail.com>2018-08-13 19:24:31 +0900
commite73e6838aa595e5a3d217480c96b1d04d3d1cb16 (patch)
tree70ef7f61617fb4bea83eda94f77c7db3bd57f797 /lisp/ibuffer.el
parent12f7116714cf0cc3566ea2a5b1184c99cbfe7b90 (diff)
downloademacs-e73e6838aa595e5a3d217480c96b1d04d3d1cb16.tar.gz
Ibuffer: Add toggle ibuffer-do-toggle-lock
Toggle the locked status in marked buffers or the buffer at point (Bug#32421). * lisp/ibuffer.el (ibuffer-do-toggle-lock): New command. (ibuffer-mode-map): Bind it to 'L'. (ibuffer-mode-operate-map): Add entries for `ibuffer-do-toggle-read-only' and `ibuffer-do-toggle-lock'. * etc/NEWS (Changes in Specialized Modes and Packages in Emacs 26.2): Announce the change.
Diffstat (limited to 'lisp/ibuffer.el')
-rw-r--r--lisp/ibuffer.el16
1 files changed, 16 insertions, 0 deletions
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index 03018d08a58..08b0801cb51 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -590,6 +590,7 @@ directory, like `default-directory'."
(define-key map (kbd "R") 'ibuffer-do-rename-uniquely)
(define-key map (kbd "S") 'ibuffer-do-save)
(define-key map (kbd "T") 'ibuffer-do-toggle-read-only)
+ (define-key map (kbd "L") 'ibuffer-do-toggle-lock)
(define-key map (kbd "r") 'ibuffer-do-replace-regexp)
(define-key map (kbd "V") 'ibuffer-do-revert)
(define-key map (kbd "W") 'ibuffer-do-view-and-eval)
@@ -862,6 +863,10 @@ directory, like `default-directory'."
'(menu-item "Print" ibuffer-do-print))
(define-key-after operate-map [do-toggle-modified]
'(menu-item "Toggle modification flag" ibuffer-do-toggle-modified))
+ (define-key-after operate-map [do-toggle-read-only]
+ '(menu-item "Toggle read-only flag" ibuffer-do-toggle-read-only))
+ (define-key-after operate-map [do-toggle-lock]
+ '(menu-item "Toggle lock flag" ibuffer-do-toggle-lock))
(define-key-after operate-map [do-revert]
'(menu-item "Revert" ibuffer-do-revert
:help "Revert marked buffers to their associated file"))
@@ -1361,6 +1366,16 @@ Otherwise, toggle read only status."
:modifier-p t)
(read-only-mode (if (integerp arg) arg 'toggle)))
+(define-ibuffer-op ibuffer-do-toggle-lock (&optional arg)
+ "Toggle locked status in marked buffers.
+If optional ARG is a non-negative integer, lock buffers.
+If ARG is a negative integer or 0, unlock buffers.
+Otherwise, toggle lock status."
+ (:opstring "toggled lock status in"
+ :interactive "P"
+ :modifier-p t)
+ (emacs-lock-mode (if (integerp arg) arg 'toggle)))
+
(define-ibuffer-op ibuffer-do-delete ()
"Kill marked buffers as with `kill-this-buffer'."
(:opstring "killed"
@@ -2513,6 +2528,7 @@ Operations on marked buffers:
`\\[ibuffer-do-view-other-frame]' - View the marked buffers in another frame.
`\\[ibuffer-do-revert]' - Revert the marked buffers.
`\\[ibuffer-do-toggle-read-only]' - Toggle read-only state of marked buffers.
+ `\\[ibuffer-do-toggle-lock]' - Toggle lock state of marked buffers.
`\\[ibuffer-do-delete]' - Kill the marked buffers.
`\\[ibuffer-do-isearch]' - Do incremental search in the marked buffers.
`\\[ibuffer-do-isearch-regexp]' - Isearch for regexp in the marked buffers.