all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: extension for image view to go to next or previous image
Date: Fri, 08 Apr 2011 08:34:42 +0200	[thread overview]
Message-ID: <871v1dcku5.fsf@gmail.com> (raw)
In-Reply-To: 293db391-853d-4043-8b0b-aa68dad213bf@t13g2000vbo.googlegroups.com

chris <cwittern@gmail.com> writes:

> Hi there,
>
> I am frequently viewing images in emacs that are part of a sequence,
> therefore I am missing a way to go the next or previous image.  I was
> wondering if this is possible somehow already?  Or maybe somebody can
> show me how to do this with elisp?  The filenames for these images are
> chosen in a way that sorting by name brings them in the right order,
> also usually the directory that contains them is open in a dired
> buffer, so if necessary, maybe one could retrieve the position of the
> current image and then simply get the name of the next image from
> there?
>
> Any help would be greatly appreciated,
You can use iterators to do that.
You can find some of my iterators functions actually in ioccur.el, 
the iterator package on emacswiki is no more updated/maintained.
http://mercurial.intuxication.org/hg/ioccur

Use it like this:
--8<---------------cut here---------------start------------->8---
ELISP> (setq A (ioccur-iter-list '("img1.jpg" "img2.jpg" "img3.jpg" "img4.jpg" "img5.jpg")))
ELISP> (ioccur-iter-next A)
"img1.jpg"
ELISP> (ioccur-iter-next A)
"img2.jpg"
ELISP> (ioccur-iter-next A)
"img3.jpg"
--8<---------------cut here---------------end--------------->8---
When you want to go back, create a new iterator from the last element to
beginning of sequence.
To go forward again, same recreate an iterator etc...

You can also create infinite iterators.
(See ioccur-iter-circular)

-- 
A+ Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 




  reply	other threads:[~2011-04-08  6:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-08  1:49 extension for image view to go to next or previous image chris
2011-04-08  6:34 ` Thierry Volpiatto [this message]
2011-04-08 13:55 ` Drew Adams
     [not found] ` <mailman.9.1302270960.11168.help-gnu-emacs@gnu.org>
2011-04-08 23:07   ` chris
2011-04-09  0:28     ` Drew Adams
     [not found]     ` <mailman.12.1302309090.11006.help-gnu-emacs@gnu.org>
2011-04-09  1:24       ` chris
2011-04-09  4:03       ` rusi
2011-04-09 15:06         ` Drew Adams
2011-04-09  5:32     ` Thierry Volpiatto
     [not found] ` <mailman.20.1302244507.25447.help-gnu-emacs@gnu.org>
2011-04-08 23:11   ` chris
2011-04-09  5:39     ` Thierry Volpiatto

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=871v1dcku5.fsf@gmail.com \
    --to=thierry.volpiatto@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.