mu4e-headers: fix column sorting
This commit is contained in:
@ -1033,8 +1033,9 @@ COUNT is the number of messages found."
|
|||||||
(defun mu4e~header-line-click (sortable threads)
|
(defun mu4e~header-line-click (sortable threads)
|
||||||
"Return function for header-line clicks.
|
"Return function for header-line clicks.
|
||||||
If SORTABLE, handle the sorting; otherwise show a message that
|
If SORTABLE, handle the sorting; otherwise show a message that
|
||||||
you cannot sort by this field. If THREADS, give a more
|
you cannot sort by this field.
|
||||||
informative error message."
|
|
||||||
|
If THREADS is non-nil, give a more informative error message."
|
||||||
(if (not sortable)
|
(if (not sortable)
|
||||||
(if threads
|
(if threads
|
||||||
(lambda (&optional e)
|
(lambda (&optional e)
|
||||||
@ -1045,8 +1046,7 @@ informative error message."
|
|||||||
(mu4e-message "Field is not sortable")))
|
(mu4e-message "Field is not sortable")))
|
||||||
(lambda (&optional e)
|
(lambda (&optional e)
|
||||||
(interactive "e")
|
(interactive "e")
|
||||||
;; getting the field, inspired by
|
;; getting the field, inspired by `tabulated-list-col-sort'
|
||||||
;; `tabulated-list-col-sort'
|
|
||||||
(let* ((obj (posn-object (event-start e)))
|
(let* ((obj (posn-object (event-start e)))
|
||||||
(field (and obj
|
(field (and obj
|
||||||
(get-text-property 0 'field (car obj)))))
|
(get-text-property 0 'field (car obj)))))
|
||||||
@ -1057,7 +1057,7 @@ informative error message."
|
|||||||
(defun mu4e~header-line-format ()
|
(defun mu4e~header-line-format ()
|
||||||
"Get the format for the header line."
|
"Get the format for the header line."
|
||||||
(let* ((plist (mu4e-server-last-query)) ;; info about the last query
|
(let* ((plist (mu4e-server-last-query)) ;; info about the last query
|
||||||
(reverse (plist-get plist :reverse))
|
(reverse (plist-get plist :descending))
|
||||||
(threads (plist-get plist :threads))
|
(threads (plist-get plist :threads))
|
||||||
;; with threads enabled, we can only sort by ;date
|
;; with threads enabled, we can only sort by ;date
|
||||||
(sort-field (if threads :date (plist-get plist :sort-field)))
|
(sort-field (if threads :date (plist-get plist :sort-field)))
|
||||||
@ -1080,13 +1080,11 @@ informative error message."
|
|||||||
(field-sort-field
|
(field-sort-field
|
||||||
(if (eq sortable-info t) field sortable-info))
|
(if (eq sortable-info t) field sortable-info))
|
||||||
;; only if we're actually looking at if for this column
|
;; only if we're actually looking at if for this column
|
||||||
(field-sort-field (and (eq field-sort-field sort-field) field-sort-field))
|
(current-sort-field (and (eq field-sort-field sort-field) field-sort-field))
|
||||||
(help (plist-get info :help))
|
(help (plist-get info :help))
|
||||||
;; triangle to mark the sorted-by column
|
;; triangle to mark the sorted-by column
|
||||||
(arrow
|
(name (concat (plist-get info :shortname)
|
||||||
(when field-sort-field
|
(if current-sort-field arrow "")))
|
||||||
(if reverse downarrow uparrow)))
|
|
||||||
(name (concat (plist-get info :shortname) arrow))
|
|
||||||
(map (make-sparse-keymap)))
|
(map (make-sparse-keymap)))
|
||||||
(define-key map [header-line mouse-1]
|
(define-key map [header-line mouse-1]
|
||||||
(mu4e~header-line-click field-sort-field threads))
|
(mu4e~header-line-click field-sort-field threads))
|
||||||
@ -1099,7 +1097,7 @@ informative error message."
|
|||||||
'face (when arrow 'bold)
|
'face (when arrow 'bold)
|
||||||
'help-echo help
|
'help-echo help
|
||||||
'mouse-face (when field-sort-field 'highlight)
|
'mouse-face (when field-sort-field 'highlight)
|
||||||
'keymap (when field-sort-field map)
|
'keymap map
|
||||||
'field field) " ")))
|
'field field) " ")))
|
||||||
mu4e-headers-fields))))
|
mu4e-headers-fields))))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user