* add/use mu4e-error

This commit is contained in:
djcb
2012-07-10 12:11:06 +03:00
parent 129b5ad264
commit 985d5340bc
11 changed files with 109 additions and 113 deletions

View File

@ -54,7 +54,7 @@ headers view and message-view."
"Convert the message to pdf, then show it. Works for the message
view."
(unless (file-executable-p mu4e-msg2pdf)
(error "msg2pdf not found; please set `mu4e-msg2pdf'"))
(mu4e-error "msg2pdf not found; please set `mu4e-msg2pdf'"))
(let* ((pdf
(shell-command-to-string
(concat mu4e-msg2pdf " "
@ -64,7 +64,7 @@ view."
(substring pdf 0 -1)))) ;; chop \n
(unless (and pdf (file-exists-p pdf))
(message "==> %S %S" pdf (mu4e-msg-field msg :path))
(error "Failed to create PDF file"))
(mu4e-error "Failed to create PDF file"))
(find-file pdf)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -77,7 +77,7 @@ view."
the browser to use with the variable `browse-url-generic-program'."
(let ((html (mu4e-msg-field msg :body-html))
(tmpfile (format "%s/%d.html" temporary-file-directory (random))))
(unless html (error "No html part for this message"))
(unless html (mu4e-error "No html part for this message"))
(with-temp-file tmpfile
(insert html)
(save-buffer)
@ -94,7 +94,7 @@ the browser to use with the variable `browse-url-generic-program'."
(defun mu4e-action-message-to-speech (msg)
"Pronounce the message text using `mu4e-text2speech-command'."
(unless (mu4e-msg-field msg :body-txt)
(error "No text body for this message"))
(mu4e-error "No text body for this message"))
(with-temp-buffer
(insert (mu4e-msg-field msg :body-txt))
(shell-command-on-region (point-min) (point-max)
@ -135,10 +135,10 @@ with `mu4e-compose-attach-captured-message'."
current message (in headers or view). You need to set
`mu4e-org-contacts-file' to the full path to the file where you
store your org-contacts."
(unless (require 'org-capture nil 'noerror)
(error "org-capture is not available."))
(unless (require 'org-capture nil 'nomu4e-error)
(mu4e-error "org-capture is not available."))
(unless mu4e-org-contacts-file
(error "`mu4e-org-contacts-file' is not defined."))
(mu4e-error "`mu4e-org-contacts-file' is not defined."))
(let* ((sender (car-safe (mu4e-msg-field msg :from)))
(name (car-safe sender)) (email (cdr-safe sender))
(blurb