[gnu.emacs] Buffer stuff

dkeisen@Gang-of-Four.Stanford.EDU (Dave Eisen) (06/17/89)

Is there some way to take a command that ordinarily only acts on the
current buffer and make it be applied to all of the buffers? Or to all
buffers of a certain type? Or to have emacs run through the buffer
list and inquire if you want the command applied to each buffer one at
a time?

Also, is there some way to modify the switch-to-buffer command so the
default is to run through the buffer list rather than to choose the
most recently used buffer?


Dave Eisen                                  dkeisen@Gang-of-Four.Stanford.EDU
Home   (415) 324-9366                       814 University Avenue    
Office (415) 723-2963                       Palo Alto, CA 94301
I was born to be a bachelor... (R. Hunter "Althea")

eliot@phoenix.Princeton.EDU (Eliot Handelman) (06/18/89)

In article <10067@polya.Stanford.EDU> dkeisen@Gang-of-Four.Stanford.EDU (Dave Eisen) writes:


>Also, is there some way to modify the switch-to-buffer command so the
>default is to run through the buffer list rather than to choose the
>most recently used buffer?


Here's a little function that I use for selecting lisp buffers without
having to type in names. If you want to go through the list looking
for something else, just modify the regexp.

No doubt there are elisp hackers out there who could improve on this.

(defun switch-to-lisp-buffer ()
  "Offers to switch to any lisp buffers that are already opened."
  (interactive)
  (let ((buffers (cdr (buffer-list))) (selected nil))
    (while (and buffers (not selected))
      (let ((buff (buffer-name (car buffers))))
	(if (string-match  ".lsp$" buff)
		(if (y-or-n-p
		     (format "Switch to %s? " buff))
		       (setq selected (car buffers))))
	(setq buffers (cdr buffers))))
          (cond (selected (switch-to-buffer selected)
			  (message ""))
		(t
		 (beep)
		 (message "No more Lisp buffers")))))

dkeisen@Gang-of-Four.Stanford.EDU (Dave Eisen) (06/18/89)

In article <10067@polya.Stanford.EDU> dkeisen@Gang-of-Four.Stanford.EDU (Dave Eisen) writes:
>
>Is there some way to take a command that ordinarily only acts on the
>current buffer and make it be applied to all of the buffers? Or to all
>buffers of a certain type? Or to have emacs run through the buffer
>list and inquire if you want the command applied to each buffer one at
>a time?


Never mind. I wrote up the commands this morning.


Dave Eisen                         "Maybe it's *not* me, y'know? ...
dkeisen@Gang-of-Four.Stanford.EDU   Maybe it's the rest of the herd 
Office: (415)723-2963               that's gone insane." -- Guess who.
Summer tour stops: Shoreline , Alpine Valley, Cal Expo, and the Greeks