Commit 843571cb authored by Lars Magne Ingebrigtsen's avatar Lars Magne Ingebrigtsen
Browse files

Implement a command and mode for displaying and editing cookies

parent eab35f39
......@@ -1194,6 +1194,9 @@ and the `attributes' slot is always nil.
The `url-retrieve' function now uses this to encode its URL argument,
in case that is not properly encoded.
*** New command `url-cookie-list' displays all the current cookies, and
allows deleting selected cookies.
** notifications.el supports now version 1.2 of the Notifications API.
The function `notifications-get-capabilities' returns the supported
server properties.
2013-06-26 Lars Magne Ingebrigtsen <>
* net/eww.el (eww-mode): Undo isn't necessary in eww buffers,
2013-06-26 Glenn Morris <>
* htmlfontify.el (hfy-triplet): Handle unspecified-fg, bg.
......@@ -346,6 +346,7 @@ word(s) will be searched for via `eww-search-prefix'."
(set (make-local-variable 'after-change-functions) 'eww-process-text-input)
(set (make-local-variable 'eww-history) nil)
(set (make-local-variable 'eww-history-position) 0)
;;(setq buffer-read-only t)
2013-06-26 Lars Magne Ingebrigtsen <>
* url-cookie.el: Implement a command and mode for displaying and
editing cookies.
2013-06-21 Glenn Morris <>
* url-future.el (url-future-call): Remove useless value call.
......@@ -349,6 +349,94 @@ to run the `url-cookie-setup-save-timer' function manually."
;;; Mode for listing and editing cookies.
(defun url-cookie-list ()
"List the URL cookies."
(when (and (null url-cookie-secure-storage)
(null url-cookie-storage))
(error "No cookies are defined"))
(pop-to-buffer "*url cookies*")
(let ((inhibit-read-only t)
(domains (sort
(append url-cookie-secure-storage
(lambda (e1 e2)
(string< (car e1) (car e2)))))
(domain-length 0)
start name format domain)
(dolist (elem domains)
(setq domain-length (max domain-length (length (car elem)))))
(setq format (format "%%-%ds %%-20s %%s" domain-length)
(concat " " (format format "Domain" "Name" "Value")))
(dolist (elem domains)
(setq domain (car elem))
(dolist (cookie (sort (copy-sequence (cdr elem))
(lambda (c1 c2)
(string< (url-cookie-name c1)
(url-cookie-name c2)))))
(setq start (point)
name (url-cookie-name cookie))
(when (> (length name) 20)
(setq name (substring name 0 20)))
(insert (format format domain name
(url-cookie-value cookie))
(setq domain "")
(put-text-property start (1+ start) 'url-cookie cookie)))
(goto-char (point-min))))
(defun url-cookie-delete ()
"Delete the cookie on the current line."
(let ((cookie (get-text-property (line-beginning-position) 'url-cookie))
(inhibit-read-only t)
(unless cookie
(error "No cookie on the current line"))
(setq variable (if (url-cookie-secure cookie)
(let* ((list (symbol-value variable))
(elem (assoc (url-cookie-domain cookie) list)))
(setq elem (delq cookie elem))
(when (zerop (length (cdr elem)))
(setq list (delq elem list)))
(set variable list))
(setq url-cookies-changed-since-last-save t)
(delete-region (line-beginning-position)
(forward-line 1)
(defun url-cookie-quit ()
"Kill the current buffer."
(kill-buffer (current-buffer)))
(defvar url-cookie-mode-map
(let ((map (make-sparse-keymap)))
(suppress-keymap map)
(define-key map "q" 'url-cookie-quit)
(define-key map [delete] 'url-cookie-delete)
(define-derived-mode url-cookie-mode nil "eww"
"Mode for listing cookies.
(setq buffer-read-only t
truncate-lines t))
(provide 'url-cookie)
;;; url-cookie.el ends here
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment