Subject: 25.1.50; Error in url-cookie-delete-cookies

From: Michael Heerdegen <[email-masked]>
Date: Sat, 02 Apr 2016 01:04:53 +0200

Hello,

Lars had introduced the new function `url-cookie-delete-cookies'.

I had hoped that this would (always) work - since it is so suggesting to
do:

--8<---------------cut here---------------start------------->8---
(require 'url)

(add-hook 'kill-emacs-hook #'url-cookie-delete-cookies)
--8<---------------cut here---------------end--------------->8---

But that gives an error - apparently - when you haven't yet used the
cookie mechanism.  Backtrace from emacs -Q after evaluating that and
hitting C-x C-c:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  expand-file-name(nil)
  url-cookie-write-file()
  url-cookie-delete-cookies()
  kill-emacs()
  save-buffers-kill-emacs(nil)
  save-buffers-kill-terminal(nil)
  funcall-interactively(save-buffers-kill-terminal nil)
  call-interactively(save-buffers-kill-terminal nil nil)
  command-execute(save-buffers-kill-terminal)

where `nil' is "the nil" that `cookie-file' is bound to.

I think it would be good if the function would not fail in this case.

Thanks,

Michael.

In GNU Emacs 25.1.50.3 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
 of 2016-03-31 built on drachen
Repository revision: 09462b95484ebf75899c64e8ddb7ffce50ef6ca0
Windowing system distributor 'The X.Org Foundation', version 11.0.11802000
System Description:	Debian GNU/Linux testing (stretch)

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GSETTINGS NOTIFY
LIBXML2 FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LC_ALL: de_DE.utf8
  value of $LC_COLLATE: C
  value of $LC_TIME: C
  value of $LANG: de_DE.utf8
  locale-coding-system: utf-8-unix