I like to view pdf file in a dired buffer using xpdf. The following code in my ~/.emacs works fine for emacs-24. Just hitting "v" launches the xpdf with file (I stipulated xpdf in my ~/.mailcap file).
(autoload 'mailcap-parse-mailcaps "mailcap" nil t) (autoload 'mm-mailcap-command "mm-decode") (defadvice dired-view-file (around use-mailcap-mime-data activate) "Use an external viewer to view a file according to `mailcap-mime-data'." (unless (let ((file (dired-get-file-for-visit)) extension type command) (and (not (file-directory-p file)) (progn (mailcap-parse-mailcaps) (setq extension (file-name-extension file))) (setq type (mailcap-extension-to-mime extension)) (setq command (mailcap-mime-info type)) (setq command (mm-mailcap-command command file nil)) (prog1 t (shell-command command)))) ad-do-it))
However it stopped working with emacs-25 (emacs-18.104.22.168) with the error
mm-mailcap-command: Wrong type argument: stringp, doc-view-mode
Of course I can run xpdf via a shell command, but I am curious why emacs-25 does not seem to parse mailcaps. I haven't found any answers on the emacs-devel forums.