Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 19DCD431E84 for ; Wed, 25 Jan 2012 05:48:41 -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 l+6WMBJihVL5 for ; Wed, 25 Jan 2012 05:48:40 -0800 (PST) Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 79488431FD5 for ; Wed, 25 Jan 2012 05:48:40 -0800 (PST) Received: by wgbdt12 with SMTP id dt12so4808697wgb.2 for ; Wed, 25 Jan 2012 05:48:39 -0800 (PST) MIME-Version: 1.0 Received: by 10.180.19.130 with SMTP id f2mr11315186wie.12.1327499319293; Wed, 25 Jan 2012 05:48:39 -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 em13sm24450670wid.7.2012.01.25.05.48.37 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 25 Jan 2012 05:48:38 -0800 (PST) Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000) id 1C3C39FE6A; Wed, 25 Jan 2012 13:48:36 +0000 (GMT) From: David Edmondson To: notmuch@notmuchmail.org Subject: [PATCH 1/3] emacs: Stop the `truncate-string-to-width' madness. Date: Wed, 25 Jan 2012 13:48:32 +0000 Message-Id: <1327499314-7887-2-git-send-email-dme@dme.org> X-Mailer: git-send-email 1.7.8.3 In-Reply-To: <1327499314-7887-1-git-send-email-dme@dme.org> References: <1327496913-4946-1-git-send-email-dme@dme.org> <1327499314-7887-1-git-send-email-dme@dme.org> X-Gm-Message-State: ALoCoQnCAOEQZ0sZUam5AsijUP2GPj3tYxXou+S/Vf6sU17+p8CzwpE/AJtQCo83M5mNVO/N1NmH 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: Wed, 25 Jan 2012 13:48:41 -0000 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