From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#67946: 30.0.50; [RFC PATCH] Add an option to not report "Wrote ..." when saving recentf. Date: Thu, 21 Dec 2023 11:37:54 +0200 Message-ID: <83zfy3gakt.fsf@gnu.org> References: <87a5q41azk.fsf@laptop.lockywolf.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19265"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 67946@debbugs.gnu.org To: Vladimir Nikishkin Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 21 10:39:24 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rGFWU-0004mn-NZ for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 21 Dec 2023 10:39:22 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rGFWA-0004Yy-Ld; Thu, 21 Dec 2023 04:39:02 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rGFW6-0004YO-PQ for bug-gnu-emacs@gnu.org; Thu, 21 Dec 2023 04:38:58 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rGFW6-0008Cu-D9 for bug-gnu-emacs@gnu.org; Thu, 21 Dec 2023 04:38:58 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rGFW9-0005lQ-QW for bug-gnu-emacs@gnu.org; Thu, 21 Dec 2023 04:39:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 21 Dec 2023 09:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67946 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 67946-submit@debbugs.gnu.org id=B67946.170315153022137 (code B ref 67946); Thu, 21 Dec 2023 09:39:01 +0000 Original-Received: (at 67946) by debbugs.gnu.org; 21 Dec 2023 09:38:50 +0000 Original-Received: from localhost ([127.0.0.1]:42420 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGFVx-0005kz-TI for submit@debbugs.gnu.org; Thu, 21 Dec 2023 04:38:50 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38382) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGFVu-0005kl-Sv for 67946@debbugs.gnu.org; Thu, 21 Dec 2023 04:38:48 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rGFVl-0007iE-57; Thu, 21 Dec 2023 04:38:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=kUcwvh5puz4gh4DB8yv6nKI5s/kjoqalzmpMdUCp9mo=; b=lOtdqPx3J9OF SffKHA9peTtlmbgrYgJFqOVoS5qtS1n/9R43vpomVnr/f5snH2svTJDjJ924G9VrlS6hnmTrnCVL8 l5t1LBNu1LfXcZaZ+5kz7j/vRgM7uRITAeapP57+Y7iUrMOf8vI5F/5eskc34Qx/Mkzqjf1hyf8he 9EWbkK6qC/71kVq6b/3rcROv03xS22Zt+xkat6HN4S/EcGcGnAhuHwuNUD1XBG2M0DnjFCdqyOitA tm+VF8WY58/u/YKJ5rmoGrtMK1cnKhYJjVPFFevsXTv3vBprHj/9dMiJj3uQuRrxDZHs17stPypMQ 1airZ1hnWy5KJSExN0J87g==; In-Reply-To: <87a5q41azk.fsf@laptop.lockywolf.net> (message from Vladimir Nikishkin on Thu, 21 Dec 2023 11:26:52 +0800) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:276618 Archived-At: > From: Vladimir Nikishkin > Date: Thu, 21 Dec 2023 11:26:52 +0800 > > I have the following setting in my init.el > > (add-hook 'buffer-list-update-hook 'recentf-track-opened-file) > (add-hook 'buffer-list-update 'recentf-save-list) > > The first one is the one recommended by describe-function recentf-mode, > and the second one is to make this switch persistent, and resistant to > emacs being killed. > > However, I am getting a lot of messages like > `Wrote /home/lockywolf/.emacs.d/recentf', which are not very helpful > normally. > > I am attaching a trivial patch (001_patch-recentf-verbose.patch), which > adds a `recentf-verbose' defcustom, which, when set to nil, would > suppress these messages. Thanks, I have a few comments about the proposed changes: > +(defcustom recentf-verbose t > + "Non-nil means to show debugging messages related to the recentf machinery." > + :group 'recentf > + :type 'boolean) This currently only controls the "Wrote" message, so "show debugging messages" is a bit misleading. Also, new defcustoms should have a :version tag > @@ -1324,7 +1329,10 @@ 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 > + recentf-verbose > + ) You pass the value of recentf-verbose, either nil or t, to write-region, but the only way to suppress the "Wrote" message from write-region is to pass a non-nil, non-t value in the 5th argument; see the doc string of write-region. So the above will not suppress the "Wrote" message, neither if the new defcustom is t nor if it is nil, and the code needs some simple changes to do what you want. Am I missing something? Finally, this change needs a NEWS entry. And please accompany the change with a ChangeLog-style commit log message; see CONTRIBUTE for how to format the log message, and see "git log" in the repository for examples of how we do this in practice. Thanks again for working on this.