mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-24 20:08:10 +01:00
emacs: Only set one variable per setq form
It's a bit weird to avoid having to write the "(setq ... )" more than once, just because we can. In a language that uses '=' for the same purpose we also happily use that once per assignment. While there are no benefit to using just one 'setq' there are some drawbacks. It is not always clear on first what is a key and what a value and as a result it is easy to make a mistake. Also it becomes harder to comment out just one assignment.
This commit is contained in:
parent
2ee8e971c5
commit
18d289c863
6 changed files with 53 additions and 49 deletions
|
@ -381,9 +381,9 @@ to be a saved address hash."
|
||||||
notmuch-address-internal-completion)
|
notmuch-address-internal-completion)
|
||||||
(equal (plist-get load-plist :version)
|
(equal (plist-get load-plist :version)
|
||||||
notmuch-address--save-hash-version))
|
notmuch-address--save-hash-version))
|
||||||
(setq notmuch-address-last-harvest (plist-get load-plist :last-harvest)
|
(setq notmuch-address-last-harvest (plist-get load-plist :last-harvest))
|
||||||
notmuch-address-completions (plist-get load-plist :completions)
|
(setq notmuch-address-completions (plist-get load-plist :completions))
|
||||||
notmuch-address-full-harvest-finished t)
|
(setq notmuch-address-full-harvest-finished t)
|
||||||
;; Return t to say load was successful.
|
;; Return t to say load was successful.
|
||||||
t)))
|
t)))
|
||||||
|
|
||||||
|
|
|
@ -117,20 +117,21 @@ by user FROM."
|
||||||
(userid (plist-get sigstatus :userid)))
|
(userid (plist-get sigstatus :userid)))
|
||||||
;; If userid is present it has full or greater validity.
|
;; If userid is present it has full or greater validity.
|
||||||
(if userid
|
(if userid
|
||||||
(setq label (concat "Good signature by: " userid)
|
(progn
|
||||||
face 'notmuch-crypto-signature-good)
|
(setq label (concat "Good signature by: " userid))
|
||||||
(setq label (concat "Good signature by key: " fingerprint)
|
(setq face 'notmuch-crypto-signature-good))
|
||||||
face 'notmuch-crypto-signature-good-key))
|
(setq label (concat "Good signature by key: " fingerprint))
|
||||||
(setq button-action 'notmuch-crypto-sigstatus-good-callback
|
(setq face 'notmuch-crypto-signature-good-key))
|
||||||
help-msg (concat "Click to list key ID 0x" fingerprint "."))))
|
(setq button-action 'notmuch-crypto-sigstatus-good-callback)
|
||||||
|
(setq help-msg (concat "Click to list key ID 0x" fingerprint "."))))
|
||||||
((string= status "error")
|
((string= status "error")
|
||||||
(setq label (concat "Unknown key ID " keyid " or unsupported algorithm")
|
(setq label (concat "Unknown key ID " keyid " or unsupported algorithm"))
|
||||||
button-action 'notmuch-crypto-sigstatus-error-callback
|
(setq button-action 'notmuch-crypto-sigstatus-error-callback)
|
||||||
help-msg (concat "Click to retrieve key ID " keyid
|
(setq help-msg (concat "Click to retrieve key ID " keyid
|
||||||
" from keyserver.")))
|
" from keyserver.")))
|
||||||
((string= status "bad")
|
((string= status "bad")
|
||||||
(setq label (concat "Bad signature (claimed key ID " keyid ")")
|
(setq label (concat "Bad signature (claimed key ID " keyid ")"))
|
||||||
face 'notmuch-crypto-signature-bad))
|
(setq face 'notmuch-crypto-signature-bad))
|
||||||
(status
|
(status
|
||||||
(setq label (concat "Unknown signature status: " status)))
|
(setq label (concat "Unknown signature status: " status)))
|
||||||
(t
|
(t
|
||||||
|
|
|
@ -861,8 +861,8 @@ for `call-process'. ARGS is as described for
|
||||||
(let (stdin-string)
|
(let (stdin-string)
|
||||||
(while (keywordp (car args))
|
(while (keywordp (car args))
|
||||||
(cl-case (car args)
|
(cl-case (car args)
|
||||||
(:stdin-string (setq stdin-string (cadr args)
|
(:stdin-string (setq stdin-string (cadr args))
|
||||||
args (cddr args)))
|
(setq args (cddr args)))
|
||||||
(otherwise
|
(otherwise
|
||||||
(error "Unknown keyword argument: %s" (car args)))))
|
(error "Unknown keyword argument: %s" (car args)))))
|
||||||
(if (null stdin-string)
|
(if (null stdin-string)
|
||||||
|
@ -939,8 +939,8 @@ status."
|
||||||
:buffer buffer
|
:buffer buffer
|
||||||
:command (cons command args)
|
:command (cons command args)
|
||||||
:connection-type 'pipe
|
:connection-type 'pipe
|
||||||
:stderr err-buffer)
|
:stderr err-buffer))
|
||||||
err-proc (get-buffer-process err-buffer))
|
(setq err-proc (get-buffer-process err-buffer))
|
||||||
(process-put proc 'err-buffer err-buffer)
|
(process-put proc 'err-buffer err-buffer)
|
||||||
|
|
||||||
(process-put err-proc 'err-file err-file)
|
(process-put err-proc 'err-file err-file)
|
||||||
|
|
|
@ -415,8 +415,8 @@ parsing fails."
|
||||||
(cond
|
(cond
|
||||||
;; "User <user@dom.ain>" style.
|
;; "User <user@dom.ain>" style.
|
||||||
((string-match "\\(.*\\) <\\(.*\\)>" address)
|
((string-match "\\(.*\\) <\\(.*\\)>" address)
|
||||||
(setq p-name (match-string 1 address)
|
(setq p-name (match-string 1 address))
|
||||||
p-address (match-string 2 address)))
|
(setq p-address (match-string 2 address)))
|
||||||
|
|
||||||
;; "<user@dom.ain>" style.
|
;; "<user@dom.ain>" style.
|
||||||
((string-match "<\\(.*\\)>" address)
|
((string-match "<\\(.*\\)>" address)
|
||||||
|
@ -1256,14 +1256,16 @@ matched."
|
||||||
;; Set various buffer local variables to their appropriate initial
|
;; Set various buffer local variables to their appropriate initial
|
||||||
;; state. Do this after enabling `notmuch-show-mode' so that they
|
;; state. Do this after enabling `notmuch-show-mode' so that they
|
||||||
;; aren't wiped out.
|
;; aren't wiped out.
|
||||||
(setq notmuch-show-thread-id thread-id
|
(setq notmuch-show-thread-id thread-id)
|
||||||
notmuch-show-parent-buffer parent-buffer
|
(setq notmuch-show-parent-buffer parent-buffer)
|
||||||
notmuch-show-query-context (if (or (string= query-context "")
|
(setq notmuch-show-query-context
|
||||||
(string= query-context "*"))
|
(if (or (string= query-context "")
|
||||||
nil query-context)
|
(string= query-context "*"))
|
||||||
notmuch-show-process-crypto notmuch-crypto-process-mime
|
nil
|
||||||
;; If `elide-toggle', invert the default value.
|
query-context))
|
||||||
notmuch-show-elide-non-matching-messages
|
(setq notmuch-show-process-crypto notmuch-crypto-process-mime)
|
||||||
|
;; If `elide-toggle', invert the default value.
|
||||||
|
(setq notmuch-show-elide-non-matching-messages
|
||||||
(if elide-toggle
|
(if elide-toggle
|
||||||
(not notmuch-show-only-matching-messages)
|
(not notmuch-show-only-matching-messages)
|
||||||
notmuch-show-only-matching-messages))
|
notmuch-show-only-matching-messages))
|
||||||
|
@ -1518,8 +1520,8 @@ All currently available key bindings:
|
||||||
|
|
||||||
\\{notmuch-show-mode-map}"
|
\\{notmuch-show-mode-map}"
|
||||||
(setq notmuch-buffer-refresh-function #'notmuch-show-refresh-view)
|
(setq notmuch-buffer-refresh-function #'notmuch-show-refresh-view)
|
||||||
(setq buffer-read-only t
|
(setq buffer-read-only t)
|
||||||
truncate-lines t)
|
(setq truncate-lines t)
|
||||||
(setq imenu-prev-index-position-function
|
(setq imenu-prev-index-position-function
|
||||||
#'notmuch-show-imenu-prev-index-position-function)
|
#'notmuch-show-imenu-prev-index-position-function)
|
||||||
(setq imenu-extract-index-name-function
|
(setq imenu-extract-index-name-function
|
||||||
|
|
|
@ -956,8 +956,8 @@ Complete list of currently available key bindings:
|
||||||
\\{notmuch-tree-mode-map}"
|
\\{notmuch-tree-mode-map}"
|
||||||
(setq notmuch-buffer-refresh-function #'notmuch-tree-refresh-view)
|
(setq notmuch-buffer-refresh-function #'notmuch-tree-refresh-view)
|
||||||
(hl-line-mode 1)
|
(hl-line-mode 1)
|
||||||
(setq buffer-read-only t
|
(setq buffer-read-only t)
|
||||||
truncate-lines t))
|
(setq truncate-lines t))
|
||||||
|
|
||||||
(defun notmuch-tree-process-sentinel (proc msg)
|
(defun notmuch-tree-process-sentinel (proc msg)
|
||||||
"Add a message to let user know when \"notmuch tree\" exits."
|
"Add a message to let user know when \"notmuch tree\" exits."
|
||||||
|
|
|
@ -443,8 +443,8 @@ BEG."
|
||||||
(while (and pos (or (< pos end) first))
|
(while (and pos (or (< pos end) first))
|
||||||
(when (notmuch-search-get-result pos)
|
(when (notmuch-search-get-result pos)
|
||||||
(funcall fn pos))
|
(funcall fn pos))
|
||||||
(setq pos (notmuch-search-result-end pos)
|
(setq pos (notmuch-search-result-end pos))
|
||||||
first nil))))
|
(setq first nil))))
|
||||||
;; Unindent the function argument of notmuch-search-foreach-result so
|
;; Unindent the function argument of notmuch-search-foreach-result so
|
||||||
;; the indentation of callers doesn't get out of hand.
|
;; the indentation of callers doesn't get out of hand.
|
||||||
(put 'notmuch-search-foreach-result 'lisp-indent-function 2)
|
(put 'notmuch-search-foreach-result 'lisp-indent-function 2)
|
||||||
|
@ -589,8 +589,8 @@ is inactive this applies to the thread at point.
|
||||||
If ONLY-MATCHED is non-nil, only tag matched messages."
|
If ONLY-MATCHED is non-nil, only tag matched messages."
|
||||||
(interactive (notmuch-search-interactive-tag-changes))
|
(interactive (notmuch-search-interactive-tag-changes))
|
||||||
(unless (and beg end)
|
(unless (and beg end)
|
||||||
(setq beg (car (notmuch-interactive-region))
|
(setq beg (car (notmuch-interactive-region)))
|
||||||
end (cadr (notmuch-interactive-region))))
|
(setq end (cadr (notmuch-interactive-region))))
|
||||||
(let ((search-string (notmuch-search-find-stable-query-region
|
(let ((search-string (notmuch-search-find-stable-query-region
|
||||||
beg end only-matched)))
|
beg end only-matched)))
|
||||||
(notmuch-tag search-string tag-changes)
|
(notmuch-tag search-string tag-changes)
|
||||||
|
@ -762,8 +762,8 @@ non-authors is found, assume that all of the authors match."
|
||||||
(length "... "))))
|
(length "... "))))
|
||||||
;; Truncate the visible string according to the width of
|
;; Truncate the visible string according to the width of
|
||||||
;; the display string.
|
;; the display string.
|
||||||
(setq visible-string (substring formatted-authors 0 visible-length)
|
(setq visible-string (substring formatted-authors 0 visible-length))
|
||||||
invisible-string (substring formatted-authors visible-length))
|
(setq invisible-string (substring formatted-authors visible-length))
|
||||||
;; If possible, truncate the visible string at a natural
|
;; If possible, truncate the visible string at a natural
|
||||||
;; break (comma or pipe), as incremental search doesn't
|
;; break (comma or pipe), as incremental search doesn't
|
||||||
;; match across the visible/invisible border.
|
;; match across the visible/invisible border.
|
||||||
|
@ -771,8 +771,8 @@ non-authors is found, assume that all of the authors match."
|
||||||
;; Second clause is destructive on `visible-string', so
|
;; Second clause is destructive on `visible-string', so
|
||||||
;; order is important.
|
;; order is important.
|
||||||
(setq invisible-string (concat (match-string 3 visible-string)
|
(setq invisible-string (concat (match-string 3 visible-string)
|
||||||
invisible-string)
|
invisible-string))
|
||||||
visible-string (concat (match-string 1 visible-string)
|
(setq visible-string (concat (match-string 1 visible-string)
|
||||||
(match-string 2 visible-string))))
|
(match-string 2 visible-string))))
|
||||||
;; `visible-string' may be shorter than the space allowed
|
;; `visible-string' may be shorter than the space allowed
|
||||||
;; by `format-string'. If so we must insert some padding
|
;; by `format-string'. If so we must insert some padding
|
||||||
|
@ -785,17 +785,18 @@ non-authors is found, assume that all of the authors match."
|
||||||
(if (string-match "\\(.*\\)|\\(.*\\)" visible-string)
|
(if (string-match "\\(.*\\)|\\(.*\\)" visible-string)
|
||||||
;; The visible string contains both matching and
|
;; The visible string contains both matching and
|
||||||
;; non-matching authors.
|
;; non-matching authors.
|
||||||
(setq visible-string (notmuch-search-author-propertize visible-string)
|
(progn
|
||||||
;; The invisible string must contain only non-matching
|
(setq visible-string (notmuch-search-author-propertize visible-string))
|
||||||
;; authors, as the visible-string contains both.
|
;; The invisible string must contain only non-matching
|
||||||
invisible-string (propertize invisible-string
|
;; authors, as the visible-string contains both.
|
||||||
'face 'notmuch-search-non-matching-authors))
|
(setq invisible-string (propertize invisible-string
|
||||||
|
'face 'notmuch-search-non-matching-authors)))
|
||||||
;; The visible string contains only matching authors.
|
;; The visible string contains only matching authors.
|
||||||
(setq visible-string (propertize visible-string
|
(setq visible-string (propertize visible-string
|
||||||
'face 'notmuch-search-matching-authors)
|
'face 'notmuch-search-matching-authors))
|
||||||
;; The invisible string may contain both matching and
|
;; The invisible string may contain both matching and
|
||||||
;; non-matching authors.
|
;; non-matching authors.
|
||||||
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 ""))
|
(when (not (string= invisible-string ""))
|
||||||
|
|
Loading…
Reference in a new issue