From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alexis Newsgroups: gmane.emacs.help Subject: Re: Looking for a buffer-cycling library Date: Sat, 15 Nov 2014 12:34:05 +1100 Message-ID: <87tx21s0sn.fsf@gmail.com> References: <20141114231146.GS22206@mail.akwebsoft.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1416015399 12105 80.91.229.3 (15 Nov 2014 01:36:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 15 Nov 2014 01:36:39 +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 Nov 15 02:36:33 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XpSHu-000636-Ao for geh-help-gnu-emacs@m.gmane.org; Sat, 15 Nov 2014 02:36:30 +0100 Original-Received: from localhost ([::1]:38335 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpSHr-0004w8-Re for geh-help-gnu-emacs@m.gmane.org; Fri, 14 Nov 2014 20:36:27 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48642) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpSHZ-0004vp-0P for help-gnu-emacs@gnu.org; Fri, 14 Nov 2014 20:36:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XpSHP-0005dd-UY for help-gnu-emacs@gnu.org; Fri, 14 Nov 2014 20:36:08 -0500 Original-Received: from mail-pa0-x234.google.com ([2607:f8b0:400e:c03::234]:58351) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpSHP-0005dZ-Mi for help-gnu-emacs@gnu.org; Fri, 14 Nov 2014 20:35:59 -0500 Original-Received: by mail-pa0-f52.google.com with SMTP id fa1so18672421pad.39 for ; Fri, 14 Nov 2014 17:35:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:from:to:subject:date:in-reply-to:message-id:mime-version :content-type; bh=Ojjmk4gqRSZMCG8qYkozKVS9HoQ+4LYQqvA9SFnk78U=; b=wgATji6me8sAfjKD0IX6jTgeLEdi4uVt3W2VVJAQSFSP4d/+qa/ZM6wzRQxyC+CVsU nvflVM8BhJ5jiI0TRTlVvmc4kUUBGJ8JY0svJPaOcIPj0lX5GleTU6nXs4oJGPffr393 ghOavH5x2EQVkDiTVyYgX3abFaeQVaF3vGQVybFp7FQg9I7FtZsKvwyt3ffY79KJWxy8 BNzfPKwqN0C3sql1y/k1Xmnml9dLL2TIFT8qK4MqVpDJNw7Mztnqgjg869s64HJ5Du+3 I9yBSxkQCa/JHihqN+lbJhgyFbF0qZqreZSnxFubpPBdO6/4yIqoiMhpl/Budbh/bzOR cv5w== X-Received: by 10.66.66.2 with SMTP id b2mr1462968pat.113.1416015358817; Fri, 14 Nov 2014 17:35:58 -0800 (PST) Original-Received: from localhost (ppp118-209-92-67.lns20.mel4.internode.on.net. [118.209.92.67]) by mx.google.com with ESMTPSA id v15sm28629210pdj.96.2014.11.14.17.35.56 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 14 Nov 2014 17:35:57 -0800 (PST) In-reply-to: <20141114231146.GS22206@mail.akwebsoft.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::234 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:100927 Archived-At: Tim Johnson writes: > I'm looking for a buffer cycling mechanism that will ignore any > buffer not loaded from or written to a file. > > Example - any buffer whose name begins with '*' would be "jumped > over" > > Ideally it would work just like 'buffer-next or 'previous-buffer, > but I would still be able to access _all_ buffers from 'buffer-menu. > > It would have to work in terminal mode and my best imagined use > would be from a netbook without split windows. > > Recommendations are welcome. Might something like this be what you're after? --- BEGIN --- (defun get-buffers-with-files () (let ((wanted '())) (dolist (b (buffer-list)) (if (buffer-file-name b) (setq wanted (append wanted (list b))))) wanted)) (add-hook 'buffer-list-update-hook #'(lambda () (setq buffers-with-files (get-buffers-with-files)))) (defun next-buffer-with-file () (interactive) (setq buffers-with-files (append (cdr buffers-with-files) (list (car buffers-with-files)))) (switch-to-buffer (car buffers-with-files))) (defun previous-buffer-with-file () (interactive) (setq buffers-with-files (append (last buffers-with-files) (butlast buffers-with-files))) (switch-to-buffer (car buffers-with-files))) --- END --- Alexis.