[Top][All Lists]

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

Buffer Navigation

From: Shug Boabby
Subject: Buffer Navigation
Date: 18 Oct 2005 19:18:45 -0700
User-agent: G2/0.2

Hi everyone,

The CVS GNU Emacs has introduced a neat way to navigate buffers with
(C-x left/right), reproducible with the code at the end of this message
for older Emacs versions.

However, this navigation goes through *all* buffers, not just the ones
I am editing/reading. Does anyone know of a way I could set up a
similar navigation system that only navigates through *scratch* and
files I have opened myself, i.e. not some temporary buffer a function
or mode has created or opened.

One possible solution I have thought of (*very* roundabout, I'm not
proud of it) would be to create a wrapper function for opening/closing
files which adds/removes the name of the file to/from a list (which is
ordered in some way, such as alphabetically or chronological). then i
bind C-x C-f and C-x k to these wrappers. then navigate only the
buffers in that list.

Please let me know if anyone has a better solution!

(if (< emacs-major-version 22)
      (defalias 'switch-to-next-buffer 'bury-buffer)
      (defun switch-to-previous-buffer ()
        "Switches to previous buffer"
        (switch-to-buffer (nth (- (length (buffer-list)) 1)

(if (< emacs-major-version 22)          ; Use C-x <left> and C-x
    (progn                              ; for buffer navigation
      (global-set-key [(control x) (left)] 'switch-to-previous-buffer)
      (global-set-key [(control x) (right)] 'switch-to-next-buffer)))

reply via email to

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