all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alexis <flexibeast@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Looking for a buffer-cycling library
Date: Sat, 15 Nov 2014 12:34:05 +1100	[thread overview]
Message-ID: <87tx21s0sn.fsf@gmail.com> (raw)
In-Reply-To: <20141114231146.GS22206@mail.akwebsoft.com>


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.



  reply	other threads:[~2014-11-15  1:34 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 [this message]
2014-11-15  3:32   ` Tim Johnson
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=87tx21s0sn.fsf@gmail.com \
    --to=flexibeast@gmail.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.