1 Return-Path: <pieter@praet.org>
\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 30B2A429E27
\r
6 for <notmuch@notmuchmail.org>; Thu, 12 Jan 2012 09:35:09 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 RhtfeinOnArS for <notmuch@notmuchmail.org>;
\r
16 Thu, 12 Jan 2012 09:35:08 -0800 (PST)
\r
17 Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com
\r
18 [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
19 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
20 66422429E26 for <notmuch@notmuchmail.org>; Thu, 12 Jan 2012 09:35:08 -0800
\r
22 Received: by wgbds11 with SMTP id ds11so1972941wgb.2
\r
23 for <notmuch@notmuchmail.org>; Thu, 12 Jan 2012 09:35:07 -0800 (PST)
\r
24 Received: by 10.180.84.163 with SMTP id a3mr6723984wiz.3.1326389702343;
\r
25 Thu, 12 Jan 2012 09:35:02 -0800 (PST)
\r
26 Received: from localhost ([109.131.126.209])
\r
27 by mx.google.com with ESMTPS id fo18sm6533501wbb.12.2012.01.12.09.35.01
\r
28 (version=TLSv1/SSLv3 cipher=OTHER);
\r
29 Thu, 12 Jan 2012 09:35:02 -0800 (PST)
\r
30 From: Pieter Praet <pieter@praet.org>
\r
31 To: Jani Nikula <jani@nikula.org>
\r
32 Subject: [PATCH] emacs: globally replace non-branching "(if (not ..." with
\r
34 Date: Thu, 12 Jan 2012 18:33:06 +0100
\r
35 Message-Id: <1326389586-21683-1-git-send-email-pieter@praet.org>
\r
36 X-Mailer: git-send-email 1.7.8.1
\r
37 In-Reply-To: <87vcogketu.fsf@praet.org>
\r
38 References: <87vcogketu.fsf@praet.org>
\r
39 Cc: Notmuch Mail <notmuch@notmuchmail.org>
\r
40 X-BeenThere: notmuch@notmuchmail.org
\r
41 X-Mailman-Version: 2.1.13
\r
43 List-Id: "Use and development of the notmuch mail system."
\r
44 <notmuch.notmuchmail.org>
\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
46 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
48 List-Post: <mailto:notmuch@notmuchmail.org>
\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
51 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
52 X-List-Received-Date: Thu, 12 Jan 2012 17:35:09 -0000
\r
54 Less code, same results, without sacrificing readability.
\r
57 emacs/notmuch-address.el | 6 +++---
\r
58 emacs/notmuch-hello.el | 20 ++++++++++----------
\r
59 emacs/notmuch-show.el | 12 ++++++------
\r
60 emacs/notmuch.el | 8 ++++----
\r
61 4 files changed, 23 insertions(+), 23 deletions(-)
\r
63 diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
\r
64 index 8eba7a0..d72b169 100644
\r
65 --- a/emacs/notmuch-address.el
\r
66 +++ b/emacs/notmuch-address.el
\r
67 @@ -37,9 +37,9 @@ line."
\r
68 (defvar notmuch-address-history nil)
\r
70 (defun notmuch-address-message-insinuate ()
\r
71 - (if (not (memq notmuch-address-message-alist-member message-completion-alist))
\r
72 - (setq message-completion-alist
\r
73 - (push notmuch-address-message-alist-member message-completion-alist))))
\r
74 + (unless (memq notmuch-address-message-alist-member message-completion-alist)
\r
75 + (setq message-completion-alist
\r
76 + (push notmuch-address-message-alist-member message-completion-alist))))
\r
78 (defun notmuch-address-options (original)
\r
79 (process-lines notmuch-address-command original))
\r
80 diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
\r
81 index 333d4c1..dce2020 100644
\r
82 --- a/emacs/notmuch-hello.el
\r
83 +++ b/emacs/notmuch-hello.el
\r
84 @@ -315,7 +315,7 @@ should be. Returns a cons cell `(tags-per-line width)'."
\r
86 ;; If the last line was not full (and hence did not include a
\r
87 ;; carriage return), insert one now.
\r
88 - (if (not (eq (% count tags-per-line) 0))
\r
89 + (unless (eq (% count tags-per-line) 0)
\r
90 (widget-insert "\n"))
\r
93 @@ -399,7 +399,7 @@ Complete list of currently available key bindings:
\r
95 ; Jump through a hoop to get this value from the deprecated variable
\r
96 ; name (`notmuch-folders') or from the default value.
\r
97 - (if (not notmuch-saved-searches)
\r
98 + (unless notmuch-saved-searches
\r
99 (setq notmuch-saved-searches (notmuch-saved-searches)))
\r
102 @@ -565,18 +565,18 @@ Complete list of currently available key bindings:
\r
103 (widget-insert "\n\n")
\r
104 (let ((start (point)))
\r
105 (setq found-target-pos (notmuch-hello-insert-tags alltags-alist widest target))
\r
106 - (if (not final-target-pos)
\r
107 - (setq final-target-pos found-target-pos))
\r
108 + (unless final-target-pos
\r
109 + (setq final-target-pos found-target-pos))
\r
110 (indent-rigidly start (point) notmuch-hello-indent)))
\r
112 (widget-insert "\n")
\r
114 - (if (not notmuch-show-all-tags-list)
\r
115 - (widget-create 'push-button
\r
116 - :notify (lambda (widget &rest ignore)
\r
117 - (setq notmuch-show-all-tags-list t)
\r
118 - (notmuch-hello-update))
\r
119 - "Show all tags")))
\r
120 + (unless notmuch-show-all-tags-list
\r
121 + (widget-create 'push-button
\r
122 + :notify (lambda (widget &rest ignore)
\r
123 + (setq notmuch-show-all-tags-list t)
\r
124 + (notmuch-hello-update))
\r
125 + "Show all tags")))
\r
127 (let ((start (point)))
\r
128 (widget-insert "\n\n")
\r
129 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
130 index 5502efd..d3543f0 100644
\r
131 --- a/emacs/notmuch-show.el
\r
132 +++ b/emacs/notmuch-show.el
\r
133 @@ -659,8 +659,8 @@ current buffer, if possible."
\r
134 ;; part, so we make sure that we're down at the end.
\r
135 (goto-char (point-max))
\r
136 ;; Ensure that the part ends with a carriage return.
\r
142 (defun notmuch-show-insert-body (msg body depth)
\r
143 "Insert the body BODY at depth DEPTH in the current thread."
\r
144 @@ -740,8 +740,8 @@ current buffer, if possible."
\r
145 (setq body-start (point-marker))
\r
146 (notmuch-show-insert-body msg (plist-get msg :body) depth)
\r
147 ;; Ensure that the body ends with a newline.
\r
152 (setq body-end (point-marker))
\r
153 (setq content-end (point-marker))
\r
155 @@ -882,8 +882,8 @@ buffer."
\r
156 (run-hooks 'notmuch-show-hook))
\r
158 ;; Move straight to the first open message
\r
159 - (if (not (notmuch-show-message-visible-p))
\r
160 - (notmuch-show-next-open-message))
\r
161 + (unless (notmuch-show-message-visible-p)
\r
162 + (notmuch-show-next-open-message))
\r
164 ;; Set the header line to the subject of the first open message.
\r
165 (setq header-line-format (notmuch-show-strip-re (notmuch-show-get-subject)))
\r
166 diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
167 index 1e61775..ba84494 100644
\r
168 --- a/emacs/notmuch.el
\r
169 +++ b/emacs/notmuch.el
\r
170 @@ -636,8 +636,8 @@ This function advances the next thread when finished."
\r
171 (if notmuch-search-process-filter-data
\r
172 (insert (concat "Error: Unexpected output from notmuch search:\n" notmuch-search-process-filter-data)))
\r
173 (insert "End of search results.")
\r
174 - (if (not (= exit-status 0))
\r
175 - (insert (format " (process returned %d)" exit-status)))
\r
176 + (unless (= exit-status 0)
\r
177 + (insert (format " (process returned %d)" exit-status)))
\r
180 (not (string= notmuch-search-target-thread "found")))
\r
181 @@ -1006,8 +1006,8 @@ Invokes `notmuch-poll-script', \"notmuch new\", or does nothing
\r
182 depending on the value of `notmuch-poll-script'."
\r
184 (if (stringp notmuch-poll-script)
\r
185 - (if (not (string= notmuch-poll-script ""))
\r
186 - (call-process notmuch-poll-script nil nil))
\r
187 + (unless (string= notmuch-poll-script "")
\r
188 + (call-process notmuch-poll-script nil nil))
\r
189 (call-process notmuch-command nil nil nil "new")))
\r
191 (defun notmuch-search-poll-and-refresh-view ()
\r