Subject: bug#67946: [PATCH v3] lisp/recentf.el: Add verbosity option

From: Lockywolf <[email-masked]>
Date: Sat, 22 Feb 2025 20:42:57 +0800

Eli Zaretskii <[email-masked]> writes:
> So I guess something went wrong in sending the patch; please send a
> fixed patch.
>
> Also, please make sure the lines are not too long (maybe that's one of
> the side-effects of the patch corruption?).

Done.

>From 35e263cb59b36b4765388ee891e1508c8b214712 Mon Sep 17 00:00:00 2001
From: Lockywolf <[email-masked]>
Date: Thu, 13 Feb 2025 11:51:50 +0800
Subject: [PATCH] lisp/recentf.el: Add verbosity option

* lisp/recentf.el: add verbosity (bug#67946)
  recentf-verbosity: add defcustom to control verbosity
  (recentf-save-list): make use of recentf-verbosity
---
 etc/NEWS        |  7 +++++++
 lisp/recentf.el | 16 ++++++++++++++--
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 33f5df84d4b..c00dc987257 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -500,6 +500,13 @@ This user option controls the width of the type column on the bookmark
 menu 'bookmark-bmenu-list'.  The default value is 8 which is backwards
 compatible.
 
+** Recentf
+
+---
+*** New user option 'recentf-show-messages'.
+'recentf-save-list' can print a message when saving the recentf list.
+The new option, if set to nil, suppresses this message.
+
 ** Saveplace
 
 ---
diff --git a/lisp/recentf.el b/lisp/recentf.el
index a282fbee3b1..d1cc07c969c 100644
--- a/lisp/recentf.el
+++ b/lisp/recentf.el
@@ -320,6 +320,14 @@ recentf-show-file-shortcuts-flag
 used as shortcuts to open the Nth file."
   :group 'recentf
   :type 'boolean)
+
+(defcustom recentf-show-messages nil
+  "Whether to show verbose messages about low-level recentf actions.
+nil means to not show messages related to the recentf machinery.
+t means show messages that were printed by default on Emacs <= 30.1."
+  :group 'recentf
+  :type 'boolean
+  :version "30.1")
 
 ;;; Utilities
 ;;
@@ -1330,8 +1338,12 @@ recentf-save-list
         (insert "\n\n;; Local Variables:\n"
                 (format ";; coding: %s\n" recentf-save-file-coding-system)
                 ";; End:\n")
-        (write-region (point-min) (point-max)
-                      (expand-file-name recentf-save-file))
+        (write-region (point-min)
+                      (point-max)
+                      (expand-file-name recentf-save-file) nil
+                      (unless (or (called-interactively-p 'interactive)
+                                 recentf-show-messages)
+                        'quiet))
         (when recentf-save-file-modes
           (set-file-modes recentf-save-file recentf-save-file-modes))
         nil)
-- 
2.46.3

-- 
Your sincerely,
Vladimir Nikishkin (MiEr, lockywolf)
(Laptop)