unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16236: 24.3.50; [PATCH] eww: Don't set local value.
@ 2013-12-24  7:37 Kenjiro NAKAYAMA
  2013-12-24  7:54 ` Lars Ingebrigtsen
  2013-12-28 15:00 ` bug#16236: 24.3.50; [PATCH] eww: eww-history-mode fixup Kenjiro NAKAYAMA
  0 siblings, 2 replies; 5+ messages in thread
From: Kenjiro NAKAYAMA @ 2013-12-24  7:37 UTC (permalink / raw)
  To: 16236

This report includes a patch to the bug. Please, review and install it
to the official tree if appreciated.

Now, eww-history-mode does not work well.
eww-history and eww-history-position should not be local value, since eww will
use them in eww-history-mode.

Or, just deleting two lines will work well.

-  (setq-local eww-history nil)
-  (setq-local eww-history-position 0)

Kenjiro

Signed-off-by: Kenjiro NAKAYAMA <knakayam@redhat.com>

        * net/eww.el (eww-mode): Don't set local value to eww-history and eww-history-position.

Signed-off-by: Kenjiro NAKAYAMA <nakayamakenjiro@gmail.com>
---
 lisp/net/eww.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 89a7eb9..fdf5aca 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -467,8 +467,8 @@ word(s) will be searched for via `eww-search-prefix'."
   (setq-local eww-current-source nil)
   (setq-local browse-url-browser-function 'eww-browse-url)
   (setq-local after-change-functions 'eww-process-text-input)
-  (setq-local eww-history nil)
-  (setq-local eww-history-position 0)
+  (setq eww-history nil)
+  (setq eww-history-position 0)
   (when (boundp 'tool-bar-map)
    (setq-local tool-bar-map eww-tool-bar-map))
   (buffer-disable-undo)
-- 
1.8.3.1

Kenjiro NAKAYAMA





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#16236: 24.3.50; [PATCH] eww: Don't set local value.
  2013-12-24  7:37 bug#16236: 24.3.50; [PATCH] eww: Don't set local value Kenjiro NAKAYAMA
@ 2013-12-24  7:54 ` Lars Ingebrigtsen
  2013-12-28 15:00 ` bug#16236: 24.3.50; [PATCH] eww: eww-history-mode fixup Kenjiro NAKAYAMA
  1 sibling, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2013-12-24  7:54 UTC (permalink / raw)
  To: Kenjiro NAKAYAMA; +Cc: 16236

Kenjiro NAKAYAMA <nakayamakenjiro@gmail.com> writes:

> Now, eww-history-mode does not work well.
> eww-history and eww-history-position should not be local value, since eww will
> use them in eww-history-mode.
>
> Or, just deleting two lines will work well.
>
> -  (setq-local eww-history nil)
> -  (setq-local eww-history-position 0)

But that would mean that we can't have several eww buffers, which the
user should be able to if the user wants.  (By just renaming the
buffer.)

So I don't think this is the way to fix this problem.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#16236: 24.3.50; [PATCH] eww: eww-history-mode fixup.
  2013-12-24  7:37 bug#16236: 24.3.50; [PATCH] eww: Don't set local value Kenjiro NAKAYAMA
  2013-12-24  7:54 ` Lars Ingebrigtsen
@ 2013-12-28 15:00 ` Kenjiro NAKAYAMA
  2014-01-05  9:27   ` Lars Magne Ingebrigtsen
  2014-07-17  7:06   ` bug#16279: " Ivan Shmakov
  1 sibling, 2 replies; 5+ messages in thread
From: Kenjiro NAKAYAMA @ 2013-12-28 15:00 UTC (permalink / raw)
  To: 16236

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@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 





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#16236: 24.3.50; [PATCH] eww: eww-history-mode fixup.
  2013-12-28 15:00 ` bug#16236: 24.3.50; [PATCH] eww: eww-history-mode fixup Kenjiro NAKAYAMA
@ 2014-01-05  9:27   ` Lars Magne Ingebrigtsen
  2014-07-17  7:06   ` bug#16279: " Ivan Shmakov
  1 sibling, 0 replies; 5+ messages in thread
From: Lars Magne Ingebrigtsen @ 2014-01-05  9:27 UTC (permalink / raw)
  To: Kenjiro NAKAYAMA; +Cc: 16236

Kenjiro NAKAYAMA <nakayamakenjiro@gmail.com> writes:

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

Thanks; applied.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#16279: 24.3.50; [PATCH] eww: eww-history-mode fixup.
  2013-12-28 15:00 ` bug#16236: 24.3.50; [PATCH] eww: eww-history-mode fixup Kenjiro NAKAYAMA
  2014-01-05  9:27   ` Lars Magne Ingebrigtsen
@ 2014-07-17  7:06   ` Ivan Shmakov
  1 sibling, 0 replies; 5+ messages in thread
From: Ivan Shmakov @ 2014-07-17  7:06 UTC (permalink / raw)
  To: 16279-done

[-- Attachment #1: Type: text/plain, Size: 1176 bytes --]

>>>>> Kenjiro NAKAYAMA <nakayamakenjiro@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@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/

[-- Attachment #2: Type: application/octet-stream, Size: 559 bytes --]

commit e8fcf8ca81c802c30f2e2f7d10490ff9c950c12c
Author:     Kenjiro NAKAYAMA <nakayamakenjiro@gmail.com>
AuthorDate: Sun Jan 5 10:27:26 2014 +0100
Commit:     Lars Magne Ingebrigtsen <larsi@gnus.org>
CommitDate: Sun Jan 5 10:27:26 2014 +0100

    Make the eww history browsing work again
    
    * 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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-07-17  7:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-24  7:37 bug#16236: 24.3.50; [PATCH] eww: Don't set local value Kenjiro NAKAYAMA
2013-12-24  7:54 ` Lars Ingebrigtsen
2013-12-28 15:00 ` bug#16236: 24.3.50; [PATCH] eww: eww-history-mode fixup Kenjiro NAKAYAMA
2014-01-05  9:27   ` Lars Magne Ingebrigtsen
2014-07-17  7:06   ` bug#16279: " Ivan Shmakov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).