GNU bug report logs - #78303
31.0.50; Allow nil as valid value for url-cookie-save-interval per doc and type

Previous Next

Package: emacs;

Reported by: Jens Schmidt <jschmidt4gnu <at> vodafonemail.de>

Date: Wed, 7 May 2025 21:01:02 UTC

Severity: normal

Found in version 31.0.50

To reply to this bug, email your comments to 78303 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org:
bug#78303; Package emacs. (Wed, 07 May 2025 21:01:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jens Schmidt <jschmidt4gnu <at> vodafonemail.de>:
New bug report received and forwarded. Copy sent to monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org. (Wed, 07 May 2025 21:01:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jens Schmidt <jschmidt4gnu <at> vodafonemail.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 31.0.50; Allow nil as valid value for url-cookie-save-interval per
 doc and type
Date: Wed, 7 May 2025 22:59:47 +0200
[Message part 1 (text/plain, inline)]
X-Debbugs-Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>

[ CC to Stefan, who seems to be the original author of that cookie
  handling thingy ... apologies if that does not really concern you ]

Variable `url-cookie-save-interval' can be perfectly well configured to
nil, as one can see in function `url-cookie-setup-save-timer' (which
seems to be the only function referencing that variable):

  (defun url-cookie-setup-save-timer ()
    "Reset the cookie saver timer."
    (interactive)
    (ignore-errors (cancel-timer url-cookie-timer))
    (setq url-cookie-timer nil)
    (if url-cookie-save-interval
        (setq url-cookie-timer (run-at-time url-cookie-save-interval
                                            url-cookie-save-interval
                                            #'url-cookie-write-file))))

However, the docstring and the :type of the defcustom do not
document/allow for nil as a valid value.

The attached patch fixes that, please check.

Thanks!
[0001-Allow-nil-as-valid-value-for-url-cookie-save-interva.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78303; Package emacs. (Thu, 08 May 2025 09:41:01 GMT) Full text and rfc822 format available.

Message #8 received at 78303 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Jens Schmidt <jschmidt4gnu <at> vodafonemail.de>
Cc: 78303 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: Re: bug#78303: 31.0.50;
 Allow nil as valid value for url-cookie-save-interval per doc and type
Date: Thu, 08 May 2025 12:40:48 +0300
> Cc: stefan monnier <monnier <at> iro.umontreal.ca>
> Date: Wed, 7 May 2025 22:59:47 +0200
> From:  Jens Schmidt via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> [ CC to Stefan, who seems to be the original author of that cookie
>   handling thingy ... apologies if that does not really concern you ]
> 
> Variable `url-cookie-save-interval' can be perfectly well configured to
> nil, as one can see in function `url-cookie-setup-save-timer' (which
> seems to be the only function referencing that variable):
> 
>   (defun url-cookie-setup-save-timer ()
>     "Reset the cookie saver timer."
>     (interactive)
>     (ignore-errors (cancel-timer url-cookie-timer))
>     (setq url-cookie-timer nil)
>     (if url-cookie-save-interval
>         (setq url-cookie-timer (run-at-time url-cookie-save-interval
>                                             url-cookie-save-interval
>                                             #'url-cookie-write-file))))
> 
> However, the docstring and the :type of the defcustom do not
> document/allow for nil as a valid value.
> 
> The attached patch fixes that, please check.

Thanks, my alternative suggestion is below.  Now Stefan gets to choose ;-)

diff --git a/lisp/url/url-cookie.el b/lisp/url/url-cookie.el
index bb7364e..7ec90fd 100644
--- a/lisp/url/url-cookie.el
+++ b/lisp/url/url-cookie.el
@@ -350,21 +350,23 @@ url-cookie-timer
 
 (defcustom url-cookie-save-interval 3600
   "The number of seconds between automatic saves of cookies.
-Default is 1 hour.  Note that if you change this variable outside of
+Default is 1 hour; set to nil to disable automatic saving.
+Note that if you change this variable outside of
 the `customize' interface after `url-do-setup' has been run, you need
 to run the `url-cookie-setup-save-timer' function manually."
   :set (lambda (var val)
          (set-default var val)
          (if (bound-and-true-p url-setup-done)
              (url-cookie-setup-save-timer)))
-  :type 'natnum)
+  :type '(choice (const :tag "Disable automatic saving" :value nil)
+                 (natnum :tag "Auto-save interval in seconds")))
 
 (defun url-cookie-setup-save-timer ()
   "Reset the cookie saver timer."
   (interactive)
   (ignore-errors (cancel-timer url-cookie-timer))
   (setq url-cookie-timer nil)
-  (if url-cookie-save-interval
+  (if (natnump url-cookie-save-interval)
       (setq url-cookie-timer (run-at-time url-cookie-save-interval
 					  url-cookie-save-interval
 					  #'url-cookie-write-file))))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78303; Package emacs. (Thu, 08 May 2025 13:29:02 GMT) Full text and rfc822 format available.

Message #11 received at 78303 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 78303 <at> debbugs.gnu.org, Jens Schmidt <jschmidt4gnu <at> vodafonemail.de>
Subject: Re: bug#78303: 31.0.50; Allow nil as valid value for
 url-cookie-save-interval per doc and type
Date: Thu, 08 May 2025 09:28:49 -0400
>> [ CC to Stefan, who seems to be the original author of that cookie
>>   handling thingy ... apologies if that does not really concern you ]

[ Hmm... Git indeed claims that I added this file back in 2003, but
  I have no recollection of doing so.  Apparently that applies to all
  the URL package, so I guess I was the one who added that package to
  Emacs, tho I can't remember doing that either.
  FWIW, that package started its life as part of the W3 browser and was
  written mostly by W3's author, William Perry.
  You can see that package's earlier history in the `externals/w3`
  branch of the `elpa.git `repository where the files were named
  `lisp/url-*.el`.  ]

> Thanks, my alternative suggestion is below.  Now Stefan gets to choose ;-)

I'll let you fight it out.  🙂


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78303; Package emacs. (Thu, 08 May 2025 17:51:04 GMT) Full text and rfc822 format available.

Message #14 received at 78303 <at> debbugs.gnu.org (full text, mbox):

From: Jens Schmidt <jschmidt4gnu <at> vodafonemail.de>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>, Eli Zaretskii <eliz <at> gnu.org>
Cc: 78303 <at> debbugs.gnu.org
Subject: Re: bug#78303: 31.0.50; Allow nil as valid value for
 url-cookie-save-interval per doc and type
Date: Thu, 8 May 2025 19:50:22 +0200
On 2025-05-08  15:28, Stefan Monnier wrote:

>> Thanks, my alternative suggestion is below.  Now Stefan gets to choose ;-)
> 
> I'll let you fight it out.  🙂

Never mess with Eli when it comes to documentation or UI.  I quit.

Read as: Please install your alternative, Eli.

Thanks.





This bug report was last modified 6 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.