GNU bug report logs - #16279
24.3.50; [PATCH] eww: eww-history-mode fixup.

Previous Next

Package: emacs;

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

Date: Sat, 28 Dec 2013 15:02:02 UTC

Severity: normal

Tags: patch

Found in version 24.3.50

Done: Ivan Shmakov <ivan <at> siamics.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 16279 in the body.
You can then email your comments to 16279 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#16279; Package emacs. (Sat, 28 Dec 2013 15:02:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 28 Dec 2013 15:02:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org, 16236 <at> debbugs.gnu.org
Subject: 24.3.50; [PATCH] eww: eww-history-mode fixup.
Date: Sun, 29 Dec 2013 00:00:52 +0900
Since current eww-history does not work well, I fixed.
Please review and install it to the official tree if appreciated.

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

         * net/eww.el (eww-list-histories,eww-history-browse): Fixup.
         (eww-history-quit): Delete and use quit-window.
         (eww-history-kill): Delete, because it doesn't work well and
         not necessary.
         (eww-history-mode-map): Delete some keys and add easy-menu.

---
 lisp/net/eww.el | 90 +++++++++++++++++++++++----------------------------------
 1 file changed, 36 insertions(+), 54 deletions(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 25309d1..2fc30b7 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -1282,32 +1282,30 @@ Differences in #targets are ignored."
   (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*")
-  )
+  (let ((eww-history-trans eww-history))
+    (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-trans)
+	(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-trans)
+	(setq start (point))
+	(setq url (plist-get history :url))
+	(setq title (plist-get history :title))
+	(insert (format format title url))
+	(insert "\n")
+	(put-text-property start (1+ start) 'eww-history history))
+      (goto-char (point-min)))
+    (pop-to-buffer "*eww history*")))
 
 (defun eww-history-browse ()
   "Browse the history under point in eww."
@@ -1315,39 +1313,23 @@ Differences in #targets are ignored."
   (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))
-    ))
+    (quit-window)
+    (eww-restore-history 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 "q" 'quit-window)
     (define-key map "\r" 'eww-history-browse)
-                (define-key map "n" 'next-error-no-select)
-                (define-key map "p" 'previous-error-no-select)
+;;    (define-key map "n" 'next-error-no-select)
+;;    (define-key map "p" 'previous-error-no-select)
+
+    (easy-menu-define nil map
+      "Menu for `eww-history-mode-map'."
+      '("Eww History"
+        ["Exit" quit-window t]
+        ["Browse" eww-history-browse
+         :active (get-text-property (line-beginning-position) 'eww-history)]))
     map))
 
 (define-derived-mode eww-history-mode nil "eww history"
-- 
1.8.3.1


Kenjiro 




Reply sent to Ivan Shmakov <ivan <at> siamics.net>:
You have taken responsibility. (Thu, 17 Jul 2014 07:15:02 GMT) Full text and rfc822 format available.

Notification sent to Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>:
bug acknowledged by developer. (Thu, 17 Jul 2014 07:15:04 GMT) Full text and rfc822 format available.

Message #10 received at 16279-done <at> debbugs.gnu.org (full text, mbox):

From: Ivan Shmakov <ivan <at> siamics.net>
To: 16279-done <at> debbugs.gnu.org
Subject: Re: 24.3.50; [PATCH] eww: eww-history-mode fixup.
Date: Thu, 17 Jul 2014 07:06:57 +0000
[Message part 1 (text/plain, inline)]
>>>>> Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com> writes:

 > Date: Sun, 29 Dec 2013 00:00:52 +0900

 > Since current eww-history does not work well, I fixed.  Please review
 > and install it to the official tree if appreciated.

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

 > * net/eww.el (eww-list-histories,eww-history-browse): Fixup.
 > (eww-history-quit): Delete and use quit-window.
 > (eww-history-kill): Delete, because it doesn't work well and
 > not necessary.
 > (eww-history-mode-map): Delete some keys and add easy-menu.

[…]

	Except for the line numbers and such, this exact diff was
	applied as e8fcf8ca81c8 back in January.  Thus I guess this bug
	report may safely be closed.

	That being said, I’d disagree that eww-history-kill is not
	necessary: the eww-history records contain pages’ DOMs, sources,
	and rendered texts (as :dom, :source and :text properties,
	respectively), and the only currently “supported” way to clear
	that is to kill a specific EWW buffer and create one anew, which
	isn’t all that fine-grained, as it seems.

-- 
FSF associate member #7257	http://boycottsystemd.org/
[Message part 2 (application/octet-stream, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 14 Aug 2014 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 314 days ago.

Previous Next


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