emacs: Stop the `truncate-string-to-width' madness.
authorDavid Edmondson <dme@dme.org>
Mon, 30 Jan 2012 10:16:00 +0000 (10:16 +0000)
committerDavid Bremner <bremner@debian.org>
Sat, 4 Feb 2012 01:19:00 +0000 (21:19 -0400)
There's no need to call `truncate-string-to-width' twice in this code
path.

emacs/notmuch.el

index 5fa239afe14dffa1ffc8f57c7eb98e545a5bf488..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)