8

If I select image files in a Dired buffer and do C-t C-t, a nice little thumbnail appears. But if I try this with PDF files, nothing happens. I would expect to see a thumbnail of the first page of the PDF.

Is this normal? Is there an easy way to get the behavior I want? (I am running Emacs 24.3.1 on Ubuntu 14.04 if that matters.)

Dan
  • 32,584
  • 6
  • 98
  • 168
Brian Z
  • 2,863
  • 16
  • 22

1 Answers1

3

This is a feature of dired+ as far as I can tell. C-t C-t is bound to image-dired-dired-toggle-marked-thumbs, which first checks whether the file is an image or not with diredp-get-image-filename. This procedure runs image-file-name-regexp to generate a regular expression matching all image file names. Then it creates thumbnails with Imagemagick's convert (defined in image-dired-cmd-create-thumbnail-program).

You should be able to modify the behaviour of image-file-name-regexp by adding a regular expression for PDF files to the variable image-file-name-regexps. convert can convert PDF files to images, so you should get a thumbnail.

  • 1
    Thanks for the helpful info. I'm afraid this might require a defadvice then. `convert` treat PDFs differently than other images, generating a numbered image for each page in the file. Unless there is a way to modify `image-dired-cmd-create-thumbnail-program` so that it would do something like `convert file.pdf[0]`, but that may cause problems with regular images. – Brian Z Nov 18 '15 at 09:38