[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: This code won't match buffer names. Why not?
From: |
Xah Lee |
Subject: |
Re: This code won't match buffer names. Why not? |
Date: |
Fri, 21 Aug 2009 19:50:25 -0700 (PDT) |
User-agent: |
G2/1.0 |
On Aug 21, 5:31 pm, Chris Seberino <cseber...@gmail.com> wrote:
> When I cycle through buffers, I'd like to skip *scratch*, *Messages*
> and *Whitespace Errors* buffers.
>
> I wrote following code to skip one more buffer if I'm sitting in
> either of those 3.
>
> However, it never matches those buffers. Why not?
>
> (BTW, the (end-kbd-macro) is just a dummy function since "if" needs an
> "else" command.
> Is there a better dummy command I can add there?)
>
> ; Sets F10 to execute a function that moves to another buffer.
> (global-set-key [f10] (lambda () (interactive)
> (next-buffer)
> (if (equal (current-buffer)
> "*scratch*")
> (next-buffer)
> (end-kbd-macro))
> (if (equal (current-buffer)
> "*Messages*")
> (next-buffer)
> (end-kbd-macro))
> (if (equal (current-buffer)
> "*Whitespace Errors*")
> (next-buffer)
> (end-kbd-macro))))
Wee, the code to skip emacs buffers is in ergoemacs here:
http://code.google.com/p/ergoemacs/
by default it's Ctrl + Page up/down is the shortcut, similar to
Firefox et al for switching tabs.
With shift key down, it cycle among emacs's buffers.
here's the relevant code:
(defun next-user-buffer ()
"Switch to the next user buffer.
User buffers are those whose name does not start with *."
(interactive)
(next-buffer)
(let ((i 0))
(while (and (string-match "^*" (buffer-name)) (< i 50))
(setq i (1+ i)) (next-buffer) )))
Xah
∑ http://xahlee.org/
☄