[PATCH 1/3] emacs: Stop the `truncate-string-to-width' madness.

David Edmondson dme at dme.org
Wed Jan 25 05:48:32 PST 2012


There's no need to call `truncate-string-to-width' twice in this code
path.
---
 emacs/notmuch.el |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 3ec0816..3f6b977 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -441,18 +441,16 @@ Complete list of currently available key bindings:
   (interactive "P")
   (let ((thread-id (notmuch-search-find-thread-id))
 	(subject (notmuch-search-find-subject)))
+
+    (if (string-match "^[ \t]*$" subject)
+	(setq subject "[No 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))
+		      ;; Name the buffer based on the subject.
+		      (concat "*" (truncate-string-to-width subject 30 nil nil t) "*")
 		      crypto-switch)
       (message "End of search results."))))
 
-- 
1.7.8.3



More information about the notmuch mailing list