2

xemacs has a nicely organized Buffers entry in its built-in menu. As you can see from the snapshot, it's sorted alphabetically and grouped by modes:

xemacs buffers menu

I can't find how to make emacs do the same. menu-bar.el provides a very rudimentary recent 10 entries listing. I looked at menu-bar-update-buffers and I don't see how I could adjust things on the user-side, short of rewriting that function. Unfortunately I don't know lisp.

Do you know of anybody implementing an alternative version?

I'm aware of C-left-mouse-click mouse-buffer-menu - which is much better (does grouping and sorting), but requires more steps to get to the right buffer when grouped. And when forced to not group (via large setting for mouse-buffer-menu-mode-mult), it throws them all into one pile.

I'm aware of ibuffer and its extensions (and set it to C-x C-b), which is even better and more customizable - but I can't see how I could inject its listing into the menu bar. Other than going through Buffers -> *IBuffer*. Is there way to replace that entry, so that the Buffers menu entry will take me directly to IBuffer listing?

  • 1
    Have a look at the variables: buffers-menu-max-size; buffers-menu-buffer-name-length; buffers-menu-show-directories; buffers-menu-show-status; list-buffers-directory; ... To read the doc-string, type C-h v or M-x describe-variable. – lawlist Aug 22 '18 at 1:59
  • 1
    For the mouse version, have a look at the variables: mouse-buffer-menu-maxlen; mouse-buffer-menu-mode-mult; mouse-buffer-menu-mode-groups ... – lawlist Aug 22 '18 at 2:05
  • 2
    I have never used Xemacs, but as long as the code that interests you is written in Lisp, there is probably no reason we cannot just make it work with a current version of Emacs. Do you have a version number of Xemacs and/or a link to the source code that you have fallen in love with so that we can take a peak and see if the buffer menu listings is easily portable? – lawlist Aug 22 '18 at 2:53
  • 2
    Here is a first draft of an attempt to port the Xemacs buffer menu-bar functionality: gist.github.com/lawlist/651685e64bc4d471def7c87e0ef46a65 . I have not yet spent any time making complex-buffers-menu-p compatible; and, I am still unfamiliar with all of the possible settings. – lawlist Aug 23 '18 at 0:41
  • 1
    Let us assume that Emacs has created a folder called .emacs.d inside your HOME directory and we will refer to it as "~/.emacs.d". Now, let us suppose that we want to create a directory for beta testing Lisp libraries -- to that end, we will create the folder beta-testing inside the ~/.emacs.d directory, and the path to that new directory that we just crated will be ~/.emacs.d/beta-testing. Now, let us visit the Gist on the internet and we see a button "Download ZIP" and we go for it and download the zipped archive to a place such as our Desktop or other location of your choice. ... – lawlist Aug 23 '18 at 2:25
3

REPOSITORY:  https://github.com/lawlist/buffer-menu

CLONE REPO:  git clone https://github.com/lawlist/buffer-menu.git

The porting of the Xemacs buffer-menu features to Emacs 26 resulted in the creation of a library consisting of 600+ lines of code. Approximately 99.9 percent of the code is straight from Xemacs, with a few modifications by @lawlist where particular Lisp functions did not exist or they are somewhat different in Emacs 26. The general format for creating a menu in Emacs 26 is a little different than in Xemacs. Installation instructions are contained in the repository. Here are some screenshots:

https://www.lawlist.com/images/buffer_menu_a.png

https://www.lawlist.com/images/buffer_menu_b.png

https://www.lawlist.com/images/buffer_menu_c.png

https://www.lawlist.com/images/buffer_menu_d.png

  • Thank you very much for taking so much of your time to port this xemacs feature to emacs, @lawlist! It feels great to have this feature in emacs now! – stason Sep 3 '18 at 16:42

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.