Pages

Showing posts with label buffers. Show all posts
Showing posts with label buffers. Show all posts

Wednesday, October 12, 2011

ido-mode and virtual buffers

Every now and again you come across something in Emacs and slap your forehead and say "why didn't I notice that before". ido-mode is one, but the setting ido-use-virtual-buffers really makes it. The concept is simple : ido-mode remembers all your past buffers so all you need to do is "C-x b" (ido-switch-buffer) and start to type the filename and ido will complete to it having remembered it from previous sessions. No need to use C-x C-f and possibly the ido find facility any more - just type the mainpart of the filename or part of it. Incredible cool time saver and very very useful.

From the Manual

ido-use-virtual-buffers is a variable defined in `ido.el'.
Its value is t
Original value was nil

Documentation:
If non-nil, refer to past buffers as well as existing ones.
Essentially it works as follows: Say you are visiting a file and
the buffer gets cleaned up by mignight.el. Later, you want to
switch to that buffer, but find it's no longer open. With
virtual buffers enabled, the buffer name stays in the buffer
list (using the `ido-virtual' face, and always at the end), and if
you select it, it opens the file back up again. This allows you
to think less about whether recently opened files are still open
or not. Most of the time you can quit Emacs, restart, and then
switch to a file buffer that was previously open as if it still
were.
This feature relies upon the `recentf' package, which will be
enabled if this variable is configured to a non-nil value.


my ido settings are currently:-

 '(ido-create-new-buffer (quote never))
'(ido-enable-flex-matching t)
'(ido-enable-last-directory-history nil)
'(ido-enable-regexp nil)
'(ido-max-directory-size 300000)
'(ido-max-file-prompt-width 0.1)
'(ido-use-filename-at-point (quote guess))
'(ido-use-url-at-point t)
'(ido-use-virtual-buffers t)

Thursday, January 15, 2009

ibuffers - always something new.

One of the wonderful things with using such a huge and rich environment as Emacs (yes, an envorinment!) is that there is always something new to learn or to use.

Today I happened to wander over to Xah Lee's pages and discovered something called ibuffers. Wonderful interface to the often huge amounts of buffers one might have open in emacs at any one time. And to make it the default list-buffers C-x C-b commans merely define an alias for it

(defalias 'list-buffers 'ibuffer)

You can stack filters based on mode, mark buffers, operate on buffers etc. This is combination with my default C-x b command ido-switch-buffer makes for some powerful uber-geek buffer manipulation and selection.

Xah Lee is an interesting character. My advice is hear him out - he knows emacs back to front but can often appear somewhat reactionary and sharp in the face of criticism from some of the old school emacs users who, to be fair, do not take kindly to young guns criticising Emacs and the design decisions they have taken to get it where it is today. Personally I do believe that the "out of the box" Emacs could and should have a lot more user friendly defaults - the seasoned users that this offends should be more than able to reconfigure it to how they like it. Heresy I know. And thank god burning at the stake is now outlawed ....