summaryrefslogtreecommitdiff
path: root/lisp/recentf.el
diff options
context:
space:
mode:
authorStefan Kangas <stefan@marxist.se>2022-06-22 13:36:19 +0200
committerStefan Kangas <stefan@marxist.se>2022-06-23 01:18:57 +0200
commitfeb88fa8abe94dbd39ed05dd68008a4eccbf56cd (patch)
tree0b96f539bc55da1542b5963fa9753be5edcc51c7 /lisp/recentf.el
parentec1fffdeca9c87a92b8c35545121b4ee3eec3ece (diff)
downloademacs-feb88fa8abe94dbd39ed05dd68008a4eccbf56cd.tar.gz
Bind C-c C-c and C-c C-k in recentf-dialog-mode
* lisp/recentf.el (recentf-dialog-mode-map): Prefer defvar-keymap. Bind `C-c C-c' and `C-c C-k' to confirm/cancel the dialog. (recentf-cancel-dialog, recentf-edit-list-validate): Add interactive mode tags for 'recentf-dialog-mode'. (recentf-dialog-mode): Mark as non-interactive. (recentf-edit-list): Display key binding.
Diffstat (limited to 'lisp/recentf.el')
-rw-r--r--lisp/recentf.el24
1 files changed, 13 insertions, 11 deletions
diff --git a/lisp/recentf.el b/lisp/recentf.el
index b3bb6482d48..1005d4855ff 100644
--- a/lisp/recentf.el
+++ b/lisp/recentf.el
@@ -1050,7 +1050,7 @@ That is, remove a non kept file from the recent list."
(defun recentf-cancel-dialog (&rest _ignore)
"Cancel the current dialog.
IGNORE arguments."
- (interactive)
+ (interactive nil recentf-dialog-mode)
(kill-buffer (current-buffer))
(message "Dialog canceled"))
@@ -1068,19 +1068,20 @@ Go to the beginning of buffer if not found."
(error
(goto-char (point-min)))))
-(defvar recentf-dialog-mode-map
- (let ((km (copy-keymap recentf--shortcuts-keymap)))
- (set-keymap-parent km widget-keymap)
- (define-key km "q" #'recentf-cancel-dialog)
- (define-key km "n" #'next-line)
- (define-key km "p" #'previous-line)
- km)
- "Keymap used in recentf dialogs.")
+(defvar-keymap recentf-dialog-mode-map
+ :doc "Keymap used in recentf dialogs."
+ :parent (make-composed-keymap recentf--shortcuts-keymap widget-keymap)
+ "q" #'recentf-cancel-dialog
+ "n" #'next-line
+ "p" #'previous-line
+ "C-c C-c" #'recentf-edit-list-validate
+ "C-c C-k" #'recentf-cancel-dialog)
(define-derived-mode recentf-dialog-mode nil "recentf-dialog"
"Major mode of recentf dialogs.
\\{recentf-dialog-mode-map}"
+ :interactive nil
:syntax-table nil
:abbrev-table nil
(setq truncate-lines t))
@@ -1117,6 +1118,7 @@ IGNORE other arguments."
(defun recentf-edit-list-validate (&rest _ignore)
"Process the recent list when the edit list dialog is committed.
IGNORE arguments."
+ (interactive nil recentf-dialog-mode)
(if recentf-edit-list
(let ((i 0))
(dolist (e recentf-edit-list)
@@ -1136,8 +1138,8 @@ IGNORE arguments."
(widget-insert
(format-message
(substitute-command-keys
- "Click on OK to delete selected files from the recent list.
-Click on Cancel or type \\[recentf-cancel-dialog] to cancel.\n")))
+ "Click on \"OK\" or type \\[recentf-edit-list-validate] to delete selected files from the recent list.
+Click on \"Cancel\" or type \\[recentf-cancel-dialog] to cancel.\n")))
;; Insert the list of files as checkboxes
(dolist (item recentf-list)
(widget-create 'checkbox