mu4e-headers: avoid some too-long lines

In the source code.
This commit is contained in:
Dirk-Jan C. Binnema 2023-01-15 09:00:25 +02:00
parent 7b9fed6028
commit b37cf7341b
1 changed files with 26 additions and 15 deletions

View File

@ -259,15 +259,17 @@ The first character of NAME is used as the shortcut.")
(lambda (msg bytes) (> (mu4e-msg-field msg :size) (* 1024 bytes))) (lambda (msg bytes) (> (mu4e-msg-field msg :size) (* 1024 bytes)))
(lambda () (read-number "Match messages bigger than (Kbytes): ")))) (lambda () (read-number "Match messages bigger than (Kbytes): "))))
"List of custom markers -- functions to mark message that match "List of custom markers -- functions to mark message that match
some custom function. Each of the list members has the following format: some custom function. Each of the list members has the following
format:
(NAME PREDICATE-FUNC PARAM-FUNC) (NAME PREDICATE-FUNC PARAM-FUNC)
* NAME is the name of the predicate function, and the first character * NAME is the name of the predicate function, and the first
is the shortcut (so keep those unique). character is the shortcut (so keep those unique).
* PREDICATE-FUNC is a function that takes two parameters, MSG * PREDICATE-FUNC is a function that takes two parameters, MSG
and (optionally) PARAM, and should return non-nil when there's a and (optionally) PARAM, and should return non-nil when there's a
match. match.
* PARAM-FUNC is function that is evaluated once, and its value is then passed to * PARAM-FUNC is function that is evaluated once, and its value is
PREDICATE-FUNC as PARAM. This is useful for getting user-input.") then passed to PREDICATE-FUNC as PARAM. This is useful for
getting user-input.")
;;; Internal variables/constants ;;; Internal variables/constants
;; docid cookies ;; docid cookies
@ -1016,36 +1018,45 @@ after the end of the search results."
(mapcar (mapcar
(lambda (item) (lambda (item)
(let* (;; with threading enabled, we're necessarily sorting by date. (let* (;; with threading enabled, we're necessarily sorting by date.
(sort-field (if mu4e-search-threads :date mu4e-search-sort-field)) (sort-field (if mu4e-search-threads
:date mu4e-search-sort-field))
(field (car item)) (width (cdr item)) (field (car item)) (width (cdr item))
(info (cdr (assoc field (info (cdr (assoc field
(append mu4e-header-info mu4e-header-info-custom)))) (append mu4e-header-info
mu4e-header-info-custom))))
(sortable (plist-get info :sortable)) (sortable (plist-get info :sortable))
;; if sortable, it is either t (when field is sortable itself) ;; if sortable, it is either t (when field is sortable itself)
;; or a symbol (if another field is used for sorting) ;; or a symbol (if another field is used for sorting)
(this-field (when sortable (if (booleanp sortable) field sortable))) (this-field (when sortable (if (booleanp sortable)
field
sortable)))
(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 (arrow
(when (and sortable (eq this-field sort-field)) (when (and sortable (eq this-field sort-field))
(if (eq mu4e-search-sort-direction 'descending) downarrow uparrow))) (if (eq mu4e-search-sort-direction 'descending)
downarrow
uparrow)))
(name (concat (plist-get info :shortname) arrow)) (name (concat (plist-get info :shortname) arrow))
(map (make-sparse-keymap))) (map (make-sparse-keymap)))
(when sortable (when sortable
(define-key map [header-line mouse-1] (define-key map [header-line mouse-1]
(lambda (&optional e) (lambda (&optional e)
;; getting the field, inspired by `tabulated-list-col-sort' ;; getting the field, inspired by
;; `tabulated-list-col-sort'
(interactive "e") (interactive "e")
(let* ((obj (posn-object (event-start e))) (let* ((obj (posn-object (event-start e)))
(field (field
(and obj (get-text-property 0 'field (car obj))))) (and obj
;; "t": if we're already sorted by field, the sort-order is (get-text-property 0 'field (car obj)))))
;; changed ;; "t": if we're already sorted by field, the
;; sort-order is changed
(mu4e-search-change-sorting field t))))) (mu4e-search-change-sorting field t)))))
(concat (concat
(propertize (propertize
(if width (if width
(truncate-string-to-width name width 0 ?\s truncate-string-ellipsis) (truncate-string-to-width
name width 0 ?\s truncate-string-ellipsis)
name) name)
'face (when arrow 'bold) 'face (when arrow 'bold)
'help-echo help 'help-echo help
@ -1526,7 +1537,7 @@ region if there is a region, then move to the next message."
(when mu4e-headers-advance-after-mark (mu4e-headers-next))) (when mu4e-headers-advance-after-mark (mu4e-headers-next)))
(defun mu4e~headers-quit-buffer () (defun mu4e~headers-quit-buffer ()
"Quit the mu4e-headers buffer." "Quit the mu4e-headers buffer and go back to the main view."
(interactive) (interactive)
(mu4e-mark-handle-when-leaving) (mu4e-mark-handle-when-leaving)
(quit-window t) (quit-window t)