]> git.notmuchmail.org Git - notmuch/commitdiff
emacs: Fix `notmuch-search-insert-field'
authorDavid Edmondson <dme@dme.org>
Mon, 26 Apr 2010 12:16:07 +0000 (13:16 +0100)
committerCarl Worth <cworth@cworth.org>
Mon, 26 Apr 2010 15:23:48 +0000 (08:23 -0700)
Compare the formatted version of the authors with the formatted sample
string rather than the un-formatted authors with the formatted sample
string.

emacs/notmuch.el

index 378c004bfa69ddbbe6c8354667c5a912422fa32b..eecff23ebbe036b43a9b519f840314c395147bf6 100644 (file)
@@ -582,11 +582,13 @@ matching will be applied."
    ((string-equal field "count")
     (insert (format (cdr (assoc field notmuch-search-result-format)) count)))
    ((string-equal field "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)))))
+    (insert (let* ((format-string (cdr (assoc field notmuch-search-result-format)))
+                  (formatted-sample (format format-string ""))
+                  (formatted-authors (format format-string authors)))
+             (if (> (length formatted-authors)
+                    (length formatted-sample))
+                 (concat (substring authors 0 (- (length formatted-sample) 4)) "... ")
+               formatted-authors))))
    ((string-equal field "subject")
     (insert (format (cdr (assoc field notmuch-search-result-format)) subject)))
    ((string-equal field "tags")