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: sourceforge.net/projects/emacs-bin/files/snapshots See also 64-bit -- with image support: 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.M-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.dynamic-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.