Subject: bug#67946: 30.0.50; [RFC PATCH] Add an option to not report "Wrote ..." when saving recentf.

From: Vladimir Nikishkin <[email-masked]>
Date: Tue, 26 Dec 2023 13:58:45 +0800

Stefan Kangas <[email-masked]> writes:

> Eli Zaretskii <[email-masked]> writes:
>
>> If we decide to turn it off, we will need a knob to revert to the old
>> behavior, because after so many years of the existing behavior,
>> someone somewhere might be used to it.
>
> I think the existing patch basically has that already, but it seems to
> be lacking a NEWS entry and a :version tag for the defcustom before it
> can go in.
>
> Vladimir, could you fix that and send a new patch?

Added an entry to etc/NEWS, and, seems, fixed the actual verbosity
message printing condition.

-- 
Your sincerely,
Vladimir Nikishkin (MiEr, lockywolf)
(Laptop)
diff --git a/etc/NEWS b/etc/NEWS
index 1ff2f8a149f..9bc58e790f5 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1046,7 +1046,11 @@ desktop restoration to continue.
 Similarly to buffer restoration by Desktop, 'recentf-mode' checking
 of the accessibility of remote files can now time out if
 'remote-file-name-access-timeout' is set to a positive number.
-
+*** New use option 'recentf-verbose'.
+By default 'recentf-save-list' prints a message when saving the
+recentf list. The new option, if set to nil, suppresses this message.
+If more debugging info suppression switches are to be added, this
+option might become more useful.
 ** Notifications
 
 +++
diff --git a/lisp/recentf.el b/lisp/recentf.el
index 94ae871763b..616bd373232 100644
--- a/lisp/recentf.el
+++ b/lisp/recentf.el
@@ -319,6 +319,13 @@ recentf-show-file-shortcuts-flag
 used as shortcuts to open the Nth file."
   :group 'recentf
   :type 'boolean)
+
+(defcustom recentf-verbose 1
+  "0 means to not show debugging messages related to the recentf machinery.
+1 means show messages that were printed by default on Emacs <= 29.1."
+  :group 'recentf
+  :type 'integer
+  :version "30.1")
 
 ;;; Utilities
 ;;
@@ -1324,7 +1331,12 @@ recentf-save-list
                 (format ";; coding: %s\n" recentf-save-file-coding-system)
                 ";; End:\n")
         (write-region (point-min) (point-max)
-                      (expand-file-name recentf-save-file))
+                      (expand-file-name recentf-save-file)
+                      nil
+                      (if (= recentf-verbose 1)
+                          nil ;; show "Wrote ..." messages.
+                        1) ;; non-nil, non-t, non-string, do not show.
+                      )
         (when recentf-save-file-modes
           (set-file-modes recentf-save-file recentf-save-file-modes))
         nil)