aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen2013-06-26 14:54:33 +0200
committerLars Magne Ingebrigtsen2013-06-26 14:54:33 +0200
commit843571cba9e46385c1e46a6d78e2838edde4c564 (patch)
tree20d660fee82a0a38f682f846d852a97a90ad6310
parenteab35f39222d075677e012469bf612e4fbb31caa (diff)
downloademacs-843571cba9e46385c1e46a6d78e2838edde4c564.tar.gz
emacs-843571cba9e46385c1e46a6d78e2838edde4c564.zip
Implement a command and mode for displaying and editing cookies
-rw-r--r--etc/NEWS3
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/net/eww.el1
-rw-r--r--lisp/url/ChangeLog5
-rw-r--r--lisp/url/url-cookie.el88
5 files changed, 102 insertions, 0 deletions
diff --git a/etc/NEWS b/etc/NEWS
index db6ad061b28..8df6153e808 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1194,6 +1194,9 @@ and the `attributes' slot is always nil.
1194The `url-retrieve' function now uses this to encode its URL argument, 1194The `url-retrieve' function now uses this to encode its URL argument,
1195in case that is not properly encoded. 1195in case that is not properly encoded.
1196 1196
1197*** New command `url-cookie-list' displays all the current cookies, and
1198allows deleting selected cookies.
1199
1197** notifications.el supports now version 1.2 of the Notifications API. 1200** notifications.el supports now version 1.2 of the Notifications API.
1198The function `notifications-get-capabilities' returns the supported 1201The function `notifications-get-capabilities' returns the supported
1199server properties. 1202server properties.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7aa962b9ada..76d1f065401 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12013-06-26 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * net/eww.el (eww-mode): Undo isn't necessary in eww buffers,
4 probably.
5
12013-06-26 Glenn Morris <rgm@gnu.org> 62013-06-26 Glenn Morris <rgm@gnu.org>
2 7
3 * htmlfontify.el (hfy-triplet): Handle unspecified-fg, bg. 8 * htmlfontify.el (hfy-triplet): Handle unspecified-fg, bg.
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 61bb4235c34..5ad4c327627 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -346,6 +346,7 @@ word(s) will be searched for via `eww-search-prefix'."
346 (set (make-local-variable 'after-change-functions) 'eww-process-text-input) 346 (set (make-local-variable 'after-change-functions) 'eww-process-text-input)
347 (set (make-local-variable 'eww-history) nil) 347 (set (make-local-variable 'eww-history) nil)
348 (set (make-local-variable 'eww-history-position) 0) 348 (set (make-local-variable 'eww-history-position) 0)
349 (buffer-disable-undo)
349 ;;(setq buffer-read-only t) 350 ;;(setq buffer-read-only t)
350 ) 351 )
351 352
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog
index 0d963eddc02..7b64b4cb3eb 100644
--- a/lisp/url/ChangeLog
+++ b/lisp/url/ChangeLog
@@ -1,3 +1,8 @@
12013-06-26 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * url-cookie.el: Implement a command and mode for displaying and
4 editing cookies.
5
12013-06-21 Glenn Morris <rgm@gnu.org> 62013-06-21 Glenn Morris <rgm@gnu.org>
2 7
3 * url-future.el (url-future-call): Remove useless value call. 8 * url-future.el (url-future-call): Remove useless value call.
diff --git a/lisp/url/url-cookie.el b/lisp/url/url-cookie.el
index 6692c812871..3e543300b30 100644
--- a/lisp/url/url-cookie.el
+++ b/lisp/url/url-cookie.el
@@ -349,6 +349,94 @@ to run the `url-cookie-setup-save-timer' function manually."
349 url-cookie-save-interval 349 url-cookie-save-interval
350 #'url-cookie-write-file)))) 350 #'url-cookie-write-file))))
351 351
352;;; Mode for listing and editing cookies.
353
354(defun url-cookie-list ()
355 "List the URL cookies."
356 (interactive)
357
358 (when (and (null url-cookie-secure-storage)
359 (null url-cookie-storage))
360 (error "No cookies are defined"))
361
362 (pop-to-buffer "*url cookies*")
363 (let ((inhibit-read-only t)
364 (domains (sort
365 (copy-sequence
366 (append url-cookie-secure-storage
367 url-cookie-storage))
368 (lambda (e1 e2)
369 (string< (car e1) (car e2)))))
370 (domain-length 0)
371 start name format domain)
372 (erase-buffer)
373 (url-cookie-mode)
374 (dolist (elem domains)
375 (setq domain-length (max domain-length (length (car elem)))))
376 (setq format (format "%%-%ds %%-20s %%s" domain-length)
377 header-line-format
378 (concat " " (format format "Domain" "Name" "Value")))
379 (dolist (elem domains)
380 (setq domain (car elem))
381 (dolist (cookie (sort (copy-sequence (cdr elem))
382 (lambda (c1 c2)
383 (string< (url-cookie-name c1)
384 (url-cookie-name c2)))))
385 (setq start (point)
386 name (url-cookie-name cookie))
387 (when (> (length name) 20)
388 (setq name (substring name 0 20)))
389 (insert (format format domain name
390 (url-cookie-value cookie))
391 "\n")
392 (setq domain "")
393 (put-text-property start (1+ start) 'url-cookie cookie)))
394 (goto-char (point-min))))
395
396(defun url-cookie-delete ()
397 "Delete the cookie on the current line."
398 (interactive)
399 (let ((cookie (get-text-property (line-beginning-position) 'url-cookie))
400 (inhibit-read-only t)
401 variable)
402 (unless cookie
403 (error "No cookie on the current line"))
404 (setq variable (if (url-cookie-secure cookie)
405 'url-cookie-secure-storage
406 'url-cookie-storage))
407 (let* ((list (symbol-value variable))
408 (elem (assoc (url-cookie-domain cookie) list)))
409 (setq elem (delq cookie elem))
410 (when (zerop (length (cdr elem)))
411 (setq list (delq elem list)))
412 (set variable list))
413 (setq url-cookies-changed-since-last-save t)
414 (url-cookie-write-file)
415 (delete-region (line-beginning-position)
416 (progn
417 (forward-line 1)
418 (point)))))
419
420(defun url-cookie-quit ()
421 "Kill the current buffer."
422 (interactive)
423 (kill-buffer (current-buffer)))
424
425(defvar url-cookie-mode-map
426 (let ((map (make-sparse-keymap)))
427 (suppress-keymap map)
428 (define-key map "q" 'url-cookie-quit)
429 (define-key map [delete] 'url-cookie-delete)
430 map))
431
432(define-derived-mode url-cookie-mode nil "eww"
433 "Mode for listing cookies.
434
435\\{url-cookie-mode-map}"
436 (buffer-disable-undo)
437 (setq buffer-read-only t
438 truncate-lines t))
439
352(provide 'url-cookie) 440(provide 'url-cookie)
353 441
354;;; url-cookie.el ends here 442;;; url-cookie.el ends here