Discussion:
configure eww to open url in new window
(too old to reply)
Travis Zhang
2019-11-30 20:35:03 UTC
Permalink
When looking up a symbol in common lisp hyperspec with the shortcut c-c
c-d h (see info -n "(slime)Documentation") I want eww to open a new
window instead using the one currently occupied by slime. Any ideas
how to configure this?
paul wallich
2019-12-02 17:26:51 UTC
Permalink
Post by Travis Zhang
When looking up a symbol in common lisp hyperspec with the shortcut c-c
c-d h (see info -n "(slime)Documentation") I want eww to open a new
window instead using the one currently occupied by slime. Any ideas
how to configure this?
Do you mean where should you change the code from "eww" to
"eww-open-in-new-buffer" ?
Travis Zhang
2019-12-03 10:58:02 UTC
Permalink
I have set the option "browse-url-browser-function" to "eww-browse-url".
"C-c C-d h" opens in a new buffer but same window.
But i want it to open a new window instead using the same window
slime occupies. I guess i would have to
create a function for "browse-url-browser-function".
Madhu
2019-12-04 02:51:27 UTC
Permalink
Post by Travis Zhang
I have set the option "browse-url-browser-function" to "eww-browse-url".
"C-c C-d h" opens in a new buffer but same window.
But i want it to open a new window instead using the same window
slime occupies. I guess i would have to
create a function for "browse-url-browser-function".
I don't normally use eww but what you want is built into it the
browse-url design. I see that eww-browse-url takes an optional prefix
argument to open the url in a new buffer, so it is compliant/

Before calling browse-url just supply a prefix arument. C-u M-x
browse-url - and if with your b-u-b-f eww will open up the specified url
a new buffer instead of the *eww* buffer.

If you *always* want you could use a defadvice to define an around
advice on eww-browse-url which binds current-prefix-arg t around
ad-do-it

PS Please remember use the solidly well-designed defadvice API. Plesse
do NOT use the utterly RETARDED-CROCK-DESIGNED add-advice or
add-function APIs which are now unfortunately built into elisp which are
designed to make it utterly impossible to remove the the added functions
or closures especially when they are added locally
Madhu
2019-12-04 02:55:05 UTC
Permalink
Post by Madhu
If you *always* want you could use a defadvice to define an around
advice on eww-browse-url which binds current-prefix-arg t around
ad-do-it
Sorry I got carried away. See C-h v browse-url-new-window-flag
for this case.
Travis Zhang
2019-12-05 11:35:20 UTC
Permalink
Post by Madhu
[...]
Sorry I got carried away. See C-h v browse-url-new-window-flag
for this case.
Sounds like a promising option. But doesn't work for me as
the name of this option suggests. Perhaps I should mention I'm using
emacs 26.1 and slime 2.24.

But it works with a tiny adjustment to the eww-browse-url function
(in eww.el, replace pop-to-buffer-same-window with pop-to-buffer):

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

As mentioned before
browse-url-browser-function is set to eww-browse-url
browse-url-new-window-flag is set to t.

Now the hyperspec is opened with C-c C-d h in a new (emacs) window,
slime and hyperspec side by side.

Thank you for the hint.

Loading...