mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Allow deleting all non-matching cookies
* lisp/url/url-cookie.el (url-cookie-delete-cookies): Allow keeping matching cookies (bug#22720).
This commit is contained in:
parent
ad1879b7be
commit
dfcdc1cbed
1 changed files with 9 additions and 4 deletions
|
|
@ -353,14 +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)
|
||||
(defun url-cookie-delete-cookies (&optional regexp keep)
|
||||
"Delete all cookies from the cookie store where the domain matches REGEXP.
|
||||
If REGEXP is nil, all cookies are deleted."
|
||||
If REGEXP is nil, all cookies are deleted. If KEEP is non-nil,
|
||||
instead delete all cookies that do not match REGEXP."
|
||||
(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)))
|
||||
(when (or (and (null keep)
|
||||
(or (null regexp)
|
||||
(string-match regexp (car elem))))
|
||||
(and keep
|
||||
regexp
|
||||
(not (string-match regexp (car elem)))))
|
||||
(setq cookies (delq elem cookies))))
|
||||
(set variable cookies)))
|
||||
(setq url-cookies-changed-since-last-save t)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue