Avoid unnecessary errors

This commit is contained in:
sabof
2014-02-07 05:21:59 +00:00
parent 28a970a778
commit 186fc89414

View File

@ -337,12 +337,12 @@ add text-properties to VAL."
(buffer-string)) (buffer-string))
""))) "")))
(defun mu4e~view-toggle-contact (&optional point) (defun* mu4e~view-toggle-contact (&optional point)
"Toggle between the long and short versions of long/short string "Toggle between the long and short versions of long/short string
at POINT, or if nil, at (point)." at POINT, or if nil, at (point)."
(interactive) (interactive)
(unless (get-text-property (or point (point)) 'long) (unless (get-text-property (or point (point)) 'long)
(error "point is not toggleable")) (return-from mu4e~view-toggle-contact))
(let* ((point (or point (point))) (let* ((point (or point (point)))
;; find the first pos part of the button ;; find the first pos part of the button
(start (previous-property-change point)) (start (previous-property-change point))
@ -443,14 +443,16 @@ at POINT, or if nil, at (point)."
(interactive) (interactive)
(let* (( msg (mu4e~view-get-property-from-event 'mu4e-msg)) (let* (( msg (mu4e~view-get-property-from-event 'mu4e-msg))
( attnum (mu4e~view-get-property-from-event 'mu4e-attnum))) ( attnum (mu4e~view-get-property-from-event 'mu4e-attnum)))
(mu4e-view-open-attachment msg attnum))) (when (and msg attnum)
(mu4e-view-open-attachment msg attnum))))
(defun mu4e~view-save-attach-from-binding () (defun mu4e~view-save-attach-from-binding ()
"Save the attachement at point, or click location." "Save the attachement at point, or click location."
(interactive) (interactive)
(let* (( msg (mu4e~view-get-property-from-event 'mu4e-msg)) (let* (( msg (mu4e~view-get-property-from-event 'mu4e-msg))
( attnum (mu4e~view-get-property-from-event 'mu4e-attnum))) ( attnum (mu4e~view-get-property-from-event 'mu4e-attnum)))
(mu4e-view-save-attachment-single msg attnum))) (when (and msg attnum)
(mu4e-view-save-attachment-single msg attnum))))
(defun mu4e~view-construct-attachments-header (msg) (defun mu4e~view-construct-attachments-header (msg)
"Display attachment information; the field looks like something like: "Display attachment information; the field looks like something like:
@ -769,9 +771,10 @@ If the optional argument URL is provided, browse that instead.
If the url is mailto link, start writing an email to that address." If the url is mailto link, start writing an email to that address."
(interactive) (interactive)
(let* (( url (or url (mu4e~view-get-property-from-event 'mu4e-url)))) (let* (( url (or url (mu4e~view-get-property-from-event 'mu4e-url))))
(if (string-match-p "^mailto:" url) (when url
(mu4e~compose-browse-url-mail url) (if (string-match-p "^mailto:" url)
(browse-url url)))) (mu4e~compose-browse-url-mail url)
(browse-url url)))))
(defun mu4e~view-show-images-maybe (msg) (defun mu4e~view-show-images-maybe (msg)
"Show attached images, if `mu4e-show-images' is non-nil." "Show attached images, if `mu4e-show-images' is non-nil."