[PATCH] emacs: replace setq + let with let*
authordavid <david@tethera.net>
Sun, 2 Jun 2013 15:02:31 +0000 (12:02 +2100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:55:19 +0000 (09:55 -0800)
15/4b541065a57fcd002b82989c1c007bea9f64c9 [new file with mode: 0644]

diff --git a/15/4b541065a57fcd002b82989c1c007bea9f64c9 b/15/4b541065a57fcd002b82989c1c007bea9f64c9
new file mode 100644 (file)
index 0000000..c98ca44
--- /dev/null
@@ -0,0 +1,119 @@
+Return-Path: <bremner@tethera.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id EA451421168\r
+       for <notmuch@notmuchmail.org>; Sun,  2 Jun 2013 08:02:58 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.3\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id 1k5FWg+Kym6O for <notmuch@notmuchmail.org>;\r
+       Sun,  2 Jun 2013 08:02:53 -0700 (PDT)\r
+Received: from tempo.its.unb.ca (tempo.its.unb.ca [131.202.1.21])\r
+       (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id EBBCC429E58\r
+       for <notmuch@notmuchmail.org>; Sun,  2 Jun 2013 08:02:52 -0700 (PDT)\r
+Received: from tesseract.cs.unb.ca (tesseract.cs.unb.ca [131.202.240.238])\r
+       by tempo.its.unb.ca (8.13.8/8.13.8) with ESMTP id r52F2jca020729;\r
+       Sun, 2 Jun 2013 12:02:45 -0300\r
+Received: from fctnnbsc30w-156034082078.dhcp-dynamic.fibreop.nb.bellaliant.net\r
+       ([156.34.82.78] helo=zancas.localnet)\r
+       by tesseract.cs.unb.ca with esmtpsa\r
+       (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80)\r
+       (envelope-from <bremner@tethera.net>)\r
+       id 1Uj9nx-0006vI-En; Sun, 02 Jun 2013 12:02:45 -0300\r
+Received: from bremner by zancas.localnet with local (Exim 4.80)\r
+       (envelope-from <bremner@tethera.net>)\r
+       id 1Uj9nr-0006DH-LW; Sun, 02 Jun 2013 12:02:39 -0300\r
+From: david@tethera.net\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] emacs: replace setq + let with let*\r
+Date: Sun,  2 Jun 2013 12:02:31 -0300\r
+Message-Id: <1370185351-23834-1-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 1.8.2.rc2\r
+In-Reply-To: <1370175370-13561-1-git-send-email-david@tethera.net>\r
+References: <1370175370-13561-1-git-send-email-david@tethera.net>\r
+X-Spam_bar: -\r
+Cc: David Bremner <bremner@debian.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 02 Jun 2013 15:02:59 -0000\r
+\r
+From: David Bremner <bremner@debian.org>\r
+\r
+I found several places where a setq is immediately followed by a let\r
+or a let*. This seems to be the pessimal combination, with the\r
+implicit scope of the setq combined with the extra indentation of the let.\r
+I combined these cases into a single let* which I think is easier to read.\r
+In two places I turned a single clause let into a let*.\r
+---\r
+ emacs/notmuch-hello.el | 4 ++--\r
+ emacs/notmuch-show.el  | 4 ++--\r
+ emacs/notmuch.el       | 5 ++---\r
+ 3 files changed, 6 insertions(+), 7 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
+index c1c6f4b..15e3614 100644\r
+--- a/emacs/notmuch-hello.el\r
++++ b/emacs/notmuch-hello.el\r
+@@ -260,8 +260,8 @@ afterwards.")\r
+ (defun notmuch-hello-search (&optional search)\r
+   (interactive)\r
+   (unless (null search)\r
+-    (setq search (notmuch-hello-trim search))\r
+-    (let ((history-delete-duplicates t))\r
++    (let* ((search (notmuch-hello-trim search))\r
++         (history-delete-duplicates t))\r
+       (add-to-history 'notmuch-search-history search)))\r
+   (notmuch-search search notmuch-search-oldest-first nil nil\r
+                 #'notmuch-hello-search-continuation))\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 18b4671..e8c8343 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -1734,8 +1734,8 @@ TAG-CHANGES is a list of tag operations for `notmuch-tag'."\r
\r
+ See `notmuch-tag' for information on the format of TAG-CHANGES."\r
+   (interactive)\r
+-  (setq tag-changes (notmuch-tag (notmuch-show-get-message-id) tag-changes))\r
+-  (let* ((current-tags (notmuch-show-get-tags))\r
++  (let* ((tag-changes (notmuch-tag (notmuch-show-get-message-id) tag-changes))\r
++       (current-tags (notmuch-show-get-tags))\r
+        (new-tags (notmuch-update-tags current-tags tag-changes)))\r
+     (unless (equal current-tags new-tags)\r
+       (notmuch-show-set-tags new-tags))))\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index af107e2..edb5a1c 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -904,9 +904,8 @@ Other optional parameters are used as follows:\r
+   target-line: The line number to move to if the target thread does not\r
+                appear in the search results."\r
+   (interactive)\r
+-  (if (null query)\r
+-      (setq query (notmuch-read-query "Notmuch search: ")))\r
+-  (let ((buffer (get-buffer-create (notmuch-search-buffer-title query))))\r
++  (let* ((query (or query (notmuch-read-query "Notmuch search: ")))\r
++       (buffer (get-buffer-create (notmuch-search-buffer-title query))))\r
+     (switch-to-buffer buffer)\r
+     (notmuch-search-mode)\r
+     ;; Don't track undo information for this buffer\r
+-- \r
+1.8.2.rc2\r
+\r