emacs: globally replace non-branching "(if (not ..." with "(unless ..."

Less code, same results, without sacrificing readability.
This commit is contained in:
Pieter Praet 2012-01-16 11:56:40 +01:00 committed by David Bremner
parent a56e6603c6
commit 046f5dded2
4 changed files with 24 additions and 24 deletions

View file

@ -38,7 +38,7 @@ line."
(defvar notmuch-address-history nil) (defvar notmuch-address-history nil)
(defun notmuch-address-message-insinuate () (defun notmuch-address-message-insinuate ()
(if (not (memq notmuch-address-message-alist-member message-completion-alist)) (unless (memq notmuch-address-message-alist-member message-completion-alist)
(setq message-completion-alist (setq message-completion-alist
(push notmuch-address-message-alist-member message-completion-alist)))) (push notmuch-address-message-alist-member message-completion-alist))))

View file

@ -320,7 +320,7 @@ should be. Returns a cons cell `(tags-per-line width)'."
;; If the last line was not full (and hence did not include a ;; If the last line was not full (and hence did not include a
;; carriage return), insert one now. ;; carriage return), insert one now.
(if (not (eq (% count tags-per-line) 0)) (unless (eq (% count tags-per-line) 0)
(widget-insert "\n")) (widget-insert "\n"))
found-target-pos)) found-target-pos))
@ -404,7 +404,7 @@ Complete list of currently available key bindings:
; Jump through a hoop to get this value from the deprecated variable ; Jump through a hoop to get this value from the deprecated variable
; name (`notmuch-folders') or from the default value. ; name (`notmuch-folders') or from the default value.
(if (not notmuch-saved-searches) (unless notmuch-saved-searches
(setq notmuch-saved-searches (notmuch-saved-searches))) (setq notmuch-saved-searches (notmuch-saved-searches)))
(if no-display (if no-display
@ -570,13 +570,13 @@ Complete list of currently available key bindings:
(widget-insert "\n\n") (widget-insert "\n\n")
(let ((start (point))) (let ((start (point)))
(setq found-target-pos (notmuch-hello-insert-tags alltags-alist widest target)) (setq found-target-pos (notmuch-hello-insert-tags alltags-alist widest target))
(if (not final-target-pos) (unless final-target-pos
(setq final-target-pos found-target-pos)) (setq final-target-pos found-target-pos))
(indent-rigidly start (point) notmuch-hello-indent))) (indent-rigidly start (point) notmuch-hello-indent)))
(widget-insert "\n") (widget-insert "\n")
(if (not notmuch-show-all-tags-list) (unless notmuch-show-all-tags-list
(widget-create 'push-button (widget-create 'push-button
:notify (lambda (widget &rest ignore) :notify (lambda (widget &rest ignore)
(setq notmuch-show-all-tags-list t) (setq notmuch-show-all-tags-list t)

View file

@ -662,7 +662,7 @@ current buffer, if possible."
;; part, so we make sure that we're down at the end. ;; part, so we make sure that we're down at the end.
(goto-char (point-max)) (goto-char (point-max))
;; Ensure that the part ends with a carriage return. ;; Ensure that the part ends with a carriage return.
(if (not (bolp)) (unless (bolp)
(insert "\n"))) (insert "\n")))
(defun notmuch-show-insert-body (msg body depth) (defun notmuch-show-insert-body (msg body depth)
@ -743,7 +743,7 @@ current buffer, if possible."
(setq body-start (point-marker)) (setq body-start (point-marker))
(notmuch-show-insert-body msg (plist-get msg :body) depth) (notmuch-show-insert-body msg (plist-get msg :body) depth)
;; Ensure that the body ends with a newline. ;; Ensure that the body ends with a newline.
(if (not (bolp)) (unless (bolp)
(insert "\n")) (insert "\n"))
(setq body-end (point-marker)) (setq body-end (point-marker))
(setq content-end (point-marker)) (setq content-end (point-marker))
@ -885,7 +885,7 @@ buffer."
(run-hooks 'notmuch-show-hook)) (run-hooks 'notmuch-show-hook))
;; Move straight to the first open message ;; Move straight to the first open message
(if (not (notmuch-show-message-visible-p)) (unless (notmuch-show-message-visible-p)
(notmuch-show-next-open-message)) (notmuch-show-next-open-message))
;; Set the header line to the subject of the first open message. ;; Set the header line to the subject of the first open message.

View file

@ -651,7 +651,7 @@ This function advances the next thread when finished."
(if notmuch-search-process-filter-data (if notmuch-search-process-filter-data
(insert (concat "Error: Unexpected output from notmuch search:\n" notmuch-search-process-filter-data))) (insert (concat "Error: Unexpected output from notmuch search:\n" notmuch-search-process-filter-data)))
(insert "End of search results.") (insert "End of search results.")
(if (not (= exit-status 0)) (unless (= exit-status 0)
(insert (format " (process returned %d)" exit-status))) (insert (format " (process returned %d)" exit-status)))
(insert "\n") (insert "\n")
(if (and atbob (if (and atbob
@ -1022,7 +1022,7 @@ Invokes `notmuch-poll-script', \"notmuch new\", or does nothing
depending on the value of `notmuch-poll-script'." depending on the value of `notmuch-poll-script'."
(interactive) (interactive)
(if (stringp notmuch-poll-script) (if (stringp notmuch-poll-script)
(if (not (string= notmuch-poll-script "")) (unless (string= notmuch-poll-script "")
(call-process notmuch-poll-script nil nil)) (call-process notmuch-poll-script nil nil))
(call-process notmuch-command nil nil nil "new"))) (call-process notmuch-command nil nil nil "new")))