unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Shug Boabby" <Shug.Boabby@gmail.com>
Subject: Buffer Navigation
Date: 18 Oct 2005 19:18:45 -0700	[thread overview]
Message-ID: <1129688325.343746.200730@g49g2000cwa.googlegroups.com> (raw)

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)
    (progn
      (defalias 'switch-to-next-buffer 'bury-buffer)
      (defun switch-to-previous-buffer ()
        "Switches to previous buffer"
        (interactive)
        (switch-to-buffer (nth (- (length (buffer-list)) 1)
(buffer-list))))))

(if (< emacs-major-version 22)          ; Use C-x <left> and C-x
<right>
    (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	other threads:[~2005-10-19  2:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-19  2:18 Shug Boabby [this message]
2005-10-19  2:28 ` Buffer Navigation Drew Adams
     [not found] ` <mailman.11819.1129688923.20277.help-gnu-emacs@gnu.org>
2005-10-19  2:38   ` Shug Boabby
2005-10-19  3:35     ` Drew Adams
2005-10-19  3:01   ` Shug Boabby
2005-10-19  3:35     ` Drew Adams
2005-10-19 22:54     ` Thien-Thi Nguyen
2005-10-20 22:43       ` Shug Boabby
2005-10-21 17:01         ` Kevin Rodgers
     [not found]         ` <mailman.12151.1129914597.20277.help-gnu-emacs@gnu.org>
2005-10-23 19:54           ` Shug Boabby

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1129688325.343746.200730@g49g2000cwa.googlegroups.com \
    --to=shug.boabby@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).