1 Return-Path: <bremner@tethera.net>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id EA451421168
\r
6 for <notmuch@notmuchmail.org>; Sun, 2 Jun 2013 08:02:58 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id 1k5FWg+Kym6O for <notmuch@notmuchmail.org>;
\r
16 Sun, 2 Jun 2013 08:02:53 -0700 (PDT)
\r
17 Received: from tempo.its.unb.ca (tempo.its.unb.ca [131.202.1.21])
\r
18 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id EBBCC429E58
\r
21 for <notmuch@notmuchmail.org>; Sun, 2 Jun 2013 08:02:52 -0700 (PDT)
\r
22 Received: from tesseract.cs.unb.ca (tesseract.cs.unb.ca [131.202.240.238])
\r
23 by tempo.its.unb.ca (8.13.8/8.13.8) with ESMTP id r52F2jca020729;
\r
24 Sun, 2 Jun 2013 12:02:45 -0300
\r
25 Received: from fctnnbsc30w-156034082078.dhcp-dynamic.fibreop.nb.bellaliant.net
\r
26 ([156.34.82.78] helo=zancas.localnet)
\r
27 by tesseract.cs.unb.ca with esmtpsa
\r
28 (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80)
\r
29 (envelope-from <bremner@tethera.net>)
\r
30 id 1Uj9nx-0006vI-En; Sun, 02 Jun 2013 12:02:45 -0300
\r
31 Received: from bremner by zancas.localnet with local (Exim 4.80)
\r
32 (envelope-from <bremner@tethera.net>)
\r
33 id 1Uj9nr-0006DH-LW; Sun, 02 Jun 2013 12:02:39 -0300
\r
34 From: david@tethera.net
\r
35 To: notmuch@notmuchmail.org
\r
36 Subject: [PATCH] emacs: replace setq + let with let*
\r
37 Date: Sun, 2 Jun 2013 12:02:31 -0300
\r
38 Message-Id: <1370185351-23834-1-git-send-email-david@tethera.net>
\r
39 X-Mailer: git-send-email 1.8.2.rc2
\r
40 In-Reply-To: <1370175370-13561-1-git-send-email-david@tethera.net>
\r
41 References: <1370175370-13561-1-git-send-email-david@tethera.net>
\r
43 Cc: David Bremner <bremner@debian.org>
\r
44 X-BeenThere: notmuch@notmuchmail.org
\r
45 X-Mailman-Version: 2.1.13
\r
47 List-Id: "Use and development of the notmuch mail system."
\r
48 <notmuch.notmuchmail.org>
\r
49 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
50 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
51 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
52 List-Post: <mailto:notmuch@notmuchmail.org>
\r
53 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
54 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
55 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
56 X-List-Received-Date: Sun, 02 Jun 2013 15:02:59 -0000
\r
58 From: David Bremner <bremner@debian.org>
\r
60 I found several places where a setq is immediately followed by a let
\r
61 or a let*. This seems to be the pessimal combination, with the
\r
62 implicit scope of the setq combined with the extra indentation of the let.
\r
63 I combined these cases into a single let* which I think is easier to read.
\r
64 In two places I turned a single clause let into a let*.
\r
66 emacs/notmuch-hello.el | 4 ++--
\r
67 emacs/notmuch-show.el | 4 ++--
\r
68 emacs/notmuch.el | 5 ++---
\r
69 3 files changed, 6 insertions(+), 7 deletions(-)
\r
71 diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
\r
72 index c1c6f4b..15e3614 100644
\r
73 --- a/emacs/notmuch-hello.el
\r
74 +++ b/emacs/notmuch-hello.el
\r
75 @@ -260,8 +260,8 @@ afterwards.")
\r
76 (defun notmuch-hello-search (&optional search)
\r
78 (unless (null search)
\r
79 - (setq search (notmuch-hello-trim search))
\r
80 - (let ((history-delete-duplicates t))
\r
81 + (let* ((search (notmuch-hello-trim search))
\r
82 + (history-delete-duplicates t))
\r
83 (add-to-history 'notmuch-search-history search)))
\r
84 (notmuch-search search notmuch-search-oldest-first nil nil
\r
85 #'notmuch-hello-search-continuation))
\r
86 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
87 index 18b4671..e8c8343 100644
\r
88 --- a/emacs/notmuch-show.el
\r
89 +++ b/emacs/notmuch-show.el
\r
90 @@ -1734,8 +1734,8 @@ TAG-CHANGES is a list of tag operations for `notmuch-tag'."
\r
92 See `notmuch-tag' for information on the format of TAG-CHANGES."
\r
94 - (setq tag-changes (notmuch-tag (notmuch-show-get-message-id) tag-changes))
\r
95 - (let* ((current-tags (notmuch-show-get-tags))
\r
96 + (let* ((tag-changes (notmuch-tag (notmuch-show-get-message-id) tag-changes))
\r
97 + (current-tags (notmuch-show-get-tags))
\r
98 (new-tags (notmuch-update-tags current-tags tag-changes)))
\r
99 (unless (equal current-tags new-tags)
\r
100 (notmuch-show-set-tags new-tags))))
\r
101 diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
102 index af107e2..edb5a1c 100644
\r
103 --- a/emacs/notmuch.el
\r
104 +++ b/emacs/notmuch.el
\r
105 @@ -904,9 +904,8 @@ Other optional parameters are used as follows:
\r
106 target-line: The line number to move to if the target thread does not
\r
107 appear in the search results."
\r
110 - (setq query (notmuch-read-query "Notmuch search: ")))
\r
111 - (let ((buffer (get-buffer-create (notmuch-search-buffer-title query))))
\r
112 + (let* ((query (or query (notmuch-read-query "Notmuch search: ")))
\r
113 + (buffer (get-buffer-create (notmuch-search-buffer-title query))))
\r
114 (switch-to-buffer buffer)
\r
115 (notmuch-search-mode)
\r
116 ;; Don't track undo information for this buffer
\r