4

My (simplified) setup: one frame for twittering-mode and another for w3m, among others, all inside tmux.

While in the twittering-mode frame, C-m on a link does one of two things. Sometimes, the link loads in the w3m frame. Other times, the twittering-mode frame switches to a w3m buffer, so I have to type C-x b C-m to return to twittering-mode after each link I open.

Is there any way to guarantee that the first behavior occurs? It makes browsing Twitter for articles to read very convenient. (Load several, read one, type B to read another.)

I have tried playing with display-buffer-alist, as suggested here, here, and here, all to no avail.

((".w3m.*"
  (display-buffer-reuse-window)
  (reusable-frames . "visible")))

Is this not possible?

  • I have found the following documentation page to be very helpful when trying to customize how certain buffers are displayed: gnu.org/software/emacs/manual/html_node/elisp/… The bottom of the page has some good examples. – lawlist Dec 30 '14 at 17:23
  • Clarifying question: when you say "frames," do you mean Emacs's conception of a frame, or its conception of a window? – Dan Dec 30 '14 at 17:40
  • Just in case you didn't notice, there's a typo in your alist: I presume you want display-buffer-reuse-window, not ...-indow. – Dan Dec 30 '14 at 17:44
  • @Dan, an Emacs frame. I have several open. (Typo corrected.) – Steven Edwards Dec 30 '14 at 19:10
  • I just used set-frame-name on the w3m frame. If I could reference that frame in the reusable-frames alist, this might work. How would I do that? – Steven Edwards Dec 30 '14 at 19:42
0

The hacky solution is two parts.

First, add this somewhere that'll be evaluated:

(add-to-list display-buffer-alist
    (".w3m.*" (display-buffer-in-previous-window)
              (inhibit-same-window . t)
              (reusable-windows . t)))

Second, make sure that no *w3m<#>* buffers have been seen in your current frame.

(frame-parameters (selected-frame))

...if you see a w3m buffer in buffer-list, you will need to open a new frame.

As long as you never use your twittering-mode frame to visit a w3m buffer, C-m on a link will always load in a separate frame.

  • A better solution, preferably one that would remove w3m buffers from the frame's buddy-list parameter, would be welcome. – Steven Edwards Dec 30 '14 at 21:30
  • Are you calling w3m-view-this-url when selecting a link? If so, then modifying w3m-view-this-url-1 seems like the most appropriate custom tailored solution. Here is a link to an elaborate example of how to select a specific frame to display a certain buffer: stackoverflow.com/a/18371427/2112489 – lawlist Dec 30 '14 at 22:04

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.