all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tim Johnson <tim@akwebsoft.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Looking for a buffer-cycling library
Date: Fri, 14 Nov 2014 18:32:02 -0900	[thread overview]
Message-ID: <20141115033202.GU22206@mail.akwebsoft.com> (raw)
In-Reply-To: <87tx21s0sn.fsf@gmail.com>

* Alexis <flexibeast@gmail.com> [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



  reply	other threads:[~2014-11-15  3:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-14 23:11 Looking for a buffer-cycling library Tim Johnson
2014-11-15  1:34 ` Alexis
2014-11-15  3:32   ` Tim Johnson [this message]
2014-11-15  3:56     ` Alexis
2014-11-15 16:44 ` Tim Johnson
2014-11-15 17:19   ` Drew Adams
2014-11-15 20:32     ` Tim Johnson
2014-11-15 20:38       ` Drew Adams
2014-11-15 22:29         ` Tim Johnson
     [not found] <mailman.13706.1416006724.1147.help-gnu-emacs@gnu.org>
2014-11-15 11:31 ` Joost Kremers
2014-11-15 14:59   ` Marcin Borkowski
2014-11-15 17:17     ` Drew Adams
2014-11-15 21:04       ` Marcin Borkowski
2014-11-15 23:41         ` Drew Adams
     [not found]   ` <mailman.13736.1416063601.1147.help-gnu-emacs@gnu.org>
2014-11-16 10:15     ` Joost Kremers
     [not found]     ` <<slrnm6guar.a37.joost.m.kremers@j.kremers4.news.arnhem.chello.nl>
2014-11-16 17:08       ` Drew Adams
2014-11-16 18:01         ` Marcin Borkowski
2014-11-16 20:18           ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141115033202.GU22206@mail.akwebsoft.com \
    --to=tim@akwebsoft.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.