From: david@tethera.net
To: notmuch@notmuchmail.org
Cc: David Bremner <bremner@debian.org>
Subject: [PATCH] emacs: replace setq + let with let*
Date: Sun, 2 Jun 2013 12:02:31 -0300 [thread overview]
Message-ID: <1370185351-23834-1-git-send-email-david@tethera.net> (raw)
In-Reply-To: <1370175370-13561-1-git-send-email-david@tethera.net>
From: David Bremner <bremner@debian.org>
I found several places where a setq is immediately followed by a let
or a let*. This seems to be the pessimal combination, with the
implicit scope of the setq combined with the extra indentation of the let.
I combined these cases into a single let* which I think is easier to read.
In two places I turned a single clause let into a let*.
---
emacs/notmuch-hello.el | 4 ++--
emacs/notmuch-show.el | 4 ++--
emacs/notmuch.el | 5 ++---
3 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index c1c6f4b..15e3614 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -260,8 +260,8 @@ afterwards.")
(defun notmuch-hello-search (&optional search)
(interactive)
(unless (null search)
- (setq search (notmuch-hello-trim search))
- (let ((history-delete-duplicates t))
+ (let* ((search (notmuch-hello-trim search))
+ (history-delete-duplicates t))
(add-to-history 'notmuch-search-history search)))
(notmuch-search search notmuch-search-oldest-first nil nil
#'notmuch-hello-search-continuation))
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 18b4671..e8c8343 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1734,8 +1734,8 @@ TAG-CHANGES is a list of tag operations for `notmuch-tag'."
See `notmuch-tag' for information on the format of TAG-CHANGES."
(interactive)
- (setq tag-changes (notmuch-tag (notmuch-show-get-message-id) tag-changes))
- (let* ((current-tags (notmuch-show-get-tags))
+ (let* ((tag-changes (notmuch-tag (notmuch-show-get-message-id) tag-changes))
+ (current-tags (notmuch-show-get-tags))
(new-tags (notmuch-update-tags current-tags tag-changes)))
(unless (equal current-tags new-tags)
(notmuch-show-set-tags new-tags))))
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index af107e2..edb5a1c 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -904,9 +904,8 @@ Other optional parameters are used as follows:
target-line: The line number to move to if the target thread does not
appear in the search results."
(interactive)
- (if (null query)
- (setq query (notmuch-read-query "Notmuch search: ")))
- (let ((buffer (get-buffer-create (notmuch-search-buffer-title query))))
+ (let* ((query (or query (notmuch-read-query "Notmuch search: ")))
+ (buffer (get-buffer-create (notmuch-search-buffer-title query))))
(switch-to-buffer buffer)
(notmuch-search-mode)
;; Don't track undo information for this buffer
--
1.8.2.rc2
next prev parent reply other threads:[~2013-06-02 15:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-02 12:16 [PATCH] emacs: replace (funcall 'foo ...) with (foo ...) david
2013-06-02 14:30 ` Tomi Ollila
2013-06-02 15:02 ` david [this message]
2013-06-02 17:25 ` [PATCH] emacs: replace setq + let with let* Mark Walters
2013-06-03 0:01 ` David Bremner
2013-06-02 17:36 ` [PATCH] emacs: replace (funcall 'foo ...) with (foo ...) Mark Walters
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1370185351-23834-1-git-send-email-david@tethera.net \
--to=david@tethera.net \
--cc=bremner@debian.org \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).