From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#39638: 26.3; recentf-auto-cleanup deceptive Date: Mon, 17 Feb 2020 19:08:25 +0200 Message-ID: <83imk5m99y.fsf@gnu.org> References: <80wo8lacrz.fsf@felesatra.moe> Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="122316"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 39638@debbugs.gnu.org To: Allen Li , Juanma Barranquero Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 17 18:09:12 2020 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 1j3jtQ-000Vg3-7H for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 17 Feb 2020 18:09:12 +0100 Original-Received: from localhost ([::1]:48826 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3jtP-0004nG-AE for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 17 Feb 2020 12:09:11 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34805) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3jtH-0004my-HU for bug-gnu-emacs@gnu.org; Mon, 17 Feb 2020 12:09:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j3jtG-0000S8-EV for bug-gnu-emacs@gnu.org; Mon, 17 Feb 2020 12:09:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33161) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j3jtG-0000S1-BC for bug-gnu-emacs@gnu.org; Mon, 17 Feb 2020 12:09:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1j3jtG-0007du-6e for bug-gnu-emacs@gnu.org; Mon, 17 Feb 2020 12:09:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 17 Feb 2020 17:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39638 X-GNU-PR-Package: emacs Original-Received: via spool by 39638-submit@debbugs.gnu.org id=B39638.158195929929331 (code B ref 39638); Mon, 17 Feb 2020 17:09:02 +0000 Original-Received: (at 39638) by debbugs.gnu.org; 17 Feb 2020 17:08:19 +0000 Original-Received: from localhost ([127.0.0.1]:39134 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j3jsZ-0007d1-9d for submit@debbugs.gnu.org; Mon, 17 Feb 2020 12:08:19 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:47884) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j3jsX-0007co-Ic for 39638@debbugs.gnu.org; Mon, 17 Feb 2020 12:08:18 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:56609) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1j3jsS-0000Dk-8D; Mon, 17 Feb 2020 12:08:12 -0500 Original-Received: from [176.228.60.248] (port=2131 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1j3jsR-0001fc-Ir; Mon, 17 Feb 2020 12:08:12 -0500 In-reply-to: <80wo8lacrz.fsf@felesatra.moe> (message from Allen Li on Sun, 16 Feb 2020 23:33:36 -0800) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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" Xref: news.gmane.io gmane.emacs.bugs:176147 Archived-At: > From: Allen Li > Date: Sun, 16 Feb 2020 23:33:36 -0800 > > This covers two bugs around recentf-auto-cleanup being > deceptive/unintuitive. > > Both bugs are present at 26.3 and on Emacs master as of > 556cc727e5076d590f8286406e4f46cff3cee41e > at Sun, 16 Feb 2020 11:37:07 -0800 > > 1. When setting recentf-auto-cleanup to a string, the timer does not > repeat. It is only set once. This is in contrast to midnight-mode, > which repeats its timer every day. The documentation for > recentf-auto-cleanup does not make this clear, and I'm not even sure if > this was the intended behavior. > > (defun recentf-auto-cleanup () > "Automatic cleanup of the recent list." > (when (timerp recentf-auto-cleanup-timer) > (cancel-timer recentf-auto-cleanup-timer)) > (when recentf-mode > (setq recentf-auto-cleanup-timer > (cond > ;; snipped > ((stringp recentf-auto-cleanup) > (run-at-time > recentf-auto-cleanup nil 'recentf-cleanup)))))) > > 2. Due to the behavior of run-at-time, if the time string set was in the > past for today, recentf-cleanup runs immediately when recentf-mode is > turned on (e.g., at Emacs startup). This makes it pointless to set it > to something like "3:00am" if I want recentf-cleanup to run at a time > when I'm likely not using Emacs and I have also set > recentf-max-saved-items to something large like 2000. The docstring > does not make this obvious. This is also how one would usually > customize midnight-mode. > > 2a. midnight-mode suffers from the same problem of using run-at-time, > but the default behavior of midnight-mode does not make it expensive. > But this means that adding recentf-cleanup to midnight-hook when using a large > recentf-max-saved-items will still be expensive at startup. > > I have attached a number of patches: > > 1. Simply fix some awkward wording that is not directly related to this bug. > 2. Document the current behavior. > 3. Make recentf-auto-cleanup repeat for time strings. > > The third patch can be skipped if deemed too aggressive, but I think > that's the more reasonable behavior to expect. > > I have not fixed the problem of recentf-cleanup running immediately if > the time is in the past for today, since I'm not sure the best way to do > it. Juanma, any comments? Did you indeed mean for the cleanup feature to work as it does, or are those omissions? Thanks.