]> git.notmuchmail.org Git - notmuch/blobdiff - emacs/notmuch.el
emacs: Stop the `truncate-string-to-width' madness.
[notmuch] / emacs / notmuch.el
index 72f78edcbcd401e5a729b1586753c143734ce52d..05c2ff7a77ecee826bb9dc6aea7c192272e9be58 100644 (file)
@@ -469,18 +469,16 @@ Complete list of currently available key bindings:
   (let ((thread-id (notmuch-search-find-thread-id))
        (subject (notmuch-search-find-subject)))
     (if (> (length thread-id) 0)
-       (notmuch-show thread-id
-                     (current-buffer)
-                     notmuch-search-query-string
-                     ;; name the buffer based on notmuch-search-find-subject
-                     (if (string-match "^[ \t]*$" subject)
-                         "[No Subject]"
-                       (truncate-string-to-width
-                        (concat "*"
-                                (truncate-string-to-width subject 32 nil nil t)
-                                "*")
-                        32 nil nil t))
-                     crypto-switch)
+       (progn
+         (if (string-match "^[ \t]*$" subject)
+             (setq subject "[No Subject]"))
+
+         (notmuch-show thread-id
+                       (current-buffer)
+                       notmuch-search-query-string
+                       ;; Name the buffer based on the subject.
+                       (concat "*" (truncate-string-to-width subject 30 nil nil t) "*")
+                       crypto-switch))
       (message "End of search results."))))
 
 (defun notmuch-search-reply-to-thread (&optional prompt-for-sender)
@@ -673,17 +671,16 @@ This function advances the next thread when finished."
                  (goto-char (point-max))
                  (if (eq status 'signal)
                      (insert "Incomplete search results (search process was killed).\n"))
-                 (if (eq status 'exit)
-                     (progn
-                       (if notmuch-search-process-filter-data
-                           (insert (concat "Error: Unexpected output from notmuch search:\n" notmuch-search-process-filter-data)))
-                       (insert "End of search results.")
-                       (unless (= exit-status 0)
-                         (insert (format " (process returned %d)" exit-status)))
-                       (insert "\n")
-                       (if (and atbob
-                                (not (string= notmuch-search-target-thread "found")))
-                           (set 'never-found-target-thread t))))))
+                 (when (eq status 'exit)
+                   (if notmuch-search-process-filter-data
+                       (insert (concat "Error: Unexpected output from notmuch search:\n" notmuch-search-process-filter-data)))
+                   (insert "End of search results.")
+                   (unless (= exit-status 0)
+                     (insert (format " (process returned %d)" exit-status)))
+                   (insert "\n")
+                   (if (and atbob
+                            (not (string= notmuch-search-target-thread "found")))
+                       (set 'never-found-target-thread t)))))
              (when (and never-found-target-thread
                       notmuch-search-target-line)
                  (goto-char (point-min))
@@ -861,10 +858,9 @@ non-authors is found, assume that all of the authors match."
                        (put-text-property beg (point) 'notmuch-search-thread-id thread-id)
                        (put-text-property beg (point) 'notmuch-search-authors authors)
                        (put-text-property beg (point) 'notmuch-search-subject subject)
-                       (if (string= thread-id notmuch-search-target-thread)
-                           (progn
-                             (set 'found-target beg)
-                             (set 'notmuch-search-target-thread "found"))))
+                       (when (string= thread-id notmuch-search-target-thread)
+                         (set 'found-target beg)
+                         (set 'notmuch-search-target-thread "found")))
                      (set 'line (match-end 0)))
                  (set 'more nil)
                  (while (and (< line (length string)) (= (elt string line) ?\n))