From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Miguel Ulloa Newsgroups: gmane.emacs.help Subject: Re: swtching between buffers? Date: Sat, 10 May 2003 19:52:51 GMT Organization: Road Runner - NYC Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <5v9va.3476$kH.1029551@twister.nyc.rr.com> <87adduy83r.fsf@indigo.shootybangbang.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1052596969 3474 80.91.224.249 (10 May 2003 20:02:49 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 10 May 2003 20:02:49 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Sat May 10 22:02:46 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19EaYQ-0000tj-00 for ; Sat, 10 May 2003 22:02:46 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19EaWO-0004hX-0B for gnu-help-gnu-emacs@m.gmane.org; Sat, 10 May 2003 16:00:40 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed-east.nntpserver.com!nntpserver.com!news-west.rr.com!news-server.columbus.rr.com!cyclone.rdc-nyc.rr.com!news-out.nyc.rr.com!twister.nyc.rr.com.POSTED!not-for-mail User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en, es-pe, es-es, de-de Original-Newsgroups: gnu.emacs.help In-Reply-To: <87adduy83r.fsf@indigo.shootybangbang.com> Original-Lines: 35 Original-NNTP-Posting-Host: 24.90.28.181 Original-X-Complaints-To: abuse@rr.com Original-X-Trace: twister.nyc.rr.com 1052596371 24.90.28.181 (Sat, 10 May 2003 15:52:51 EDT) Original-NNTP-Posting-Date: Sat, 10 May 2003 15:52:51 EDT Original-Xref: shelby.stanford.edu gnu.emacs.help:113052 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:9547 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:9547 Thanks a lot John Paul Wallington wrote: > Miguel Ulloa wrote: > > >>I would like to know if there is a command to circularly navigate all >>opened buffers in emacs, thanks in advance. > > > There are `prev-buffer' and `next-buffer', bound to C-x and > C-x respectively, in the development sources: > > (define-key global-map [?\C-x right] 'next-buffer) > (define-key global-map [?\C-x left] 'prev-buffer) > (defun next-buffer () > "Switch to the next buffer in cyclic order." > (interactive) > (let ((buffer (current-buffer))) > (switch-to-buffer (other-buffer buffer)) > (bury-buffer buffer))) > > (defun prev-buffer () > "Switch to the previous buffer in cyclic order." > (interactive) > (let ((list (nreverse (buffer-list))) > found) > (while (and (not found) list) > (let ((buffer (car list))) > (if (and (not (get-buffer-window buffer)) > (not (string-match "\\` " (buffer-name buffer)))) > (setq found buffer))) > (setq list (cdr list))) > (switch-to-buffer found)))