Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs: easily navigate images in dired?

Tags:

emacs

elisp

dired

I want eog-style navigation when I press v on an image in dired buffer. I've searched the web for a bit, but haven't found anything straightforward. There's image-dired, but thumbnails isn't what I want.

I want the kind of behavior that's already in place for most file types: v in dired shows the file in view-mode, where n, p, and q do the obvious thing.

I've hacked some stuff around dired-view-next, but I wonder if there's already a package that does a good job?

like image 523
abo-abo Avatar asked Nov 08 '13 14:11

abo-abo


2 Answers

This has been fixed in what will become Emacs 24.4. IOW, it works in recent development snapshots of Emacs 24.

v in Dired works just as you request: it shows the image. And then n, p, and q do just what you would expect: show the next or previous file (image), and quit, respectively. Each image is shown in image-mode, which binds n etc. to DTRT.

Consider just picking up the image-mode.el code from a dev snapshot and adding that to your init file. Dunno whether you might need to fiddle with some of that code so it works well with Emacs 24.3 (or whatever Emacs version you are using).

like image 189
Drew Avatar answered Nov 11 '22 18:11

Drew


From Image Dired, you can run image-dired-display-thumbnail-original-image. If you modify the keymap so that v runs image-dired-display-thumbnail-original-image, but that will only display the image in another buffer.

You could perhaps write a custom minor mode, so that when you open an image, you modify the current dired mode. This new mode would make the image open in another buffer whilst keeping the cursor in the current buffer, and making n and p move the cursor and the displayed image to the next/previous image respectively. q would drop you back in. However, I've no idea how to do that.

like image 29
Squidly Avatar answered Nov 11 '22 17:11

Squidly