I use the package image-mode
to view images in a directory. When go to the next image in the same directory, I use a function to go the next image in image-mode
.
(defun find-next-image (&optional backward)
"Find the next file (by name) in the current directory.
With prefix arg, find the previous file."
(interactive "P")
(when buffer-file-name
(let* ((file (expand-file-name buffer-file-name))
(files (cl-remove-if (lambda (file) (cl-first (file-attributes file)))
(sort (directory-files (file-name-directory file) t nil t) 'string<)))
(pos (mod (+ (cl-position file files :test 'equal) (if backward -1 1))
(length files))))
(find-file (nth pos files))))
(kill-buffer (other-buffer (current-buffer) 1))
)
However, sometimes Emacs crashes when he tries to load the next image which happens to be a .gif
image. This Emacs version doesn't have any gif library to handle it.
So I need to skip .gif
-images and go to the next image after the .gif
image anyway. When looking to the function, he increments the position of the current file with 1. I thinked about it how I could solve this, that in the case of a GIF-image, he will skip it and increment again. But I couldn't figure out how I could write it.
Any suggestion would be appreciated.
UPDATE: see the solution below.
bin
directory where the emacs.exe is located: https://sourceforge.net/projects/emacs-bin/files/snapshots/ See also 64-bit -- with image support*: http://sourceforge.net/projects/emacsbinw64/files/snapshot/ There is no reason to go through life without enjoying Emacs master/trunk to the fullest extent available on Windows. – lawlist Oct 17 '15 at 19:46M-x describe-variable RET dynamic-library-alist RET
to obtain a listing of the required.dll
files that go in thebin
directory. The call of this particular question (in my opinion) is essentially: "I am using an incomplete installation of Emacs master branch (aka trunk) for Windows and I would like some help with a workaround for problems relating to a lack of image support . . ." The answer (in my opinion) is to just fix it so that it's not broken. – lawlist Oct 17 '15 at 19:59dynamic-library-alist
, I see thelibgif-7.dll
is used for gif-extension. And it's available inbin
-folder too. So I wonder why it's not used, since Emacs crashes when a gif file is being loaded. And I have already thought of compiling my own Emacs, but I'm not technical enough to run compilations , so please don't consider that in my case. – ReneFroger Oct 17 '15 at 20:43[email protected]
-- andgiflib-5.1.0-w32-bin.zip
from ezwinports -- https://sourceforge.net/projects/ezwinports/files/ -- I was able to successfully open/view a*.gif
image with Emacs -Q without crashing. – lawlist Oct 17 '15 at 21:19*.gif
file? I only get the text, notice that I use the Emacs 25.05 version. I think it would be better to stay in the scope of my original question. – ReneFroger Oct 18 '15 at 10:18libgif-7.dll
from ezwinports in thebin
directory whereemacs.exe
is located -- is a still image of the first in the series of.gif
images. To animate the image, just press the return key. In my case, I tested a.gif
that has 50 different combined images. Eli Z. (one of the lead developers on the Emacs team) strongly suggests in his responses to bug reports that Emacs be built with and used with the.dll
files from ezwinports -- i.e., Eli Z. maintains that ezwinports repository. – lawlist Oct 18 '15 at 15:05emacs -q
. With my configuration, I couldn't it get working, which leds me to suspect my configuration. The culprit turns out to beimage+
andimagex-sticky-maximize
. Thanks for your help anyway, it's appreciated. – ReneFroger Oct 19 '15 at 10:12