4

I have consulted this resource: http://www.emacswiki.org/cgi-bin/wiki/ControlTABbufferCycling, and tried buffer-stack.el, which is useful, but I find the user experience slightly awkward without being able to visualize other buffers further down the stack. It is also outdated (2002), so I wonder if there is an improved version. Most other links on that page are broken or very old as well.

I am seeking a ctrl +tab stack-based buffer cycling, similar to the way alt + tab works with windows. Ideally it would include an indicator for my current location in the buffer list. I don't think my desired feature is too specific, since many IDE's already have this feature.

I would imagine a tool that is similar to how buffer cycling works in Eclipse. Pick below:

enter image description here

I have explored other options, but nothing seems to mimic the functionality that has already been implemented across other IDE's like Eclipse.

I am aware of ido-mode, although it does not suit my needs for rapid stack-based switching.

I am also aware of other non-stack solutions like the one below:

(global-set-key [C-tab] 'next-buffer)
(global-set-key [C-S-iso-lefttab] 'previous-buffer);Linux
(global-set-key [C-S-tab] 'previous-buffer);Windows/Linux

but I prefer a stack-based switch.

Any suggestions? Is this feature available somewhere, or even in development? Especially with an index indicator, as shown in Eclipse above. That would be awesome - I imagine it would be as a pop-up or in the mini-buffer.

modulitos
  • 14,737
  • 16
  • 67
  • 110
  • Is tabbar.el something you might be interested in (if you don't have too many open buffers)? http://stackoverflow.com/questions/3811126/do-you-use-emacs-tabbar I also organize my open buffers by frame, which is a custom solution -- i.e., a hybrid of Tabbar and Frame-Bufs. Tabbar is ideal for small projects, but not a ton of open buffers. – lawlist Jun 19 '14 at 00:38
  • Here are a few additional options: `M-x bs-show`; `C-Down-Mouse-1`; `M-x list-buffers`; `M-x speedbar`. See: http://www.gnu.org/software/emacs/manual/html_node/emacs/Buffer-Menus.html and https://www.gnu.org/software/emacs/manual/html_node/emacs/Speedbar.html It shouldn't be that difficult to combine those built-in options with Tabbar and/or Frame-Bufs ( https://github.com/alpaker/Frame-Bufs ) – lawlist Jun 19 '14 at 01:46

3 Answers3

1

elscreen does a little bit what you seek: http://wikemacs.org/index.php/Elscreen
You have to create screens (tabs) on demand and you can call M-x elscreen-select-and-goto to select a screen from a list in the minibuffer.

Fortunately it is already coupled with helm: helm-elscreen. That gives a good looking and handy choice list:

  • fuzzy matching
  • scrollable list
  • choose actions (press TAB and choose "Change screen/Delete/Only").

However, you still have to create a screen manually (but I like it because I can organize sort of work areas -it is possible to isolate buffers per screen. A tab per buffer would be way too much + emacs creates many internal buffers so they can get on the way).

helm: https://github.com/emacs-helm/helm/wiki

ps: helm-buffers-list is close to the interface you want for switching buffers, without tabs…

enter image description here

Ehvince
  • 17,274
  • 7
  • 58
  • 79
1

Try out this snippet:

(defun ctrltab ()
  "List buffers and give it focus"
  (interactive)
  (if (string= "*Buffer List*" (buffer-name))
      ;; Go to next line. Go to first line if end is reached.
      (progn
        (revert-buffer)
        (if (>= (line-number-at-pos)
                (count-lines (point-min) (point-max)))
            (goto-char (point-min))
          (forward-line)))
    (list-buffers)
    (switch-to-buffer "*Buffer List*")
    (delete-other-windows)
    (forward-line)))

(global-set-key [C-tab] 'ctrltab)

It's often inferior to ido-switch-buffer, but it does its job anyway.

abo-abo
  • 20,038
  • 3
  • 50
  • 71
0

I have been maintaining a personal copy of buffer-stack. It works really well -- to the extent that I haven't thought about it for years until recently when I had to fix a legacy workaround which caused a bug.

I will put my fork up on github when time allows. I'm not averse to adding some sort of index display although it does not matter much in my use-case -- helm is great to choose from a list of buffers.

event_jr
  • 17,467
  • 4
  • 47
  • 62