0

I'd like to use emacs more, but I'm still used to some of my previous workflows I know from most modern IDEs. What my emacs lacks most is a static list of the open buffers or files. By static I mean: As I click on one of the buffers in that list that very buffer should open in an different buffer-window, not in the one of the listing.

There's a command for listing the buffers, but I'm not happy as the buffer will be opened in the buffer-list-window. Here's an example of my previous Netbeans-Configuration:

enter image description here

(I hope I made clear what I'm looking for - I'm new to emacs,but would like to keep using it)

3
  • 2
    The command you would use after M-x list-buffers and navigate to a buffer is the letter o, which will "Select that buffer in another window, so the Buffer Menu remains visible in its window". To learn about the other commands that are supported when using list-buffers, from the *Buffer List* window, type C-h m and you will be presented with a variety of information including, but limited to common keyboard shortcuts that work within that buffer. There are other built-in buffer lists navigation tools and a plethora that can be added.
    – lawlist
    Commented Feb 4, 2019 at 17:26
  • 1
    @lawlist: Please consider providing your comment as an answer.
    – Drew
    Commented Feb 4, 2019 at 18:52
  • 1
    Emacs comes with the built-in speedbar. The context menu Speedbar->Display offers also the Buffers display. That is almost what you want. I post this because as a comment because it lists the buffers in an extra frame not in an extra window. There is also sr-speedbar.el which shows the speedbar in an extra window. But, I do not know whether that package still works with recent Emacs versions.
    – Tobias
    Commented Feb 4, 2019 at 21:22

3 Answers 3

2

The picture you posted confuses the question somewhat. The picture shows a file selector. Files and buffers are different in Emacs. When you open a file, you visit it. That is, the file contents are read into Emacs and the file remains available to other processes. The file contents and the buffer are not guaranteed to be the same at all points in time. Some modern IDEs conflate loading/saving which can obscure how processes actually happen (looking at you PyCharm). Because there isn't always a direct comparison between Emacs and IDEs, I will address both file browsers and a static file buffer list here so that you can decide what works best for you. You may find Emacs offers a better workflow that your previous IDE couldn't.

File browser

For a file browser, my preference is neotree:

enter image description here

A basic setup requires:

(package-initialize)
(require 'package)
(require 'neotree)

To toggle it, I like to use (global-set-key (kbd "C-x M-f") 'neotree-toggle).

Static buffer list

I don't know of a persistent buffer list package that currently exists. It could surely be created, but it seems like most Emacs users are happy with the default list-buffers or something like helm-buffers-list.

However, here's a rough way to get a persistent buffer list:

  1. Create a split using C-x 3
  2. Open buffer-menu
  3. Select a buffer with o (Buffer-menu-other-window)

This will open the selected buffer in the other window.

enter image description here

You'll notice that <RET> opens the buffer in the current window. You could rebind Buffer-menu-other-window to <RET> with:

(define-key Buffer-menu-mode-map (kbd "<return>") 'Buffer-menu-other-window)

Note that this will work best with two windows open. Specifying a specific window among several is a non-trivial problem that has been addressed elsewhere.

2
  • 1
    Exactly what I needed. Thank you for all that information
    – Qohelet
    Commented Feb 5, 2019 at 12:06
  • There is also tabbar-mode. Commented Feb 5, 2019 at 13:59
2

Something similar to that screenshot is provided by treemacs

From the README:

Treemacs is a file and project explorer similar to NeoTree or vim’s NerdTree, but largely inspired by the Project Explorer in Eclipse. It shows the file system outlines of your projects in a simple tree layout allowing quick navigation and exploration, while also possessing basic file management utilities.

1

The original poster has expressed dissatisfaction with the way in which the *Buffer List* selects/displays a target buffer; e.g., by replacing the *Buffer List* buffer with the target buffer.

The command one would use after M-x list-buffers (aka C-x C-b) and navigating to a desired buffer in the list is the letter o, which will "Select that buffer in another window, so the Buffer Menu remains visible in its window".

To learn about the other commands that are supported when using list-buffers, from the *Buffer List* window, type C-h m (aka M-x describe-mode) to see a variety of information including, but limited to common keyboard shortcuts that work within that buffer.

There are other built-in buffer list navigation tools and a plethora that can be added.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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