Wanderlust の mime-view

添付ファイルを開く時に毎度聞かれるのがウザいのでどうにかならんか, と思っていたら同様の事を考えている先人が当然いらっしゃるようで.

最近は Mac OS XemacsLinux 上の emacs を両方使わなきゃいけないので, 先頭部分を多少弄ってから ~/.wl に追記してみる

;;; 添付ファイルのハンドリングを適当なコマンドに任せてしまう
;; URL: http://d.hatena.ne.jp/yamdan/20100312/1268407849
(defvar my-mime-preview-play-current-entity-appname "fiber"
 "meadow なら fiber, mac なら open, linux なら xdg-open")
;; こっから追記
(cond
 ((string-match "apple-darwin" system-configuration)
  (setq my-mime-preview-play-current-entity-appname "open")
  )
 ((string-match "linux" system-configuration)
  (setq my-mime-preview-play-current-entity-appname "xdg-open")
  ))
;; ここまで
(unless (functionp #'mime-preview-play-current-entity-orig)
  (fset #'mime-preview-play-current-entity-orig
        (symbol-function #'mime-preview-play-current-entity)))
(defun mime-preview-play-current-entity (&optional ignore-examples mode)
  (interactive "P")
  (if (and mode (not (equal mode "play")))
      (mime-preview-play-current-entity-orig ignore-examples mode)
    (let* ((entity (get-text-property (point) 'mime-view-entity))
           (name (mime-entity-safe-filename entity))
           (filename (expand-file-name (if (and name (not (string= name "")))
                                           name
                                         (make-temp-name "EMI"))
                                       (make-temp-file "EMI" 'directory))))
      (mime-write-entity-content entity filename)
      (message "External method is starting...")
      (let* ((process-name
              (concat my-mime-preview-play-current-entity-appname " " filename))
             (process
              (start-process process-name
                             mime-echo-buffer-name
                             my-mime-preview-play-current-entity-appname
                             filename)))
        (set-alist 'mime-mailcap-method-filename-alist process name)
        (set-process-sentinel process 'mime-mailcap-method-sentinel)))))

結構良い感じ.