emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r113186: Implement a command and mode for displaying


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] trunk r113186: Implement a command and mode for displaying and editing cookies
Date: Wed, 26 Jun 2013 12:55:01 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113186
revision-id: address@hidden
parent: address@hidden
committer: Lars Magne Ingebrigtsen <address@hidden>
branch nick: trunk
timestamp: Wed 2013-06-26 14:54:33 +0200
message:
  Implement a command and mode for displaying and editing cookies
modified:
  etc/NEWS                       news-20100311060928-aoit31wvzf25yr1z-1
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/net/eww.el                eww.el-20130610114603-80ap3gwnw4x4m5ix-1
  lisp/url/ChangeLog             changelog-20091113204419-o5vbwnq5f7feedwu-3116
  lisp/url/url-cookie.el         
urlcookie.el-20091113204419-o5vbwnq5f7feedwu-2980
=== modified file 'etc/NEWS'
--- a/etc/NEWS  2013-06-25 15:49:02 +0000
+++ b/etc/NEWS  2013-06-26 12:54:33 +0000
@@ -1194,6 +1194,9 @@
 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.

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-06-26 06:59:48 +0000
+++ b/lisp/ChangeLog    2013-06-26 12:54:33 +0000
@@ -1,3 +1,8 @@
+2013-06-26  Lars Magne Ingebrigtsen  <address@hidden>
+
+       * net/eww.el (eww-mode): Undo isn't necessary in eww buffers,
+       probably.
+
 2013-06-26  Glenn Morris  <address@hidden>
 
        * htmlfontify.el (hfy-triplet): Handle unspecified-fg, bg.

=== modified file 'lisp/net/eww.el'
--- a/lisp/net/eww.el   2013-06-25 22:29:01 +0000
+++ b/lisp/net/eww.el   2013-06-26 12:54:33 +0000
@@ -346,6 +346,7 @@
   (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)
+  (buffer-disable-undo)
   ;;(setq buffer-read-only t)
   )
 

=== modified file 'lisp/url/ChangeLog'
--- a/lisp/url/ChangeLog        2013-06-21 06:32:50 +0000
+++ b/lisp/url/ChangeLog        2013-06-26 12:54:33 +0000
@@ -1,3 +1,8 @@
+2013-06-26  Lars Magne Ingebrigtsen  <address@hidden>
+
+       * url-cookie.el: Implement a command and mode for displaying and
+       editing cookies.
+
 2013-06-21  Glenn Morris  <address@hidden>
 
        * url-future.el (url-future-call): Remove useless value call.

=== modified file 'lisp/url/url-cookie.el'
--- a/lisp/url/url-cookie.el    2013-01-01 09:11:05 +0000
+++ b/lisp/url/url-cookie.el    2013-06-26 12:54:33 +0000
@@ -349,6 +349,94 @@
                                          url-cookie-save-interval
                                          #'url-cookie-write-file))))
 
+;;; Mode for listing and editing cookies.
+
+(defun url-cookie-list ()
+  "List the URL cookies."
+  (interactive)
+
+  (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
+                 (copy-sequence
+                  (append url-cookie-secure-storage
+                          url-cookie-storage))
+                 (lambda (e1 e2)
+                   (string< (car e1) (car e2)))))
+       (domain-length 0)
+       start name format domain)
+    (erase-buffer)
+    (url-cookie-mode)
+    (dolist (elem domains)
+      (setq domain-length (max domain-length (length (car elem)))))
+    (setq format (format "%%-%ds %%-20s %%s" domain-length)
+         header-line-format
+         (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))
+               "\n")
+       (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."
+  (interactive)
+  (let ((cookie (get-text-property (line-beginning-position) 'url-cookie))
+       (inhibit-read-only t)
+       variable)
+    (unless cookie
+      (error "No cookie on the current line"))
+    (setq variable (if (url-cookie-secure cookie)
+                      'url-cookie-secure-storage
+                    'url-cookie-storage))
+    (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)
+    (url-cookie-write-file)
+    (delete-region (line-beginning-position)
+                  (progn
+                    (forward-line 1)
+                    (point)))))
+
+(defun url-cookie-quit ()
+  "Kill the current buffer."
+  (interactive)
+  (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)
+    map))
+
+(define-derived-mode url-cookie-mode nil "eww"
+  "Mode for listing cookies.
+
+\\{url-cookie-mode-map}"
+  (buffer-disable-undo)
+  (setq buffer-read-only t
+       truncate-lines t))
+
 (provide 'url-cookie)
 
 ;;; url-cookie.el ends here


reply via email to

[Prev in Thread] Current Thread [Next in Thread]