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 711AF429E30
\r
6 for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 02:58:29 -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 vn3wMMi4Q07A for <notmuch@notmuchmail.org>;
\r
16 Mon, 16 Jan 2012 02:58:28 -0800 (PST)
\r
17 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com
\r
18 [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 7ECCC431FC0
\r
21 for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 02:58:28 -0800 (PST)
\r
22 Received: by wibhr12 with SMTP id hr12so2280823wib.26
\r
23 for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 02:58:27 -0800 (PST)
\r
24 Received: by 10.180.77.38 with SMTP id p6mr18630991wiw.19.1326711507334;
\r
25 Mon, 16 Jan 2012 02:58:27 -0800 (PST)
\r
26 Received: from localhost ([109.131.75.86])
\r
27 by mx.google.com with ESMTPS id df2sm3793846wib.4.2012.01.16.02.58.26
\r
28 (version=TLSv1/SSLv3 cipher=OTHER);
\r
29 Mon, 16 Jan 2012 02:58:26 -0800 (PST)
\r
30 From: Pieter Praet <pieter@praet.org>
\r
31 To: David Edmondson <dme@dme.org>,
\r
32 Jani Nikula <jani@nikula.org>
\r
33 Subject: [PATCH v2] emacs: globally replace non-branching "(if (not ..." with
\r
35 Date: Mon, 16 Jan 2012 11:56:40 +0100
\r
36 Message-Id: <1326711400-28002-1-git-send-email-pieter@praet.org>
\r
37 X-Mailer: git-send-email 1.7.8.1
\r
38 In-Reply-To: <cuny5t95gfe.fsf@hotblack-desiato.hh.sledj.net>
\r
39 References: <cuny5t95gfe.fsf@hotblack-desiato.hh.sledj.net>
\r
40 Cc: Notmuch Mail <notmuch@notmuchmail.org>
\r
41 X-BeenThere: notmuch@notmuchmail.org
\r
42 X-Mailman-Version: 2.1.13
\r
44 List-Id: "Use and development of the notmuch mail system."
\r
45 <notmuch.notmuchmail.org>
\r
46 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
47 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
48 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
49 List-Post: <mailto:notmuch@notmuchmail.org>
\r
50 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
51 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
52 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
53 X-List-Received-Date: Mon, 16 Jan 2012 10:58:29 -0000
\r
55 Less code, same results, without sacrificing readability.
\r
59 v2: Fixed indentation oversight @ `notmuch-hello-insert-tags'.
\r
61 emacs/notmuch-address.el | 6 +++---
\r
62 emacs/notmuch-hello.el | 22 +++++++++++-----------
\r
63 emacs/notmuch-show.el | 12 ++++++------
\r
64 emacs/notmuch.el | 8 ++++----
\r
65 4 files changed, 24 insertions(+), 24 deletions(-)
\r
67 diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
\r
68 index 8eba7a0..d72b169 100644
\r
69 --- a/emacs/notmuch-address.el
\r
70 +++ b/emacs/notmuch-address.el
\r
71 @@ -37,9 +37,9 @@ line."
\r
72 (defvar notmuch-address-history nil)
\r
74 (defun notmuch-address-message-insinuate ()
\r
75 - (if (not (memq notmuch-address-message-alist-member message-completion-alist))
\r
76 - (setq message-completion-alist
\r
77 - (push notmuch-address-message-alist-member message-completion-alist))))
\r
78 + (unless (memq notmuch-address-message-alist-member message-completion-alist)
\r
79 + (setq message-completion-alist
\r
80 + (push notmuch-address-message-alist-member message-completion-alist))))
\r
82 (defun notmuch-address-options (original)
\r
83 (process-lines notmuch-address-command original))
\r
84 diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
\r
85 index 02017ce..8aa2ad5 100644
\r
86 --- a/emacs/notmuch-hello.el
\r
87 +++ b/emacs/notmuch-hello.el
\r
88 @@ -317,8 +317,8 @@ should be. Returns a cons cell `(tags-per-line width)'."
\r
90 ;; If the last line was not full (and hence did not include a
\r
91 ;; carriage return), insert one now.
\r
92 - (if (not (eq (% count tags-per-line) 0))
\r
93 - (widget-insert "\n"))
\r
94 + (unless (eq (% count tags-per-line) 0)
\r
95 + (widget-insert "\n"))
\r
98 (defun notmuch-hello-goto-search ()
\r
99 @@ -401,7 +401,7 @@ Complete list of currently available key bindings:
\r
101 ; Jump through a hoop to get this value from the deprecated variable
\r
102 ; name (`notmuch-folders') or from the default value.
\r
103 - (if (not notmuch-saved-searches)
\r
104 + (unless notmuch-saved-searches
\r
105 (setq notmuch-saved-searches (notmuch-saved-searches)))
\r
108 @@ -567,18 +567,18 @@ Complete list of currently available key bindings:
\r
109 (widget-insert "\n\n")
\r
110 (let ((start (point)))
\r
111 (setq found-target-pos (notmuch-hello-insert-tags alltags-alist widest target))
\r
112 - (if (not final-target-pos)
\r
113 - (setq final-target-pos found-target-pos))
\r
114 + (unless final-target-pos
\r
115 + (setq final-target-pos found-target-pos))
\r
116 (indent-rigidly start (point) notmuch-hello-indent)))
\r
118 (widget-insert "\n")
\r
120 - (if (not 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
126 + (unless notmuch-show-all-tags-list
\r
127 + (widget-create 'push-button
\r
128 + :notify (lambda (widget &rest ignore)
\r
129 + (setq notmuch-show-all-tags-list t)
\r
130 + (notmuch-hello-update))
\r
131 + "Show all tags")))
\r
133 (let ((start (point)))
\r
134 (widget-insert "\n\n")
\r
135 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
136 index 1a250a3..72bf888 100644
\r
137 --- a/emacs/notmuch-show.el
\r
138 +++ b/emacs/notmuch-show.el
\r
139 @@ -656,8 +656,8 @@ current buffer, if possible."
\r
140 ;; part, so we make sure that we're down at the end.
\r
141 (goto-char (point-max))
\r
142 ;; Ensure that the part ends with a carriage return.
\r
148 (defun notmuch-show-insert-body (msg body depth)
\r
149 "Insert the body BODY at depth DEPTH in the current thread."
\r
150 @@ -737,8 +737,8 @@ current buffer, if possible."
\r
151 (setq body-start (point-marker))
\r
152 (notmuch-show-insert-body msg (plist-get msg :body) depth)
\r
153 ;; Ensure that the body ends with a newline.
\r
158 (setq body-end (point-marker))
\r
159 (setq content-end (point-marker))
\r
161 @@ -879,8 +879,8 @@ buffer."
\r
162 (run-hooks 'notmuch-show-hook))
\r
164 ;; Move straight to the first open message
\r
165 - (if (not (notmuch-show-message-visible-p))
\r
166 - (notmuch-show-next-open-message))
\r
167 + (unless (notmuch-show-message-visible-p)
\r
168 + (notmuch-show-next-open-message))
\r
170 ;; Set the header line to the subject of the first open message.
\r
171 (setq header-line-format (notmuch-show-strip-re (notmuch-show-get-subject)))
\r
172 diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
173 index ef4dcc7..c5fcc80 100644
\r
174 --- a/emacs/notmuch.el
\r
175 +++ b/emacs/notmuch.el
\r
176 @@ -643,8 +643,8 @@ This function advances the next thread when finished."
\r
177 (if notmuch-search-process-filter-data
\r
178 (insert (concat "Error: Unexpected output from notmuch search:\n" notmuch-search-process-filter-data)))
\r
179 (insert "End of search results.")
\r
180 - (if (not (= exit-status 0))
\r
181 - (insert (format " (process returned %d)" exit-status)))
\r
182 + (unless (= exit-status 0)
\r
183 + (insert (format " (process returned %d)" exit-status)))
\r
186 (not (string= notmuch-search-target-thread "found")))
\r
187 @@ -1013,8 +1013,8 @@ Invokes `notmuch-poll-script', \"notmuch new\", or does nothing
\r
188 depending on the value of `notmuch-poll-script'."
\r
190 (if (stringp notmuch-poll-script)
\r
191 - (if (not (string= notmuch-poll-script ""))
\r
192 - (call-process notmuch-poll-script nil nil))
\r
193 + (unless (string= notmuch-poll-script "")
\r
194 + (call-process notmuch-poll-script nil nil))
\r
195 (call-process notmuch-command nil nil nil "new")))
\r
197 (defun notmuch-search-poll-and-refresh-view ()
\r