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 69C3D431FB6 for ; Fri, 27 Jan 2012 21:10:45 -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 yb5NoeL-3oo6 for ; Fri, 27 Jan 2012 21:10:44 -0800 (PST) Received: from dmz-mailsec-scanner-6.mit.edu (DMZ-MAILSEC-SCANNER-6.MIT.EDU [18.7.68.35]) by olra.theworths.org (Postfix) with ESMTP id BE036431FAE for ; Fri, 27 Jan 2012 21:10:44 -0800 (PST) X-AuditID: 12074423-b7f9c6d0000008c3-13-4f238353ad1d Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP id C5.1B.02243.353832F4; Sat, 28 Jan 2012 00:10:43 -0500 (EST) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id q0S5AgIX029389; Sat, 28 Jan 2012 00:10:43 -0500 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q0S5AfbL007759 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Sat, 28 Jan 2012 00:10:42 -0500 (EST) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) (envelope-from ) id 1Rr0Y2-000502-PU; Sat, 28 Jan 2012 00:09:58 -0500 Date: Sat, 28 Jan 2012 00:09:58 -0500 From: Austin Clements To: David Edmondson Subject: Re: [PATCH 1/3] emacs: Stop the `truncate-string-to-width' madness. Message-ID: <20120128050958.GA17991@mit.edu> References: <1327496913-4946-1-git-send-email-dme@dme.org> <1327499314-7887-1-git-send-email-dme@dme.org> <1327499314-7887-2-git-send-email-dme@dme.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1327499314-7887-2-git-send-email-dme@dme.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmphleLIzCtJLcpLzFFi42IR4hTV1g1uVvY3WNQsb7HvzhYmi+s3ZzI7 MHnsev6XyePZqlvMAUxRXDYpqTmZZalF+nYJXBn3jr9kLJjKW9HauIalgfEPZxcjJ4eEgIlE 84vdjBC2mMSFe+vZuhi5OIQE9jFKPN44iwnC2cAo0dW4GSpzkkni18dWVghnCaPE5vvT2bsY OThYBFQljj6zBhnFJqAhsW3/crCxIgKKEv+/rWAHsZkFpCW+/W5mArGFBXwk3p5cwAJi8wro SEzsP8sCMXMOo8TbP0uYIBKCEidnPmGBaNaSuPHvJRPILpBBy/9xgIQ5Bawl5nScAZsvKqAi MeXkNrYJjEKzkHTPQtI9C6F7ASPzKkbZlNwq3dzEzJzi1GTd4uTEvLzUIl0zvdzMEr3UlNJN jKDAZndR3sH456DSIUYBDkYlHt4Lr5T8hVgTy4orcw8xSnIwKYnyZjYo+wvxJeWnVGYkFmfE F5XmpBYfYpTgYFYS4b3jpegvxJuSWFmVWpQPk5LmYFES59XQeucnJJCeWJKanZpakFoEk5Xh 4FCS4J3SBDRUsCg1PbUiLTOnBCHNxMEJMpwHaPgckBre4oLE3OLMdIj8KUZFKXHeXSAJAZBE RmkeXC8s8bxiFAd6RZh3EUgVDzBpwXW/AhrMBDQ44irI1cUliQgpqQZGt/D2mCts6dz7Vk36 8GL+9cWvwrkTI/taVyb+dPt6hePs3Uw11cDT9T/OJatXclovY/f7ayex1+rf85KNUfaJczwb PypFZXb9+beHWaWh6LKPyuXP7NPzKyMEneSY9zEI20zeteNsns1/Xr2Hk/fl31BTZzS+eLwr pS236VOSU+2tuvuXrooqsRRnJBpqMRcVJwIAP2VizhcDAAA= Cc: notmuch@notmuchmail.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: Sat, 28 Jan 2012 05:10:45 -0000 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.")))) >