unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#19902: 25.0.50; [PATCH] Make eww entry point more info-like
@ 2015-02-19 15:03 Mark Oteiza
  2015-02-19 15:05 ` Mark Oteiza
                   ` (3 more replies)
  0 siblings, 4 replies; 25+ messages in thread
From: Mark Oteiza @ 2015-02-19 15:03 UTC (permalink / raw)
  To: 19902

---
eww already has some info-like behaviour, and I think this is a good
thing. An example is isearch in eww.

It's weird how M-x eww will always just reset the whole eww session
instead of going back to a buried eww buffer.  Also, now that eww has a
nice way to select instances with S, there should be an easy way to
duplicate eww buffers. The way info does this is with clone-buffer, and
it makes sense for eww to do the same.

With these changes, one can keep eww sessions around without clobbering
them every time M-x eww is invoked.  Now, one can have multiple eww's,
and to get to one of them, either:

M-x eww RET S
M-N eww RET

where M-N is the numeric prefix N.  Aside from eww's `S' command for
switching sessions, this is very much like how one uses info, and usage
feels much smoother and familiar for an Emacs interface.

P.S.  This (or some other patches I have sitting on the ML) puts my
contributions over 15 lines.  Paperwork is currently a WIP.

lisp/ChangeLog  |  6 ++++++
 lisp/net/eww.el | 25 ++++++++++++++++++++-----
 2 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 933e5bb..f12889a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2015-02-19  Mark Oteiza  <mvoteiza@udel.edu>
+
+	* net/eww.el (eww): Behave more like `info' entry point
+	(eww-fetch): Replaces prior eww function.
+	(eww-mode-map): More Info-like `M-n' for `clone-buffer'
+
 2015-02-19  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* emacs-lisp/smie.el (smie-prec2->grammar): Fix corner case problem.
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index b7ee065..ad322ed 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -239,8 +239,7 @@ This list can be customized via `eww-suggest-uris'."
 	    (push   uri uris)))))
     (nreverse uris)))
 
-;;;###autoload
-(defun eww (url)
+(defun eww-fetch (url)
   "Fetch URL and render the page.
 If the input doesn't look like an URL or a domain name, the
 word(s) will be searched for via `eww-search-prefix'."
@@ -288,6 +287,23 @@ word(s) will be searched for via `eww-search-prefix'."
   (url-retrieve url 'eww-render
 		(list url nil (current-buffer))))
 
+;;;###autoload
+(defun eww (&optional url buffer)
+  "Enter eww, the Emacs Web Wowser.
+Optional argument URL specifies the target to navigate;
+the default is `eww-search-prefix'.
+
+In interactive use, a numeric prefix argument of N selects an eww
+buffer named \"*eww*<N>\"."
+  (interactive
+   (let ((buf (get-buffer (if (numberp current-prefix-arg)
+                              (format "*eww*<%s>" current-prefix-arg)
+                            "*eww*"))))
+     (list (unless buf (read-string "Enter URL or keywords: "))
+           buf)))
+  (if buffer (pop-to-buffer-same-window buffer)
+    (eww-fetch url)))
+
 ;;;###autoload (defalias 'browse-web 'eww)
 
 ;;;###autoload
@@ -624,7 +640,7 @@ the like."
   (let ((map (make-sparse-keymap)))
     (set-keymap-parent map special-mode-map)
     (define-key map "g" 'eww-reload) ;FIXME: revert-buffer-function instead!
-    (define-key map "G" 'eww)
+    (define-key map "G" 'eww-fetch)
     (define-key map [?\t] 'shr-next-link)
     (define-key map [?\M-\t] 'shr-previous-link)
     (define-key map [backtab] 'shr-previous-link)
@@ -648,8 +664,7 @@ the like."
 
     (define-key map "b" 'eww-add-bookmark)
     (define-key map "B" 'eww-list-bookmarks)
-    (define-key map [(meta n)] 'eww-next-bookmark)
-    (define-key map [(meta p)] 'eww-previous-bookmark)
+    (define-key map [(meta n)] 'clone-buffer)
 
     (easy-menu-define nil map ""
       '("Eww"
-- 
2.3.0






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

end of thread, other threads:[~2015-12-25 18:00 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-19 15:03 bug#19902: 25.0.50; [PATCH] Make eww entry point more info-like Mark Oteiza
2015-02-19 15:05 ` Mark Oteiza
2015-02-19 15:32 ` Eli Zaretskii
2015-02-19 15:52   ` Mark Oteiza
2015-02-19 15:35 ` Ivan Shmakov
2015-02-19 15:51   ` Mark Oteiza
2015-02-19 17:32     ` bug#19902: 25.0.50; " Ivan Shmakov
2015-02-19 18:33       ` Stefan Monnier
2015-02-19 19:03 ` bug#19902: 25.0.50; [PATCH] " Juri Linkov
2015-02-19 22:55   ` bug#19902: 25.0.50; [PATCH v2] " Mark Oteiza
2015-02-20 23:34     ` Mark Oteiza
2015-02-21 10:37       ` bug#19902: 25.0.50; " Ivan Shmakov
2015-03-04 18:52         ` bug#19902: 25.0.50; [PATCH v3] " Mark Oteiza
2015-03-05 12:52           ` Lars Magne Ingebrigtsen
2015-03-05 15:05             ` Mark Oteiza
2015-03-05 22:21               ` Lars Magne Ingebrigtsen
2015-03-05 23:25                 ` Mark Oteiza
2015-03-06  0:16                   ` Lars Magne Ingebrigtsen
2015-12-25  6:38                     ` Lars Ingebrigtsen
2015-12-25 16:34                       ` Mark Oteiza
2015-12-25 16:37                         ` Lars Ingebrigtsen
2015-12-25 17:59                           ` Mark Oteiza
2015-12-25 18:00                       ` Mark Oteiza
2015-02-23 19:28     ` bug#19902: 25.0.50; [PATCH v2] " Juri Linkov
2015-03-04 19:01       ` Mark Oteiza

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).