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 0E2C1429E2E for ; Sun, 2 Jun 2013 10:26:06 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.098 X-Spam-Level: X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 07JLb-8f5E1i for ; Sun, 2 Jun 2013 10:25:58 -0700 (PDT) Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id ECD0D431FBC for ; Sun, 2 Jun 2013 10:25:57 -0700 (PDT) Received: from smtp.qmul.ac.uk ([138.37.6.40]) by mail2.qmul.ac.uk with esmtp (Exim 4.71) (envelope-from ) id 1UjC2N-0000fN-QP; Sun, 02 Jun 2013 18:25:50 +0100 Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost) by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71) (envelope-from ) id 1UjC2N-00029p-BR; Sun, 02 Jun 2013 18:25:47 +0100 From: Mark Walters To: david@tethera.net, notmuch@notmuchmail.org Subject: Re: [PATCH] emacs: replace setq + let with let* In-Reply-To: <1370185351-23834-1-git-send-email-david@tethera.net> References: <1370175370-13561-1-git-send-email-david@tethera.net> <1370185351-23834-1-git-send-email-david@tethera.net> User-Agent: Notmuch/0.14+255~gff3cc55 (http://notmuchmail.org) Emacs/23.4.1 (i486-pc-linux-gnu) Date: Sun, 02 Jun 2013 18:25:36 +0100 Message-ID: <878v2sv2zz.fsf@qmul.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Sender-Host-Address: 93.97.24.31 X-QM-SPAM-Info: Sender has good ham record. :) X-QM-Body-MD5: 67eabe4b552f1eef3ecffe4c3d34f2f5 (of first 20000 bytes) X-SpamAssassin-Score: -0.0 X-SpamAssassin-SpamBar: / X-SpamAssassin-Report: The QM spam filters have analysed this message to determine if it is spam. We require at least 5.0 points to mark a message as spam. This message scored -0.0 points. Summary of the scoring: * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider * (markwalters1009[at]gmail.com) * -0.0 AWL AWL: From: address is in the auto white-list X-QM-Scan-Virus: ClamAV says the message is clean Cc: David Bremner 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: Sun, 02 Jun 2013 17:26:06 -0000 On Sun, 02 Jun 2013, david@tethera.net wrote: > From: David Bremner > > 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 These look good to me except I don't see why the above is a let* not a let? Best wishes Mark > #'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 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch