From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim Johnson Newsgroups: gmane.emacs.help Subject: Re: Looking for a buffer-cycling library Date: Fri, 14 Nov 2014 18:32:02 -0900 Organization: AkWebsoft Message-ID: <20141115033202.GU22206@mail.akwebsoft.com> References: <20141114231146.GS22206@mail.akwebsoft.com> <87tx21s0sn.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1416022347 11664 80.91.229.3 (15 Nov 2014 03:32:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 15 Nov 2014 03:32:27 +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 04:32:23 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 1XpU62-0002MO-Fl for geh-help-gnu-emacs@m.gmane.org; Sat, 15 Nov 2014 04:32:22 +0100 Original-Received: from localhost ([::1]:38535 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpU61-0001Uz-Uf for geh-help-gnu-emacs@m.gmane.org; Fri, 14 Nov 2014 22:32:21 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33764) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpU5o-0001Uj-Hc for help-gnu-emacs@gnu.org; Fri, 14 Nov 2014 22:32:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XpU5k-00031S-0x for help-gnu-emacs@gnu.org; Fri, 14 Nov 2014 22:32:08 -0500 Original-Received: from 191-232-4-64.mtaonline.net ([64.4.232.191]:52558 helo=tj49.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpU5j-00031H-PJ for help-gnu-emacs@gnu.org; Fri, 14 Nov 2014 22:32:03 -0500 Original-Received: by tj49.com (Postfix, from userid 501) id 3C1C85341CBB; Fri, 14 Nov 2014 18:32:02 -0900 (AKST) Mail-Followup-To: help-gnu-emacs@gnu.org Content-Disposition: inline In-Reply-To: <87tx21s0sn.fsf@gmail.com> User-Agent: Mutt/1.4.2.3i X-detected-operating-system: by eggs.gnu.org: Mac OS X 10.x X-Received-From: 64.4.232.191 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:100928 Archived-At: * Alexis [141114 16:48]: > > 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 --- Looks good Alex, I will have to grok it further tomorrow. As far as a quick hack, I've seen some good stuff at http://stackoverflow.com/questions/14323516/make-emacs-next-buffer-skip-messages-buffer but I thought that a full-blown library might introduce me to some other goodies I haven't thought off. thanks a lot -- Tim tim at tee jay forty nine dot com or akwebsoft dot com http://www.akwebsoft.com, http://www.tj49.com