unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#22244: 25.0.50; Make eww use display-buffer to display eww buffer
@ 2015-12-26 16:54 Michael Heerdegen
  2015-12-26 17:02 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 24+ messages in thread
From: Michael Heerdegen @ 2015-12-26 16:54 UTC (permalink / raw)
  To: 22244; +Cc: Lars Ingebrigtsen


Hello,

this has been discussed several times, but since Lars is here now, an
official request:

Wouldn't it be better to let eww use display-buffer instead of
switch-to-buffer in several places (at least, when calling eww and
eww-browse-url, probably some more)?  display-buffer's behavior can be
controlled via binding variables, while display-buffer makes the same a
horror.

For example, when I'm reading newspaper feeds from Gnus and want to open
a link with eww in a new pop up frame, I have to use this ugly hack,
ugh:

--8<---------------cut here---------------start------------->8---
(defun my-eww-browse-url-pop-up-frame (url &optional _)
  "My private version of `eww-browse-url', creating a new frame."
  (let ((frame (make-frame '()))
        (buffer (generate-new-buffer "*eww*"))
        win)
    (with-current-buffer buffer
      (eww-mode)
      (eww url))
    (select-frame-set-input-focus frame)
    (setq win (frame-root-window frame))
    (set-window-buffer win buffer)
    frame))
--8<---------------cut here---------------end--------------->8---


Thanks,

Michael.




In GNU Emacs 25.0.50.8 (x86_64-pc-linux-gnu, GTK+ Version 3.18.5)
 of 2015-12-23
Repository revision: 09053075225fec8a6cf7a72017a6dfc1ec6b6f0c
Windowing system distributor 'The X.Org Foundation', version 11.0.11703000
System Description:	Debian GNU/Linux testing (stretch)

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GSETTINGS NOTIFY
LIBXML2 FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LC_ALL: de_DE.utf8
  value of $LC_COLLATE: C
  value of $LC_TIME: C
  value of $LANG: de_DE.utf8
  locale-coding-system: utf-8-unix






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

* bug#22244: 25.0.50; Make eww use display-buffer to display eww buffer
  2015-12-26 16:54 bug#22244: 25.0.50; Make eww use display-buffer to display eww buffer Michael Heerdegen
@ 2015-12-26 17:02 ` Lars Ingebrigtsen
  2015-12-26 17:29   ` Michael Heerdegen
  0 siblings, 1 reply; 24+ messages in thread
From: Lars Ingebrigtsen @ 2015-12-26 17:02 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 22244

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Wouldn't it be better to let eww use display-buffer instead of
> switch-to-buffer in several places (at least, when calling eww and
> eww-browse-url, probably some more)?  display-buffer's behavior can be
> controlled via binding variables, while display-buffer makes the same a
> horror.

I'm not familiar with display-buffer, but by default it seems to work
like pop-to-buffer?  
-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#22244: 25.0.50; Make eww use display-buffer to display eww buffer
  2015-12-26 17:02 ` Lars Ingebrigtsen
@ 2015-12-26 17:29   ` Michael Heerdegen
  2015-12-26 17:45     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 24+ messages in thread
From: Michael Heerdegen @ 2015-12-26 17:29 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 22244

Lars Ingebrigtsen <larsi@gnus.org> writes:

> I'm not familiar with display-buffer, but by default it seems to work
> like pop-to-buffer?  

I wouldn't say so.  Today, pop-to-buffer is defined in terms of
display-buffer (it calls it).

The semantics of display-buffer are a bit complicated (it's documented
in the manual, but you'll need some minutes to understand the concept) -
but it is highly customizable via user options.  display-buffer can be
controlled on a finer level that in the old days (with variables like
same-window-buffer-names etc.).  AFAIK it's the standard way today to
display a buffer.

User preferences can be overridden/modified/refined at run-time when
calling display-buffer via the optional args.

The default behavior of display-buffer depends on the user options

display-buffer-overriding-action
display-buffer-base-action
display-buffer-fallback-action

With the default values, these functions are tried in order (that's the
default value of `display-buffer-fallback-action'):

(display-buffer--maybe-same-window
 display-buffer-reuse-window
 display-buffer--maybe-pop-up-frame-or-window
 display-buffer-in-previous-window
 display-buffer-use-some-window
 display-buffer-pop-up-frame)

So, in the unconfigured case, the buffer is just displayed in the
selected window.


Regards,

Michael.





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

* bug#22244: 25.0.50; Make eww use display-buffer to display eww buffer
  2015-12-26 17:29   ` Michael Heerdegen
@ 2015-12-26 17:45     ` Lars Ingebrigtsen
  2015-12-26 18:09       ` Michael Heerdegen
  0 siblings, 1 reply; 24+ messages in thread
From: Lars Ingebrigtsen @ 2015-12-26 17:45 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 22244

Michael Heerdegen <michael_heerdegen@web.de> writes:

> With the default values, these functions are tried in order (that's the
> default value of `display-buffer-fallback-action'):
>
> (display-buffer--maybe-same-window
>  display-buffer-reuse-window
>  display-buffer--maybe-pop-up-frame-or-window
>  display-buffer-in-previous-window
>  display-buffer-use-some-window
>  display-buffer-pop-up-frame)
>
> So, in the unconfigured case, the buffer is just displayed in the
> selected window.

That's not what I get if I eval

(display-buffer (get-buffer-create "foo"))

in a frame with a single window, where "foo" doesn't exist before.  It
pops the buffer up in a new window...

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





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

* bug#22244: 25.0.50; Make eww use display-buffer to display eww buffer
  2015-12-26 17:45     ` Lars Ingebrigtsen
@ 2015-12-26 18:09       ` Michael Heerdegen
  2015-12-26 18:19         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 24+ messages in thread
From: Michael Heerdegen @ 2015-12-26 18:09 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 22244

Lars Ingebrigtsen <larsi@gnus.org> writes:

> That's not what I get if I eval
>
> (display-buffer (get-buffer-create "foo"))
>
> in a frame with a single window, where "foo" doesn't exist before.  It
> pops the buffer up in a new window...

Indeed, I was to fast.  The first action that succeeds by default is
`display-buffer-use-some-window'.

Anyway, you can specify a default action in your `display-buffer' call
so that the thing behaves by default as it does now, and the user can
modify this behavior if he wants by customizing or binding
display-buffer-alist.


Michael.





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

* bug#22244: 25.0.50; Make eww use display-buffer to display eww buffer
  2015-12-26 18:09       ` Michael Heerdegen
@ 2015-12-26 18:19         ` Lars Ingebrigtsen
  2015-12-26 23:19           ` Michael Heerdegen
  0 siblings, 1 reply; 24+ messages in thread
From: Lars Ingebrigtsen @ 2015-12-26 18:19 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 22244

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Anyway, you can specify a default action in your `display-buffer' call
> so that the thing behaves by default as it does now, and the user can
> modify this behavior if he wants by customizing or binding
> display-buffer-alist.

Right.  Patches are welcome.  :-)

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





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

* bug#22244: 25.0.50; Make eww use display-buffer to display eww buffer
  2015-12-26 18:19         ` Lars Ingebrigtsen
@ 2015-12-26 23:19           ` Michael Heerdegen
  2015-12-26 23:28             ` Lars Ingebrigtsen
  0 siblings, 1 reply; 24+ messages in thread
From: Michael Heerdegen @ 2015-12-26 23:19 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 22244

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Right.  Patches are welcome.  :-)

Ok, I'll give it a try.  Shouldn't be hard, but I want to be sure I do
the right thing, and have a look how this is done at other places in the
code etc.

How long are you available here, Lars?


Michael.





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

* bug#22244: 25.0.50; Make eww use display-buffer to display eww buffer
  2015-12-26 23:19           ` Michael Heerdegen
@ 2015-12-26 23:28             ` Lars Ingebrigtsen
  2016-01-09  6:01               ` Michael Heerdegen
  0 siblings, 1 reply; 24+ messages in thread
From: Lars Ingebrigtsen @ 2015-12-26 23:28 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 22244

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Ok, I'll give it a try.  Shouldn't be hard, but I want to be sure I do
> the right thing, and have a look how this is done at other places in the
> code etc.
>
> How long are you available here, Lars?

For a couple more days, and then most of February, I think.

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





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

* bug#22244: 25.0.50; Make eww use display-buffer to display eww buffer
  2015-12-26 23:28             ` Lars Ingebrigtsen
@ 2016-01-09  6:01               ` Michael Heerdegen
  2016-02-02  4:55                 ` Lars Ingebrigtsen
  2016-02-02  4:58                 ` bug#22244: 25.0.50; Make eww use display-buffer to display eww buffer Lars Ingebrigtsen
  0 siblings, 2 replies; 24+ messages in thread
From: Michael Heerdegen @ 2016-01-09  6:01 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 22244

Lars Ingebrigtsen <larsi@gnus.org> writes:

> For a couple more days, and then most of February, I think.

pop-to-buffer-same-window is the function we could use.

But this issue is not as easy as it seemed.  The whole code must be
reworked to work with multiple eww buffers.  E.g.

(defun eww-browse-url (url &optional new-window)
  (cond (new-window
	 (switch-to-buffer (generate-new-buffer "*eww*"))
         (eww-mode)))
  (eww url))

creates a new buffer when new-window is non-nil, but eww calls
eww-setup-buffer, which unconditionally goes back to a hardcoded "*eww*"
named buffer again.

I don't know the code well and would prefer if you could had a look.  I
dunno in which direction we want to go (tabs, some day, maybe?).


Regards,

Michael.





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

* bug#22244: 25.0.50; Make eww use display-buffer to display eww buffer
  2016-01-09  6:01               ` Michael Heerdegen
@ 2016-02-02  4:55                 ` Lars Ingebrigtsen
  2016-02-02 15:24                   ` Mark Oteiza
  2016-02-02  4:58                 ` bug#22244: 25.0.50; Make eww use display-buffer to display eww buffer Lars Ingebrigtsen
  1 sibling, 1 reply; 24+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-02  4:55 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 22244

Michael Heerdegen <michael_heerdegen@web.de> writes:

> But this issue is not as easy as it seemed.  The whole code must be
> reworked to work with multiple eww buffers.  E.g.
>
> (defun eww-browse-url (url &optional new-window)
>   (cond (new-window
> 	 (switch-to-buffer (generate-new-buffer "*eww*"))
>          (eww-mode)))
>   (eww url))
>
> creates a new buffer when new-window is non-nil, but eww calls
> eww-setup-buffer, which unconditionally goes back to a hardcoded "*eww*"
> named buffer again.

Yeah, that doesn't work very well.  I've now fiddled with it a bit more,
and new-window now does what it's supposed to do.

> I don't know the code well and would prefer if you could had a look.  I
> dunno in which direction we want to go (tabs, some day, maybe?).

Hm...  I don't quite see it.  Switching between buffers now is so...
standard.  Would tabs be something other than buffers?

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





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

* bug#22244: 25.0.50; Make eww use display-buffer to display eww buffer
  2016-01-09  6:01               ` Michael Heerdegen
  2016-02-02  4:55                 ` Lars Ingebrigtsen
@ 2016-02-02  4:58                 ` Lars Ingebrigtsen
  2016-02-02 14:19                   ` Michael Heerdegen
  1 sibling, 1 reply; 24+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-02  4:58 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 22244

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Lars Ingebrigtsen <larsi@gnus.org> writes:
>
>> For a couple more days, and then most of February, I think.
>
> pop-to-buffer-same-window is the function we could use.

Yeah, that seems to do the trick.  Committed and pushed.

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





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

* bug#22244: 25.0.50; Make eww use display-buffer to display eww buffer
  2016-02-02  4:58                 ` bug#22244: 25.0.50; Make eww use display-buffer to display eww buffer Lars Ingebrigtsen
@ 2016-02-02 14:19                   ` Michael Heerdegen
  2016-02-03  2:35                     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 24+ messages in thread
From: Michael Heerdegen @ 2016-02-02 14:19 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 22244

Lars Ingebrigtsen <larsi@gnus.org> writes:

> > pop-to-buffer-same-window is the function we could use.
>
> Yeah, that seems to do the trick.  Committed and pushed.

Thanks so far.

Do we need to do the same at other positions where `switch-to-buffer' is
used?

I think it is needed at least for `eww-browse-url'.


Regards,

Michael.





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

* bug#22244: 25.0.50; Make eww use display-buffer to display eww buffer
  2016-02-02  4:55                 ` Lars Ingebrigtsen
@ 2016-02-02 15:24                   ` Mark Oteiza
  2016-02-03  1:59                     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 24+ messages in thread
From: Mark Oteiza @ 2016-02-02 15:24 UTC (permalink / raw)
  To: 22244


Lars Ingebrigtsen <larsi@gnus.org> writes:

> Michael Heerdegen <michael_heerdegen@web.de> writes:
>> I don't know the code well and would prefer if you could had a look.  I
>> dunno in which direction we want to go (tabs, some day, maybe?).
>
> Hm...  I don't quite see it.  Switching between buffers now is so...
> standard.  Would tabs be something other than buffers?

Just an idle though: something like erc's erc-switch-to-buffer could be
a step above standard buffer switching.





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

* bug#22244: 25.0.50; Make eww use display-buffer to display eww buffer
  2016-02-02 15:24                   ` Mark Oteiza
@ 2016-02-03  1:59                     ` Lars Ingebrigtsen
  2016-02-03  2:57                       ` Mark Oteiza
  0 siblings, 1 reply; 24+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-03  1:59 UTC (permalink / raw)
  To: Mark Oteiza; +Cc: 22244

Mark Oteiza <mvoteiza@udel.edu> writes:

> Just an idle though: something like erc's erc-switch-to-buffer could be
> a step above standard buffer switching.

I use ido mode, and that's as convenient, I find...

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





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

* bug#22244: 25.0.50; Make eww use display-buffer to display eww buffer
  2016-02-02 14:19                   ` Michael Heerdegen
@ 2016-02-03  2:35                     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 24+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-03  2:35 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 22244

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Do we need to do the same at other positions where `switch-to-buffer' is
> used?

I've now done so.

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





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

* bug#22244: 25.0.50; Make eww use display-buffer to display eww buffer
  2016-02-03  1:59                     ` Lars Ingebrigtsen
@ 2016-02-03  2:57                       ` Mark Oteiza
  2016-02-04  2:18                         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 24+ messages in thread
From: Mark Oteiza @ 2016-02-03  2:57 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 22244

On 03/02/16 at 12:59pm, Lars Ingebrigtsen wrote:
> Mark Oteiza <mvoteiza@udel.edu> writes:
> 
> > Just an idle though: something like erc's erc-switch-to-buffer could be
> > a step above standard buffer switching.
> 
> I use ido mode, and that's as convenient, I find...

I don't, but I was thinking more like "S but in the minibuffer". Where the
buffer names in erc are meaningful, in eww they are not so much (at
least in my case where I'm usually using clone-buffer to make more eww
buffers). So the completion candidates might be the buffer urls, titles, or
instead just showing annotations like so:

(defun eww-switch-to-buffer ()
  "Prompt for an EWW buffer to switch to."
  (interactive)
  (let ((completion-extra-properties
         '(:annotation-function
           (lambda (bufn)
             (with-current-buffer bufn
               (format " %s" (eww-current-url)))))))
    (switch-to-buffer
     (read-buffer "Switch to EWW buffer: "
                  (cl-loop for buf in (nreverse (buffer-list))
                           if (with-current-buffer buf (derived-mode-p 'eww-mode))
                           return buf)
                  t
                  (lambda (bufn)
                    (let ((buf (if (consp bufn) (cdr bufn) (get-buffer bufn))))
                      (with-current-buffer buf
                        (derived-mode-p 'eww-mode))))))))





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

* bug#22244: 25.0.50; Make eww use display-buffer to display eww buffer
  2016-02-03  2:57                       ` Mark Oteiza
@ 2016-02-04  2:18                         ` Lars Ingebrigtsen
  2016-02-04  6:31                           ` bug#22244: [PATCH] New command eww-switch-to-buffer Mark Oteiza
  0 siblings, 1 reply; 24+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-04  2:18 UTC (permalink / raw)
  To: Mark Oteiza; +Cc: 22244

Mark Oteiza <mvoteiza@udel.edu> writes:

> I don't, but I was thinking more like "S but in the minibuffer". Where the
> buffer names in erc are meaningful, in eww they are not so much (at
> least in my case where I'm usually using clone-buffer to make more eww
> buffers). So the completion candidates might be the buffer urls, titles, or
> instead just showing annotations like so:

That sounds pretty cool...  Alternatively we could give the eww buffers
better names (based on URLs or titles).  That may be a handful, though.

Could you send a patch for this new command against the trunk (including
documentation)?

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





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

* bug#22244: [PATCH] New command eww-switch-to-buffer
  2016-02-04  2:18                         ` Lars Ingebrigtsen
@ 2016-02-04  6:31                           ` Mark Oteiza
  2016-02-04  7:02                             ` Lars Ingebrigtsen
  2016-02-04 16:46                             ` Eli Zaretskii
  0 siblings, 2 replies; 24+ messages in thread
From: Mark Oteiza @ 2016-02-04  6:31 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 22244

* doc/misc/eww.texi: Document eww-switch-to-buffer and its keybinding
* etc/NEWS: Mention new command
* lisp/net/eww.el (eww-mode-map): Bind eww-switch-to-buffer to "s"
(eww-mode-map): Add menu item
(eww-switch-to-buffer): New command
---
On 04/02/16 at 01:18pm, Lars Ingebrigtsen wrote:
> Mark Oteiza <mvoteiza@udel.edu> writes:
> 
> > I don't, but I was thinking more like "S but in the minibuffer". Where the
> > buffer names in erc are meaningful, in eww they are not so much (at
> > least in my case where I'm usually using clone-buffer to make more eww
> > buffers). So the completion candidates might be the buffer urls, titles, or
> > instead just showing annotations like so:
> 
> That sounds pretty cool...  Alternatively we could give the eww buffers
> better names (based on URLs or titles).  That may be a handful, though.
> 
> Could you send a patch for this new command against the trunk (including
> documentation)?

Hopefully covered everything. "s" seemed a sensible bind.

 doc/misc/eww.texi |  6 +++++-
 etc/NEWS          |  5 +++++
 lisp/net/eww.el   | 20 ++++++++++++++++++++
 3 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi
index 0e9bedb..afb1caf 100644
--- a/doc/misc/eww.texi
+++ b/doc/misc/eww.texi
@@ -164,12 +164,16 @@ You can view stored bookmarks with @kbd{B}
 (@code{eww-list-bookmarks}).  This will open the bookmark buffer
 @file{*eww bookmarks*}.
 
+@findex eww-switch-to-buffer
 @findex eww-list-buffers
+@kindex s
 @kindex S
 @cindex Multiple Buffers
   To get summary of currently opened EWW buffers, press @kbd{S}
 (@code{eww-list-buffers}).  The @file{*eww buffers*} buffer allows you
-to quickly kill, flip through and switch to specific EWW buffer.
+to quickly kill, flip through and switch to specific EWW buffer.  To
+switch EWW buffers through a minibuffer prompt, press @kbd{s}
+(@code{eww-switch-to-buffer}).
 
 @findex eww-browse-with-external-browser
 @vindex shr-external-browser
diff --git a/etc/NEWS b/etc/NEWS
index 3150432..faf49b0 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -52,6 +52,11 @@ in these situations.
 \f
 * Changes in Specialized Modes and Packages in Emacs 25.2
 
+** eww
+
++++
+*** A new `s' command for switching to another eww buffer via the minibuffer.
+
 +++
 ** The commands that add ChangeLog entries now prefer a VCS root directory
 for the ChangeLog file, if none already exists.  Customize
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index cb23127..5a50877 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -689,6 +689,7 @@ the like."
     (define-key map "R" 'eww-readable)
     (define-key map "H" 'eww-list-histories)
     (define-key map "E" 'eww-set-character-encoding)
+    (define-key map "s" 'eww-switch-to-buffer)
     (define-key map "S" 'eww-list-buffers)
     (define-key map "F" 'eww-toggle-fonts)
     (define-key map [(meta C)] 'eww-toggle-colors)
@@ -712,6 +713,7 @@ the like."
 	["View page source" eww-view-source]
 	["Copy page URL" eww-copy-page-url t]
 	["List histories" eww-list-histories t]
+	["Switch to buffer" eww-switch-to-buffer t]
 	["List buffers" eww-list-buffers t]
 	["Add bookmark" eww-add-bookmark t]
 	["List bookmarks" eww-list-bookmarks t]
@@ -1498,6 +1500,24 @@ If CHARSET is nil then use UTF-8."
       (eww-reload nil 'utf-8)
     (eww-reload nil charset)))
 
+(defun eww-switch-to-buffer ()
+  "Prompt for an EWW buffer to display in the selected window."
+  (interactive)
+  (let ((completion-extra-properties
+         '(:annotation-function (lambda (buf)
+                                  (with-current-buffer buf
+                                    (format " %s" (eww-current-url)))))))
+    (switch-to-buffer
+     (read-buffer "Switch to EWW buffer: "
+                  (cl-loop for buf in (nreverse (buffer-list))
+                           if (with-current-buffer buf (derived-mode-p 'eww-mode))
+                           return buf)
+                  t
+                  (lambda (bufn)
+                    (with-current-buffer
+                        (if (consp bufn) (cdr bufn) (get-buffer bufn))
+                      (derived-mode-p 'eww-mode)))))))
+
 (defun eww-toggle-fonts ()
   "Toggle whether to use monospaced or font-enabled layouts."
   (interactive)
-- 
2.7.0






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

* bug#22244: [PATCH] New command eww-switch-to-buffer
  2016-02-04  6:31                           ` bug#22244: [PATCH] New command eww-switch-to-buffer Mark Oteiza
@ 2016-02-04  7:02                             ` Lars Ingebrigtsen
  2016-02-04 13:10                               ` Michael Heerdegen
  2016-02-04 16:46                             ` Eli Zaretskii
  1 sibling, 1 reply; 24+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-04  7:02 UTC (permalink / raw)
  To: Mark Oteiza; +Cc: 22244

Mark Oteiza <mvoteiza@udel.edu> writes:

> Hopefully covered everything. "s" seemed a sensible bind.

Thanks; applied to the trunk.

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





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

* bug#22244: [PATCH] New command eww-switch-to-buffer
  2016-02-04  7:02                             ` Lars Ingebrigtsen
@ 2016-02-04 13:10                               ` Michael Heerdegen
  2016-02-04 17:49                                 ` Mark Oteiza
  0 siblings, 1 reply; 24+ messages in thread
From: Michael Heerdegen @ 2016-02-04 13:10 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Mark Oteiza, 22244

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Thanks; applied to the trunk.

Could we again not use `switch-to-buffer'?


Thanks,

Michael





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

* bug#22244: [PATCH] New command eww-switch-to-buffer
  2016-02-04  6:31                           ` bug#22244: [PATCH] New command eww-switch-to-buffer Mark Oteiza
  2016-02-04  7:02                             ` Lars Ingebrigtsen
@ 2016-02-04 16:46                             ` Eli Zaretskii
  2016-02-04 17:48                               ` Mark Oteiza
  1 sibling, 1 reply; 24+ messages in thread
From: Eli Zaretskii @ 2016-02-04 16:46 UTC (permalink / raw)
  To: Mark Oteiza; +Cc: 22244, larsi

> Date: Thu, 4 Feb 2016 01:31:43 -0500
> From: Mark Oteiza <mvoteiza@udel.edu>
> Cc: 22244@debbugs.gnu.org
> 
> * doc/misc/eww.texi: Document eww-switch-to-buffer and its keybinding
> * etc/NEWS: Mention new command
> * lisp/net/eww.el (eww-mode-map): Bind eww-switch-to-buffer to "s"
> (eww-mode-map): Add menu item
> (eww-switch-to-buffer): New command

Thanks a lot for making the effort of including the documentation in
the patch.





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

* bug#22244: [PATCH] New command eww-switch-to-buffer
  2016-02-04 16:46                             ` Eli Zaretskii
@ 2016-02-04 17:48                               ` Mark Oteiza
  0 siblings, 0 replies; 24+ messages in thread
From: Mark Oteiza @ 2016-02-04 17:48 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 22244, larsi

On 04/02/16 at 06:46pm, Eli Zaretskii wrote:
> > Date: Thu, 4 Feb 2016 01:31:43 -0500
> > From: Mark Oteiza <mvoteiza@udel.edu>
> > Cc: 22244@debbugs.gnu.org
> > 
> > * doc/misc/eww.texi: Document eww-switch-to-buffer and its keybinding
> > * etc/NEWS: Mention new command
> > * lisp/net/eww.el (eww-mode-map): Bind eww-switch-to-buffer to "s"
> > (eww-mode-map): Add menu item
> > (eww-switch-to-buffer): New command
> 
> Thanks a lot for making the effort of including the documentation in
> the patch.

You're welcome





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

* bug#22244: [PATCH] New command eww-switch-to-buffer
  2016-02-04 13:10                               ` Michael Heerdegen
@ 2016-02-04 17:49                                 ` Mark Oteiza
  2016-02-04 19:09                                   ` Michael Heerdegen
  0 siblings, 1 reply; 24+ messages in thread
From: Mark Oteiza @ 2016-02-04 17:49 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 22244, Lars Ingebrigtsen

On 04/02/16 at 02:10pm, Michael Heerdegen wrote:
> Lars Ingebrigtsen <larsi@gnus.org> writes:
> 
> > Thanks; applied to the trunk.
> 
> Could we again not use `switch-to-buffer'?

Done.





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

* bug#22244: [PATCH] New command eww-switch-to-buffer
  2016-02-04 17:49                                 ` Mark Oteiza
@ 2016-02-04 19:09                                   ` Michael Heerdegen
  0 siblings, 0 replies; 24+ messages in thread
From: Michael Heerdegen @ 2016-02-04 19:09 UTC (permalink / raw)
  To: Mark Oteiza; +Cc: 22244, Lars Ingebrigtsen

Mark Oteiza <mvoteiza@udel.edu> writes:

> > > Thanks; applied to the trunk.
> > 
> > Could we again not use `switch-to-buffer'?
>
> Done.

Thanks!


Michael.





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

end of thread, other threads:[~2016-02-04 19:09 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-26 16:54 bug#22244: 25.0.50; Make eww use display-buffer to display eww buffer Michael Heerdegen
2015-12-26 17:02 ` Lars Ingebrigtsen
2015-12-26 17:29   ` Michael Heerdegen
2015-12-26 17:45     ` Lars Ingebrigtsen
2015-12-26 18:09       ` Michael Heerdegen
2015-12-26 18:19         ` Lars Ingebrigtsen
2015-12-26 23:19           ` Michael Heerdegen
2015-12-26 23:28             ` Lars Ingebrigtsen
2016-01-09  6:01               ` Michael Heerdegen
2016-02-02  4:55                 ` Lars Ingebrigtsen
2016-02-02 15:24                   ` Mark Oteiza
2016-02-03  1:59                     ` Lars Ingebrigtsen
2016-02-03  2:57                       ` Mark Oteiza
2016-02-04  2:18                         ` Lars Ingebrigtsen
2016-02-04  6:31                           ` bug#22244: [PATCH] New command eww-switch-to-buffer Mark Oteiza
2016-02-04  7:02                             ` Lars Ingebrigtsen
2016-02-04 13:10                               ` Michael Heerdegen
2016-02-04 17:49                                 ` Mark Oteiza
2016-02-04 19:09                                   ` Michael Heerdegen
2016-02-04 16:46                             ` Eli Zaretskii
2016-02-04 17:48                               ` Mark Oteiza
2016-02-02  4:58                 ` bug#22244: 25.0.50; Make eww use display-buffer to display eww buffer Lars Ingebrigtsen
2016-02-02 14:19                   ` Michael Heerdegen
2016-02-03  2:35                     ` Lars Ingebrigtsen

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