Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

eww - multiple buffers

179 views
Skip to first unread message

Andreas Röhler

unread,
Jun 9, 2016, 3:23:25 AM6/9/16
to Help Gnu Emacs mailing list
Hi,

eww comes with a command "eww-list-buffers" - however, seems to exist
only one hard-coded "*eww*" buffer at time.

Is there a way to open different "*eww MY FYLE*" buffers in parallel?

Thanks,

Andreas


Tassilo Horn

unread,
Jun 9, 2016, 6:40:04 AM6/9/16
to Andreas Röhler, Help Gnu Emacs mailing list
Andreas Röhler <andreas...@easy-emacs.de> writes:

Hi Andreas,

> eww comes with a command "eww-list-buffers" - however, seems to exist
> only one hard-coded "*eww*" buffer at time.
>
> Is there a way to open different "*eww MY FYLE*" buffers in parallel?

Well, there's

,----[ C-h f eww-browse-url RET ]
| eww-browse-url is an autoloaded compiled Lisp function in ‘eww.el’.
|
| (eww-browse-url URL &optional NEW-WINDOW)
|
| Not documented.
`----

which can open a new buffer. And that's used by

,----[ C-h f eww-follow-link RET ]
| eww-follow-link is an interactive compiled Lisp function in ‘eww.el’.
|
| (eww-follow-link &optional EXTERNAL MOUSE-EVENT)
|
| Browse the URL under point.
| If EXTERNAL is single prefix, browse the URL using ‘shr-external-browser’.
| If EXTERNAL is double prefix, browse in new buffer.
`----

So you'd usually start with one eww buffer and then follow links with
`C-u C-u RET' which would create a new buffer for the referenced link.

But you're right. It seems quite strange to me that you can't call
`eww' itself with a prefix arg to make it open a new buffer...

HTH,
Tassilo

Rasmus

unread,
Jun 9, 2016, 6:55:28 AM6/9/16
to help-gn...@gnu.org
Another thing, in Fx you can middle click to open in a new tab. It might
make sense to have something similar. Either with the mouse button or
C-RET for new tab and RET for current tab. It should be pretty easy to
add...

Rasmus

--
Human: An animal that complicates things more than strictly necessary


Andreas Röhler

unread,
Jun 9, 2016, 10:20:44 AM6/9/16
to Tassilo Horn, Help Gnu Emacs mailing list


On 09.06.2016 12:39, Tassilo Horn wrote:
> Andreas Röhler <andreas...@easy-emacs.de> writes:
>
> Hi Andreas,
>
>> eww comes with a command "eww-list-buffers" - however, seems to exist
>> only one hard-coded "*eww*" buffer at time.
>>
>> Is there a way to open different "*eww MY FYLE*" buffers in parallel?
> Well, there's
>
> ,----[ C-h f eww-browse-url RET ]
> | eww-browse-url is an autoloaded compiled Lisp function in ‘eww.el’.
> |
> | (eww-browse-url URL &optional NEW-WINDOW)
> |
> | Not documented.
> `----
>
> which can open a new buffer. And that's used by
>
> ,----[ C-h f eww-follow-link RET ]
> | eww-follow-link is an interactive compiled Lisp function in ‘eww.el’.
> |
> | (eww-follow-link &optional EXTERNAL MOUSE-EVENT)
> |
> | Browse the URL under point.
> | If EXTERNAL is single prefix, browse the URL using ‘shr-external-browser’.
> | If EXTERNAL is double prefix, browse in new buffer.
> `----
>
> So you'd usually start with one eww buffer and then follow links with
> `C-u C-u RET' which would create a new buffer for the referenced link.
>
> But you're right. It seems quite strange to me that you can't call
> `eww' itself with a prefix arg to make it open a new buffer...
>
> HTH,
> Tassilo

Hmm, eww-browse-url isn't designed as command.

When looking at, it seems to use the very same buffer too.

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

;;;

Maybe worth a feature request?

Thanks all,

Andreas


Kaushal Modi

unread,
Jun 9, 2016, 10:32:17 AM6/9/16
to Andreas Röhler, Tassilo Horn, Help Gnu Emacs mailing list
I have been using this snippet from ergoemacs,org and it has been working
great for me:

;; Auto-rename new eww buffers
;; http://ergoemacs.org/emacs/emacs_eww_web_browser.html
(defun xah-rename-eww-hook ()
"Rename eww browser's buffer so sites open in new page."
(rename-buffer "eww" t))
(add-hook 'eww-mode-hook #'xah-rename-eww-hook)
> --

--
Kaushal Modi

Michael Heerdegen

unread,
Jun 10, 2016, 10:57:17 AM6/10/16
to help-gn...@gnu.org
Andreas Röhler <andreas...@easy-emacs.de> writes:

> When looking at, it seems to use the very same buffer too.
>
> (defun eww-browse-url (url &optional new-window)
> (when new-window
> (pop-to-buffer-same-window (generate-new-buffer "*eww*"))
> (eww-mode))

No, it doesn't, see the doc of `generate-new-buffer'.


Michael.


Andreas Röhler

unread,
Jun 13, 2016, 4:17:54 AM6/13/16
to help-gn...@gnu.org
Right, thanks. So that way it numerates buffers given C-u:

(defun ar-eww (&optional new-buffer)
(interactive "P")
(let ((erg (read-from-minibuffer "Url: ")))
(eww-browse-url erg new-buffer)))



Andreas Röhler

unread,
Jun 13, 2016, 4:51:42 AM6/13/16
to help-gn...@gnu.org
Here is a eww-browse-url based hack, displaying the initials of visited
URL in buffer-name


(defun ar--compose-buffer-name-initials (liste)
(let (erg)
(dolist (ele liste)
(unless (string= "" ele)
(setq erg (concat erg (char-to-string (aref ele 0))))))
erg))

(defun ar-eww-browse-url (url &optional new-window)
(when new-window
(if (stringp new-window)
(set-buffer (get-buffer-create (concat "*eww " new-window "*")))
(pop-to-buffer-same-window (generate-new-buffer "*eww*")))
(eww-mode))
(eww url))

(defun ar-eww (&optional new-buffer)
(interactive "P")
(let* ((erg (read-from-minibuffer "Url: "))
(acronym (ar--compose-buffer-name-initials (split-string
(substring erg (ignore-errors (1+ (string-match "www\\." erg))))
"[^a-z]"))))
(if (eq 4 (prefix-numeric-value new-buffer))
(ar-eww-browse-url erg acronym)
(ar-eww-browse-url erg))))

0 new messages