GNU bug report logs - #16086
24.3.50; [PATCH] eww: New command and functions to list the browser histories.

Previous Next

Package: emacs;

Reported by: Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>

Date: Sun, 8 Dec 2013 05:46:02 UTC

Severity: wishlist

Tags: patch

Found in version 24.3.50

Done: Ted Zlatanov <tzz <at> lifelogs.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>
Subject: bug#16086: closed (Re: bug#16086: 24.3.50; [PATCH] eww: New
 command and functions to list the browser histories..)
Date: Sat, 21 Dec 2013 20:34:03 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#16086: 24.3.50; [PATCH] eww: New command and functions to list the browser histories.

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 16086 <at> debbugs.gnu.org.

-- 
16086: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16086
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Ted Zlatanov <tzz <at> lifelogs.com>
To: 16086-done <at> debbugs.gnu.org
Subject: Re: bug#16086: 24.3.50;
 [PATCH] eww: New command and functions to list the browser histories..
Date: Sat, 21 Dec 2013 15:34:37 -0500
On Fri, 20 Dec 2013 09:53:13 +0900 Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com> wrote: 

>> It should probably not be applied until the assignment is listed in that
>> file that lists the assignments.  Which I've never found myself.  >"?

KN> Now, my contributor papers were accepted.
KN> Can you please apply my patches if it is applicable?

KN> Thanks,

KN> Kenjiro Nakayama

KN> larsi <at> gnus.org writes:

>> Ted Zlatanov <tzz <at> lifelogs.com> writes:
>> 
>>> (Lars, if you want to review the patch and commit it yourself, please
>>> let me know.)
>> 
>> The patch looks good to me -- this seems like useful functionality.  But:
>> 
>> Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com> writes:
>> 
>>>> The patch looks OK, but please remind me, do we have contributor papers
>>>> from you?  It's a large patch.
>>> 
>>> Yes, I have already signed and sent the paper.
>> 
>> It should probably not be applied until the assignment is listed in that
>> file that lists the assignments.  Which I've never found myself.  >"?

-- 
Teodor Zlatanov <tzz <at> lifelogs.com>
"Brevis oratio penetrat caelos et longa potatio evacuat scyphos." -Rabelais

[Message part 3 (message/rfc822, inline)]
From: Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50;
 [PATCH] eww: New command and functions to list the browser histories.
Date: Sun, 08 Dec 2013 14:44:55 +0900
New command and functions to list the eww browser histories. Since eww quits only "q" command, I think it becomes useful.

Signed-off-by: Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>

	* net/eww.el
      (eww-list-histories,eww-list-histories,eww-history-browse,eww-history-quit,eww-history-kill,eww-history-mode-map,eww-history-mode):
      New command and functions to list browser histories.

---
 lisp/net/eww.el | 107 +++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 95 insertions(+), 12 deletions(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 9d1c3a2..7a9c8e2 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -410,7 +410,8 @@ word(s) will be searched for via `eww-search-prefix'."
     (define-key map "w" 'eww-copy-page-url)
     (define-key map "C" 'url-cookie-list)
     (define-key map "v" 'eww-view-source)
-
+    (define-key map "H" 'eww-list-histories)
+    
     (define-key map "b" 'eww-add-bookmark)
     (define-key map "B" 'eww-list-bookmarks)
     (define-key map [(meta n)] 'eww-next-bookmark)
@@ -430,6 +431,7 @@ word(s) will be searched for via `eww-search-prefix'."
 	["Copy page URL" eww-copy-page-url t]
 	["Add bookmark" eww-add-bookmark t]
 	["List bookmarks" eww-copy-page-url t]
+	["List histories" eww-list-histories t]	
 	["List cookies" url-cookie-list t]))
     map))
 
@@ -443,21 +445,12 @@ word(s) will be searched for via `eww-search-prefix'."
   (set (make-local-variable 'eww-current-source) nil)
   (set (make-local-variable 'browse-url-browser-function) 'eww-browse-url)
   (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)
+;;  (set (make-local-variable 'eww-history) nil)
+;;  (set (make-local-variable 'eww-history-position) 0)
   (buffer-disable-undo)
   ;;(setq buffer-read-only t)
   )
 
-(defun eww-save-history ()
-  (push (list :url eww-current-url
-	      :title eww-current-title
-	      :point (point)
-              :dom eww-current-dom
-              :source eww-current-source
-	      :text (buffer-string))
-	eww-history))
-
 ;;;###autoload
 (defun eww-browse-url (url &optional _new-window)
   (when (and (equal major-mode 'eww-mode)
@@ -1229,6 +1222,96 @@ Differences in #targets are ignored."
   (setq buffer-read-only t
 	truncate-lines t))
 
+;;; History code
+
+(defun eww-save-history ()
+  (push (list :url eww-current-url
+	      :title eww-current-title
+	      :point (point)
+              :dom eww-current-dom
+              :source eww-current-source
+	      :text (buffer-string))
+	eww-history))
+
+(defun eww-list-histories ()
+  "List the eww-histories."
+  (interactive)
+  (when (null eww-history)
+    (error "No eww-histories are defined"))
+  (set-buffer (get-buffer-create "*eww history*"))    
+  (eww-history-mode)
+  (let ((inhibit-read-only t)
+	(domain-length 0)
+	(title-length 0)
+	url title format start)
+    (erase-buffer)
+    (dolist (history eww-history)
+      (setq start (point))            
+      (setq domain-length (max domain-length (length (plist-get history :url))))
+      (setq title-length (max title-length (length (plist-get history :title))))
+      )
+    (setq format (format "%%-%ds %%-%ds" title-length domain-length)
+	  header-line-format
+	  (concat " " (format format "Title" "URL")))
+
+    (dolist (history eww-history)
+      (setq url (plist-get history :url))
+      (setq title (plist-get history :title))
+      (insert (format format title url))
+      (insert "\n")
+      (put-text-property start (point) 'eww-history history)
+      )
+    (goto-char (point-min)))
+  (pop-to-buffer "*eww history*")  
+  )
+
+(defun eww-history-browse ()
+  "Browse the history under point in eww."
+  (interactive)
+  (let ((history (get-text-property (line-beginning-position) 'eww-history)))
+    (unless history
+      (error "No history on the current line"))
+    (eww-history-quit)
+    (pop-to-buffer "*eww*")
+    (eww-browse-url (plist-get history :url))))
+
+(defun eww-history-quit ()
+  "Kill the current buffer."
+  (interactive)
+  (kill-buffer (current-buffer)))
+
+(defvar eww-history-kill-ring nil)
+
+(defun eww-history-kill ()
+  "Kill the current history."
+  (interactive)
+  (let* ((start (line-beginning-position))
+	 (history (get-text-property start 'eww-history))
+	 (inhibit-read-only t))
+    (unless history
+      (error "No history on the current line"))
+    (forward-line 1)
+    (push (buffer-substring start (point)) eww-history-kill-ring)
+    (delete-region start (point))
+    (setq eww-history (delq history eww-history))
+    ))
+
+(defvar eww-history-mode-map
+  (let ((map (make-sparse-keymap)))
+    (suppress-keymap map)
+    (define-key map "q" 'eww-history-quit)
+    (define-key map [(control k)] 'eww-history-kill)
+    (define-key map "\r" 'eww-history-browse)
+    map))
+
+(define-derived-mode eww-history-mode nil "eww history"
+  "Mode for listing eww-histories.
+
+\\{eww-history-mode-map}"
+  (buffer-disable-undo)
+  (setq buffer-read-only t
+	truncate-lines t))
+
 (provide 'eww)
 
 ;;; eww.el ends here
-- 
1.8.3.1




This bug report was last modified 11 years and 209 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.