3

Say I open a new buffer by eww-browse-url "emacs.stackexchange.com". Then, I navigate for a while, so the eww-se buffer updates its name to the current url. Same history for another buffer eww-ew, lets say by doing eww-browse-url "emacswiki.org".

Then, I switch to another different buffer, loosing the pointer to the eww buffers, so that I don't know how to refer to them programmatically.

I wonder if there is a way to switch back to a given eww buffer (eww-se, for example), without knowing its current name, or a way to check if this buffer is already open. Obviously, I don't want to go visually through the list of all open buffers. Maybe labeling the buffer or something ...

So, how can I refer to an already eww open buffer without knowing its current name ?

  • Are you using eww as it is or have you added customization to rename its buffer? For me, eww buffer is always named *eww*. – Kaushal Modi Nov 17 '14 at 16:04
  • Sure, I am renaming the buffer. My question is related to whether there exist some other way to refer to a buffer other that its name. – csantosb Nov 17 '14 at 16:16
  • @csantosb Other than explicitly holding a reference to the buffer object somewhere, there is no way to refer to a buffer. If there was, you wouldn't need names anymore… – lunaryorn Dec 18 '14 at 7:27
1

You can iterate through (buffer-list) to find the buffer that interests you. For example, the following expression returns the list of buffers in Eww mode :

(cl-remove :test-not (lambda (buffer)
                       (with-current-buffer buffer
                         (eq major-mode 'eww-mode)))
  (buffer-list))

If you want to keep track of a specific buffer after it's created, store it in a variable.

-1

If you are using IBuffer you can filter by major mode.

Within IBuffer press /m and then enter eww-mode to only see your eww buffers.

  • 1
    I believe the question is about a way to "refer to them programmatically". Consider updating your answer to address that. – Constantine Nov 18 '14 at 4:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.