Add a function to delete URL cookies
* doc/misc/url.texi (Cookies): Document url-cookie-delete-cookies. * lisp/url/url-cookie.el (url-cookie-delete-cookies): New function.
This commit is contained in:
parent
336dac5820
commit
3e67708d72
3 changed files with 24 additions and 0 deletions
|
|
@ -417,6 +417,12 @@ cookies, if there are any. You can remove a cookie using the
|
|||
@kbd{C-k} (@code{url-cookie-delete}) command.
|
||||
@end defun
|
||||
|
||||
@defun url-cookie-delete-cookies &optional regexp
|
||||
This function takes a regular expression as its parameters and deletes
|
||||
all cookies from that domain. If @var{regexp} is @code{nil}, delete
|
||||
all cookies.
|
||||
@end defun
|
||||
|
||||
@defopt url-cookie-file
|
||||
The file in which cookies are stored, defaulting to @file{cookies} in
|
||||
the directory specified by @code{url-configuration-directory}.
|
||||
|
|
|
|||
5
etc/NEWS
5
etc/NEWS
|
|
@ -1040,6 +1040,11 @@ we should not be queried about things like TLS certificate validity.
|
|||
plist will contain a :peer element that has the output of
|
||||
`gnutls-peer-status' (if Emacs is built with GnuTLS support).
|
||||
|
||||
+++
|
||||
*** The new function `url-cookie-delete-cookie' can be used to
|
||||
programmatically delete all cookies, or cookies from a specific
|
||||
domain.
|
||||
|
||||
** Tramp
|
||||
|
||||
+++
|
||||
|
|
|
|||
|
|
@ -353,6 +353,19 @@ to run the `url-cookie-setup-save-timer' function manually."
|
|||
url-cookie-save-interval
|
||||
#'url-cookie-write-file))))
|
||||
|
||||
(defun url-cookie-delete-cookies (&optional regexp)
|
||||
"Delete all cookies from the cookie store where the domain matches REGEXP.
|
||||
If REGEXP is nil, all cookies are deleted."
|
||||
(dolist (variable '(url-cookie-secure-storage url-cookie-storage))
|
||||
(let ((cookies (symbol-value variable)))
|
||||
(dolist (elem cookies)
|
||||
(when (or (null regexp)
|
||||
(string-match regexp (car elem)))
|
||||
(setq cookies (delq elem cookies))))
|
||||
(set variable cookies)))
|
||||
(setq url-cookies-changed-since-last-save t)
|
||||
(url-cookie-write-file))
|
||||
|
||||
;;; Mode for listing and editing cookies.
|
||||
|
||||
(defun url-cookie-list ()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue