mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 02:48:08 +01:00
emacs: Remove notmuch-search-authors-width' and fix the use of
notmuch-search-result-format' accordingly
The width of the authors field in search output was previously specified in two places: - `notmuch-search-authors-width': the limit beyond which the authors names are truncated, - `notmuch-search-result-format': the layout of the search results. Changing the configuration of one of these may have required the user to know about and adapt the other accordingly. This led to confusion. Instead, remove `notmuch-search-authors-width' and perform truncation based on the relevant field in `notmuch-search-result-format'. Approved-By: Jameson Rollins <jrollins@finestructure.net>
This commit is contained in:
parent
44982ab332
commit
b65bcb5f8f
1 changed files with 6 additions and 10 deletions
|
@ -54,15 +54,10 @@
|
||||||
(require 'notmuch-lib)
|
(require 'notmuch-lib)
|
||||||
(require 'notmuch-show)
|
(require 'notmuch-show)
|
||||||
|
|
||||||
(defcustom notmuch-search-authors-width 20
|
|
||||||
"Number of columns to use to display authors in a notmuch-search buffer."
|
|
||||||
:type 'integer
|
|
||||||
:group 'notmuch)
|
|
||||||
|
|
||||||
(defcustom notmuch-search-result-format
|
(defcustom notmuch-search-result-format
|
||||||
`(("date" . "%s ")
|
`(("date" . "%s ")
|
||||||
("count" . "%-7s ")
|
("count" . "%-7s ")
|
||||||
("authors" . ,(format "%%-%ds " notmuch-search-authors-width))
|
("authors" . "%-20s ")
|
||||||
("subject" . "%s ")
|
("subject" . "%s ")
|
||||||
("tags" . "(%s)"))
|
("tags" . "(%s)"))
|
||||||
"Search result formating. Supported fields are:
|
"Search result formating. Supported fields are:
|
||||||
|
@ -591,7 +586,11 @@ matching will be applied."
|
||||||
((string-equal field "count")
|
((string-equal field "count")
|
||||||
(insert (format (cdr (assoc field notmuch-search-result-format)) count)))
|
(insert (format (cdr (assoc field notmuch-search-result-format)) count)))
|
||||||
((string-equal field "authors")
|
((string-equal field "authors")
|
||||||
(insert (format (cdr (assoc field notmuch-search-result-format)) authors)))
|
(insert (let ((sample (format (cdr (assoc field notmuch-search-result-format)) "")))
|
||||||
|
(if (> (length authors)
|
||||||
|
(length sample))
|
||||||
|
(concat (substring authors 0 (- (length sample) 4)) "... ")
|
||||||
|
(format (cdr (assoc field notmuch-search-result-format)) authors)))))
|
||||||
((string-equal field "subject")
|
((string-equal field "subject")
|
||||||
(insert (format (cdr (assoc field notmuch-search-result-format)) subject)))
|
(insert (format (cdr (assoc field notmuch-search-result-format)) subject)))
|
||||||
((string-equal field "tags")
|
((string-equal field "tags")
|
||||||
|
@ -620,12 +619,9 @@ matching will be applied."
|
||||||
(date (match-string 2 string))
|
(date (match-string 2 string))
|
||||||
(count (match-string 3 string))
|
(count (match-string 3 string))
|
||||||
(authors (match-string 4 string))
|
(authors (match-string 4 string))
|
||||||
(authors-length (length authors))
|
|
||||||
(subject (match-string 5 string))
|
(subject (match-string 5 string))
|
||||||
(tags (match-string 6 string))
|
(tags (match-string 6 string))
|
||||||
(tag-list (if tags (save-match-data (split-string tags)))))
|
(tag-list (if tags (save-match-data (split-string tags)))))
|
||||||
(if (> authors-length notmuch-search-authors-width)
|
|
||||||
(set 'authors (concat (substring authors 0 (- notmuch-search-authors-width 3)) "...")))
|
|
||||||
(goto-char (point-max))
|
(goto-char (point-max))
|
||||||
(let ((beg (point-marker)))
|
(let ((beg (point-marker)))
|
||||||
(notmuch-search-show-result date count authors subject tags)
|
(notmuch-search-show-result date count authors subject tags)
|
||||||
|
|
Loading…
Reference in a new issue