[PATCH 1/3] emacs: Stop the `truncate-string-to-width' madness.
Austin Clements
amdragon at MIT.EDU
Fri Jan 27 21:09:58 PST 2012
Quoth David Edmondson on Jan 25 at 1:48 pm:
> There's no need to call `truncate-string-to-width' twice in this code
> path.
LGTM if what I point out below is okay. Technically this changes the
behavior of this code, but what it did before was obviously wrong (if
you do roll a new version, I'd mention this in the commit message; but
no need to do that just for this).
> ---
> 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]"))
> +
Is subject necessarily a string at this point? Previously this only
ran if the code determined there was a thread at point.
> (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."))))
>
More information about the notmuch
mailing list