1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 12:21:25 -08:00

Optionally suppress recentf open file messages (bug#78666)

* etc/NEWS: Announce new user option.

* lisp/recentf.el (recentf-suppress-open-file-help): New defcustom.
(recentf-dialog-goto-first): Use it; otherwise, make calling
'widget-move' suppress message only for interactive recentf use.
(recentf-forward, recentf-backward): New commands, wrappers around
'widget-{forward, backward}' using 'recentf-suppress-open-file-help'.
(recentf-dialog): Use them in locally remapped key bindings.

* lisp/wid-edit.el (widget-forward, widget-backward): Add optional
argument to suppress :help-echo message and pass it to 'widget-move'.
This commit is contained in:
Stephen Berman 2025-06-23 11:51:31 +02:00
parent edd18978aa
commit 2b34f38b38
3 changed files with 56 additions and 9 deletions

View file

@ -1055,6 +1055,15 @@ compatible.
'recentf-save-list' can print a message when saving the recentf list.
The new option, if set to nil, suppresses this message.
---
*** New user option 'recentf-suppress-open-file-help'.
By default, invoking 'recentf-open-files' displays a message saying what
action clicking or typing RET on the item at point executes, and tabbing
between items in the *Open Recent* buffer likewise displays such
messages. To suppress these messages, customize the user option
'recentf-suppress-open-file-help' to non-nil. The default value of this
option is nil.
** Saveplace
---

View file

@ -330,6 +330,15 @@ t means show messages that were printed by default on Emacs <= 31.1."
:group 'recentf
:type 'boolean
:version "31.1")
(defcustom recentf-suppress-open-file-help nil
"If non-nil, suppress help messages in recentf open file dialogs.
By default, opening the dialog interactively and tabbing between items
shows help messages. (In any case, a tooltip displays the help text
when the mouse pointer hovers over an item)."
:group 'recentf
:type 'boolean
:version "31.1")
;;; Utilities
;;
@ -1101,15 +1110,38 @@ IGNORE arguments."
Go to the beginning of buffer if not found."
(goto-char (point-min))
(condition-case nil
(let (done)
(widget-move 1)
(let ((no-echo (or recentf-suppress-open-file-help
;; Show help messages by default only when
;; invoking these interactively (bug#78666).
(not (memq this-command '(recentf-open-files
recentf-open-more-files
recentf-forward
recentf-backward)))))
done)
(widget-move 1 no-echo)
(while (not done)
(if (eq widget-type (widget-type (widget-at (point))))
(setq done t)
(widget-move 1))))
(widget-move 1 no-echo))))
(error
(goto-char (point-min)))))
(defun recentf-forward (arg)
"Move the cursor to the next widget in the current dialog.
With prefix argument ARG, move to the ARGth next widget. If
`recentf-suppress-open-file-help' is non-nil, suppress help messages in
the echo area in the open recentf dialog."
(interactive "p")
(widget-forward arg recentf-suppress-open-file-help))
(defun recentf-backward (arg)
"Move the cursor to the previous widget in the current dialog.
With prefix argument ARG, move to the ARGth previous widget. If
`recentf-suppress-open-file-help' is non-nil, suppress help messages in
the echo area in the open recentf dialog."
(interactive "p")
(widget-backward arg recentf-suppress-open-file-help))
(defvar-keymap recentf-dialog-mode-map
:doc "Keymap used in recentf dialogs."
:parent (make-composed-keymap recentf--shortcuts-keymap widget-keymap)
@ -1141,6 +1173,8 @@ Go to the beginning of buffer if not found."
(recentf-dialog-mode)
,@forms
(widget-setup)
(keymap-local-set "<remap> <widget-forward>" #'recentf-forward)
(keymap-local-set "<remap> <widget-backward>" #'recentf-backward)
(switch-to-buffer (current-buffer))))
;;; Edit list dialog

View file

@ -1383,19 +1383,23 @@ nothing is shown in the echo area."
(widget-echo-help (point)))
(run-hooks 'widget-move-hook))
(defun widget-forward (arg)
(defun widget-forward (arg &optional suppress-echo)
"Move point to the next field or button.
With optional ARG, move across that many fields."
With optional ARG, move across that many fields.
When the second optional argument is non-nil,
nothing is shown in the echo area."
(interactive "p")
(run-hooks 'widget-forward-hook)
(widget-move arg))
(widget-move arg suppress-echo))
(defun widget-backward (arg)
(defun widget-backward (arg &optional suppress-echo)
"Move point to the previous field or button.
With optional ARG, move across that many fields."
With optional ARG, move across that many fields.
When the second optional argument is non-nil,
nothing is shown in the echo area."
(interactive "p")
(run-hooks 'widget-backward-hook)
(widget-move (- arg)))
(widget-move (- arg) suppress-echo))
;; Since the widget code uses a `field' property to identify fields,
;; ordinary beginning-of-line does the right thing.