mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-24 20:08:10 +01:00
emacs: Use 'unless' instead of 'when' and 'not'
Also use 'unless' in a few cases where previously 'if' was used with 'not' but without an ELSE part.
This commit is contained in:
parent
dfb1b8eb89
commit
09f6533c37
8 changed files with 18 additions and 19 deletions
|
@ -638,7 +638,7 @@ with `notmuch-hello-query-counts'."
|
|||
(dolist (window (window-list))
|
||||
(let ((last-buf (window-parameter window 'notmuch-hello-last-buffer))
|
||||
(cur-buf (window-buffer window)))
|
||||
(when (not (eq last-buf cur-buf))
|
||||
(unless (eq last-buf cur-buf)
|
||||
;; This window changed or is new. Update recorded buffer
|
||||
;; for next time.
|
||||
(set-window-parameter window 'notmuch-hello-last-buffer cur-buf)
|
||||
|
@ -652,7 +652,7 @@ with `notmuch-hello-query-counts'."
|
|||
;; 24, we can't do it right here because something in this
|
||||
;; hook's call stack overrides hello's point placement.
|
||||
(run-at-time nil nil #'notmuch-hello t))
|
||||
(when (null hello-buf)
|
||||
(unless hello-buf
|
||||
;; Clean up hook
|
||||
(remove-hook 'window-configuration-change-hook
|
||||
#'notmuch-hello-window-configuration-change))))
|
||||
|
@ -908,7 +908,7 @@ Supports the following entries in OPTIONS as a plist:
|
|||
(notmuch-hello-update))
|
||||
"hide"))
|
||||
(widget-insert "\n")
|
||||
(when (not is-hidden)
|
||||
(unless is-hidden
|
||||
(let ((searches (apply 'notmuch-hello-query-counts query-list options)))
|
||||
(when (or (not (plist-get options :hide-if-empty))
|
||||
searches)
|
||||
|
|
|
@ -198,7 +198,7 @@ Typically this is added to `notmuch-mua-send-hook'."
|
|||
(defun notmuch-mua-add-more-hidden-headers ()
|
||||
"Add some headers to the list that are hidden by default."
|
||||
(mapc (lambda (header)
|
||||
(when (not (member header message-hidden-headers))
|
||||
(unless (member header message-hidden-headers)
|
||||
(push header message-hidden-headers)))
|
||||
notmuch-mua-hidden-headers))
|
||||
|
||||
|
@ -368,7 +368,7 @@ modified. This function is notmuch addaptation of
|
|||
(interactive)
|
||||
(when notmuch-mua-user-agent-function
|
||||
(let ((user-agent (funcall notmuch-mua-user-agent-function)))
|
||||
(when (not (string= "" user-agent))
|
||||
(unless (string= "" user-agent)
|
||||
(push (cons 'User-Agent user-agent) other-headers))))
|
||||
(unless (assq 'From other-headers)
|
||||
(push (cons 'From (message-make-from
|
||||
|
|
|
@ -78,7 +78,7 @@ returns the value."
|
|||
;; parse, extend the partial parse to figure out when we
|
||||
;; have a complete list.
|
||||
(catch 'return
|
||||
(when (null (notmuch-sexp--partial-state sp))
|
||||
(unless (notmuch-sexp--partial-state sp)
|
||||
(let ((start (point)))
|
||||
(condition-case nil
|
||||
(throw 'return (read (current-buffer)))
|
||||
|
|
|
@ -1066,8 +1066,7 @@ is t, hide the part initially and show the button."
|
|||
;; If the subject of this message is the same as that of the
|
||||
;; previous message, don't display it when this message is
|
||||
;; collapsed.
|
||||
(when (not (string= notmuch-show-previous-subject
|
||||
bare-subject))
|
||||
(unless (string= notmuch-show-previous-subject bare-subject)
|
||||
(forward-line 1))
|
||||
(setq headers-start (point-marker)))
|
||||
(setq headers-end (point-marker))
|
||||
|
|
|
@ -382,7 +382,7 @@ the messages that were tagged."
|
|||
"Return a list of tags for messages matching SEARCH-TERMS.
|
||||
|
||||
Returns all tags if no search terms are given."
|
||||
(if (null search-terms)
|
||||
(unless search-terms
|
||||
(setq search-terms (list "*")))
|
||||
(split-string
|
||||
(with-output-to-string
|
||||
|
|
|
@ -1063,7 +1063,7 @@ The arguments are:
|
|||
OPEN-TARGET: If TRUE open the target message in the message pane.
|
||||
UNTHREADED: If TRUE only show matching messages in an unthreaded view."
|
||||
(interactive)
|
||||
(if (null query)
|
||||
(unless query
|
||||
(setq query (notmuch-read-query (concat "Notmuch "
|
||||
(if unthreaded "unthreaded " "tree ")
|
||||
"view search: "))))
|
||||
|
|
|
@ -803,13 +803,13 @@ non-authors is found, assume that all of the authors match."
|
|||
(setq invisible-string (notmuch-search-author-propertize invisible-string)))
|
||||
;; If there is any invisible text, add it as a tooltip to the
|
||||
;; visible text.
|
||||
(when (not (string= invisible-string ""))
|
||||
(unless (string= invisible-string "")
|
||||
(setq visible-string
|
||||
(propertize visible-string
|
||||
'help-echo (concat "..." invisible-string))))
|
||||
;; Insert the visible and, if present, invisible author strings.
|
||||
(insert visible-string)
|
||||
(when (not (string= invisible-string ""))
|
||||
(unless (string= invisible-string "")
|
||||
(let ((start (point))
|
||||
overlay)
|
||||
(insert invisible-string)
|
||||
|
|
|
@ -81,7 +81,7 @@ invisible text."
|
|||
(let (str)
|
||||
(while (< start end)
|
||||
(let ((next-pos (next-char-property-change start end)))
|
||||
(when (not (invisible-p start))
|
||||
(unless (invisible-p start)
|
||||
(setq str (concat str (buffer-substring-no-properties
|
||||
start next-pos))))
|
||||
(setq start next-pos)))
|
||||
|
@ -97,7 +97,7 @@ invisible text."
|
|||
(defun orphan-watchdog-check (pid)
|
||||
"Periodically check that the process with id PID is still
|
||||
running, quit if it terminated."
|
||||
(if (not (test-process-running pid))
|
||||
(unless (test-process-running pid)
|
||||
(kill-emacs)))
|
||||
|
||||
(defun orphan-watchdog (pid)
|
||||
|
|
Loading…
Reference in a new issue