help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Feeling lost without tabs


From: Robert Thorpe
Subject: Re: Feeling lost without tabs
Date: Tue, 22 Jul 2014 00:57:37 +0100

Emanuel Berg <embe8573@student.uu.se> writes:

> Dan Espen <despen@verizon.net> writes:
>
>> I just feel the best one should be the default.
>> Could be ibuffer or some other xbuffer is the best,
>> but electric is better than the default (IMO).
>
> Perhaps it would make sense to merge some or many of
> those projects if they are so similar.

There's much more reuse than you think.  The normal Emacs buffer list,
the one tied to C-x C-b is 'list-buffers'.

Here is the code for list-buffers with the docstring removed:
(defun list-buffers (&optional arg)
  (interactive "P")
  (display-buffer (list-buffers-noselect arg)))

Here is the code for buffer-menu with the docstring removed:
(defun buffer-menu (&optional arg)
  (interactive "P")
  (switch-to-buffer (list-buffers-noselect arg))
  (message
   "Commands: d, s, x, u; f, o, 1, 2, m, v; ~, %%; q to quit; ? for
   help."))

The one I use is buffer-menu-other-window:
(defun buffer-menu-other-window (&optional arg)
  (interactive "P")
  (switch-to-buffer-other-window (list-buffers-noselect arg))
  (message
   "Commands: d, s, x, u; f, o, 1, 2, m, v; ~, %%; q to quit; ? for
   help."))

So, all of them use the same underlying function:
'list-buffers-noselect', also all are in the same file: buff-menu.el.
Once you're in the menu buffer they all behave exactly the same.

The only major difference with electric-buffer-list is the keymap.  The
buffer menu is made by calling list-buffer-noselect as usual then
changing the keymaps.  Electric-buffer-menu-mode is derived from
Buffer-menu-mode using ~300 lines of code in ebuff-menu.el.

There is another buffer menu packaged with Emacs that's entirely
different: ibuffer.  I understand a lot of people use that, I tried to
once but I've got too used to the default.

BR,
Robert Thorpe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]