here's a little more robust version i've
been working on, which allows you to just
specify a list in a variable which contains the
patterns to ignore:
;; Setup the next buffer function
(defvar next-buffer-ignore-buffer-patterns
(list* "\\*.*Minibuf.*\\*" "\\*.*Echo Area.*\\*" "\\*.*Messages.*\\*")
"Ignore strings for the next-buffer function. Any buffer which matches
one of these patterns will not be considered when cycling through the buffers
using the next-buffer function"
)
(defun match-patterns(buf-name &rest patterns)
"Match a particular string against a list of patterns, and see if
any one of them matches"
(if (listp (car patterns))
(setq patterns (car patterns)))
(let* ((matched nil))
(while (and (not matched)
(not (null patterns)))
(let* ((islast (not (listp patterns)))
(pat (if islast patterns (car patterns))))
(if (string-match pat buf-name)
(setq matched t)
(setq patterns (if islast nil (cdr patterns))))
)
)
matched
)
)
;; Find the next applicable buffer to switch to
(defun get-next-buffer(cbuf)
"This function will return the next buffer which we should switch
to which does not match one of the ignore patterns in
next-buffer-ignore-buffer-patterns"
(let*
((bufs (buffer-list))
(bufslen (length bufs))
(pos (position cbuf bufs)))
(if (eq pos 0)
(setq pos (- bufslen 1))
(setq pos (- pos 1)))
(setq cbuf (nth pos bufs))
(if (match-patterns (buffer-name cbuf)
next-buffer-ignore-buffer-patterns)
(get-next-buffer cbuf)
cbuf))
)
;; Switch to the next buffer
(defun next-buffer()
"Switch to the next buffer in the buffer list which does not match
one of the patterns in next-buffer-ignore-buffer-patterns cons list"
(interactive)
(let*
((cbuf (current-buffer)))
(setq cbuf (get-next-buffer cbuf))
(switch-to-buffer cbuf)
)
)
;; Set the next-buffer key
(global-set-key [C-tab] 'next-buffer)
-----Original Message-----
From: Chris [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 31, 2002 3:04 PM
To: [EMAIL PROTECTED]
Subject: RE: (emacs newbie) Modifying JDE
Thank you Matthew! I'm right now reading the online ELisp manual, and after a bit of that I'll hit your code. But I really appreciate it -- not just for what it will let me do, but for what I can learn from it.
Thanks again!
Chris