Emacs Sidebars

↩ blog

← Previous: A life-changing keyboard tweak → Next: Keyboard machinations with Kmonad

<2021-07-10T05:11:07+0530>

So I wanted an overview of definitions in the current buffer, and set about evaluating the options I was suggested.

speedbar

What I like -
✔️ Displays files and definitions in each file.
✔️ Hides package prefixes in Elisp code
✔️ Automatically displays outline of buffer in current window (i.e. follows the current window)

What I don't -
❌ Makes a new frame instead of a side window.
❌ Very dated-looking icons

wgreenhouse: yeah, it's very late-90s Visual Studio

sr-speedbar

What I like -
✔️ Makes a side window
✔️ Displays files and definitions in each file.
✔️ Automatically displays outline of buffer in current window (i.e. follows the current window)
✔️ [Elisp buffers] Hides package prefixes in outline

What I don't -
❌ MELPA's version is from 2016 (!!!); has some bugs, e.g. error when running sr-speedbar, and erroneous code to detect if it is active (haven't tested with emacs -q, although I'm not sure that will affect it)
❌ Very dated-looking icons, same as speedbar

Other characteristics -

  1. identical to speedbar in almost all aspects

treemacs

dale‎: treemacs is probably closer to the Sublime experience. Let me know if you figure out how to… use it.
dale‎: I have it. I turn it on sometimes. Files get displayed, it looks pretty. Things usually go downhill from there.

dale: I don't know why everyone wants to have "roots" and "projects". It's irritating.

What I like -
✔️ Makes a side window
✔️ Pretty, modern-looking icons

What I don't -
❌ [Elisp buffers] Does not hide package prefixes
❌ Following the current window is…complicated.

  • treemacs-follow-mode follows the file visited by the current buffer, but I want Treemacs to display the files in the directory of the current window!
  • treemacs-tag-follow-mode automatically displays tags of the open file, but only if it's in a subdirectory of the path of the "default workspace"
  • I made a comment about this to bring it to the attention of the author.

Other characteristics -

  1. Default left-click action is to place point on an item. This can be changed with e.g. -
(use-package treemacs
  :bind (:map treemacs-mode-map
  ([mouse-1] . #'treemacs-single-click-expand-action)))

imenu-list

What I like -
✔️ Makes a window
✔️ Highlights items to indicate where you are in the buffer
✔️ Automatically displays outline of buffer in current window (i.e. follows the current window)
✔️ Does not use icons at all. I find this more Emacs-y, like Dired.
✔️ Nice colors - gives you an indication of heading depth in Org buffers (although it's different from the heading colors of the Org buffer itself)

What I don't -
❌ Window is not a "Side Window", in Emacs terminology - it can be removed via delete-other-windows.

  • dale pointed out this hack to make imenu-list run in a side window; I haven't tried it yet.

Other characteristics -

  1. [Org mode buffers] Displays headings which can be folded. The depth of headings displayed (2 by default) can be changed with org-imenu-depth.

side-hustle

What I like -
✔️ Makes a side window

  • But…it can be deleted with delete-other-windows? 🤔

✔️ Funny name
✔️ Highlights items to indicate where you are in the buffer
✔️ Does not use icons at all. I find this more Emacs-y, like Dired.

What I don't -
❌ Does not follow the file visited in the current window, you have to run side-hustle-toggle each time you switch buffers.
❌ [Elisp buffers] Does not hide package prefixes
❌ Colors are all the same; uses indentation to compensate

Other characteristics -

  1. [Org mode buffers] Displays headings which can be folded. The depth of headings displayed (2 by default) can be changed with org-imenu-depth.

Epilogue

I went with imenu-list for the moment. As and when Treemacs implements the sort of follow-behavior I want, I may consider moving to it.

Know some more sidebar solutions? Want to share your experiences? Drop me a line!