Skip to content

Instantly share code, notes, and snippets.

@tsuchm
Created July 28, 2019 12:35
Show Gist options
  • Select an option

  • Save tsuchm/fc300cd5d2fc4a8e39af3f0fef85b51a to your computer and use it in GitHub Desktop.

Select an option

Save tsuchm/fc300cd5d2fc4a8e39af3f0fef85b51a to your computer and use it in GitHub Desktop.
Use neither doc-view-mode or gimp to display application/pdf part
(eval-after-load "mailcap"
'(setq mailcap-mime-data
(mapcar
(lambda (data)
(cons (car data)
(delq nil
(mapcar
(lambda (pair)
(let ((viewer (cdr (assq 'viewer (cdr pair)))))
(cond
;; MIME part を表示するときに doc-view-mode を利用しないための設定
;; doc-view-mode を使うようになっていると,applicate/pdf な MIME part
;; を表示できずに,単にファイルを保存してしまう.
((memq viewer '(pdf-view-mode doc-view-mode))
nil)
;; application/pdf または application/postscript を表示する時に gimp を利用しないための設定
((and (string-match "\\`\\(pdf\\|postscript\\)\\'" (car pair))
(string-match "\\`gimp" viewer))
nil)
(t pair))))
(cdr data)))))
mailcap-mime-data)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment