Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!usc!apple!fernwood!oracle!news From: wmesard@oracle.com (Wayne Mesard) Newsgroups: comp.emacs Subject: Re: How can I select the next buffer? Message-ID: <1990Oct11.223849.4896@oracle.com> Date: 11 Oct 90 22:38:49 GMT References: <9010052137.AA10846@wubios.wustl.edu> Reply-To: wmesard@oracle.com (Wayne Mesard) Organization: Oracle Corporation, Belmont CA Lines: 25 david@WUBIOS.WUSTL.EDU (David J. Camp) writes: >I am looking for a command in emacs to easily alternate from one >buffer to the next. For example, if I am editing ~/.login and >~/.cshrc, I may want to toggle between them without reentering >the filename. This seesm like an reasonable thing to do, but I >cannot find it in the documentation. Thanks, -David- I wrote a function which does just that. It was inspired by the Control-Meta-L command from Symbolics' Zmacs editor. You, of course, can bind it to anything you like. (global-set-key "\e\C-l" 'select-previous-buffer) (defun select-previous-buffer (nth) "Like the useful parts of Zmacs' command of the same name. With no arg it toggles between the two topmost buffers. With an arg, goes to the Nth buffer down on the stack, er, ring." (interactive "p") (let ((buf (current-buffer))) (while (not (zerop nth)) (setq nth (1- nth)) (setq buf (other-buffer buf)) ) (switch-to-buffer buf) ))