From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id E1A16429E34 for ; Mon, 30 Jan 2012 02:16:07 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0vCTdVz4Uj7W for ; Mon, 30 Jan 2012 02:16:07 -0800 (PST) Received: from mail-we0-f181.google.com (mail-we0-f181.google.com [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 60188431FBC for ; Mon, 30 Jan 2012 02:16:07 -0800 (PST) Received: by werb10 with SMTP id b10so3639029wer.26 for ; Mon, 30 Jan 2012 02:16:06 -0800 (PST) Received: by 10.216.133.104 with SMTP id p82mr6775390wei.6.1327918566118; Mon, 30 Jan 2012 02:16:06 -0800 (PST) Received: from hotblack-desiato.hh.sledj.net (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25]) by mx.google.com with ESMTPS id bj10sm29070795wib.9.2012.01.30.02.16.04 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 30 Jan 2012 02:16:05 -0800 (PST) Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000) id 1415FA0CE8; Mon, 30 Jan 2012 10:16:03 +0000 (GMT) From: David Edmondson To: notmuch@notmuchmail.org Subject: [PATCH 1/2 v2] emacs: Stop the `truncate-string-to-width' madness. Date: Mon, 30 Jan 2012 10:16:00 +0000 Message-Id: <1327918561-16245-2-git-send-email-dme@dme.org> X-Mailer: git-send-email 1.7.8.3 In-Reply-To: <1327918561-16245-1-git-send-email-dme@dme.org> References: <1327496913-4946-1-git-send-email-dme@dme.org> <1327918561-16245-1-git-send-email-dme@dme.org> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jan 2012 10:16:08 -0000 There's no need to call `truncate-string-to-width' twice in this code path. --- emacs/notmuch.el | 22 ++++++++++------------ 1 files changed, 10 insertions(+), 12 deletions(-) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 72f78ed..d4d6904 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -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) -- 1.7.8.3