mu4e如何更改mu4e-action-view-as-pdf函数的查找目录

时间:2014-02-18 18:22:41

标签: emacs elisp mu

我正在尝试将视图作为pdf函数在mu4e中工作,我猜这个问题是可执行文件msg2pdf的查找目录。 从我看到的功能定义

(defvar mu4e-msg2pdf "/usr/bin/msg2pdf" "Path to the msg2pdf toy.")

(defun mu4e-action-view-as-pdf (msg)
  "Convert the message to pdf, then show it.
Works for the message view."
  (unless (file-executable-p mu4e-msg2pdf)
    (mu4e-error "msg2pdf not found; please set `mu4e-msg2pdf'"))
  (let* ((pdf
      (shell-command-to-string
        (concat mu4e-msg2pdf " "
          (shell-quote-argument (mu4e-message-field msg :path))
          " 2> /dev/null")))
     (pdf (and pdf (> (length pdf) 5)
        (substring pdf 0 -1)))) ;; chop \n
    (unless (and pdf (file-exists-p pdf))
      (mu4e-warn "Failed to create PDF file"))
    (find-file pdf)))

我将(defvar mu4e-msg2pdf "/usr/bin/msg2pdf" "Path to the msg2pdf toy.") 更改为与msg2pdf所在的路径相匹配。 问题是从我看到的调试器

Debugger entered--returning value: nil
  file-executable-p("/build/buildd/maildir-utils-0.9.9.5/toys/msg2pdf/msg2pdf")
* #[(msg) "\305!\204\n ......
* mu4e-action-view-as-pdf((.....
  mu4e-view-action()
  call-interactively(mu4e-view-action nil nil)

查找路径不是我指定的路径。因为我试图以不同的方式对它进行切割,显然mu4e忽略了我,有人知道如何设置正确的查找路径?

1 个答案:

答案 0 :(得分:2)

您可以通过在init文件中添加以下内容,将变量mu4e-msg2pf设置为可执行文件msg2pdf的路径

(setq mu4e-msg2pdf "/path/to/msg2pdf")