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