From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Sean MacLennan Newsgroups: gmane.emacs.devel Subject: Re: The minibuffer vs. Dialog Boxes (Re: Making XEmacs be more up-to-date) Date: Tue, 23 Apr 2002 23:45:49 -0400 Sender: emacs-devel-admin@gnu.org Message-ID: References: NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="KpEd8Wh7CT" Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1019620111 31852 127.0.0.1 (24 Apr 2002 03:48:31 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 24 Apr 2002 03:48:31 +0000 (UTC) Cc: Kai =?iso-8859-1?Q?Gro=FEjohann?= , Hrvoje Niksic , Eli Zaretskii , jas@extundo.com, bradym@balestra.org, xemacs-design@xemacs.org, emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 170Dle-0008Hc-00 for ; Wed, 24 Apr 2002 05:48:30 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 170Dn9-0006yb-00 for ; Wed, 24 Apr 2002 05:50:03 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 170DlR-0007E0-00; Tue, 23 Apr 2002 23:48:17 -0400 Original-Received: from spitfire.velocet.net ([216.138.223.227]) by fencepost.gnu.org with smtp (Exim 3.34 #1 (Debian)) id 170DjL-00078o-00 for ; Tue, 23 Apr 2002 23:46:07 -0400 Original-Received: from fillmore.seanm.ca (H67.C233.tor.velocet.net [216.138.233.67]) by spitfire.velocet.net (Postfix) with ESMTP id 13223FB45FC; Tue, 23 Apr 2002 23:46:00 -0400 (EDT) Original-Received: by fillmore.seanm.ca (Postfix, from userid 500) id 7962FF843; Tue, 23 Apr 2002 23:45:49 -0400 (EDT) Original-To: Terje Bless In-Reply-To: X-Mailer: VM 7.03 under 21.4 (patch 6) "Common Lisp" XEmacs Lucid X-Message-Flag: Warning: This message may contain actual content! Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:3152 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:3152 --KpEd8Wh7CT Content-Type: text/plain; charset=us-ascii Content-Description: message body text Content-Transfer-Encoding: 7bit Terje Bless writes: > But the switch to buffer bit is simply that me and Hrvoje are speaking of > slightly different things. Switch to buffer by name is there, but I'd like > to cycle through buffers sequentially; analogous to switching between > applications using Alt-TAB on Windows or Cmd-TAB on Mac OS. > > A simple repetetive action instead of a single complicated one. I have attached some sample code that does just what you want ;-) You probably want to attach it to a key though. Email me privately if you want help with that. I have only tested it in XEmacs. I wrote this for a new emacs user who wanted just what you said, an Alt-TAB for buffers. However, most people tend to keep the number of windows on their desktop to a relatively low number. Too many windows and the desktop gets so cluttered that you cannot deal with the windows. Plus, you will tend to run out of memory :-) On the other hand, the number of buffers in an active emacs session can get huge. I have had my current emacs session running for about 2 hours and have not been doing any majour development, just email and this and that. I am up to 30 buffers. At work I can easily have sessions running for days with hundreds of open buffers. The above user quickly gave up on the command, so it is not heavily tested :-) It also probably needs a previous-buffer command since if you overshoot the buffer you have to go through the entire list again. Now, both the user and I are developers. Maybe in a different environment the command would be useful. If so, maybe something like this should go in emacs. Cheers, Sean MacLennan --KpEd8Wh7CT Content-Type: text/plain Content-Disposition: inline; filename="next-buffer.el" Content-Transfer-Encoding: 7bit (require 'iswitchb) (defvar next-buffer-depth 0) (defun next-buffer () (interactive) (let (buflist len buf) ;; This is a stripped down version of `iswitchb-make-buflist'. ;; I want to use `iswitchb-ignore-buffername-p' instead of ;; duplicating the work. (setq buflist (delq nil (mapcar (lambda (x) (let ((b-name (buffer-name x))) (unless (iswitchb-ignore-buffername-p b-name) b-name))) (buffer-list)))) ;; However, I do not want the current buffer in the list (setq buflist (delq (buffer-name) buflist)) (if (eq last-command 'next-buffer) (progn (setq len (1- (list-length buflist))) (if (eq next-buffer-depth len) ;; Just keep taking the tail of the list (setq buf (nth next-buffer-depth buflist)) (progn (setq next-buffer-depth (1+ next-buffer-depth)) (setq buf (nth next-buffer-depth buflist))))) ;; This is the first next-buffer (setq next-buffer-depth 0) (setq buf (car buflist))) (if (not buf) (error "No other buffers")) (switch-to-buffer buf))) (global-set-key [f11] 'next-buffer) --KpEd8Wh7CT--