help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: extension for image view to go to next or previous image


From: Thierry Volpiatto
Subject: Re: extension for image view to go to next or previous image
Date: Fri, 08 Apr 2011 08:34:42 +0200
User-agent: Gnus/5.110016 (No Gnus v0.16) Emacs/23.3.50 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]