mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 02:48:08 +01:00
emacs: deal with unused lexical arguments and variables
The previous commit switched to lexical-binding but without dealing with the new warnings about unused lexical arguments and variables. This commit deals with most of them, in most cases by either removing leftover bindings that are actually unnecessary, or by marking certain arguments as "known to be unused" by prefixing their names with "_". In the case of the functions named `notmuch-show-insert-...' the amount of silencing that is required is a bit extreme and we might want to investigate if there is a better way. In the case of `notmuch-mua-mail', ignoring CONTINUE means that we do not fully follow the intended behavior described in `compose-mail's doc-string.
This commit is contained in:
parent
fc4cda07a9
commit
0067a43ea2
12 changed files with 54 additions and 61 deletions
|
@ -191,7 +191,7 @@ toggles the setting in this buffer."
|
|||
The candidates are taken from `notmuch-address-completions'."
|
||||
(let ((candidates)
|
||||
(re (regexp-quote substring)))
|
||||
(maphash (lambda (key val)
|
||||
(maphash (lambda (key _val)
|
||||
(when (string-match re key)
|
||||
(push key candidates)))
|
||||
notmuch-address-completions)
|
||||
|
@ -406,7 +406,7 @@ appear to be an address savefile. Not overwriting."
|
|||
(setq notmuch-address-last-harvest now)
|
||||
(notmuch-address-harvest
|
||||
nil nil
|
||||
(lambda (proc event)
|
||||
(lambda (_proc event)
|
||||
;; If harvest fails, we want to try
|
||||
;; again when the trigger is next
|
||||
;; called
|
||||
|
|
|
@ -171,7 +171,7 @@ mode."
|
|||
(declare-function notmuch-show-refresh-view "notmuch-show" (&optional reset-state))
|
||||
(declare-function notmuch-show-get-message-id "notmuch-show" (&optional bare))
|
||||
|
||||
(defun notmuch-crypto--async-key-sentinel (process event)
|
||||
(defun notmuch-crypto--async-key-sentinel (process _event)
|
||||
"When the user asks for a GPG key to be retrieved
|
||||
asynchronously, handle completion of that task.
|
||||
|
||||
|
|
|
@ -480,7 +480,7 @@ diagonal."
|
|||
(cl-loop for row from 0 to (- nrows 1)
|
||||
append (notmuch-hello-reflect-generate-row ncols nrows row list))))
|
||||
|
||||
(defun notmuch-hello-widget-search (widget &rest ignore)
|
||||
(defun notmuch-hello-widget-search (widget &rest _ignore)
|
||||
(cond
|
||||
((eq (widget-get widget :notmuch-search-type) 'tree)
|
||||
(notmuch-tree (widget-get widget
|
||||
|
@ -775,14 +775,14 @@ Complete list of currently available key bindings:
|
|||
(let ((widget-link-prefix "")
|
||||
(widget-link-suffix ""))
|
||||
(widget-create 'link
|
||||
:notify (lambda (&rest ignore)
|
||||
:notify (lambda (&rest _ignore)
|
||||
(browse-url notmuch-hello-url))
|
||||
:help-echo "Visit the notmuch website."
|
||||
"notmuch")
|
||||
(widget-insert ". ")
|
||||
(widget-insert "You have ")
|
||||
(widget-create 'link
|
||||
:notify (lambda (&rest ignore)
|
||||
:notify (lambda (&rest _ignore)
|
||||
(notmuch-hello-update))
|
||||
:help-echo "Refresh"
|
||||
(notmuch-hello-nice-number
|
||||
|
@ -801,7 +801,7 @@ Complete list of currently available key bindings:
|
|||
(when searches
|
||||
(widget-insert "Saved searches: ")
|
||||
(widget-create 'push-button
|
||||
:notify (lambda (&rest ignore)
|
||||
:notify (lambda (&rest _ignore)
|
||||
(customize-variable 'notmuch-saved-searches))
|
||||
"edit")
|
||||
(widget-insert "\n\n")
|
||||
|
@ -873,13 +873,13 @@ Supports the following entries in OPTIONS as a plist:
|
|||
(start (point)))
|
||||
(if is-hidden
|
||||
(widget-create 'push-button
|
||||
:notify `(lambda (widget &rest ignore)
|
||||
:notify `(lambda (widget &rest _ignore)
|
||||
(setq notmuch-hello-hidden-sections
|
||||
(delete ,title notmuch-hello-hidden-sections))
|
||||
(notmuch-hello-update))
|
||||
"show")
|
||||
(widget-create 'push-button
|
||||
:notify `(lambda (widget &rest ignore)
|
||||
:notify `(lambda (widget &rest _ignore)
|
||||
(add-to-list 'notmuch-hello-hidden-sections
|
||||
,title)
|
||||
(notmuch-hello-update))
|
||||
|
@ -928,13 +928,13 @@ following:
|
|||
(widget-insert "Hit `?' for context-sensitive help in any Notmuch screen.\n")
|
||||
(widget-insert "Customize ")
|
||||
(widget-create 'link
|
||||
:notify (lambda (&rest ignore)
|
||||
:notify (lambda (&rest _ignore)
|
||||
(customize-group 'notmuch))
|
||||
:button-prefix "" :button-suffix ""
|
||||
"Notmuch")
|
||||
(widget-insert " or ")
|
||||
(widget-create 'link
|
||||
:notify (lambda (&rest ignore)
|
||||
:notify (lambda (&rest _ignore)
|
||||
(customize-variable 'notmuch-hello-sections))
|
||||
:button-prefix "" :button-suffix ""
|
||||
"this page.")
|
||||
|
|
|
@ -120,7 +120,7 @@ ACTION-MAP. These strings can be inserted into a tabular
|
|||
buffer."
|
||||
;; Compute the maximum key description width
|
||||
(let ((key-width 1))
|
||||
(pcase-dolist (`(,key ,desc) action-map)
|
||||
(pcase-dolist (`(,key ,_desc) action-map)
|
||||
(setq key-width
|
||||
(max key-width
|
||||
(string-width (format-kbd-macro key)))))
|
||||
|
@ -164,7 +164,7 @@ buffer."
|
|||
"Translate ACTION-MAP into a minibuffer keymap."
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(set-keymap-parent map notmuch-jump-minibuffer-map)
|
||||
(pcase-dolist (`(,key ,name ,fn) action-map)
|
||||
(pcase-dolist (`(,key ,_name ,fn) action-map)
|
||||
(when (= (length key) 1)
|
||||
(define-key map key
|
||||
`(lambda () (interactive)
|
||||
|
@ -173,7 +173,7 @@ buffer."
|
|||
;; By doing this in two passes (and checking if we already have a
|
||||
;; binding) we avoid problems if the user specifies a binding which
|
||||
;; is a prefix of another binding.
|
||||
(pcase-dolist (`(,key ,name ,fn) action-map)
|
||||
(pcase-dolist (`(,key ,_name ,_fn) action-map)
|
||||
(when (> (length key) 1)
|
||||
(let* ((key (elt key 0))
|
||||
(keystr (string key))
|
||||
|
|
|
@ -978,7 +978,7 @@ status."
|
|||
;; so turn errors into messages.
|
||||
(message "%s" (error-message-string err))))))
|
||||
|
||||
(defun notmuch-start-notmuch-error-sentinel (proc event)
|
||||
(defun notmuch-start-notmuch-error-sentinel (proc _event)
|
||||
(unless (process-live-p proc)
|
||||
(let ((buffer (process-buffer proc)))
|
||||
(when (buffer-live-p buffer)
|
||||
|
|
|
@ -346,12 +346,12 @@ return t if successful, and nil otherwise."
|
|||
(let ((msg-id (notmuch-maildir-fcc-save-buffer-to-tmp destdir)))
|
||||
(when msg-id
|
||||
(cond (mark-seen
|
||||
(condition-case err
|
||||
(condition-case nil
|
||||
(notmuch-maildir-fcc-move-tmp-to-cur destdir msg-id t)
|
||||
(file-already-exists
|
||||
(throw 'link-error nil))))
|
||||
(t
|
||||
(condition-case err
|
||||
(condition-case nil
|
||||
(notmuch-maildir-fcc-move-tmp-to-new destdir msg-id)
|
||||
(file-already-exists
|
||||
(throw 'link-error nil))))))
|
||||
|
|
|
@ -370,7 +370,7 @@ instead of `message-mode' and SWITCH-FUNCTION is mandatory."
|
|||
(erase-buffer)
|
||||
(notmuch-message-mode)))
|
||||
|
||||
(defun notmuch-mua-mail (&optional to subject other-headers continue
|
||||
(defun notmuch-mua-mail (&optional to subject other-headers _continue
|
||||
switch-function yank-action send-actions
|
||||
return-action &rest ignored)
|
||||
"Invoke the notmuch mail composition window."
|
||||
|
|
|
@ -58,7 +58,7 @@ Optional OUTPUT allows passing a list of flags to muttprint."
|
|||
|
||||
;;; User-visible functions
|
||||
|
||||
(defun notmuch-print-lpr (msg)
|
||||
(defun notmuch-print-lpr (_msg)
|
||||
"Print a message buffer using lpr."
|
||||
(lpr-buffer))
|
||||
|
||||
|
@ -78,11 +78,11 @@ Optional OUTPUT allows passing a list of flags to muttprint."
|
|||
(ps-print-buffer ps-file)
|
||||
(notmuch-print-run-evince ps-file)))
|
||||
|
||||
(defun notmuch-print-muttprint (msg)
|
||||
(defun notmuch-print-muttprint (_msg)
|
||||
"Print a message using muttprint."
|
||||
(notmuch-print-run-muttprint))
|
||||
|
||||
(defun notmuch-print-muttprint/evince (msg)
|
||||
(defun notmuch-print-muttprint/evince (_msg)
|
||||
"Preview a message buffer using muttprint and evince."
|
||||
(let ((ps-file (make-temp-file "notmuch" nil ".ps")))
|
||||
(notmuch-print-run-muttprint (list "--printer" (concat "TO_FILE:" ps-file)))
|
||||
|
|
|
@ -517,7 +517,7 @@ message at DEPTH in the current thread."
|
|||
'face 'message-mml
|
||||
:supertype 'notmuch-button-type)
|
||||
|
||||
(defun notmuch-show-insert-part-header (nth content-type declared-type
|
||||
(defun notmuch-show-insert-part-header (_nth content-type declared-type
|
||||
&optional name comment)
|
||||
(let ((base-label (concat (and name (concat name ": "))
|
||||
declared-type
|
||||
|
@ -624,7 +624,7 @@ will return nil if the CID is unknown or cannot be retrieved."
|
|||
(setq mm-html-inhibit-images nil))
|
||||
|
||||
(defvar w3m-current-buffer) ;; From `w3m.el'.
|
||||
(defun notmuch-show--cid-w3m-retrieve (url &rest args)
|
||||
(defun notmuch-show--cid-w3m-retrieve (url &rest _args)
|
||||
;; url includes the cid: prefix and is URL encoded (see RFC 2392).
|
||||
(let* ((cid (url-unhex-string (substring url 4)))
|
||||
(content-and-type
|
||||
|
@ -640,7 +640,7 @@ will return nil if the CID is unknown or cannot be retrieved."
|
|||
(mapcar (lambda (inner-part) (plist-get inner-part :content-type))
|
||||
(plist-get part :content)))
|
||||
|
||||
(defun notmuch-show-insert-part-multipart/alternative (msg part content-type nth depth button)
|
||||
(defun notmuch-show-insert-part-multipart/alternative (msg part _content-type _nth depth _button)
|
||||
(let ((chosen-type (car (notmuch-multipart/alternative-choose
|
||||
msg (notmuch-show-multipart/*-to-list part))))
|
||||
(inner-parts (plist-get part :content))
|
||||
|
@ -659,7 +659,7 @@ will return nil if the CID is unknown or cannot be retrieved."
|
|||
(indent-rigidly start (point) 1)))
|
||||
t)
|
||||
|
||||
(defun notmuch-show-insert-part-multipart/related (msg part content-type nth depth button)
|
||||
(defun notmuch-show-insert-part-multipart/related (msg part _content-type _nth depth _button)
|
||||
(let ((inner-parts (plist-get part :content))
|
||||
(start (point)))
|
||||
;; Render the primary part. FIXME: Support RFC 2387 Start header.
|
||||
|
@ -672,7 +672,7 @@ will return nil if the CID is unknown or cannot be retrieved."
|
|||
(indent-rigidly start (point) 1)))
|
||||
t)
|
||||
|
||||
(defun notmuch-show-insert-part-multipart/signed (msg part content-type nth depth button)
|
||||
(defun notmuch-show-insert-part-multipart/signed (msg part _content-type _nth depth button)
|
||||
(when button
|
||||
(button-put button 'face 'notmuch-crypto-part-header))
|
||||
;; Insert a button detailing the signature status.
|
||||
|
@ -688,7 +688,7 @@ will return nil if the CID is unknown or cannot be retrieved."
|
|||
(indent-rigidly start (point) 1)))
|
||||
t)
|
||||
|
||||
(defun notmuch-show-insert-part-multipart/encrypted (msg part content-type nth depth button)
|
||||
(defun notmuch-show-insert-part-multipart/encrypted (msg part _content-type _nth depth button)
|
||||
(when button
|
||||
(button-put button 'face 'notmuch-crypto-part-header))
|
||||
;; Insert a button detailing the encryption status.
|
||||
|
@ -706,10 +706,10 @@ will return nil if the CID is unknown or cannot be retrieved."
|
|||
(indent-rigidly start (point) 1)))
|
||||
t)
|
||||
|
||||
(defun notmuch-show-insert-part-application/pgp-encrypted (msg part content-type nth depth button)
|
||||
(defun notmuch-show-insert-part-application/pgp-encrypted (_msg _part _content-type _nth _depth _button)
|
||||
t)
|
||||
|
||||
(defun notmuch-show-insert-part-multipart/* (msg part content-type nth depth button)
|
||||
(defun notmuch-show-insert-part-multipart/* (msg part _content-type _nth depth _button)
|
||||
(let ((inner-parts (plist-get part :content))
|
||||
(start (point)))
|
||||
;; Show all of the parts.
|
||||
|
@ -720,7 +720,7 @@ will return nil if the CID is unknown or cannot be retrieved."
|
|||
(indent-rigidly start (point) 1)))
|
||||
t)
|
||||
|
||||
(defun notmuch-show-insert-part-message/rfc822 (msg part content-type nth depth button)
|
||||
(defun notmuch-show-insert-part-message/rfc822 (msg part _content-type _nth depth _button)
|
||||
(let* ((message (car (plist-get part :content)))
|
||||
(body (car (plist-get message :body)))
|
||||
(start (point)))
|
||||
|
@ -737,7 +737,7 @@ will return nil if the CID is unknown or cannot be retrieved."
|
|||
(indent-rigidly start (point) 1)))
|
||||
t)
|
||||
|
||||
(defun notmuch-show-insert-part-text/plain (msg part content-type nth depth button)
|
||||
(defun notmuch-show-insert-part-text/plain (msg part _content-type _nth depth button)
|
||||
;; For backward compatibility we want to apply the text/plain hook
|
||||
;; to the whole of the part including the part button if there is
|
||||
;; one.
|
||||
|
@ -751,7 +751,7 @@ will return nil if the CID is unknown or cannot be retrieved."
|
|||
(run-hook-with-args 'notmuch-show-insert-text/plain-hook msg depth))))
|
||||
t)
|
||||
|
||||
(defun notmuch-show-insert-part-text/calendar (msg part content-type nth depth button)
|
||||
(defun notmuch-show-insert-part-text/calendar (msg part _content-type _nth _depth _button)
|
||||
(insert (with-temp-buffer
|
||||
(insert (notmuch-get-bodypart-text msg part notmuch-show-process-crypto))
|
||||
;; notmuch-get-bodypart-text does no newline conversion.
|
||||
|
@ -775,8 +775,8 @@ will return nil if the CID is unknown or cannot be retrieved."
|
|||
t)
|
||||
|
||||
;; For backwards compatibility.
|
||||
(defun notmuch-show-insert-part-text/x-vcalendar (msg part content-type nth depth button)
|
||||
(notmuch-show-insert-part-text/calendar msg part content-type nth depth button))
|
||||
(defun notmuch-show-insert-part-text/x-vcalendar (msg part _content-type _nth depth _button)
|
||||
(notmuch-show-insert-part-text/calendar msg part nil nil depth nil))
|
||||
|
||||
(when (version< emacs-version "25.3")
|
||||
;; https://bugs.gnu.org/28350
|
||||
|
@ -792,7 +792,7 @@ will return nil if the CID is unknown or cannot be retrieved."
|
|||
;; the first time).
|
||||
(require 'enriched)
|
||||
(cl-letf (((symbol-function 'enriched-decode-display-prop)
|
||||
(lambda (start end &optional param) (list start end))))
|
||||
(lambda (start end &optional _param) (list start end))))
|
||||
(notmuch-show-insert-part-*/* msg part content-type nth depth button))))
|
||||
|
||||
(defun notmuch-show-get-mime-type-of-application/octet-stream (part)
|
||||
|
@ -850,7 +850,7 @@ will return nil if the CID is unknown or cannot be retrieved."
|
|||
(shr-insert-document dom)
|
||||
t))
|
||||
|
||||
(defun notmuch-show-insert-part-*/* (msg part content-type nth depth button)
|
||||
(defun notmuch-show-insert-part-*/* (msg part content-type _nth _depth _button)
|
||||
;; This handler _must_ succeed - it is the handler of last resort.
|
||||
(notmuch-mm-display-part-inline msg part content-type notmuch-show-process-crypto)
|
||||
t)
|
||||
|
@ -970,13 +970,13 @@ The function should take two parameters, PART and HIDE, and
|
|||
should return non-NIL if a header button should be inserted for
|
||||
this part.")
|
||||
|
||||
(defun notmuch-show-insert-header-p (part hide)
|
||||
(defun notmuch-show-insert-header-p (part _hide)
|
||||
;; Show all part buttons except for the first part if it is text/plain.
|
||||
(let ((mime-type (notmuch-show-mime-type part)))
|
||||
(not (and (string= mime-type "text/plain")
|
||||
(<= (plist-get part :id) 1)))))
|
||||
|
||||
(defun notmuch-show-reply-insert-header-p-never (part hide)
|
||||
(defun notmuch-show-reply-insert-header-p-never (_part _hide)
|
||||
nil)
|
||||
|
||||
(defun notmuch-show-reply-insert-header-p-trimmed (part hide)
|
||||
|
@ -1759,7 +1759,7 @@ marked as unread, i.e. the tag changes in
|
|||
(apply 'notmuch-show-tag-message
|
||||
(notmuch-tag-change-list notmuch-show-mark-read-tags unread))))
|
||||
|
||||
(defun notmuch-show-seen-current-message (start end)
|
||||
(defun notmuch-show-seen-current-message (_start _end)
|
||||
"Mark the current message read if it is open.
|
||||
|
||||
We only mark it read once: if it is changed back then that is a
|
||||
|
@ -1777,7 +1777,7 @@ user decision and we should not override it."
|
|||
;; We need to redisplay to get window-start and window-end correct.
|
||||
(redisplay)
|
||||
(save-excursion
|
||||
(condition-case err
|
||||
(condition-case nil
|
||||
(funcall notmuch-show-mark-read-function (window-start) (window-end))
|
||||
((debug error)
|
||||
(unless notmuch-show--seen-has-errored
|
||||
|
|
|
@ -598,8 +598,7 @@ NOT change the database."
|
|||
"Show the current message (in whole window)."
|
||||
(interactive)
|
||||
(let ((id (notmuch-tree-get-message-id))
|
||||
(inhibit-read-only t)
|
||||
buffer)
|
||||
(inhibit-read-only t))
|
||||
(when id
|
||||
;; We close the window to kill off un-needed buffers.
|
||||
(notmuch-tree-close-message-window)
|
||||
|
@ -1033,19 +1032,17 @@ Complete list of currently available key bindings:
|
|||
(setq buffer-read-only 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."
|
||||
(let ((buffer (process-buffer proc))
|
||||
(status (process-status proc))
|
||||
(exit-status (process-exit-status proc))
|
||||
(never-found-target-thread nil))
|
||||
(exit-status (process-exit-status proc)))
|
||||
(when (memq status '(exit signal))
|
||||
(kill-buffer (process-get proc 'parse-buf))
|
||||
(when (buffer-live-p buffer)
|
||||
(with-current-buffer buffer
|
||||
(save-excursion
|
||||
(let ((inhibit-read-only t)
|
||||
(atbob (bobp)))
|
||||
(let ((inhibit-read-only t))
|
||||
(goto-char (point-max))
|
||||
(when (eq status 'signal)
|
||||
(insert "Incomplete search results (tree view process was killed).\n"))
|
||||
|
@ -1059,8 +1056,7 @@ Complete list of currently available key bindings:
|
|||
"Process and filter the output of \"notmuch show\" for tree view."
|
||||
(let ((results-buf (process-buffer proc))
|
||||
(parse-buf (process-get proc 'parse-buf))
|
||||
(inhibit-read-only t)
|
||||
done)
|
||||
(inhibit-read-only t))
|
||||
(if (not (buffer-live-p results-buf))
|
||||
(delete-process proc)
|
||||
(with-current-buffer parse-buf
|
||||
|
|
|
@ -237,11 +237,10 @@ that PREFIX should not include a newline."
|
|||
(beginning-of-line)
|
||||
(when (and (< (point) (point-max))
|
||||
(re-search-forward notmuch-wash-original-regexp nil t))
|
||||
(let* ((msg-start (match-beginning 0))
|
||||
(msg-end (point-max))
|
||||
(msg-lines (count-lines msg-start msg-end)))
|
||||
(notmuch-wash-region-to-button
|
||||
msg msg-start msg-end "original")))
|
||||
(notmuch-wash-region-to-button msg
|
||||
(match-beginning 0)
|
||||
(point-max)
|
||||
"original"))
|
||||
(while (and (< (point) (point-max))
|
||||
(re-search-forward notmuch-wash-citation-regexp nil t))
|
||||
(let* ((cite-start (match-beginning 0))
|
||||
|
@ -262,10 +261,9 @@ that PREFIX should not include a newline."
|
|||
"citation")))))
|
||||
(when (and (not (eobp))
|
||||
(re-search-forward notmuch-wash-signature-regexp nil t))
|
||||
(let* ((sig-start (match-beginning 0))
|
||||
(sig-end (match-end 0))
|
||||
(sig-lines (count-lines sig-start (point-max))))
|
||||
(when (<= sig-lines notmuch-wash-signature-lines-max)
|
||||
(let ((sig-start (match-beginning 0)))
|
||||
(when (<= (count-lines sig-start (point-max))
|
||||
notmuch-wash-signature-lines-max)
|
||||
(let ((sig-start-marker (make-marker))
|
||||
(sig-end-marker (make-marker)))
|
||||
(set-marker sig-start-marker sig-start)
|
||||
|
|
|
@ -693,7 +693,7 @@ of the result."
|
|||
(min init-point (- new-end 1)))))
|
||||
(goto-char new-point)))))
|
||||
|
||||
(defun notmuch-search-process-sentinel (proc msg)
|
||||
(defun notmuch-search-process-sentinel (proc _msg)
|
||||
"Add a message to let user know when \"notmuch search\" exits."
|
||||
(let ((buffer (process-buffer proc))
|
||||
(status (process-status proc))
|
||||
|
@ -896,8 +896,7 @@ sets the :orig-tag property."
|
|||
"Process and filter the output of \"notmuch search\"."
|
||||
(let ((results-buf (process-buffer proc))
|
||||
(parse-buf (process-get proc 'parse-buf))
|
||||
(inhibit-read-only t)
|
||||
done)
|
||||
(inhibit-read-only t))
|
||||
(when (buffer-live-p results-buf)
|
||||
(with-current-buffer parse-buf
|
||||
;; Insert new data
|
||||
|
|
Loading…
Reference in a new issue