Subject: bug#16280: 24.3.50; [PATCH] eww: Add new function to clean browser histories.

From: Kenjiro NAKAYAMA <[email-masked]>
Date: Sun, 29 Dec 2013 00:32:12 +0900

I think this function is simple but sufficient. 
Please review and install it to the official tree if appreciated, after Feature freeze.

Signed-off-by: Kenjiro NAKAYAMA <[email-masked]>

          * net/eww.el (eww-mode-map): Add new key map and easy-menu to
            clean up browser histories.
            (eww-history-cleanup): New function to cleanup browser histories.

---
 lisp/net/eww.el | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 25309d1..11fcbf1 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -428,6 +428,7 @@ word(s) will be searched for via `eww-search-prefix'."
     (define-key map "C" 'url-cookie-list)
     (define-key map "v" 'eww-view-source)
     (define-key map "H" 'eww-list-histories)
+    (define-key map [(meta c)] 'eww-history-cleanup)

     (define-key map "b" 'eww-add-bookmark)
     (define-key map "B" 'eww-list-bookmarks)
@@ -448,6 +449,8 @@ word(s) will be searched for via `eww-search-prefix'."
        ["View page source" eww-view-source]
        ["Copy page URL" eww-copy-page-url t]
        ["List histories" eww-list-histories t]
+       ["Clean histories" eww-history-cleanup
+        :active (not (zerop (length eww-history)))]
        ["Add bookmark" eww-add-bookmark t]
        ["List bookmarks" eww-list-bookmarks t]
        ["List cookies" url-cookie-list t]))
@@ -1091,6 +1094,13 @@ Differences in #targets are ignored."
        (setq count (1+ count)))
       (expand-file-name file directory)))

+(defun eww-history-cleanup ()
+  (interactive)
+  (if (y-or-n-p "clean up browser histories? ")
+      (progn
+       (setq-local eww-history nil)
+       (setq-local eww-history-position 0))))
+
 ;;; Bookmarks code

 (defvar eww-bookmarks nil)
-- 
1.8.3.1

Regards,

Kenji