mu4e: better error for non-supported header fields

Some fields (eg. :attachments and :user-agent) require a full message
and are not supported in headers-mode. Document this and give a clearer
error message when they are added to `mu4e-headers-fields'.

Fixes issue #933.
This commit is contained in:
djcb
2016-11-05 12:42:28 +02:00
parent e294016e85
commit 01fe899c37
2 changed files with 14 additions and 2 deletions

View File

@ -851,7 +851,8 @@ after the end of the search results."
(let* ((field (car item)) (width (cdr item))
(info (cdr (assoc field
(append mu4e-header-info mu4e-header-info-custom))))
(sortable (plist-get info :sortable))
(require-full (plist-get info :require-full))
(sortable (plist-get info :sortable))
;; if sortable, it is either t (when field is sortable itself)
;; or a symbol (if another field is used for sorting)
(sortfield (when sortable (if (booleanp sortable) field sortable)))
@ -862,6 +863,8 @@ after the end of the search results."
(if (eq mu4e-headers-sort-direction 'descending) downarrow uparrow)))
(name (concat (plist-get info :shortname) arrow))
(map (make-sparse-keymap)))
(when require-full
(mu4e-error "Field %S is not supported in mu4e-headers-mode" field))
(when sortable
(define-key map [header-line mouse-1]
(lambda (&optional e)