1

I have configured Emacs to open certain file types with external viewers:

(progn                                                                     
    (require 'openwith)                                                    
    (openwith-mode t)                                                      
    (setq openwith-associations '(("\\.pdf\\'" "evince" (file))))          
    (setq openwith-associations '(("\\.jpg\\'" "eog" (file))))             
   (setq openwith-associations '(("\\.png\\'" "eog" (file))))             
)

While eog file types are indeed opened with the eog program, when I navigate to a PDF file (with C-x C-f) this is what I see:

enter image description here

In contrast, when I navigate to png files they are opened in an external eog viewer as intended.

  • 1
    You are redefining `openwith-associations` three times in a row, each time differently -- the latest in time will prevail. Instead, try defining it once in a list format that includes everything. Here is a general example: `(setq openwith-associations '(("\\.pdf\\'" "acroread" (file)) ("\\.mp3\\'" "xmms" (file)) ("\\.\\(?:mpe?g\\|avi\\|wmv\\)\\'" "mplayer" ("-idx" file)) ("\\.\\(?:jp?g\\|png\\)\\'" "display" (file))))` – lawlist Oct 14 '15 at 22:14
  • @lawlist That would convert into a fine answer :) – Kaushal Modi Oct 14 '15 at 22:28

1 Answers1

7

The original poster has defined openwith-associations three (3) times in a row, each time differently. The latest in time will prevail. Instead, consider using the following list format that includes everything:

(setq openwith-associations '(
  ("\\.pdf\\'" "evince" (file))
  ("\\.\\(?:jp?g\\|png\\)\\'" "eog" (file))
  ("\\.mp3\\'" "xmms" (file))
  ("\\.\\(?:mpe?g\\|avi\\|wmv\\)\\'" "mplayer" ("-idx" file)) ))
lawlist
  • 18,826
  • 5
  • 37
  • 118