1 Return-Path: <dmitry.kurochkin@gmail.com>
\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 4B06F429E25
\r
6 for <notmuch@notmuchmail.org>; Thu, 12 Jan 2012 09:41:28 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id kqaKiXgUoI85 for <notmuch@notmuchmail.org>;
\r
17 Thu, 12 Jan 2012 09:41:27 -0800 (PST)
\r
18 Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com
\r
19 [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 219CE431FB6
\r
22 for <notmuch@notmuchmail.org>; Thu, 12 Jan 2012 09:41:27 -0800 (PST)
\r
23 Received: by bkat2 with SMTP id t2so1657445bka.26
\r
24 for <notmuch@notmuchmail.org>; Thu, 12 Jan 2012 09:41:25 -0800 (PST)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
\r
26 h=from:to:cc:subject:in-reply-to:references:user-agent:date
\r
27 :message-id:mime-version:content-type;
\r
28 bh=xhRGczelEH7GmPscDOHxGg/G4Q4M7fYpadP4ePxp3Pc=;
\r
29 b=qFDPY65CldR5p0WdmuxJ+ktTp8uO+2J/CwYXM8oYNX25l7PVVoTR/132vuegWZZN3n
\r
30 byhOaLPGJrZA4ir7XIQEumxGRh6T2ynJW/aZxlKC7YFlTOTIm65px5WXX0geF42f1le0
\r
31 P3Q57MDtrxy9wGVXJHwvWzAxvlvILEDFB+VP4=
\r
32 Received: by 10.205.131.16 with SMTP id ho16mr1565127bkc.105.1326390085731;
\r
33 Thu, 12 Jan 2012 09:41:25 -0800 (PST)
\r
34 Received: from localhost ([91.144.186.21])
\r
35 by mx.google.com with ESMTPS id a17sm12142522bkz.7.2012.01.12.09.41.24
\r
36 (version=TLSv1/SSLv3 cipher=OTHER);
\r
37 Thu, 12 Jan 2012 09:41:25 -0800 (PST)
\r
38 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
\r
39 To: Pieter Praet <pieter@praet.org>, Jani Nikula <jani@nikula.org>
\r
40 Subject: Re: [PATCH] emacs: globally replace non-branching "(if (not ..." with
\r
42 In-Reply-To: <1326389586-21683-1-git-send-email-pieter@praet.org>
\r
43 References: <87vcogketu.fsf@praet.org>
\r
44 <1326389586-21683-1-git-send-email-pieter@praet.org>
\r
45 User-Agent: Notmuch/0.10.2+135~gb811a3c (http://notmuchmail.org) Emacs/23.3.1
\r
46 (x86_64-pc-linux-gnu)
\r
47 Date: Thu, 12 Jan 2012 21:40:34 +0400
\r
48 Message-ID: <87wr8wg6p9.fsf@gmail.com>
\r
50 Content-Type: text/plain; charset=us-ascii
\r
51 Cc: Notmuch Mail <notmuch@notmuchmail.org>
\r
52 X-BeenThere: notmuch@notmuchmail.org
\r
53 X-Mailman-Version: 2.1.13
\r
55 List-Id: "Use and development of the notmuch mail system."
\r
56 <notmuch.notmuchmail.org>
\r
57 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
58 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
59 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
60 List-Post: <mailto:notmuch@notmuchmail.org>
\r
61 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
62 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
63 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
64 X-List-Received-Date: Thu, 12 Jan 2012 17:41:28 -0000
\r
66 On Thu, 12 Jan 2012 18:33:06 +0100, Pieter Praet <pieter@praet.org> wrote:
\r
67 > Less code, same results, without sacrificing readability.
\r
76 > emacs/notmuch-address.el | 6 +++---
\r
77 > emacs/notmuch-hello.el | 20 ++++++++++----------
\r
78 > emacs/notmuch-show.el | 12 ++++++------
\r
79 > emacs/notmuch.el | 8 ++++----
\r
80 > 4 files changed, 23 insertions(+), 23 deletions(-)
\r
82 > diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
\r
83 > index 8eba7a0..d72b169 100644
\r
84 > --- a/emacs/notmuch-address.el
\r
85 > +++ b/emacs/notmuch-address.el
\r
86 > @@ -37,9 +37,9 @@ line."
\r
87 > (defvar notmuch-address-history nil)
\r
89 > (defun notmuch-address-message-insinuate ()
\r
90 > - (if (not (memq notmuch-address-message-alist-member message-completion-alist))
\r
91 > - (setq message-completion-alist
\r
92 > - (push notmuch-address-message-alist-member message-completion-alist))))
\r
93 > + (unless (memq notmuch-address-message-alist-member message-completion-alist)
\r
94 > + (setq message-completion-alist
\r
95 > + (push notmuch-address-message-alist-member message-completion-alist))))
\r
97 > (defun notmuch-address-options (original)
\r
98 > (process-lines notmuch-address-command original))
\r
99 > diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
\r
100 > index 333d4c1..dce2020 100644
\r
101 > --- a/emacs/notmuch-hello.el
\r
102 > +++ b/emacs/notmuch-hello.el
\r
103 > @@ -315,7 +315,7 @@ should be. Returns a cons cell `(tags-per-line width)'."
\r
105 > ;; If the last line was not full (and hence did not include a
\r
106 > ;; carriage return), insert one now.
\r
107 > - (if (not (eq (% count tags-per-line) 0))
\r
108 > + (unless (eq (% count tags-per-line) 0)
\r
109 > (widget-insert "\n"))
\r
110 > found-target-pos))
\r
112 > @@ -399,7 +399,7 @@ Complete list of currently available key bindings:
\r
114 > ; Jump through a hoop to get this value from the deprecated variable
\r
115 > ; name (`notmuch-folders') or from the default value.
\r
116 > - (if (not notmuch-saved-searches)
\r
117 > + (unless notmuch-saved-searches
\r
118 > (setq notmuch-saved-searches (notmuch-saved-searches)))
\r
121 > @@ -565,18 +565,18 @@ Complete list of currently available key bindings:
\r
122 > (widget-insert "\n\n")
\r
123 > (let ((start (point)))
\r
124 > (setq found-target-pos (notmuch-hello-insert-tags alltags-alist widest target))
\r
125 > - (if (not final-target-pos)
\r
126 > - (setq final-target-pos found-target-pos))
\r
127 > + (unless final-target-pos
\r
128 > + (setq final-target-pos found-target-pos))
\r
129 > (indent-rigidly start (point) notmuch-hello-indent)))
\r
131 > (widget-insert "\n")
\r
133 > - (if (not notmuch-show-all-tags-list)
\r
134 > - (widget-create 'push-button
\r
135 > - :notify (lambda (widget &rest ignore)
\r
136 > - (setq notmuch-show-all-tags-list t)
\r
137 > - (notmuch-hello-update))
\r
138 > - "Show all tags")))
\r
139 > + (unless notmuch-show-all-tags-list
\r
140 > + (widget-create 'push-button
\r
141 > + :notify (lambda (widget &rest ignore)
\r
142 > + (setq notmuch-show-all-tags-list t)
\r
143 > + (notmuch-hello-update))
\r
144 > + "Show all tags")))
\r
146 > (let ((start (point)))
\r
147 > (widget-insert "\n\n")
\r
148 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
149 > index 5502efd..d3543f0 100644
\r
150 > --- a/emacs/notmuch-show.el
\r
151 > +++ b/emacs/notmuch-show.el
\r
152 > @@ -659,8 +659,8 @@ current buffer, if possible."
\r
153 > ;; part, so we make sure that we're down at the end.
\r
154 > (goto-char (point-max))
\r
155 > ;; Ensure that the part ends with a carriage return.
\r
156 > - (if (not (bolp))
\r
157 > - (insert "\n")))
\r
159 > + (insert "\n")))
\r
161 > (defun notmuch-show-insert-body (msg body depth)
\r
162 > "Insert the body BODY at depth DEPTH in the current thread."
\r
163 > @@ -740,8 +740,8 @@ current buffer, if possible."
\r
164 > (setq body-start (point-marker))
\r
165 > (notmuch-show-insert-body msg (plist-get msg :body) depth)
\r
166 > ;; Ensure that the body ends with a newline.
\r
167 > - (if (not (bolp))
\r
171 > (setq body-end (point-marker))
\r
172 > (setq content-end (point-marker))
\r
174 > @@ -882,8 +882,8 @@ buffer."
\r
175 > (run-hooks 'notmuch-show-hook))
\r
177 > ;; Move straight to the first open message
\r
178 > - (if (not (notmuch-show-message-visible-p))
\r
179 > - (notmuch-show-next-open-message))
\r
180 > + (unless (notmuch-show-message-visible-p)
\r
181 > + (notmuch-show-next-open-message))
\r
183 > ;; Set the header line to the subject of the first open message.
\r
184 > (setq header-line-format (notmuch-show-strip-re (notmuch-show-get-subject)))
\r
185 > diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
186 > index 1e61775..ba84494 100644
\r
187 > --- a/emacs/notmuch.el
\r
188 > +++ b/emacs/notmuch.el
\r
189 > @@ -636,8 +636,8 @@ This function advances the next thread when finished."
\r
190 > (if notmuch-search-process-filter-data
\r
191 > (insert (concat "Error: Unexpected output from notmuch search:\n" notmuch-search-process-filter-data)))
\r
192 > (insert "End of search results.")
\r
193 > - (if (not (= exit-status 0))
\r
194 > - (insert (format " (process returned %d)" exit-status)))
\r
195 > + (unless (= exit-status 0)
\r
196 > + (insert (format " (process returned %d)" exit-status)))
\r
199 > (not (string= notmuch-search-target-thread "found")))
\r
200 > @@ -1006,8 +1006,8 @@ Invokes `notmuch-poll-script', \"notmuch new\", or does nothing
\r
201 > depending on the value of `notmuch-poll-script'."
\r
203 > (if (stringp notmuch-poll-script)
\r
204 > - (if (not (string= notmuch-poll-script ""))
\r
205 > - (call-process notmuch-poll-script nil nil))
\r
206 > + (unless (string= notmuch-poll-script "")
\r
207 > + (call-process notmuch-poll-script nil nil))
\r
208 > (call-process notmuch-command nil nil nil "new")))
\r
210 > (defun notmuch-search-poll-and-refresh-view ()
\r
214 > _______________________________________________
\r
215 > notmuch mailing list
\r
216 > notmuch@notmuchmail.org
\r
217 > http://notmuchmail.org/mailman/listinfo/notmuch
\r