From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Lee Newsgroups: gmane.emacs.help Subject: Re: This code won't match buffer names. Why not? Date: Fri, 21 Aug 2009 19:50:25 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <30670a65-7226-4950-b43a-adb2890eec1c@i18g2000pro.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1250926877 28345 80.91.229.12 (22 Aug 2009 07:41:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 22 Aug 2009 07:41:17 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Aug 22 09:41:10 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MelDp-0006xN-Uz for geh-help-gnu-emacs@m.gmane.org; Sat, 22 Aug 2009 09:41:10 +0200 Original-Received: from localhost ([127.0.0.1]:46651 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MelDp-0001tj-E6 for geh-help-gnu-emacs@m.gmane.org; Sat, 22 Aug 2009 03:41:09 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!news2.glorb.com!postnews.google.com!l35g2000pra.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help,comp.emacs Original-Lines: 52 Original-NNTP-Posting-Host: 76.102.12.87 Original-X-Trace: posting.google.com 1250909426 14516 127.0.0.1 (22 Aug 2009 02:50:26 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Sat, 22 Aug 2009 02:50:26 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: l35g2000pra.googlegroups.com; posting-host=76.102.12.87; posting-account=bRPKjQoAAACxZsR8_VPXCX27T2YcsyMA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/530.5 (KHTML, like Gecko) Chrome/2.0.172.39 Safari/530.5, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:172224 comp.emacs:98629 X-Mailman-Approved-At: Sat, 22 Aug 2009 03:27:08 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:67389 Archived-At: On Aug 21, 5:31 pm, Chris Seberino wrote: > When I cycle through buffers, I'd like to skip *scratch*, *Messages* > and *Whitespace Errors* buffers. > > I wrote following code to skip one more buffer if I'm sitting in > either of those 3. > > However, it never matches those buffers. Why not? > > (BTW, the (end-kbd-macro) is just a dummy function since "if" needs an > "else" command. > Is there a better dummy command I can add there?) > > ; Sets F10 to execute a function that moves to another buffer. > (global-set-key [f10] (lambda () (interactive) > (next-buffer) > (if (equal (current-buffer) > "*scratch*") > (next-buffer) > (end-kbd-macro)) > (if (equal (current-buffer) > "*Messages*") > (next-buffer) > (end-kbd-macro)) > (if (equal (current-buffer) > "*Whitespace Errors*") > (next-buffer) > (end-kbd-macro)))) Wee, the code to skip emacs buffers is in ergoemacs here: http://code.google.com/p/ergoemacs/ by default it's Ctrl + Page up/down is the shortcut, similar to Firefox et al for switching tabs. With shift key down, it cycle among emacs's buffers. here's the relevant code: (defun next-user-buffer () "Switch to the next user buffer. User buffers are those whose name does not start with *." (interactive) (next-buffer) (let ((i 0)) (while (and (string-match "^*" (buffer-name)) (< i 50)) (setq i (1+ i)) (next-buffer) ))) Xah =E2=88=91 http://xahlee.org/ =E2=98=84