I did it again; looked at some code and cleaned it up along the way. Cheers, Jonas Jonas Bernoulli (27): emacs: silence byte-compiler emacs: define notmuch-message-mode-map explicitly emacs: add doc-string to notmuch-tree-mode-map emacs: don't fset keymaps emacs: remove redundant notmuch-hello-trim emacs: fix old bug in notmuch-mua-mail emacs: remove kludge for Emacs 23 from notmuch-mua-mail emacs: more cleanup since dropping support for Emacs 24 emacs: sanitize function that displays version emacs: define notmuch-hello-url as a constant emacs: shorten/replace first sentence of a few doc-strings emacs: place only first sentence on first doc-string line emacs: place complete first sentence on first doc-string line emacs: always use elisp quoting style in doc-strings emacs: misc doc-string improvements emacs: remove deprecated notmuch-folder command emacs: remove unnecessary notmuch-remove-if-not emacs: remove unused notmuch-address-locate-command emacs: remove unnecessary notmuch-tree-button-activate emacs: inline notmuch-documentation-first-line emacs: inline notmuch-split-content-type emacs: use defvar-local emacs: use setq-local emacs: use setq instead set emacs: do not quote self-quoting t emacs: avoid binding unnamed commands in keymaps emacs: various cosmetic improvements emacs/coolj.el | 4 +- emacs/notmuch-address.el | 58 ++++-------- emacs/notmuch-company.el | 7 +- emacs/notmuch-compat.el | 9 +- emacs/notmuch-crypto.el | 7 +- emacs/notmuch-draft.el | 17 ++-- emacs/notmuch-hello.el | 123 ++++++++---------------- emacs/notmuch-jump.el | 5 - emacs/notmuch-lib.el | 108 +++++++++------------ emacs/notmuch-maildir-fcc.el | 12 +-- emacs/notmuch-mua.el | 77 +++++++-------- emacs/notmuch-parser.el | 5 +- emacs/notmuch-show.el | 57 +++++------ emacs/notmuch-tag.el | 24 ++--- emacs/notmuch-tree.el | 179 ++++++++++++++++++----------------- emacs/notmuch.el | 109 +++++++++++---------- 16 files changed, 346 insertions(+), 455 deletions(-) -- 2.29.1
--- emacs/notmuch-tree.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index f342f85a..7b1e34ca 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -42,6 +42,11 @@ (declare-function notmuch-read-query "notmuch" (prompt)) (declare-function notmuch-search-find-thread-id "notmuch" (&optional bare)) (declare-function notmuch-search-find-subject "notmuch" ()) +;; For `notmuch-tree-next-thread-from-search'. +(declare-function notmuch-search-next-thread "notmuch" ()) +(declare-function notmuch-search-previous-thread "notmuch" ()) +(declare-function notmuch-tree-from-search-thread "notmuch" ()) + ;; the following variable is defined in notmuch.el (defvar notmuch-search-query-string) -- 2.29.1
Key bindings should not be defined at the top-level but inside a `defvar' form. Doing it at the top-level makes it harder to reliably customize key bindings. --- emacs/notmuch-mua.el | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 03c7cc97..616b625c 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -324,17 +324,21 @@ (defun notmuch-mua-reply (query-string &optional sender reply-all) (message-goto-body) (set-buffer-modified-p nil)) +(defvar notmuch-message-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "C-c C-c") #'notmuch-mua-send-and-exit) + (define-key map (kbd "C-c C-s") #'notmuch-mua-send) + (define-key map (kbd "C-c C-p") #'notmuch-draft-postpone) + (define-key map (kbd "C-x C-s") #'notmuch-draft-save) + map) + "Keymap for `notmuch-message-mode'.") + (define-derived-mode notmuch-message-mode message-mode "Message[Notmuch]" "Notmuch message composition mode. Mostly like `message-mode'." (notmuch-address-setup)) (put 'notmuch-message-mode 'flyspell-mode-predicate 'mail-mode-flyspell-verify) -(define-key notmuch-message-mode-map (kbd "C-c C-c") #'notmuch-mua-send-and-exit) -(define-key notmuch-message-mode-map (kbd "C-c C-s") #'notmuch-mua-send) -(define-key notmuch-message-mode-map (kbd "C-c C-p") #'notmuch-draft-postpone) -(define-key notmuch-message-mode-map (kbd "C-x C-s") #'notmuch-draft-save) - (defun notmuch-mua-pop-to-buffer (name switch-function) "Pop to buffer NAME, and warn if it already exists and is modified. This function is notmuch adaptation of -- 2.29.1
--- emacs/notmuch-tree.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index 7b1e34ca..ea6a5cf3 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -359,7 +359,8 @@ (defvar notmuch-tree-mode-map (define-key map " " 'notmuch-tree-scroll-or-next) (define-key map (kbd "DEL") 'notmuch-tree-scroll-message-window-back) (define-key map "e" 'notmuch-tree-resume-message) - map)) + map) + "Keymap for \"notmuch tree\" buffers.") (fset 'notmuch-tree-mode-map notmuch-tree-mode-map) (defun notmuch-tree-get-message-properties () -- 2.29.1
These keymaps are never invoked as commands so the function definitions serve no purpose. --- emacs/notmuch-show.el | 1 - emacs/notmuch-tree.el | 1 - emacs/notmuch.el | 1 - 3 files changed, 3 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index b08ceb97..ec22fd94 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1485,7 +1485,6 @@ (defvar notmuch-show-mode-map (define-key map "B" 'notmuch-show-browse-urls) map) "Keymap for \"notmuch show\" buffers.") -(fset 'notmuch-show-mode-map notmuch-show-mode-map) (define-derived-mode notmuch-show-mode fundamental-mode "notmuch-show" "Major mode for viewing a thread with notmuch. diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index ea6a5cf3..ad08f7c6 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -361,7 +361,6 @@ (defvar notmuch-tree-mode-map (define-key map "e" 'notmuch-tree-resume-message) map) "Keymap for \"notmuch tree\" buffers.") -(fset 'notmuch-tree-mode-map notmuch-tree-mode-map) (defun notmuch-tree-get-message-properties () "Return the properties of the current message as a plist. diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 83bcee57..165aaa43 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -194,7 +194,6 @@ (defvar notmuch-search-mode-map (define-key map "U" 'notmuch-unthreaded-from-search-current-query) map) "Keymap for \"notmuch search\" buffers.") -(fset 'notmuch-search-mode-map notmuch-search-mode-map) (defvar notmuch-search-stash-map (let ((map (make-sparse-keymap))) -- 2.29.1
Use `string-trim', which exists since Emacs 24.4. --- emacs/notmuch-hello.el | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index bb60a890..b67a5e19 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -387,15 +387,9 @@ (defun notmuch-hello-nice-number (n) (format "%s%03d" notmuch-hello-thousands-separator elem)) (cdr result))))) -(defun notmuch-hello-trim (search) - "Trim whitespace." - (if (string-match "^[[:space:]]*\\(.*[^[:space:]]\\)[[:space:]]*$" search) - (match-string 1 search) - search)) - (defun notmuch-hello-search (&optional search) (unless (null search) - (setq search (notmuch-hello-trim search)) + (setq search (string-trim search)) (let ((history-delete-duplicates t)) (add-to-history 'notmuch-search-history search))) (notmuch-search search notmuch-search-oldest-first)) -- 2.29.1
This fixes a regression introduced in [1: 7e20d264]. If the argument RETURN-ACTION was non-nil then we should pass along the value of that argument. Instead we passed along the constant symbol `return-action'. 1: 7e20d26480553f57d53bd9ec28cae163c1ac91e3 emacs: Fix mail composition under Emacs 23 --- emacs/notmuch-mua.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 616b625c..1204fb6a 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -402,7 +402,7 @@ (defun notmuch-mua-mail (&optional to subject other-headers continue ;; argument. Pass it only if it is supplied by the caller. This ;; will never be the case when we're called by `compose-mail' in ;; Emacs 23. - (when return-action (nconc args '(return-action))) + (when return-action (nconc args (list return-action))) (apply 'message-setup-1 headers args)) (notmuch-fcc-header-setup) (message-sort-headers) -- 2.29.1
Notmuch requires at least Emacs version 25. The `return-action' argument was added prior to Emacs 24.1 in 25ca2e61403f97b5a023164f2924d5f8aca2492a. --- emacs/notmuch-mua.el | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 1204fb6a..869ec51a 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -394,16 +394,10 @@ (defun notmuch-mua-mail (&optional to subject other-headers continue (dolist (h other-headers other-headers) (when (stringp (car h)) (setcar h (intern (capitalize (car h)))))))) - (args (list yank-action send-actions)) ;; Cause `message-setup-1' to do things relevant for mail, ;; such as observe `message-default-mail-headers'. (message-this-is-mail t)) - ;; message-setup-1 in Emacs 23 does not accept return-action - ;; argument. Pass it only if it is supplied by the caller. This - ;; will never be the case when we're called by `compose-mail' in - ;; Emacs 23. - (when return-action (nconc args (list return-action))) - (apply 'message-setup-1 headers args)) + (message-setup-1 headers yank-action send-actions return-action)) (notmuch-fcc-header-setup) (message-sort-headers) (message-hide-headers) -- 2.29.1
Notmuch requires at least version 25 of Emacs now. Adjust comments that previously referenced version 24 specifically, even though they also apply to later releases. Remove documentation and code that no longer applies. - `mm-shr' no longer references `gnus-inhibit-images'. --- emacs/notmuch-compat.el | 9 +++++---- emacs/notmuch-hello.el | 16 +++++----------- emacs/notmuch-jump.el | 5 ----- emacs/notmuch-lib.el | 12 ------------ emacs/notmuch-mua.el | 17 ++++++----------- emacs/notmuch-show.el | 10 ++++------ emacs/notmuch-tree.el | 7 ++++--- 7 files changed, 24 insertions(+), 52 deletions(-) diff --git a/emacs/notmuch-compat.el b/emacs/notmuch-compat.el index 3ede6b36..2975f4c2 100644 --- a/emacs/notmuch-compat.el +++ b/emacs/notmuch-compat.el @@ -21,10 +21,11 @@ ;;; Code: -;; emacs master has a bugfix for folding long headers when sending -;; messages. Include the fix for earlier versions of emacs. To avoid -;; interfering with gnus we only run the hook when called from -;; notmuch-message-mode. +;; Before Emacs 26.1 lines that are longer than 998 octets were not. +;; folded. Commit 77bbca8c82f6e553c42abbfafca28f55fc995d00 fixed +;; that. Until we drop support for Emacs 25 we have to backport that +;; fix. To avoid interfering with Gnus we only run the hook when +;; called from notmuch-message-mode. (declare-function mail-header-fold-field "mail-parse" nil) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index b67a5e19..af170dd4 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -645,6 +645,7 @@ (defun notmuch-hello-window-configuration-change () ;; Refresh hello as soon as we get back to redisplay. On Emacs ;; 24, we can't do it right here because something in this ;; hook's call stack overrides hello's point placement. + ;; FIXME And on Emacs releases that we still support? (run-at-time nil nil #'notmuch-hello t)) (unless hello-buf ;; Clean up hook @@ -665,17 +666,10 @@ (defun notmuch-hello-versions () " (emacs mua version " notmuch-emacs-version ")"))))) (defvar notmuch-hello-mode-map - (let ((map (if (fboundp 'make-composed-keymap) - ;; Inherit both widget-keymap and - ;; notmuch-common-keymap. We have to use - ;; make-sparse-keymap to force this to be a new - ;; keymap (so that when we modify map it does not - ;; modify widget-keymap). - (make-composed-keymap (list (make-sparse-keymap) widget-keymap)) - ;; Before Emacs 24, keymaps didn't support multiple - ;; inheritance,, so just copy the widget keymap since - ;; it's unlikely to change. - (copy-keymap widget-keymap)))) + ;; Inherit both widget-keymap and notmuch-common-keymap. We have + ;; to use make-sparse-keymap to force this to be a new keymap (so + ;; that when we modify map it does not modify widget-keymap). + (let ((map (make-composed-keymap (list (make-sparse-keymap) widget-keymap)))) (set-keymap-parent map notmuch-common-keymap) (define-key map "v" 'notmuch-hello-versions) (define-key map (kbd "<C-tab>") 'widget-backward) diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el index 1e2d0497..ff622055 100644 --- a/emacs/notmuch-jump.el +++ b/emacs/notmuch-jump.el @@ -29,11 +29,6 @@ (eval-when-compile (require 'notmuch-lib) (require 'notmuch-hello) -(eval-and-compile - (unless (fboundp 'window-body-width) - ;; Compatibility for Emacs pre-24 - (defalias 'window-body-width 'window-width))) - ;;;###autoload (defun notmuch-jump-search () "Jump to a saved search by shortcut key. diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 118faf1e..edb40533 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -653,18 +653,6 @@ (defun notmuch-get-bodypart-text (msg part process-crypto &optional cache) MSG (if it isn't already)." (notmuch--get-bodypart-raw msg part process-crypto nil cache)) -;; Workaround: The call to `mm-display-part' below triggers a bug in -;; Emacs 24 if it attempts to use the shr renderer to display an HTML -;; part with images in it (demonstrated in 24.1 and 24.2 on Debian and -;; Fedora 17, though unreproducible in other configurations). -;; `mm-shr' references the variable `gnus-inhibit-images' without -;; first loading gnus-art, which defines it, resulting in a -;; void-variable error. Hence, we advise `mm-shr' to ensure gnus-art -;; is loaded. -(define-advice mm-shr (:before (_handle) notmuch--load-gnus-args) - "Require `gnus-art' since we use its variables." - (require 'gnus-art nil t)) - (defun notmuch-mm-display-part-inline (msg part content-type process-crypto) "Use the mm-decode/mm-view functions to display a part in the current buffer, if possible." diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 869ec51a..49bad00d 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -47,8 +47,7 @@ (defcustom notmuch-mua-send-hook nil :group 'notmuch-hooks) (defcustom notmuch-mua-compose-in 'current-window - (concat - "Where to create the mail buffer used to compose a new message. + "Where to create the mail buffer used to compose a new message. Possible values are `current-window' (default), `new-window' and `new-frame'. If set to `current-window', the mail buffer will be displayed in the current window, so the old buffer will be @@ -57,10 +56,6 @@ (defcustom notmuch-mua-compose-in 'current-window window/frame that will be destroyed when the buffer is killed. You may want to customize `message-kill-buffer-on-exit' accordingly." - (when (< emacs-major-version 24) - " Due to a known bug in Emacs 23, you should not set -this to `new-window' if `message-kill-buffer-on-exit' is -disabled: this would result in an incorrect behavior.")) :group 'notmuch-send :type '(choice (const :tag "Compose in the current window" current-window) (const :tag "Compose mail in a new window" new-window) @@ -212,7 +207,7 @@ (defun notmuch-mua-reply-crypto (parts) "multipart/*") do (notmuch-mua-reply-crypto (plist-get part :content)))) -;; There is a bug in emacs 23's message.el that results in a newline +;; There is a bug in Emacs' message.el that results in a newline ;; not being inserted after the References header, so the next header ;; is concatenated to the end of it. This function fixes the problem, ;; while guarding against the possibility that some current or future @@ -517,10 +512,10 @@ (defun notmuch-mua-new-reply (query-string &optional prompt-for-sender reply-all If PROMPT-FOR-SENDER is non-nil, the user will be prompted for the From: address first. If REPLY-ALL is non-nil, the message will be addressed to all recipients of the source message." - ;; In current emacs (24.3) select-active-regions is set to t by - ;; default. The reply insertion code sets the region to the quoted - ;; message to make it easy to delete (kill-region or C-w). These two - ;; things combine to put the quoted message in the primary selection. + ;; `select-active-regions' is t by default. The reply insertion code + ;; sets the region to the quoted message to make it easy to delete + ;; (kill-region or C-w). These two things combine to put the quoted + ;; message in the primary selection. ;; ;; This is not what the user wanted and is a privacy risk (accidental ;; pasting of the quoted message). We can avoid some of the problems diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index ec22fd94..6a757687 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -186,8 +186,7 @@ (defvar notmuch-show-attachment-debug nil When set to nil (the default) stdout and stderr from attachment handlers is discarded. When set to t the stdout and stderr from each attachment handler is logged in buffers with names beginning -\" *notmuch-part*\". This option requires emacs version at least -24.3 to work.") +\" *notmuch-part*\".") (defcustom notmuch-show-stash-mlarchive-link-alist '(("Gmane" . "https://mid.gmane.org/") @@ -2417,10 +2416,9 @@ (defun notmuch-show-apply-to-current-part-handle (fn &optional mime-type) is destroyed when FN returns. If MIME-TYPE is given then force part to be treated as if it had that mime-type." (let ((handle (notmuch-show-current-part-handle mime-type))) - ;; emacs 24.3+ puts stdout/stderr into the calling buffer so we - ;; call it from a temp-buffer, unless - ;; notmuch-show-attachment-debug is non-nil in which case we put - ;; it in " *notmuch-part*". + ;; Emacs puts stdout/stderr into the calling buffer so we call + ;; it from a temp-buffer, unless notmuch-show-attachment-debug + ;; is non-nil, in which case we put it in " *notmuch-part*". (unwind-protect (if notmuch-show-attachment-debug (with-current-buffer (generate-new-buffer " *notmuch-part*") diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index ad08f7c6..28c9372e 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -531,9 +531,10 @@ (defun notmuch-tree-message-window-kill-hook () (let ((buffer (current-buffer))) (when (and (window-live-p notmuch-tree-message-window) (eq (window-buffer notmuch-tree-message-window) buffer)) - ;; We do not want an error if this is the sole window in the - ;; frame and I do not know how to test for that in emacs pre - ;; 24. Hence we just ignore-errors. + ;; We could check whether this is the only window in its frame, + ;; but simply ignoring the error that is thrown otherwise is + ;; what we had to do for Emacs 24 and we stick to that because + ;; it is still the simplest approach. (ignore-errors (delete-window notmuch-tree-message-window))))) -- 2.29.1
Previously it was defined in "notmuch-hello.el" and its name contained "hello" solely because it replaced an anonymous function that was mistakenly only bound in `notmuch-hello-mode-map'. But it makes more sense to bind it in all notmuch modes and even if we did not change that aspect it still would make no sense to have "hello" in its name. --- emacs/notmuch-hello.el | 14 -------------- emacs/notmuch-lib.el | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index af170dd4..69d0ad64 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -652,26 +652,12 @@ (defun notmuch-hello-window-configuration-change () (remove-hook 'window-configuration-change-hook #'notmuch-hello-window-configuration-change)))) -;; the following variable is defined as being defconst in notmuch-version.el -(defvar notmuch-emacs-version) - -(defun notmuch-hello-versions () - "Display the notmuch version(s)." - (interactive) - (let ((notmuch-cli-version (notmuch-cli-version))) - (message "notmuch version %s" - (if (string= notmuch-emacs-version notmuch-cli-version) - notmuch-cli-version - (concat notmuch-cli-version - " (emacs mua version " notmuch-emacs-version ")"))))) - (defvar notmuch-hello-mode-map ;; Inherit both widget-keymap and notmuch-common-keymap. We have ;; to use make-sparse-keymap to force this to be a new keymap (so ;; that when we modify map it does not modify widget-keymap). (let ((map (make-composed-keymap (list (make-sparse-keymap) widget-keymap)))) (set-keymap-parent map notmuch-common-keymap) - (define-key map "v" 'notmuch-hello-versions) (define-key map (kbd "<C-tab>") 'widget-backward) map) "Keymap for \"notmuch hello\" buffers.") diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index edb40533..8ee3f17f 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -147,6 +147,7 @@ (defcustom notmuch-archive-tags '("-inbox") (defvar notmuch-common-keymap (let ((map (make-sparse-keymap))) (define-key map "?" 'notmuch-help) + (define-key map "v" 'notmuch-version) (define-key map "q" 'notmuch-bury-or-kill-this-buffer) (define-key map "s" 'notmuch-search) (define-key map "t" 'notmuch-search-by-tag) @@ -218,6 +219,21 @@ (defun notmuch-cli-version () (match-string 2 long-string) "unknown"))) +(defvar notmuch-emacs-version) + +(defun notmuch-version () + "Display the notmuch version. +The versions of the Emacs package and the `notmuch' executable +should match, but if and only if they don't, then this command +displays both values separately." + (interactive) + (let ((cli-version (notmuch-cli-version))) + (message "notmuch version %s" + (if (string= notmuch-emacs-version cli-version) + cli-version + (concat cli-version + " (emacs mua version " notmuch-emacs-version ")"))))) + (defun notmuch-config-get (item) "Return a value from the notmuch configuration." (let* ((val (notmuch-command-to-string "config" "get" item)) -- 2.29.1
--- emacs/notmuch-hello.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 69d0ad64..003bec33 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -282,7 +282,7 @@ (defcustom notmuch-hello-refresh-hook nil :group 'notmuch-hello :group 'notmuch-hooks) -(defvar notmuch-hello-url "https://notmuchmail.org" +(defconst notmuch-hello-url "https://notmuchmail.org" "The `notmuch' web site.") (defvar notmuch-hello-custom-section-options -- 2.29.1
The first sentence should fit on the first line. It is okay if the first sentence/line does not contain all the information that the rest of the doc-string covers. --- emacs/notmuch-show.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 6a757687..14250d34 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -2347,7 +2347,9 @@ (defun notmuch-show-stash-mlarchive-link-and-go (&optional mla) (browse-url (current-kill 0 t))) (defun notmuch-show-stash-git-helper (addresses prefix) - "Escape, trim, quote, and add PREFIX to each address in list of ADDRESSES, and return the result as a single string." + "Normalize all ADDRESSES while adding PREFIX. +Escape, trim, quote and add PREFIX to each address in list +of ADDRESSES, and return the result as a single string." (mapconcat (lambda (x) (concat prefix "\"" ;; escape double-quotes @@ -2360,10 +2362,12 @@ (defun notmuch-show-stash-git-helper (addresses prefix) addresses " ")) (put 'notmuch-show-stash-git-send-email 'notmuch-prefix-doc - "Copy From/To/Cc of current message to kill-ring in a form suitable for pasting to git send-email command line.") + "Copy From/To/Cc of current message to kill-ring. +Use a form suitable for pasting to git send-email command line.") (defun notmuch-show-stash-git-send-email (&optional no-in-reply-to) - "Copy From/To/Cc/Message-Id of current message to kill-ring in a form suitable for pasting to git send-email command line. + "Copy From/To/Cc/Message-Id of current message to kill-ring. +Use a form suitable for pasting to git send-email command line. If invoked with a prefix argument (or NO-IN-REPLY-TO is non-nil), omit --in-reply-to=<Message-Id>." -- 2.29.1
--- emacs/notmuch-mua.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 49bad00d..9d08c2c9 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -62,8 +62,8 @@ (defcustom notmuch-mua-compose-in 'current-window (const :tag "Compose mail in a new frame" new-frame))) (defcustom notmuch-mua-user-agent-function nil - "Function used to generate a `User-Agent:' string. If this is -`nil' then no `User-Agent:' will be generated." + "Function used to generate a `User-Agent:' string. +If this is `nil' then no `User-Agent:' will be generated." :type '(choice (const :tag "No user agent string" nil) (const :tag "Full" notmuch-mua-user-agent-full) (const :tag "Notmuch" notmuch-mua-user-agent-notmuch) -- 2.29.1
--- emacs/notmuch-crypto.el | 3 +-- emacs/notmuch-hello.el | 3 +-- emacs/notmuch-mua.el | 11 ++++------- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el index 276c9859..4fab215a 100644 --- a/emacs/notmuch-crypto.el +++ b/emacs/notmuch-crypto.el @@ -103,8 +103,7 @@ (define-button-type 'notmuch-crypto-status-button-type :supertype 'notmuch-button-type) (defun notmuch-crypto-insert-sigstatus-button (sigstatus from) - "Insert a button describing the signature status SIGSTATUS sent -by user FROM." + "Insert a button describing the signature status SIGSTATUS sent by user FROM." (let* ((status (plist-get sigstatus :status)) (show-button t) (face 'notmuch-crypto-signature-unknown) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 003bec33..28784345 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -372,8 +372,7 @@ (defvar notmuch-hello-hidden-sections nil "List of sections titles whose contents are hidden.") (defvar notmuch-hello-first-run t - "True if `notmuch-hello' is run for the first time, set to nil -afterwards.") + "True if `notmuch-hello' is run for the first time, set to nil afterwards.") (defun notmuch-hello-nice-number (n) (let (result) diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 9d08c2c9..62d615d1 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -73,8 +73,7 @@ (defcustom notmuch-mua-user-agent-function nil :group 'notmuch-send) (defcustom notmuch-mua-hidden-headers nil - "Headers that are added to the `message-mode' hidden headers -list." + "Headers that are added to the `message-mode' hidden headers list." :type '(repeat string) :group 'notmuch-send) @@ -167,8 +166,7 @@ (defun notmuch-mua-get-switch-function () (t (error "Invalid value for `notmuch-mua-compose-in'")))) (defun notmuch-mua-maybe-set-window-dedicated () - "Set the selected window as dedicated according to -`notmuch-mua-compose-in'." + "Set the selected window as dedicated according to `notmuch-mua-compose-in'." (when (or (eq notmuch-mua-compose-in 'new-frame) (eq notmuch-mua-compose-in 'new-window)) (set-window-dedicated-p (selected-window) t))) @@ -335,9 +333,8 @@ (define-derived-mode notmuch-message-mode message-mode "Message[Notmuch]" (put 'notmuch-message-mode 'flyspell-mode-predicate 'mail-mode-flyspell-verify) (defun notmuch-mua-pop-to-buffer (name switch-function) - "Pop to buffer NAME, and warn if it already exists and is -modified. This function is notmuch adaptation of -`message-pop-to-buffer'." + "Pop to buffer NAME, and warn if it already exists and is modified. +This function is notmuch adaptation of `message-pop-to-buffer'." (let ((buffer (get-buffer name))) (if (and buffer (buffer-name buffer)) -- 2.29.1
Emacs doc-strings use neither markdown nor lisp symbol quoting. --- emacs/notmuch-address.el | 2 +- emacs/notmuch-draft.el | 8 ++++---- emacs/notmuch-hello.el | 4 ++-- emacs/notmuch-maildir-fcc.el | 2 +- emacs/notmuch-tag.el | 20 ++++++++++---------- emacs/notmuch.el | 4 ++-- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el index 8a6d299c..561cc140 100644 --- a/emacs/notmuch-address.el +++ b/emacs/notmuch-address.el @@ -294,7 +294,7 @@ (defun notmuch-address-harvest (&optional addr-prefix synchronous callback) "Collect addresses completion candidates. It queries the notmuch database for messages sent/received (as -configured with `notmuch-address-command`) by the user, collects +configured with `notmuch-address-command') by the user, collects destination/source addresses from those messages and stores them in `notmuch-address-completions'. diff --git a/emacs/notmuch-draft.el b/emacs/notmuch-draft.el index 283830ad..b13eb51c 100644 --- a/emacs/notmuch-draft.el +++ b/emacs/notmuch-draft.el @@ -101,7 +101,7 @@ (defun notmuch-draft--mark-deleted () (notmuch-tag notmuch-draft-id '("+deleted")))) (defun notmuch-draft-quote-some-mml () - "Quote the mml tags in `notmuch-draft-quoted-tags`." + "Quote the mml tags in `notmuch-draft-quoted-tags'." (save-excursion ;; First we deal with any secure tag separately. (message-goto-body) @@ -122,7 +122,7 @@ (defun notmuch-draft-quote-some-mml () (insert "!")))))) (defun notmuch-draft-unquote-some-mml () - "Unquote the mml tags in `notmuch-draft-quoted-tags`." + "Unquote the mml tags in `notmuch-draft-quoted-tags'." (save-excursion (when notmuch-draft-quoted-tags (let ((re (concat "<#!+/?\\(" @@ -174,7 +174,7 @@ (defun notmuch-draft-save () "Save the current draft message in the notmuch database. This saves the current message in the database with tags -`notmuch-draft-tags` (in addition to any default tags +`notmuch-draft-tags' (in addition to any default tags applied to newly inserted messages)." (interactive) (when (notmuch-draft--has-encryption-tag) @@ -185,7 +185,7 @@ (defun notmuch-draft-save () ;; so that it is easier to search for the message, and the ;; latter so we have a way of accessing the saved message (for ;; example to delete it at a later time). We check that the - ;; user has these in `message-deletable-headers` (the default) + ;; user has these in `message-deletable-headers' (the default) ;; as otherwise they are doing something strange and we ;; shouldn't interfere. Note, since we are doing this in a new ;; buffer we don't change the version in the compose buffer. diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 28784345..bc07c29c 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -138,8 +138,8 @@ (defcustom notmuch-saved-searches shown. If not present then the :query property is used. :sort-order Specify the sort order to be used for the search. - Possible values are 'oldest-first 'newest-first or - nil. Nil means use the default sort order. + Possible values are `oldest-first', `newest-first' + or nil. Nil means use the default sort order. :search-type Specify whether to run the search in search-mode, tree mode or unthreaded mode. Set to 'tree to specify tree mode, 'unthreaded to specify unthreaded mode, and set to nil diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el index a9103a20..b1da93e6 100644 --- a/emacs/notmuch-maildir-fcc.el +++ b/emacs/notmuch-maildir-fcc.el @@ -196,7 +196,7 @@ (defun notmuch-maildir-message-do-fcc () (defun notmuch-fcc-handler (fcc-header) "Store message with notmuch insert or normal (file) fcc. -If `notmuch-maildir-use-notmuch-insert` is set then store the +If `notmuch-maildir-use-notmuch-insert' is set then store the message using notmuch insert. Otherwise store the message using normal fcc." (message "Doing Fcc...") diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el index 5d4a6865..dc9a2186 100644 --- a/emacs/notmuch-tag.el +++ b/emacs/notmuch-tag.el @@ -68,15 +68,15 @@ (defcustom notmuch-tagging-keys be used (either as a key, or as the start of a key sequence) as it is already bound: it switches the menu to a menu of the reverse tagging operations. The reverse of a tagging operation is -the same list of individual tag-ops but with `+tag` replaced by -`-tag` and vice versa. +the same list of individual tag-ops but with `+tag' replaced by +`-tag' and vice versa. If setting this variable outside of customize then it should be a list of triples (lists of three elements). Each triple should be of the form (key-binding tagging-operations name). KEY-BINDING can be a single character or a key sequence; TAGGING-OPERATIONS should either be a list of individual tag operations each of the -form `+tag` or `-tag`, or the variable name of a variable that is +form `+tag' or `-tag', or the variable name of a variable that is a list of tagging operations; NAME should be a name for the tagging operation, if omitted or empty than then name is taken from TAGGING-OPERATIONS." @@ -116,7 +116,7 @@ (defface notmuch-tag-unread '((t :foreground "red")) "Default face used for the unread tag. -Used in the default value of `notmuch-tag-formats`." +Used in the default value of `notmuch-tag-formats'." :group 'notmuch-faces) (defface notmuch-tag-flagged @@ -128,7 +128,7 @@ (defface notmuch-tag-flagged (:foreground "blue"))) "Face used for the flagged tag. -Used in the default value of `notmuch-tag-formats`." +Used in the default value of `notmuch-tag-formats'." :group 'notmuch-faces) (defcustom notmuch-tag-formats @@ -170,7 +170,7 @@ (defface notmuch-tag-deleted (t :inverse-video t)) "Face used to display deleted tags. -Used in the default value of `notmuch-tag-deleted-formats`." +Used in the default value of `notmuch-tag-deleted-formats'." :group 'notmuch-faces) (defcustom notmuch-tag-deleted-formats @@ -178,7 +178,7 @@ (defcustom notmuch-tag-deleted-formats (".*" (notmuch-apply-face tag `notmuch-tag-deleted))) "Custom formats for tags when deleted. -For deleted tags the formats in `notmuch-tag-formats` are applied +For deleted tags the formats in `notmuch-tag-formats' are applied first and then these formats are applied on top; that is `tag' passed to the function is the tag with all these previous formattings applied. The formatted can access the original @@ -199,14 +199,14 @@ (defface notmuch-tag-added '((t :underline "green")) "Default face used for added tags. -Used in the default value for `notmuch-tag-added-formats`." +Used in the default value for `notmuch-tag-added-formats'." :group 'notmuch-faces) (defcustom notmuch-tag-added-formats '((".*" (notmuch-apply-face tag 'notmuch-tag-added))) "Custom formats for tags when added. -For added tags the formats in `notmuch-tag-formats` are applied +For added tags the formats in `notmuch-tag-formats' are applied first and then these formats are applied on top. To disable special formatting of added tags, set this variable to @@ -506,7 +506,7 @@ (defun notmuch-tag-jump (reverse) Creates and displays a jump menu for the tagging operations specified in `notmuch-tagging-keys'. If REVERSE is set then it offers a menu of the reverses of the operations specified in -`notmuch-tagging-keys'; i.e. each `+tag` is replaced by `-tag` +`notmuch-tagging-keys'; i.e. each `+tag' is replaced by `-tag' and vice versa." ;; In principle this function is simple, but it has to deal with ;; lots of cases: different modes (search/show/tree), whether a name diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 165aaa43..3ca27b26 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -342,7 +342,7 @@ (defface notmuch-search-flagged-face "Face used in search mode face for flagged threads. This face is the default value for the \"flagged\" tag in -`notmuch-search-line-faces`." +`notmuch-search-line-faces'." :group 'notmuch-search :group 'notmuch-faces) @@ -352,7 +352,7 @@ (defface notmuch-search-unread-face "Face used in search mode for unread threads. This face is the default value for the \"unread\" tag in -`notmuch-search-line-faces`." +`notmuch-search-line-faces'." :group 'notmuch-search :group 'notmuch-faces) -- 2.29.1
--- emacs/notmuch-address.el | 6 +++--- emacs/notmuch-crypto.el | 4 ++-- emacs/notmuch-mua.el | 7 ++++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el index 561cc140..04353522 100644 --- a/emacs/notmuch-address.el +++ b/emacs/notmuch-address.el @@ -36,9 +36,9 @@ (defvar notmuch-address-completions (make-hash-table :test 'equal) This variable is set by calling `notmuch-address-harvest'.") (defvar notmuch-address-full-harvest-finished nil - "t indicates that full completion address harvesting has been finished. -Use notmuch-address--harvest-ready to access as that will load a -saved hash if necessary (and available).") + "Whether full completion address harvesting has finished. +Use notmuch-address--harvest-ready to access as that will load +a saved hash if necessary (and available).") (defun notmuch-address--harvest-ready () "Return t if there is a full address hash available. diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el index 4fab215a..9e6f3a9d 100644 --- a/emacs/notmuch-crypto.el +++ b/emacs/notmuch-crypto.el @@ -27,7 +27,7 @@ (require 'notmuch-lib) (declare-function notmuch-show-get-message-id "notmuch-show" (&optional bare)) (defcustom notmuch-crypto-process-mime t - "Should cryptographic MIME parts be processed? + "Whether to process cryptographic MIME parts. If this variable is non-nil signatures in multipart/signed messages will be verified and multipart/encrypted parts will be @@ -46,7 +46,7 @@ (defcustom notmuch-crypto-process-mime t :group 'notmuch-crypto) (defcustom notmuch-crypto-get-keys-asynchronously t - "Retrieve gpg keys asynchronously." + "Whether to retrieve openpgp keys asynchronously." :type 'boolean :group 'notmuch-crypto) diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 62d615d1..821bb324 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -82,10 +82,11 @@ (defgroup notmuch-reply nil :group 'notmuch) (defcustom notmuch-mua-cite-function 'message-cite-original - "*Function for citing an original message. + "Function for citing an original message. + Predefined functions include `message-cite-original' and -`message-cite-original-without-signature'. -Note that these functions use `mail-citation-hook' if that is non-nil." +`message-cite-original-without-signature'. Note that these +functions use `mail-citation-hook' if that is non-nil." :type '(radio (function-item message-cite-original) (function-item message-cite-original-without-signature) (function-item sc-cite-original) -- 2.29.1
It has been deprecated for a decade and it's time to let go. --- emacs/notmuch-hello.el | 5 ----- 1 file changed, 5 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index bc07c29c..f5d9e0ec 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -987,11 +987,6 @@ (defun notmuch-hello (&optional no-display) (run-hooks 'notmuch-hello-refresh-hook) (setq notmuch-hello-first-run nil)) -(defun notmuch-folder () - "Deprecated function for invoking notmuch---calling `notmuch' is preferred now." - (interactive) - (notmuch-hello)) - ;; (provide 'notmuch-hello) -- 2.29.1
We could just have switched to using `cl-remove-if-not' instead, but the two uses of the *remove-if-not function are pretty strange to begin with so we refactor to not use any such function at all. --- emacs/notmuch-hello.el | 43 ++++++++++++++++++++---------------------- emacs/notmuch-lib.el | 9 --------- 2 files changed, 20 insertions(+), 32 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index f5d9e0ec..fa31694f 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -21,8 +21,7 @@ ;;; Code: -(eval-when-compile (require 'cl-lib)) - +(require 'cl-lib) (require 'widget) (require 'wid-edit) ; For `widget-forward'. @@ -542,21 +541,19 @@ (defun notmuch-hello-query-counts (query-list &rest options) --batch'. In general we recommend running matching versions of the CLI and emacs interface.")) (goto-char (point-min)) - (notmuch-remove-if-not - #'identity - (mapcar - (lambda (elem) - (let* ((elem-plist (notmuch-hello-saved-search-to-plist elem)) - (search-query (plist-get elem-plist :query)) - (filtered-query (notmuch-hello-filtered-query - search-query (plist-get options :filter))) - (message-count (prog1 (read (current-buffer)) - (forward-line 1)))) - (when (and filtered-query (or (plist-get options :show-empty-searches) - (> message-count 0))) - (setq elem-plist (plist-put elem-plist :query filtered-query)) - (plist-put elem-plist :count message-count)))) - query-list)))) + (cl-mapcan + (lambda (elem) + (let* ((elem-plist (notmuch-hello-saved-search-to-plist elem)) + (search-query (plist-get elem-plist :query)) + (filtered-query (notmuch-hello-filtered-query + search-query (plist-get options :filter))) + (message-count (prog1 (read (current-buffer)) + (forward-line 1)))) + (when (and filtered-query (or (plist-get options :show-empty-searches) + (> message-count 0))) + (setq elem-plist (plist-put elem-plist :query filtered-query)) + (list (plist-put elem-plist :count message-count))))) + query-list))) (defun notmuch-hello-insert-buttons (searches) "Insert buttons for SEARCHES. @@ -698,12 +695,12 @@ (define-derived-mode notmuch-hello-mode fundamental-mode "notmuch-hello" (defun notmuch-hello-generate-tag-alist (&optional hide-tags) "Return an alist from tags to queries to display in the all-tags section." - (mapcar (lambda (tag) - (cons tag (concat "tag:" (notmuch-escape-boolean-term tag)))) - (notmuch-remove-if-not - (lambda (tag) - (not (member tag hide-tags))) - (process-lines notmuch-command "search" "--output=tags" "*")))) + (cl-mapcan (lambda (tag) + (and (not (member tag hide-tags)) + (list (cons tag + (concat "tag:" + (notmuch-escape-boolean-term tag)))))) + (process-lines notmuch-command "search" "--output=tags" "*"))) (defun notmuch-hello-insert-header () "Insert the default notmuch-hello header." diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 8ee3f17f..d7c6b737 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -534,15 +534,6 @@ (defun notmuch-common-do-stash (text) ;; -(defun notmuch-remove-if-not (predicate list) - "Return a copy of LIST with all items not satisfying PREDICATE removed." - (let (out) - (while list - (when (funcall predicate (car list)) - (push (car list) out)) - (setq list (cdr list))) - (nreverse out))) - (defun notmuch-plist-delete (plist property) (let* ((xplist (cons nil plist)) (pred xplist)) -- 2.29.1
We stopped using it in [1: 0e671478]. 1: 0e671478c6f37018973392f049979da5e1a8ff99 emacs: replace use of notmuch-address-message-insinuate --- emacs/notmuch-address.el | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el index 04353522..21d1d82f 100644 --- a/emacs/notmuch-address.el +++ b/emacs/notmuch-address.el @@ -250,25 +250,6 @@ (defun notmuch-address-expand-name () (ding)))) (t nil))) -;; Copied from `w3m-which-command'. -(defun notmuch-address-locate-command (command) - "Return non-nil if `command' is an executable either on -`exec-path' or an absolute pathname." - (and (stringp command) - (if (and (file-name-absolute-p command) - (file-executable-p command)) - command - (setq command (file-name-nondirectory command)) - (catch 'found-command - (let (bin) - (dolist (dir exec-path) - (setq bin (expand-file-name command dir)) - (when (or (and (file-executable-p bin) - (not (file-directory-p bin))) - (and (file-executable-p (setq bin (concat bin ".exe"))) - (not (file-directory-p bin)))) - (throw 'found-command bin)))))))) - (defun notmuch-address-harvest-addr (result) (let ((name-addr (plist-get result :name-addr))) (puthash name-addr t notmuch-address-completions))) -- 2.29.1
Since [1: f8bdba37] no key is bound to this command and it is redundant because the behavior of `push-command' is identical when called as a command. 1: f8bdba37d3f4c877e05e17b5b1c7d2d512106538 emacs: tree: remove binding for pressing button in message pane --- emacs/notmuch-tree.el | 8 -------- 1 file changed, 8 deletions(-) diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index 28c9372e..71b6387a 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -267,14 +267,6 @@ (defun notmuch-tree-inherit-from-message-pane (sym) (symbol-value sym)) (symbol-value sym))) -(defun notmuch-tree-button-activate (&optional button) - "Activate BUTTON or button at point. - -This function does not give an error if there is no button." - (interactive) - (let ((button (or button (button-at (point))))) - (when button (button-activate button)))) - (defun notmuch-tree-close-message-pane-and (func) "Close message pane and execute FUNC. -- 2.29.1
Inline a simplified version of `notmuch-documentation-first-line' into its only caller. The new code snippet differs from the removed function in that it returns nil instead of the empty string for symbols that have no function documentation. That value is ultimately used as an argument to `concat', which treats nil like the empty string. So we can do the logical thing without changing the behavior. --- emacs/notmuch-lib.el | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index d7c6b737..61107e38 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -287,18 +287,6 @@ (defun notmuch-bury-or-kill-this-buffer () (bury-buffer) (kill-buffer))) -(defun notmuch-documentation-first-line (symbol) - "Return the first line of the documentation string for SYMBOL." - (let ((doc (documentation symbol))) - (if doc - (with-temp-buffer - (insert (documentation symbol t)) - (goto-char (point-min)) - (let ((beg (point))) - (end-of-line) - (buffer-substring beg (point)))) - ""))) - (defun notmuch-prefix-key-description (key) "Given a prefix key code, return a human-readable string representation. @@ -331,7 +319,10 @@ (defun notmuch-describe-key (actual-key binding prefix ua-keys tail) (or (and (symbolp binding) (get binding 'notmuch-doc)) (and (functionp binding) - (notmuch-documentation-first-line binding)))) + (let ((doc (documentation binding))) + (and doc + (string-match "\\`.+" doc) + (match-string 0 doc)))))) tail))) tail) -- 2.29.1
This trivial helper function actually made things slightly *less* readable by adding an unnecessary indirection. --- emacs/notmuch-lib.el | 8 ++------ emacs/notmuch-show.el | 16 ++++++++-------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 61107e38..2c8de328 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -534,14 +534,10 @@ (defun notmuch-plist-delete (plist property) (setq pred (cddr pred))) (cdr xplist))) -(defun notmuch-split-content-type (content-type) - "Split content/type into 'content' and 'type'." - (split-string content-type "/")) - (defun notmuch-match-content-type (t1 t2) "Return t if t1 and t2 are matching content types, taking wildcards into account." - (let ((st1 (notmuch-split-content-type t1)) - (st2 (notmuch-split-content-type t2))) + (let ((st1 (split-string t1 "/")) + (st2 (split-string t2 "/"))) (if (or (string= (cadr st1) "*") (string= (cadr st2) "*")) ;; Comparison of content types should be case insensitive. diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 14250d34..09cdeaaa 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -573,12 +573,13 @@ (defun notmuch-show--register-cids (msg part) ;; alternative (even if we can't render it). (push (list content-id msg part) notmuch-show--cids))) ;; Recurse on sub-parts - (let ((ctype (notmuch-split-content-type - (downcase (plist-get part :content-type))))) - (cond ((equal (car ctype) "multipart") + (pcase-let ((`(,content ,type) + (split-string (downcase (plist-get part :content-type)) "/"))) + (cond ((equal content "multipart") (mapc (apply-partially #'notmuch-show--register-cids msg) (plist-get part :content))) - ((equal ctype '("message" "rfc822")) + ((and (equal content "message") + (equal type "rfc822")) (notmuch-show--register-cids msg (car (plist-get (car (plist-get part :content)) :body))))))) @@ -851,10 +852,9 @@ (defun notmuch-show-handlers-for (content-type) (push func result))) ;; Reverse order of prefrence. (list (intern (concat "notmuch-show-insert-part-*/*")) - (intern (concat - "notmuch-show-insert-part-" - (car (notmuch-split-content-type content-type)) - "/*")) + (intern (concat "notmuch-show-insert-part-" + (car (split-string content-type "/")) + "/*")) (intern (concat "notmuch-show-insert-part-" content-type)))) result)) -- 2.29.1
It is available since Emacs 24.3 and we require at least Emacs 25. --- emacs/coolj.el | 4 +--- emacs/notmuch-company.el | 4 ++-- emacs/notmuch-draft.el | 3 +-- emacs/notmuch-lib.el | 8 ++------ emacs/notmuch-show.el | 18 ++++++------------ emacs/notmuch-tree.el | 27 +++++++++------------------ 6 files changed, 21 insertions(+), 43 deletions(-) diff --git a/emacs/coolj.el b/emacs/coolj.el index 39a8de2b..0385872f 100644 --- a/emacs/coolj.el +++ b/emacs/coolj.el @@ -50,9 +50,7 @@ (defcustom coolj-line-prefix-regexp "^\\(>+ \\)*" :group 'coolj :type 'regexp) -(defvar coolj-wrap-point nil) - -(make-variable-buffer-local 'coolj-wrap-point) +(defvar-local coolj-wrap-point nil) (defun coolj-determine-prefix () "Determine the prefix for the current line." diff --git a/emacs/notmuch-company.el b/emacs/notmuch-company.el index 9ee8ceca..9e743029 100644 --- a/emacs/notmuch-company.el +++ b/emacs/notmuch-company.el @@ -36,8 +36,8 @@ (eval-when-compile (require 'cl-lib)) (require 'notmuch-lib) -(defvar notmuch-company-last-prefix nil) -(make-variable-buffer-local 'notmuch-company-last-prefix) +(defvar-local notmuch-company-last-prefix nil) + (declare-function company-begin-backend "company") (declare-function company-grab "company") (declare-function company-mode "company") diff --git a/emacs/notmuch-draft.el b/emacs/notmuch-draft.el index b13eb51c..ca720384 100644 --- a/emacs/notmuch-draft.el +++ b/emacs/notmuch-draft.el @@ -89,9 +89,8 @@ (defvar notmuch-draft-encryption-tag-regex "<#\\(part encrypt\\|secure.*mode=.*encrypt>\\)" "Regular expression matching mml tags indicating encryption of part or message.") -(defvar notmuch-draft-id nil +(defvar-local notmuch-draft-id nil "Message-id of the most recent saved draft of this message.") -(make-variable-buffer-local 'notmuch-draft-id) (defun notmuch-draft--mark-deleted () "Tag the last saved draft deleted. diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 2c8de328..e23999ad 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -435,9 +435,8 @@ (defun notmuch-subkeymap-help () (insert desc))) (pop-to-buffer (help-buffer))))) -(defvar notmuch-buffer-refresh-function nil +(defvar-local notmuch-buffer-refresh-function nil "Function to call to refresh the current buffer.") -(make-variable-buffer-local 'notmuch-buffer-refresh-function) (defun notmuch-refresh-this-buffer () "Refresh the current buffer." @@ -989,10 +988,7 @@ (defun notmuch-start-notmuch-error-sentinel (proc event) (find-file-noselect err-file)))) (when err-buffer (kill-buffer err-buffer)))) -;; This variable is used only buffer local, but it needs to be -;; declared globally first to avoid compiler warnings. -(defvar notmuch-show-process-crypto nil) -(make-variable-buffer-local 'notmuch-show-process-crypto) +(defvar-local notmuch-show-process-crypto nil) (defun notmuch-interactive-region () "Return the bounds of the current interactive region. diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 09cdeaaa..c9b1e966 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -162,23 +162,17 @@ (defcustom notmuch-show-text/html-blocked-images "." :type '(choice (const nil) regexp) :group 'notmuch-show) -(defvar notmuch-show-thread-id nil) -(make-variable-buffer-local 'notmuch-show-thread-id) +(defvar-local notmuch-show-thread-id nil) -(defvar notmuch-show-parent-buffer nil) -(make-variable-buffer-local 'notmuch-show-parent-buffer) +(defvar-local notmuch-show-parent-buffer nil) -(defvar notmuch-show-query-context nil) -(make-variable-buffer-local 'notmuch-show-query-context) +(defvar-local notmuch-show-query-context nil) -(defvar notmuch-show-process-crypto nil) -(make-variable-buffer-local 'notmuch-show-process-crypto) +(defvar-local notmuch-show-process-crypto nil) -(defvar notmuch-show-elide-non-matching-messages nil) -(make-variable-buffer-local 'notmuch-show-elide-non-matching-messages) +(defvar-local notmuch-show-elide-non-matching-messages nil) -(defvar notmuch-show-indent-content t) -(make-variable-buffer-local 'notmuch-show-indent-content) +(defvar-local notmuch-show-indent-content t) (defvar notmuch-show-attachment-debug nil "If t log stdout and stderr from attachment handlers. diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index 71b6387a..3b5dab3e 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -51,9 +51,8 @@ (declare-function notmuch-tree-from-search-thread "notmuch" ()) (defvar notmuch-search-query-string) ;; this variable distinguishes the unthreaded display from the normal tree display -(defvar notmuch-tree-unthreaded nil +(defvar-local notmuch-tree-unthreaded nil "A buffer local copy of argument unthreaded to the function notmuch-tree.") -(make-variable-buffer-local 'notmuch-tree-unthreaded) (defgroup notmuch-tree nil "Showing message and thread structure." @@ -207,44 +206,36 @@ (defface notmuch-tree-no-match-tag-face :group 'notmuch-tree :group 'notmuch-faces) -(defvar notmuch-tree-previous-subject +(defvar-local notmuch-tree-previous-subject "The subject of the most recent result shown during the async display.") -(make-variable-buffer-local 'notmuch-tree-previous-subject) -(defvar notmuch-tree-basic-query nil +(defvar-local notmuch-tree-basic-query nil "A buffer local copy of argument query to the function notmuch-tree.") -(make-variable-buffer-local 'notmuch-tree-basic-query) -(defvar notmuch-tree-query-context nil +(defvar-local notmuch-tree-query-context nil "A buffer local copy of argument query-context to the function notmuch-tree.") -(make-variable-buffer-local 'notmuch-tree-query-context) -(defvar notmuch-tree-target-msg nil +(defvar-local notmuch-tree-target-msg nil "A buffer local copy of argument target to the function notmuch-tree.") -(make-variable-buffer-local 'notmuch-tree-target-msg) -(defvar notmuch-tree-open-target nil +(defvar-local notmuch-tree-open-target nil "A buffer local copy of argument open-target to the function notmuch-tree.") -(make-variable-buffer-local 'notmuch-tree-open-target) -(defvar notmuch-tree-parent-buffer nil) -(make-variable-buffer-local 'notmuch-tree-parent-buffer) +(defvar-local notmuch-tree-parent-buffer nil) -(defvar notmuch-tree-message-window nil +(defvar-local notmuch-tree-message-window nil "The window of the message pane. It is set in both the tree buffer and the child show buffer. It is used to try and close the message pane when quitting tree view or the child show buffer.") -(make-variable-buffer-local 'notmuch-tree-message-window) (put 'notmuch-tree-message-window 'permanent-local t) -(defvar notmuch-tree-message-buffer nil +(defvar-local notmuch-tree-message-buffer nil "The buffer name of the show buffer in the message pane. This is used to try and make sure we don't close the message pane if the user has loaded a different buffer in that window.") -(make-variable-buffer-local 'notmuch-tree-message-buffer) (put 'notmuch-tree-message-buffer 'permanent-local t) (defun notmuch-tree-to-message-pane (func) -- 2.29.1
It is available since Emacs 24.3 and we require at least Emacs 25. It makes the variable buffer-local if it isn't always buffer-local anyway. --- emacs/notmuch-company.el | 3 +-- emacs/notmuch-parser.el | 5 ++--- emacs/notmuch.el | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/emacs/notmuch-company.el b/emacs/notmuch-company.el index 9e743029..b50e73c8 100644 --- a/emacs/notmuch-company.el +++ b/emacs/notmuch-company.el @@ -55,8 +55,7 @@ (defvar notmuch-address-command) ;;;###autoload (defun notmuch-company-setup () (company-mode) - (make-local-variable 'company-backends) - (setq company-backends '(notmuch-company)) + (setq-local company-backends '(notmuch-company)) ;; Disable automatic company completion unless an internal ;; completion method is configured. Company completion (using ;; internal completion) can still be accessed via standard company diff --git a/emacs/notmuch-parser.el b/emacs/notmuch-parser.el index 3aa5bd8f..4a437016 100644 --- a/emacs/notmuch-parser.el +++ b/emacs/notmuch-parser.el @@ -168,9 +168,8 @@ (defun notmuch-sexp-parse-partial-list (result-function result-buffer) move point in the input buffer." ;; Set up the initial state (unless (local-variable-p 'notmuch-sexp--parser) - (set (make-local-variable 'notmuch-sexp--parser) - (notmuch-sexp-create-parser)) - (set (make-local-variable 'notmuch-sexp--state) 'begin)) + (setq-local notmuch-sexp--parser (notmuch-sexp-create-parser)) + (setq-local notmuch-sexp--state 'begin)) (let (done) (while (not done) (cl-case notmuch-sexp--state diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 3ca27b26..95770fc3 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -391,7 +391,7 @@ (define-derived-mode notmuch-search-mode fundamental-mode "notmuch-search" (make-local-variable 'notmuch-search-target-thread) (make-local-variable 'notmuch-search-target-line) (setq notmuch-buffer-refresh-function #'notmuch-search-refresh-view) - (set (make-local-variable 'scroll-preserve-screen-position) t) + (setq-local scroll-preserve-screen-position t) (add-to-invisibility-spec (cons 'ellipsis t)) (setq truncate-lines t) (setq buffer-read-only t) -- 2.29.1
Commonly `set' is only used if there is no way around it; i.e. when the variable cannot be known until runtime. --- emacs/notmuch-tree.el | 2 +- emacs/notmuch.el | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index 3b5dab3e..7cc28b62 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -1115,7 +1115,7 @@ (defun notmuch-tree (&optional query query-context target buffer-name open-targe (inhibit-read-only t)) (pop-to-buffer-same-window buffer)) ;; Don't track undo information for this buffer - (set 'buffer-undo-list t) + (setq buffer-undo-list t) (notmuch-tree-worker query query-context target open-target unthreaded) (setq notmuch-tree-parent-buffer parent-buffer) (setq truncate-lines t)) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 95770fc3..b221be05 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -693,7 +693,7 @@ (defun notmuch-search-process-sentinel (proc msg) (throw 'return nil)) (when (and atbob (not (string= notmuch-search-target-thread "found"))) - (set 'never-found-target-thread t))))) + (setq never-found-target-thread t))))) (when (and never-found-target-thread notmuch-search-target-line) (goto-char (point-min)) @@ -1000,11 +1000,11 @@ (defun notmuch-search (&optional query oldest-first target-thread target-line no (unless (eq major-mode 'notmuch-search-mode) (notmuch-search-mode)) ;; Don't track undo information for this buffer - (set 'buffer-undo-list t) - (set 'notmuch-search-query-string query) - (set 'notmuch-search-oldest-first oldest-first) - (set 'notmuch-search-target-thread target-thread) - (set 'notmuch-search-target-line target-line) + (setq buffer-undo-list t) + (setq notmuch-search-query-string query) + (setq notmuch-search-oldest-first oldest-first) + (setq notmuch-search-target-thread target-thread) + (setq notmuch-search-target-line target-line) (notmuch-tag-clear-cache) (let ((proc (get-buffer-process (current-buffer))) (inhibit-read-only t)) @@ -1052,7 +1052,7 @@ (defun notmuch-search-toggle-order () This command toggles the sort order for the current search. The default sort order is defined by `notmuch-search-oldest-first'." (interactive) - (set 'notmuch-search-oldest-first (not notmuch-search-oldest-first)) + (setq notmuch-search-oldest-first (not notmuch-search-oldest-first)) (notmuch-search-refresh-view)) (defun notmuch-group-disjunctive-query-string (query-string) -- 2.29.1
--- emacs/notmuch-draft.el | 6 +++--- emacs/notmuch-maildir-fcc.el | 10 +++++----- emacs/notmuch-mua.el | 6 +++--- emacs/notmuch-show.el | 2 +- emacs/notmuch-tag.el | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/emacs/notmuch-draft.el b/emacs/notmuch-draft.el index ca720384..f928be87 100644 --- a/emacs/notmuch-draft.el +++ b/emacs/notmuch-draft.el @@ -135,7 +135,7 @@ (defun notmuch-draft-unquote-some-mml () (let (secure-tag) (save-restriction (message-narrow-to-headers) - (setq secure-tag (message-fetch-field "X-Notmuch-Emacs-Secure" 't)) + (setq secure-tag (message-fetch-field "X-Notmuch-Emacs-Secure" t)) (message-remove-header "X-Notmuch-Emacs-Secure")) (message-goto-body) (when secure-tag @@ -145,7 +145,7 @@ (defun notmuch-draft--has-encryption-tag () "Returns t if there is an mml secure tag." (save-excursion (message-goto-body) - (re-search-forward notmuch-draft-encryption-tag-regex nil 't))) + (re-search-forward notmuch-draft-encryption-tag-regex nil t))) (defun notmuch-draft--query-encryption () "Checks if we should save a message that should be encrypted. @@ -207,7 +207,7 @@ (defun notmuch-draft-save () (notmuch-draft-quote-some-mml) (notmuch-maildir-setup-message-for-saving) (notmuch-maildir-notmuch-insert-current-buffer - notmuch-draft-folder 't notmuch-draft-tags)) + notmuch-draft-folder t notmuch-draft-tags)) ;; We are now back in the original compose buffer. Note the ;; function notmuch-call-notmuch-process (called by ;; notmuch-maildir-notmuch-insert-current-buffer) signals an error diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el index b1da93e6..32b8100e 100644 --- a/emacs/notmuch-maildir-fcc.el +++ b/emacs/notmuch-maildir-fcc.el @@ -76,7 +76,7 @@ (defcustom notmuch-fcc-dirs "sent" :require 'notmuch-fcc-initialization :group 'notmuch-send) -(defcustom notmuch-maildir-use-notmuch-insert 't +(defcustom notmuch-maildir-use-notmuch-insert t "Should fcc use notmuch insert instead of simple fcc." :type '(choice :tag "Fcc Method" (const :tag "Use notmuch insert" t) @@ -246,8 +246,8 @@ (defun notmuch-maildir-fcc-with-notmuch-insert (fcc-header &optional create) \(r)etry, (c)reate folder, (i)gnore, or (e)dit the header? " '(?r ?c ?i ?e)))) (cl-case response (?r (notmuch-maildir-fcc-with-notmuch-insert fcc-header)) - (?c (notmuch-maildir-fcc-with-notmuch-insert fcc-header 't)) - (?i 't) + (?c (notmuch-maildir-fcc-with-notmuch-insert fcc-header t)) + (?i t) (?e (notmuch-maildir-fcc-with-notmuch-insert (read-from-minibuffer "Fcc header: " fcc-header))))))))) @@ -322,7 +322,7 @@ (defun notmuch-maildir-fcc-file-fcc (fcc-header) It offers the user a chance to correct the header, or filesystem, if needed." (if (notmuch-maildir-fcc-dir-is-maildir-p fcc-header) - (notmuch-maildir-fcc-write-buffer-to-maildir fcc-header 't) + (notmuch-maildir-fcc-write-buffer-to-maildir fcc-header t) ;; The fcc-header is not a valid maildir see if the user wants to ;; fix it in some way. (let* ((prompt (format "Fcc %s is not a maildir: \ @@ -335,7 +335,7 @@ (defun notmuch-maildir-fcc-file-fcc (fcc-header) (message "No permission to create %s." fcc-header) (sit-for 2)) (notmuch-maildir-fcc-file-fcc fcc-header)) - (?i 't) + (?i t) (?e (notmuch-maildir-fcc-file-fcc (read-from-minibuffer "Fcc header: " fcc-header))))))) diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 821bb324..f9843546 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -538,11 +538,11 @@ (defun notmuch-mua-check-no-misplaced-secure-tag () (goto-char (point-max)) (or ;; We are always fine if there is no secure tag. - (not (search-backward "<#secure" nil 't)) + (not (search-backward "<#secure" nil t)) ;; There is a secure tag, so it must be at the start of the ;; body, with no secure tag earlier (i.e., in the headers). (and (= (point) body-start) - (not (search-backward "<#secure" nil 't))) + (not (search-backward "<#secure" nil t))) ;; The user confirms they means it. (yes-or-no-p "\ There is a <#secure> tag not at the start of the body. It is @@ -582,7 +582,7 @@ (defun notmuch-mua-send-common (arg &optional exit) (defun notmuch-mua-send-and-exit (&optional arg) (interactive "P") - (notmuch-mua-send-common arg 't)) + (notmuch-mua-send-common arg t)) (defun notmuch-mua-send (&optional arg) (interactive "P") diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index c9b1e966..056c4e30 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1751,7 +1751,7 @@ (defun notmuch-show-command-hook () (funcall notmuch-show-mark-read-function (window-start) (window-end)) ((debug error) (unless notmuch-show--seen-has-errored - (setq notmuch-show--seen-has-errored 't) + (setq notmuch-show--seen-has-errored t) (setq header-line-format (concat header-line-format (propertize diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el index dc9a2186..925de78c 100644 --- a/emacs/notmuch-tag.el +++ b/emacs/notmuch-tag.el @@ -524,7 +524,7 @@ (defun notmuch-tag-jump (reverse) (symbol-value tag) tag)) (tag-change (if reverse - (notmuch-tag-change-list tag 't) + (notmuch-tag-change-list tag t) tag)) (name (or (and (not (string= name "")) name) -- 2.29.1
One should never bind unnamed commands in keymaps because doing that makes it needlessly hard for users to change these bindings. Replace such anonymous bindings with named commands that are generated using macros and some boilerplate. Using macros is better than using a simple loop because that makes it possible for `find-function' to find the definitions. Eat your boilerplate--it forms character. Admittedly this approach is quite ugly and it might be better to teach the original commands to support different buffers directly instead of requiring wrapper commands to do just that. Never-the-less as a short-term solution this is better than what we had before. --- emacs/notmuch-tree.el | 126 ++++++++++++++++++++++++------------------ 1 file changed, 72 insertions(+), 54 deletions(-) diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index 7cc28b62..17863f6a 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -238,57 +238,83 @@ (defvar-local notmuch-tree-message-buffer nil if the user has loaded a different buffer in that window.") (put 'notmuch-tree-message-buffer 'permanent-local t) -(defun notmuch-tree-to-message-pane (func) - "Execute FUNC in message pane. - -This function returns a function (so can be used as a keybinding) -which executes function FUNC in the message pane if it is -open (if the message pane is closed it does nothing)." - `(lambda () - ,(concat "(In message pane) " (documentation func t)) +(defmacro notmuch-tree--define-do-in-message-window (name cmd) + "Define NAME as a command that calls CMD interactively in the message window. +If the message pane is closed then this command does nothing. +Avoid using this macro in new code; it will be removed." + `(defun ,name () + ,(concat "(In message window) " (documentation cmd t)) (interactive) (when (window-live-p notmuch-tree-message-window) (with-selected-window notmuch-tree-message-window - (call-interactively #',func))))) - -(defun notmuch-tree-inherit-from-message-pane (sym) - "Return value of SYM in message-pane if open, or tree-pane if not." + (call-interactively #',cmd))))) + +(notmuch-tree--define-do-in-message-window + notmuch-tree-previous-message-button + notmuch-show-previous-button) +(notmuch-tree--define-do-in-message-window + notmuch-tree-next-message-button + notmuch-show-next-button) +(notmuch-tree--define-do-in-message-window + notmuch-tree-toggle-message-process-crypto + notmuch-show-toggle-process-crypto) + +(defun notmuch-tree--message-process-crypto () + "Return value of `notmuch-show-process-crypto' in the message window. +If that window isn't alive, then return the current value. +Avoid using this function in new code; it will be removed." (if (window-live-p notmuch-tree-message-window) (with-selected-window notmuch-tree-message-window - (symbol-value sym)) - (symbol-value sym))) - -(defun notmuch-tree-close-message-pane-and (func) - "Close message pane and execute FUNC. - -This function returns a function (so can be used as a keybinding) -which closes the message pane if open and then executes function -FUNC." - `(lambda () - ,(concat "(Close message pane and) " (documentation func t)) + notmuch-show-process-crypto) + notmuch-show-process-crypto)) + +(defmacro notmuch-tree--define-close-message-window-and (name cmd) + "Define NAME as a variant of CMD. + +NAME determines the value of `notmuch-show-process-crypto' in the +message window, closes the window, and then call CMD interactively +with that value let-bound. If the message window does not exist, +then NAME behaves like CMD." + `(defun ,name () + ,(concat "(Close message pane and) " (documentation cmd t)) (interactive) (let ((notmuch-show-process-crypto - (notmuch-tree-inherit-from-message-pane 'notmuch-show-process-crypto))) + (notmuch-tree--message-process-crypto))) (notmuch-tree-close-message-window) - (call-interactively #',func)))) + (call-interactively #',cmd)))) + +(notmuch-tree--define-close-message-window-and + notmuch-tree-help + notmuch-help) +(notmuch-tree--define-close-message-window-and + notmuch-tree-new-mail + notmuch-mua-new-mail) +(notmuch-tree--define-close-message-window-and + notmuch-tree-jump-search + notmuch-jump-search) +(notmuch-tree--define-close-message-window-and + notmuch-tree-forward-message + notmuch-show-forward-message) +(notmuch-tree--define-close-message-window-and + notmuch-tree-reply-sender + notmuch-show-reply-sender) +(notmuch-tree--define-close-message-window-and + notmuch-tree-reply + notmuch-show-reply) +(notmuch-tree--define-close-message-window-and + notmuch-tree-view-raw-message + notmuch-show-view-raw-message) (defvar notmuch-tree-mode-map (let ((map (make-sparse-keymap))) (set-keymap-parent map notmuch-common-keymap) - ;; The following override the global keymap. - ;; Override because we want to close message pane first. - (define-key map [remap notmuch-help] - (notmuch-tree-close-message-pane-and #'notmuch-help)) - ;; Override because we first close message pane and then close tree buffer. + ;; These bindings shadow common bindings with variants + ;; that additionally close the message window. (define-key map [remap notmuch-bury-or-kill-this-buffer] 'notmuch-tree-quit) - ;; Override because we close message pane after the search query is entered. - (define-key map [remap notmuch-search] 'notmuch-tree-to-search) - ;; Override because we want to close message pane first. - (define-key map [remap notmuch-mua-new-mail] - (notmuch-tree-close-message-pane-and #'notmuch-mua-new-mail)) - ;; Override because we want to close message pane first. - (define-key map [remap notmuch-jump-search] - (notmuch-tree-close-message-pane-and #'notmuch-jump-search)) + (define-key map [remap notmuch-search] 'notmuch-tree-to-search) + (define-key map [remap notmuch-help] 'notmuch-tree-help) + (define-key map [remap notmuch-mua-new-mail] 'notmuch-tree-new-mail) + (define-key map [remap notmuch-jump-search] 'notmuch-tree-jump-search) (define-key map "S" 'notmuch-search-from-tree-current-query) (define-key map "U" 'notmuch-unthreaded-from-tree-current-query) @@ -302,24 +328,16 @@ (defvar notmuch-tree-mode-map (define-key map "b" 'notmuch-show-resend-message) ;; these apply to the message pane - (define-key map (kbd "M-TAB") - (notmuch-tree-to-message-pane #'notmuch-show-previous-button)) - (define-key map (kbd "<backtab>") - (notmuch-tree-to-message-pane #'notmuch-show-previous-button)) - (define-key map (kbd "TAB") - (notmuch-tree-to-message-pane #'notmuch-show-next-button)) - (define-key map "$" - (notmuch-tree-to-message-pane #'notmuch-show-toggle-process-crypto)) + (define-key map (kbd "M-TAB") 'notmuch-tree-previous-message-button) + (define-key map (kbd "<backtab>") 'notmuch-tree-previous-message-button) + (define-key map (kbd "TAB") 'notmuch-tree-next-message-button) + (define-key map "$" 'notmuch-tree-toggle-message-process-crypto) ;; bindings from show (or elsewhere) but we close the message pane first. - (define-key map "f" - (notmuch-tree-close-message-pane-and #'notmuch-show-forward-message)) - (define-key map "r" - (notmuch-tree-close-message-pane-and #'notmuch-show-reply-sender)) - (define-key map "R" - (notmuch-tree-close-message-pane-and #'notmuch-show-reply)) - (define-key map "V" - (notmuch-tree-close-message-pane-and #'notmuch-show-view-raw-message)) + (define-key map "f" 'notmuch-tree-forward-message) + (define-key map "r" 'notmuch-tree-reply-sender) + (define-key map "R" 'notmuch-tree-reply) + (define-key map "V" 'notmuch-tree-view-raw-message) ;; The main tree view bindings (define-key map (kbd "RET") 'notmuch-tree-show-message) -- 2.29.1
--- emacs/notmuch-address.el | 31 ++++++-------- emacs/notmuch-hello.el | 28 +++++-------- emacs/notmuch-lib.el | 38 +++++++++-------- emacs/notmuch-mua.el | 10 ++--- emacs/notmuch-tag.el | 2 +- emacs/notmuch.el | 88 ++++++++++++++++++++-------------------- 6 files changed, 91 insertions(+), 106 deletions(-) diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el index 21d1d82f..0dedd5d5 100644 --- a/emacs/notmuch-address.el +++ b/emacs/notmuch-address.el @@ -21,6 +21,8 @@ ;;; Code: +(eval-when-compile (require 'cl-lib)) + (require 'message) (require 'notmuch-parser) (require 'notmuch-lib) @@ -154,15 +156,12 @@ (defcustom notmuch-address-use-company t :group 'notmuch-address) (defun notmuch-address-setup () - (let* ((setup-company (and notmuch-address-use-company - (require 'company nil t))) - (pair (cons notmuch-address-completion-headers-regexp - #'notmuch-address-expand-name))) - (when setup-company - (notmuch-company-setup)) - (unless (member pair message-completion-alist) - (setq message-completion-alist - (push pair message-completion-alist))))) + (when (and notmuch-address-use-company + (require 'company nil t)) + (notmuch-company-setup)) + (cl-pushnew (cons notmuch-address-completion-headers-regexp + #'notmuch-address-expand-name) + message-completion-alist :test #'equal)) (defun notmuch-address-toggle-internal-completion () "Toggle use of internal completion for current buffer. @@ -251,11 +250,8 @@ (defun notmuch-address-expand-name () (t nil))) (defun notmuch-address-harvest-addr (result) - (let ((name-addr (plist-get result :name-addr))) - (puthash name-addr t notmuch-address-completions))) - -(defun notmuch-address-harvest-handle-result (obj) - (notmuch-address-harvest-addr obj)) + (puthash (plist-get result :name-addr) + t notmuch-address-completions)) (defun notmuch-address-harvest-filter (proc string) (when (buffer-live-p (process-buffer proc)) @@ -264,7 +260,7 @@ (defun notmuch-address-harvest-filter (proc string) (goto-char (point-max)) (insert string)) (notmuch-sexp-parse-partial-list - 'notmuch-address-harvest-handle-result (process-buffer proc))))) + 'notmuch-address-harvest-addr (process-buffer proc))))) (defvar notmuch-address-harvest-procs '(nil . nil) "The currently running harvests. @@ -375,7 +371,7 @@ (defun notmuch-address--load-address-hash () (defun notmuch-address--save-address-hash () (when notmuch-address-save-filename (if (or (not (file-exists-p notmuch-address-save-filename)) - ;; The file exists, check it is a file we saved + ;; The file exists, check it is a file we saved. (notmuch-address--get-address-hash)) (with-temp-file notmuch-address-save-filename (let ((save-plist @@ -398,8 +394,7 @@ (defun notmuch-address-harvest-trigger () nil nil (lambda (proc event) ;; If harvest fails, we want to try - ;; again when the trigger is next - ;; called + ;; again when the trigger is next called. (if (string= event "finished\n") (progn (notmuch-address--save-address-hash) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index fa31694f..80af7544 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -402,8 +402,7 @@ (defun notmuch-hello-add-saved-search (widget) ;; If an existing saved search with this name exists, remove it. (setq notmuch-saved-searches (cl-loop for elem in notmuch-saved-searches - if (not (equal name - (notmuch-saved-search-get elem :name))) + unless (equal name (notmuch-saved-search-get elem :name)) collect elem)) ;; Add the new one. (customize-save-variable 'notmuch-saved-searches @@ -446,18 +445,14 @@ (defun notmuch-hello-reflect (list ncols) append (notmuch-hello-reflect-generate-row ncols nrows row list)))) (defun notmuch-hello-widget-search (widget &rest ignore) - (cond - ((eq (widget-get widget :notmuch-search-type) 'tree) - (notmuch-tree (widget-get widget - :notmuch-search-terms))) - ((eq (widget-get widget :notmuch-search-type) 'unthreaded) - (notmuch-unthreaded (widget-get widget - :notmuch-search-terms))) + (cl-case (widget-get widget :notmuch-search-type) + (tree + (notmuch-tree (widget-get widget :notmuch-search-terms))) + (unthreaded + (notmuch-unthreaded (widget-get widget :notmuch-search-terms))) (t - (notmuch-search (widget-get widget - :notmuch-search-terms) - (widget-get widget - :notmuch-search-oldest-first))))) + (notmuch-search (widget-get widget :notmuch-search-terms) + (widget-get widget :notmuch-search-oldest-first))))) (defun notmuch-saved-search-count (search) (car (process-lines notmuch-command "count" search))) @@ -689,9 +684,7 @@ (define-derived-mode notmuch-hello-mode fundamental-mode "notmuch-hello" Complete list of currently available key bindings: \\{notmuch-hello-mode-map}" - (setq notmuch-buffer-refresh-function #'notmuch-hello-update) - ;;(setq buffer-read-only t) - ) + (setq notmuch-buffer-refresh-function #'notmuch-hello-update)) (defun notmuch-hello-generate-tag-alist (&optional hide-tags) "Return an alist from tags to queries to display in the all-tags section." @@ -775,8 +768,7 @@ (defun notmuch-hello-insert-search () ;; instead of a space to make `show-trailing-whitespace' ;; happy, i.e. avoid it marking the whole line as trailing ;; spaces. - (widget-insert ".") - (put-text-property (1- (point)) (point) 'invisible t) + (widget-insert (propertize "." 'invisible t)) (widget-insert "\n")) (defun notmuch-hello-insert-recent-searches () diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index e23999ad..aa48b949 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -186,8 +186,8 @@ (defun notmuch-command-to-string (&rest args) Otherwise the output will be returned." (with-temp-buffer - (let* ((status (apply #'call-process notmuch-command nil t nil args)) - (output (buffer-string))) + (let ((status (apply #'call-process notmuch-command nil t nil args)) + (output (buffer-string))) (notmuch-check-exit-status status (cons notmuch-command args) output) output))) @@ -239,8 +239,9 @@ (defun notmuch-config-get (item) (let* ((val (notmuch-command-to-string "config" "get" item)) (len (length val))) ;; Trim off the trailing newline (if the value is empty or not - ;; configured, there will be no newline) - (if (and (> len 0) (= (aref val (- len 1)) ?\n)) + ;; configured, there will be no newline). + (if (and (> len 0) + (= (aref val (- len 1)) ?\n)) (substring val 0 -1) val))) @@ -403,9 +404,9 @@ (defun notmuch-help () its prefixed behavior by setting the 'notmuch-prefix-doc property of its command symbol." (interactive) - (let* ((mode major-mode) - (doc (substitute-command-keys - (notmuch-substitute-command-keys (documentation mode t))))) + (let ((doc (substitute-command-keys + (notmuch-substitute-command-keys + (documentation major-mode t))))) (with-current-buffer (generate-new-buffer "*notmuch-help*") (insert doc) (goto-char (point-min)) @@ -467,8 +468,8 @@ (defun notmuch-refresh-all-buffers () (notmuch-refresh-this-buffer)))))) (defun notmuch-prettify-subject (subject) - ;; This function is used by `notmuch-search-process-filter' which - ;; requires that we not disrupt its' matching state. + ;; This function is used by `notmuch-search-process-filter', + ;; which requires that we not disrupt its matching state. (save-match-data (if (and subject (string-match "^[ \t]*$" subject)) @@ -525,13 +526,12 @@ (defun notmuch-common-do-stash (text) ;; (defun notmuch-plist-delete (plist property) - (let* ((xplist (cons nil plist)) - (pred xplist)) - (while (cdr pred) - (when (eq (cadr pred) property) - (setcdr pred (cdddr pred))) - (setq pred (cddr pred))) - (cdr xplist))) + (let (p) + (while plist + (unless (eq property (car plist)) + (setq p (plist-put p (car plist) (cadr plist)))) + (setq plist (cddr plist))) + p)) (defun notmuch-match-content-type (t1 t2) "Return t if t1 and t2 are matching content types, taking wildcards into account." @@ -540,8 +540,10 @@ (defun notmuch-match-content-type (t1 t2) (if (or (string= (cadr st1) "*") (string= (cadr st2) "*")) ;; Comparison of content types should be case insensitive. - (string= (downcase (car st1)) (downcase (car st2))) - (string= (downcase t1) (downcase t2))))) + (string= (downcase (car st1)) + (downcase (car st2))) + (string= (downcase t1) + (downcase t2))))) (defvar notmuch-multipart/alternative-discouraged '(;; Avoid HTML parts. diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index f9843546..8501e294 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -347,12 +347,10 @@ (defun notmuch-mua-pop-to-buffer (name switch-function) (select-window window)) (funcall switch-function buffer) (set-buffer buffer)) - (when (and (buffer-modified-p) - (not (prog1 - (y-or-n-p - "Message already being composed; erase? ") - (message nil)))) - (error "Message being composed"))) + (when (buffer-modified-p) + (if (y-or-n-p "Message already being composed; erase? ") + (message nil) + (error "Message being composed")))) (funcall switch-function name) (set-buffer name)) (erase-buffer) diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el index 925de78c..75e864a4 100644 --- a/emacs/notmuch-tag.el +++ b/emacs/notmuch-tag.el @@ -472,7 +472,7 @@ (defun notmuch-tag (query tag-changes) tag-changes) (unless query (error "Nothing to tag!")) - (unless (null tag-changes) + (when tag-changes (run-hooks 'notmuch-before-tag-hook) (if (<= (length query) notmuch-tag-argument-limit) (apply 'notmuch-call-notmuch-process "tag" diff --git a/emacs/notmuch.el b/emacs/notmuch.el index b221be05..8157bbf4 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -169,7 +169,7 @@ (defvar notmuch-search-mode-map (let ((map (make-sparse-keymap))) (set-keymap-parent map notmuch-common-keymap) (define-key map "x" 'notmuch-bury-or-kill-this-buffer) - (define-key map (kbd "<DEL>") 'notmuch-search-scroll-down) + (define-key map (kbd "DEL") 'notmuch-search-scroll-down) (define-key map "b" 'notmuch-search-scroll-down) (define-key map " " 'notmuch-search-scroll-up) (define-key map "<" 'notmuch-search-first-thread) @@ -923,40 +923,39 @@ (defun notmuch-read-query (prompt) "Read a notmuch-query from the minibuffer with completion. PROMPT is the string to prompt with." - (let* - ((all-tags - (mapcar (lambda (tag) (notmuch-escape-boolean-term tag)) - (process-lines notmuch-command "search" "--output=tags" "*"))) - (completions - (append (list "folder:" "path:" "thread:" "id:" "date:" "from:" "to:" - "subject:" "attachment:") - (mapcar (lambda (tag) (concat "tag:" tag)) all-tags) - (mapcar (lambda (tag) (concat "is:" tag)) all-tags) - (mapcar (lambda (mimetype) (concat "mimetype:" mimetype)) - (mailcap-mime-types))))) - (let ((keymap (copy-keymap minibuffer-local-map)) - (current-query (cl-case major-mode - (notmuch-search-mode (notmuch-search-get-query)) - (notmuch-show-mode (notmuch-show-get-query)) - (notmuch-tree-mode (notmuch-tree-get-query)))) - (minibuffer-completion-table - (completion-table-dynamic - (lambda (string) - ;; generate a list of possible completions for the current input - (cond - ;; this ugly regexp is used to get the last word of the input - ;; possibly preceded by a '(' - ((string-match "\\(^\\|.* (?\\)\\([^ ]*\\)$" string) - (mapcar (lambda (compl) - (concat (match-string-no-properties 1 string) compl)) - (all-completions (match-string-no-properties 2 string) - completions))) - (t (list string))))))) - ;; this was simpler than convincing completing-read to accept spaces: - (define-key keymap (kbd "TAB") 'minibuffer-complete) - (let ((history-delete-duplicates t)) - (read-from-minibuffer prompt nil keymap nil - 'notmuch-search-history current-query nil))))) + (let* ((all-tags + (mapcar (lambda (tag) (notmuch-escape-boolean-term tag)) + (process-lines notmuch-command "search" "--output=tags" "*"))) + (completions + (append (list "folder:" "path:" "thread:" "id:" "date:" "from:" "to:" + "subject:" "attachment:") + (mapcar (lambda (tag) (concat "tag:" tag)) all-tags) + (mapcar (lambda (tag) (concat "is:" tag)) all-tags) + (mapcar (lambda (mimetype) (concat "mimetype:" mimetype)) + (mailcap-mime-types)))) + (keymap (copy-keymap minibuffer-local-map)) + (current-query (cl-case major-mode + (notmuch-search-mode (notmuch-search-get-query)) + (notmuch-show-mode (notmuch-show-get-query)) + (notmuch-tree-mode (notmuch-tree-get-query)))) + (minibuffer-completion-table + (completion-table-dynamic + (lambda (string) + ;; generate a list of possible completions for the current input + (cond + ;; this ugly regexp is used to get the last word of the input + ;; possibly preceded by a '(' + ((string-match "\\(^\\|.* (?\\)\\([^ ]*\\)$" string) + (mapcar (lambda (compl) + (concat (match-string-no-properties 1 string) compl)) + (all-completions (match-string-no-properties 2 string) + completions))) + (t (list string))))))) + ;; This was simpler than convincing completing-read to accept spaces: + (define-key keymap (kbd "TAB") 'minibuffer-complete) + (let ((history-delete-duplicates t)) + (read-from-minibuffer prompt nil keymap nil + 'notmuch-search-history current-query nil)))) (defun notmuch-search-get-query () "Return the current query in this search buffer." @@ -1006,10 +1005,9 @@ (defun notmuch-search (&optional query oldest-first target-thread target-line no (setq notmuch-search-target-thread target-thread) (setq notmuch-search-target-line target-line) (notmuch-tag-clear-cache) - (let ((proc (get-buffer-process (current-buffer))) - (inhibit-read-only t)) - (when proc - (error "notmuch search process already running for query `%s'" query)) + (when (get-buffer-process buffer) + (error "notmuch search process already running for query `%s'" query)) + (let ((inhibit-read-only t)) (erase-buffer) (goto-char (point-min)) (save-excursion @@ -1019,12 +1017,12 @@ (defun notmuch-search (&optional query oldest-first target-thread target-line no (if oldest-first "--sort=oldest-first" "--sort=newest-first") - query)) - ;; Use a scratch buffer to accumulate partial output. - ;; This buffer will be killed by the sentinel, which - ;; should be called no matter how the process dies. - (parse-buf (generate-new-buffer " *notmuch search parse*"))) - (process-put proc 'parse-buf parse-buf) + query))) + ;; Use a scratch buffer to accumulate partial output. + ;; This buffer will be killed by the sentinel, which + ;; should be called no matter how the process dies. + (process-put proc 'parse-buf + (generate-new-buffer " *notmuch search parse*")) (set-process-filter proc 'notmuch-search-process-filter) (set-process-query-on-exit-flag proc nil)))) (run-hooks 'notmuch-search-hook))) -- 2.29.1
Jonas Bernoulli <jonas@bernoul.li> writes:
> ---
> emacs/notmuch-tree.el | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
> index f342f85a..7b1e34ca 100644
> --- a/emacs/notmuch-tree.el
> +++ b/emacs/notmuch-tree.el
> @@ -42,6 +42,11 @@ (declare-function notmuch-read-query "notmuch" (prompt))
> (declare-function notmuch-search-find-thread-id "notmuch" (&optional bare))
> (declare-function notmuch-search-find-subject "notmuch" ())
>
> +;; For `notmuch-tree-next-thread-from-search'.
> +(declare-function notmuch-search-next-thread "notmuch" ())
> +(declare-function notmuch-search-previous-thread "notmuch" ())
> +(declare-function notmuch-tree-from-search-thread "notmuch" ())
> +
> ;; the following variable is defined in notmuch.el
> (defvar notmuch-search-query-string)
LGTM, I have a similar patch here: id:20200908171536.20679-1-jb55@jb55.com
Reviewed-by: William Casarin <jb55@jb55.com>
William Casarin <jb55@jb55.com> writes:
> LGTM, I have a similar patch here: id:20200908171536.20679-1-jb55@jb55.com
So if I understood correctly the problem with that was that you were
unable to run the tests and therefore couldn't confirm that you fixed
the issue or even that there was an issue in the first place.
Well I was able to build and test and I can confirm that there is an
issue and that your commit fixes it. So it should be merged (though
I would merge my own variant because of the extra comment ;-).
Cheers,
Jonas
Jonas Bernoulli <jonas@bernoul.li> writes: > William Casarin <jb55@jb55.com> writes: >> LGTM, I have a similar patch here: id:20200908171536.20679-1-jb55@jb55.com > > So if I understood correctly the problem with that was that you were > unable to run the tests and therefore couldn't confirm that you fixed > the issue or even that there was an issue in the first place. More so I got a bug report from a user that I couldn't replicate. I haven't run the tests. > Well I was able to build and test and I can confirm that there is an > issue and that your commit fixes it. So it should be merged (though > I would merge my own variant because of the extra comment ;-). Sounds good, happy to use this patch instead. Cheers, Will
Jonas Bernoulli <jonas@bernoul.li> writes:
> Key bindings should not be defined at the top-level but inside
> a `defvar' form. Doing it at the top-level makes it harder to
> reliably customize key bindings.
> ---
> emacs/notmuch-mua.el | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
> index 03c7cc97..616b625c 100644
> --- a/emacs/notmuch-mua.el
> +++ b/emacs/notmuch-mua.el
> @@ -324,17 +324,21 @@ (defun notmuch-mua-reply (query-string &optional sender reply-all)
> (message-goto-body)
> (set-buffer-modified-p nil))
>
> +(defvar notmuch-message-mode-map
> + (let ((map (make-sparse-keymap)))
> + (define-key map (kbd "C-c C-c") #'notmuch-mua-send-and-exit)
> + (define-key map (kbd "C-c C-s") #'notmuch-mua-send)
> + (define-key map (kbd "C-c C-p") #'notmuch-draft-postpone)
> + (define-key map (kbd "C-x C-s") #'notmuch-draft-save)
> + map)
> + "Keymap for `notmuch-message-mode'.")
> +
> (define-derived-mode notmuch-message-mode message-mode "Message[Notmuch]"
> "Notmuch message composition mode. Mostly like `message-mode'."
> (notmuch-address-setup))
>
> (put 'notmuch-message-mode 'flyspell-mode-predicate 'mail-mode-flyspell-verify)
>
> -(define-key notmuch-message-mode-map (kbd "C-c C-c") #'notmuch-mua-send-and-exit)
> -(define-key notmuch-message-mode-map (kbd "C-c C-s") #'notmuch-mua-send)
> -(define-key notmuch-message-mode-map (kbd "C-c C-p") #'notmuch-draft-postpone)
> -(define-key notmuch-message-mode-map (kbd "C-x C-s") #'notmuch-draft-save)
> -
> (defun notmuch-mua-pop-to-buffer (name switch-function)
> "Pop to buffer NAME, and warn if it already exists and is
> modified. This function is notmuch adaptation of
Tested-by: William Casarin <jb55@jb55.com>
Jonas Bernoulli <jonas@bernoul.li> writes:
> These keymaps are never invoked as commands
> so the function definitions serve no purpose.
> ---
> emacs/notmuch-show.el | 1 -
> emacs/notmuch-tree.el | 1 -
> emacs/notmuch.el | 1 -
> 3 files changed, 3 deletions(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index b08ceb97..ec22fd94 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -1485,7 +1485,6 @@ (defvar notmuch-show-mode-map
> (define-key map "B" 'notmuch-show-browse-urls)
> map)
> "Keymap for \"notmuch show\" buffers.")
> -(fset 'notmuch-show-mode-map notmuch-show-mode-map)
>
> (define-derived-mode notmuch-show-mode fundamental-mode "notmuch-show"
> "Major mode for viewing a thread with notmuch.
> diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
> index ea6a5cf3..ad08f7c6 100644
> --- a/emacs/notmuch-tree.el
> +++ b/emacs/notmuch-tree.el
> @@ -361,7 +361,6 @@ (defvar notmuch-tree-mode-map
> (define-key map "e" 'notmuch-tree-resume-message)
> map)
> "Keymap for \"notmuch tree\" buffers.")
> -(fset 'notmuch-tree-mode-map notmuch-tree-mode-map)
>
> (defun notmuch-tree-get-message-properties ()
> "Return the properties of the current message as a plist.
> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> index 83bcee57..165aaa43 100644
> --- a/emacs/notmuch.el
> +++ b/emacs/notmuch.el
> @@ -194,7 +194,6 @@ (defvar notmuch-search-mode-map
> (define-key map "U" 'notmuch-unthreaded-from-search-current-query)
> map)
> "Keymap for \"notmuch search\" buffers.")
> -(fset 'notmuch-search-mode-map notmuch-search-mode-map)
>
> (defvar notmuch-search-stash-map
> (let ((map (make-sparse-keymap)))
> --
> 2.29.1
I believe this makes sense. Looks like they were first introduced in
early versions of the code...
Reviewed-by: William Casarin <jb55@jb55.com>
Tested-by: William Casarin <jb55@jb55.com>
William Casarin <jb55@jb55.com> writes:
> Jonas Bernoulli <jonas@bernoul.li> writes:
>
>
> I believe this makes sense. Looks like they were first introduced in
> early versions of the code...
>
> Reviewed-by: William Casarin <jb55@jb55.com>
> Tested-by: William Casarin <jb55@jb55.com>
I have applied the first 4 patches.
d
On Sunday, 2020-11-08 at 20:02:50 +01, Jonas Bernoulli wrote: > This fixes a regression introduced in [1: 7e20d264]. If the argument > RETURN-ACTION was non-nil then we should pass along the value of that > argument. Instead we passed along the constant symbol `return-action'. > > 1: 7e20d26480553f57d53bd9ec28cae163c1ac91e3 > emacs: Fix mail composition under Emacs 23 Reviewed-by: David Edmondson <dme@dme.org> > --- > emacs/notmuch-mua.el | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el > index 616b625c..1204fb6a 100644 > --- a/emacs/notmuch-mua.el > +++ b/emacs/notmuch-mua.el > @@ -402,7 +402,7 @@ (defun notmuch-mua-mail (&optional to subject other-headers continue > ;; argument. Pass it only if it is supplied by the caller. This > ;; will never be the case when we're called by `compose-mail' in > ;; Emacs 23. > - (when return-action (nconc args '(return-action))) > + (when return-action (nconc args (list return-action))) > (apply 'message-setup-1 headers args)) > (notmuch-fcc-header-setup) > (message-sort-headers) > -- > 2.29.1 > _______________________________________________ > notmuch mailing list -- notmuch@notmuchmail.org > To unsubscribe send an email to notmuch-leave@notmuchmail.org dme. -- This is not how I woke up, but it's how I look now.
On Sunday, 2020-11-08 at 20:02:57 +01, Jonas Bernoulli wrote: With a suggested rewording below... Reviewed-by: David Edmondson <dme@dme.org> > --- > emacs/notmuch-crypto.el | 3 +-- > emacs/notmuch-hello.el | 3 +-- > emacs/notmuch-mua.el | 11 ++++------- > 3 files changed, 6 insertions(+), 11 deletions(-) > > diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el > index 276c9859..4fab215a 100644 > --- a/emacs/notmuch-crypto.el > +++ b/emacs/notmuch-crypto.el > @@ -103,8 +103,7 @@ (define-button-type 'notmuch-crypto-status-button-type > :supertype 'notmuch-button-type) > > (defun notmuch-crypto-insert-sigstatus-button (sigstatus from) > - "Insert a button describing the signature status SIGSTATUS sent > -by user FROM." > + "Insert a button describing the signature status SIGSTATUS sent by user FROM." > (let* ((status (plist-get sigstatus :status)) > (show-button t) > (face 'notmuch-crypto-signature-unknown) > diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el > index 003bec33..28784345 100644 > --- a/emacs/notmuch-hello.el > +++ b/emacs/notmuch-hello.el > @@ -372,8 +372,7 @@ (defvar notmuch-hello-hidden-sections nil > "List of sections titles whose contents are hidden.") > > (defvar notmuch-hello-first-run t > - "True if `notmuch-hello' is run for the first time, set to nil > -afterwards.") > + "True if `notmuch-hello' is run for the first time, set to nil afterwards.") > > (defun notmuch-hello-nice-number (n) > (let (result) > diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el > index 9d08c2c9..62d615d1 100644 > --- a/emacs/notmuch-mua.el > +++ b/emacs/notmuch-mua.el > @@ -73,8 +73,7 @@ (defcustom notmuch-mua-user-agent-function nil > :group 'notmuch-send) > > (defcustom notmuch-mua-hidden-headers nil > - "Headers that are added to the `message-mode' hidden headers > -list." > + "Headers that are added to the `message-mode' hidden headers list." > :type '(repeat string) > :group 'notmuch-send) > > @@ -167,8 +166,7 @@ (defun notmuch-mua-get-switch-function () > (t (error "Invalid value for `notmuch-mua-compose-in'")))) > > (defun notmuch-mua-maybe-set-window-dedicated () > - "Set the selected window as dedicated according to > -`notmuch-mua-compose-in'." > + "Set the selected window as dedicated according to `notmuch-mua-compose-in'." > (when (or (eq notmuch-mua-compose-in 'new-frame) > (eq notmuch-mua-compose-in 'new-window)) > (set-window-dedicated-p (selected-window) t))) > @@ -335,9 +333,8 @@ (define-derived-mode notmuch-message-mode message-mode "Message[Notmuch]" > (put 'notmuch-message-mode 'flyspell-mode-predicate 'mail-mode-flyspell-verify) > > (defun notmuch-mua-pop-to-buffer (name switch-function) > - "Pop to buffer NAME, and warn if it already exists and is > -modified. This function is notmuch adaptation of > -`message-pop-to-buffer'." > + "Pop to buffer NAME, and warn if it already exists and is modified. > +This function is notmuch adaptation of `message-pop-to-buffer'." "notmuch's adaptation" or "a notmuch adaptation", or just "an adaptation". > (let ((buffer (get-buffer name))) > (if (and buffer > (buffer-name buffer)) > -- > 2.29.1 > _______________________________________________ > notmuch mailing list -- notmuch@notmuchmail.org > To unsubscribe send an email to notmuch-leave@notmuchmail.org dme. -- You bring light in.
On Sunday, 2020-11-08 at 20:02:59 +01, Jonas Bernoulli wrote: Minor suggestion below... Reviewed-by: David Edmondson <dme@dme.org> > --- > emacs/notmuch-address.el | 6 +++--- > emacs/notmuch-crypto.el | 4 ++-- > emacs/notmuch-mua.el | 7 ++++--- > 3 files changed, 9 insertions(+), 8 deletions(-) > > diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el > index 561cc140..04353522 100644 > --- a/emacs/notmuch-address.el > +++ b/emacs/notmuch-address.el > @@ -36,9 +36,9 @@ (defvar notmuch-address-completions (make-hash-table :test 'equal) > This variable is set by calling `notmuch-address-harvest'.") > > (defvar notmuch-address-full-harvest-finished nil > - "t indicates that full completion address harvesting has been finished. > -Use notmuch-address--harvest-ready to access as that will load a > -saved hash if necessary (and available).") > + "Whether full completion address harvesting has finished. > +Use notmuch-address--harvest-ready to access as that will load Quotes to indicate that `notmuch-address--harvest-ready' is a function? > +a saved hash if necessary (and available).") > > (defun notmuch-address--harvest-ready () > "Return t if there is a full address hash available. > diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el > index 4fab215a..9e6f3a9d 100644 > --- a/emacs/notmuch-crypto.el > +++ b/emacs/notmuch-crypto.el > @@ -27,7 +27,7 @@ (require 'notmuch-lib) > (declare-function notmuch-show-get-message-id "notmuch-show" (&optional bare)) > > (defcustom notmuch-crypto-process-mime t > - "Should cryptographic MIME parts be processed? > + "Whether to process cryptographic MIME parts. > > If this variable is non-nil signatures in multipart/signed > messages will be verified and multipart/encrypted parts will be > @@ -46,7 +46,7 @@ (defcustom notmuch-crypto-process-mime t > :group 'notmuch-crypto) > > (defcustom notmuch-crypto-get-keys-asynchronously t > - "Retrieve gpg keys asynchronously." > + "Whether to retrieve openpgp keys asynchronously." > :type 'boolean > :group 'notmuch-crypto) > > diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el > index 62d615d1..821bb324 100644 > --- a/emacs/notmuch-mua.el > +++ b/emacs/notmuch-mua.el > @@ -82,10 +82,11 @@ (defgroup notmuch-reply nil > :group 'notmuch) > > (defcustom notmuch-mua-cite-function 'message-cite-original > - "*Function for citing an original message. > + "Function for citing an original message. > + > Predefined functions include `message-cite-original' and > -`message-cite-original-without-signature'. > -Note that these functions use `mail-citation-hook' if that is non-nil." > +`message-cite-original-without-signature'. Note that these > +functions use `mail-citation-hook' if that is non-nil." > :type '(radio (function-item message-cite-original) > (function-item message-cite-original-without-signature) > (function-item sc-cite-original) > -- > 2.29.1 > _______________________________________________ > notmuch mailing list -- notmuch@notmuchmail.org > To unsubscribe send an email to notmuch-leave@notmuchmail.org dme. -- I'm not the reason you're looking for redemption.
On Sunday, 2020-11-08 at 20:03:11 +01, Jonas Bernoulli wrote:
There were some places here where you capitalised comments (more
generally, turned them into English prose) when they were moving for
$reasons, and others where you left them alone. Was there a rationale
for the different treatment?
Reviewed-by: David Edmondson <dme@dme.org>
> ---
> emacs/notmuch-address.el | 31 ++++++--------
> emacs/notmuch-hello.el | 28 +++++--------
> emacs/notmuch-lib.el | 38 +++++++++--------
> emacs/notmuch-mua.el | 10 ++---
> emacs/notmuch-tag.el | 2 +-
> emacs/notmuch.el | 88 ++++++++++++++++++++--------------------
> 6 files changed, 91 insertions(+), 106 deletions(-)
>
> diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
> index 21d1d82f..0dedd5d5 100644
> --- a/emacs/notmuch-address.el
> +++ b/emacs/notmuch-address.el
> @@ -21,6 +21,8 @@
>
> ;;; Code:
>
> +(eval-when-compile (require 'cl-lib))
> +
> (require 'message)
> (require 'notmuch-parser)
> (require 'notmuch-lib)
> @@ -154,15 +156,12 @@ (defcustom notmuch-address-use-company t
> :group 'notmuch-address)
>
> (defun notmuch-address-setup ()
> - (let* ((setup-company (and notmuch-address-use-company
> - (require 'company nil t)))
> - (pair (cons notmuch-address-completion-headers-regexp
> - #'notmuch-address-expand-name)))
> - (when setup-company
> - (notmuch-company-setup))
> - (unless (member pair message-completion-alist)
> - (setq message-completion-alist
> - (push pair message-completion-alist)))))
> + (when (and notmuch-address-use-company
> + (require 'company nil t))
> + (notmuch-company-setup))
> + (cl-pushnew (cons notmuch-address-completion-headers-regexp
> + #'notmuch-address-expand-name)
> + message-completion-alist :test #'equal))
>
> (defun notmuch-address-toggle-internal-completion ()
> "Toggle use of internal completion for current buffer.
> @@ -251,11 +250,8 @@ (defun notmuch-address-expand-name ()
> (t nil)))
>
> (defun notmuch-address-harvest-addr (result)
> - (let ((name-addr (plist-get result :name-addr)))
> - (puthash name-addr t notmuch-address-completions)))
> -
> -(defun notmuch-address-harvest-handle-result (obj)
> - (notmuch-address-harvest-addr obj))
> + (puthash (plist-get result :name-addr)
> + t notmuch-address-completions))
>
> (defun notmuch-address-harvest-filter (proc string)
> (when (buffer-live-p (process-buffer proc))
> @@ -264,7 +260,7 @@ (defun notmuch-address-harvest-filter (proc string)
> (goto-char (point-max))
> (insert string))
> (notmuch-sexp-parse-partial-list
> - 'notmuch-address-harvest-handle-result (process-buffer proc)))))
> + 'notmuch-address-harvest-addr (process-buffer proc)))))
>
> (defvar notmuch-address-harvest-procs '(nil . nil)
> "The currently running harvests.
> @@ -375,7 +371,7 @@ (defun notmuch-address--load-address-hash ()
> (defun notmuch-address--save-address-hash ()
> (when notmuch-address-save-filename
> (if (or (not (file-exists-p notmuch-address-save-filename))
> - ;; The file exists, check it is a file we saved
> + ;; The file exists, check it is a file we saved.
> (notmuch-address--get-address-hash))
> (with-temp-file notmuch-address-save-filename
> (let ((save-plist
> @@ -398,8 +394,7 @@ (defun notmuch-address-harvest-trigger ()
> nil nil
> (lambda (proc event)
> ;; If harvest fails, we want to try
> - ;; again when the trigger is next
> - ;; called
> + ;; again when the trigger is next called.
> (if (string= event "finished\n")
> (progn
> (notmuch-address--save-address-hash)
> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> index fa31694f..80af7544 100644
> --- a/emacs/notmuch-hello.el
> +++ b/emacs/notmuch-hello.el
> @@ -402,8 +402,7 @@ (defun notmuch-hello-add-saved-search (widget)
> ;; If an existing saved search with this name exists, remove it.
> (setq notmuch-saved-searches
> (cl-loop for elem in notmuch-saved-searches
> - if (not (equal name
> - (notmuch-saved-search-get elem :name)))
> + unless (equal name (notmuch-saved-search-get elem :name))
> collect elem))
> ;; Add the new one.
> (customize-save-variable 'notmuch-saved-searches
> @@ -446,18 +445,14 @@ (defun notmuch-hello-reflect (list ncols)
> append (notmuch-hello-reflect-generate-row ncols nrows row list))))
>
> (defun notmuch-hello-widget-search (widget &rest ignore)
> - (cond
> - ((eq (widget-get widget :notmuch-search-type) 'tree)
> - (notmuch-tree (widget-get widget
> - :notmuch-search-terms)))
> - ((eq (widget-get widget :notmuch-search-type) 'unthreaded)
> - (notmuch-unthreaded (widget-get widget
> - :notmuch-search-terms)))
> + (cl-case (widget-get widget :notmuch-search-type)
> + (tree
> + (notmuch-tree (widget-get widget :notmuch-search-terms)))
> + (unthreaded
> + (notmuch-unthreaded (widget-get widget :notmuch-search-terms)))
> (t
> - (notmuch-search (widget-get widget
> - :notmuch-search-terms)
> - (widget-get widget
> - :notmuch-search-oldest-first)))))
> + (notmuch-search (widget-get widget :notmuch-search-terms)
> + (widget-get widget :notmuch-search-oldest-first)))))
>
> (defun notmuch-saved-search-count (search)
> (car (process-lines notmuch-command "count" search)))
> @@ -689,9 +684,7 @@ (define-derived-mode notmuch-hello-mode fundamental-mode "notmuch-hello"
> Complete list of currently available key bindings:
>
> \\{notmuch-hello-mode-map}"
> - (setq notmuch-buffer-refresh-function #'notmuch-hello-update)
> - ;;(setq buffer-read-only t)
> - )
> + (setq notmuch-buffer-refresh-function #'notmuch-hello-update))
>
> (defun notmuch-hello-generate-tag-alist (&optional hide-tags)
> "Return an alist from tags to queries to display in the all-tags section."
> @@ -775,8 +768,7 @@ (defun notmuch-hello-insert-search ()
> ;; instead of a space to make `show-trailing-whitespace'
> ;; happy, i.e. avoid it marking the whole line as trailing
> ;; spaces.
> - (widget-insert ".")
> - (put-text-property (1- (point)) (point) 'invisible t)
> + (widget-insert (propertize "." 'invisible t))
> (widget-insert "\n"))
>
> (defun notmuch-hello-insert-recent-searches ()
> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> index e23999ad..aa48b949 100644
> --- a/emacs/notmuch-lib.el
> +++ b/emacs/notmuch-lib.el
> @@ -186,8 +186,8 @@ (defun notmuch-command-to-string (&rest args)
>
> Otherwise the output will be returned."
> (with-temp-buffer
> - (let* ((status (apply #'call-process notmuch-command nil t nil args))
> - (output (buffer-string)))
> + (let ((status (apply #'call-process notmuch-command nil t nil args))
> + (output (buffer-string)))
> (notmuch-check-exit-status status (cons notmuch-command args) output)
> output)))
>
> @@ -239,8 +239,9 @@ (defun notmuch-config-get (item)
> (let* ((val (notmuch-command-to-string "config" "get" item))
> (len (length val)))
> ;; Trim off the trailing newline (if the value is empty or not
> - ;; configured, there will be no newline)
> - (if (and (> len 0) (= (aref val (- len 1)) ?\n))
> + ;; configured, there will be no newline).
> + (if (and (> len 0)
> + (= (aref val (- len 1)) ?\n))
> (substring val 0 -1)
> val)))
>
> @@ -403,9 +404,9 @@ (defun notmuch-help ()
> its prefixed behavior by setting the 'notmuch-prefix-doc property
> of its command symbol."
> (interactive)
> - (let* ((mode major-mode)
> - (doc (substitute-command-keys
> - (notmuch-substitute-command-keys (documentation mode t)))))
> + (let ((doc (substitute-command-keys
> + (notmuch-substitute-command-keys
> + (documentation major-mode t)))))
> (with-current-buffer (generate-new-buffer "*notmuch-help*")
> (insert doc)
> (goto-char (point-min))
> @@ -467,8 +468,8 @@ (defun notmuch-refresh-all-buffers ()
> (notmuch-refresh-this-buffer))))))
>
> (defun notmuch-prettify-subject (subject)
> - ;; This function is used by `notmuch-search-process-filter' which
> - ;; requires that we not disrupt its' matching state.
> + ;; This function is used by `notmuch-search-process-filter',
> + ;; which requires that we not disrupt its matching state.
> (save-match-data
> (if (and subject
> (string-match "^[ \t]*$" subject))
> @@ -525,13 +526,12 @@ (defun notmuch-common-do-stash (text)
> ;;
>
> (defun notmuch-plist-delete (plist property)
> - (let* ((xplist (cons nil plist))
> - (pred xplist))
> - (while (cdr pred)
> - (when (eq (cadr pred) property)
> - (setcdr pred (cdddr pred)))
> - (setq pred (cddr pred)))
> - (cdr xplist)))
> + (let (p)
> + (while plist
> + (unless (eq property (car plist))
> + (setq p (plist-put p (car plist) (cadr plist))))
> + (setq plist (cddr plist)))
> + p))
>
> (defun notmuch-match-content-type (t1 t2)
> "Return t if t1 and t2 are matching content types, taking wildcards into account."
> @@ -540,8 +540,10 @@ (defun notmuch-match-content-type (t1 t2)
> (if (or (string= (cadr st1) "*")
> (string= (cadr st2) "*"))
> ;; Comparison of content types should be case insensitive.
> - (string= (downcase (car st1)) (downcase (car st2)))
> - (string= (downcase t1) (downcase t2)))))
> + (string= (downcase (car st1))
> + (downcase (car st2)))
> + (string= (downcase t1)
> + (downcase t2)))))
>
> (defvar notmuch-multipart/alternative-discouraged
> '(;; Avoid HTML parts.
> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
> index f9843546..8501e294 100644
> --- a/emacs/notmuch-mua.el
> +++ b/emacs/notmuch-mua.el
> @@ -347,12 +347,10 @@ (defun notmuch-mua-pop-to-buffer (name switch-function)
> (select-window window))
> (funcall switch-function buffer)
> (set-buffer buffer))
> - (when (and (buffer-modified-p)
> - (not (prog1
> - (y-or-n-p
> - "Message already being composed; erase? ")
> - (message nil))))
> - (error "Message being composed")))
> + (when (buffer-modified-p)
> + (if (y-or-n-p "Message already being composed; erase? ")
> + (message nil)
> + (error "Message being composed"))))
> (funcall switch-function name)
> (set-buffer name))
> (erase-buffer)
> diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el
> index 925de78c..75e864a4 100644
> --- a/emacs/notmuch-tag.el
> +++ b/emacs/notmuch-tag.el
> @@ -472,7 +472,7 @@ (defun notmuch-tag (query tag-changes)
> tag-changes)
> (unless query
> (error "Nothing to tag!"))
> - (unless (null tag-changes)
> + (when tag-changes
> (run-hooks 'notmuch-before-tag-hook)
> (if (<= (length query) notmuch-tag-argument-limit)
> (apply 'notmuch-call-notmuch-process "tag"
> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> index b221be05..8157bbf4 100644
> --- a/emacs/notmuch.el
> +++ b/emacs/notmuch.el
> @@ -169,7 +169,7 @@ (defvar notmuch-search-mode-map
> (let ((map (make-sparse-keymap)))
> (set-keymap-parent map notmuch-common-keymap)
> (define-key map "x" 'notmuch-bury-or-kill-this-buffer)
> - (define-key map (kbd "<DEL>") 'notmuch-search-scroll-down)
> + (define-key map (kbd "DEL") 'notmuch-search-scroll-down)
> (define-key map "b" 'notmuch-search-scroll-down)
> (define-key map " " 'notmuch-search-scroll-up)
> (define-key map "<" 'notmuch-search-first-thread)
> @@ -923,40 +923,39 @@ (defun notmuch-read-query (prompt)
> "Read a notmuch-query from the minibuffer with completion.
>
> PROMPT is the string to prompt with."
> - (let*
> - ((all-tags
> - (mapcar (lambda (tag) (notmuch-escape-boolean-term tag))
> - (process-lines notmuch-command "search" "--output=tags" "*")))
> - (completions
> - (append (list "folder:" "path:" "thread:" "id:" "date:" "from:" "to:"
> - "subject:" "attachment:")
> - (mapcar (lambda (tag) (concat "tag:" tag)) all-tags)
> - (mapcar (lambda (tag) (concat "is:" tag)) all-tags)
> - (mapcar (lambda (mimetype) (concat "mimetype:" mimetype))
> - (mailcap-mime-types)))))
> - (let ((keymap (copy-keymap minibuffer-local-map))
> - (current-query (cl-case major-mode
> - (notmuch-search-mode (notmuch-search-get-query))
> - (notmuch-show-mode (notmuch-show-get-query))
> - (notmuch-tree-mode (notmuch-tree-get-query))))
> - (minibuffer-completion-table
> - (completion-table-dynamic
> - (lambda (string)
> - ;; generate a list of possible completions for the current input
> - (cond
> - ;; this ugly regexp is used to get the last word of the input
> - ;; possibly preceded by a '('
> - ((string-match "\\(^\\|.* (?\\)\\([^ ]*\\)$" string)
> - (mapcar (lambda (compl)
> - (concat (match-string-no-properties 1 string) compl))
> - (all-completions (match-string-no-properties 2 string)
> - completions)))
> - (t (list string)))))))
> - ;; this was simpler than convincing completing-read to accept spaces:
> - (define-key keymap (kbd "TAB") 'minibuffer-complete)
> - (let ((history-delete-duplicates t))
> - (read-from-minibuffer prompt nil keymap nil
> - 'notmuch-search-history current-query nil)))))
> + (let* ((all-tags
> + (mapcar (lambda (tag) (notmuch-escape-boolean-term tag))
> + (process-lines notmuch-command "search" "--output=tags" "*")))
> + (completions
> + (append (list "folder:" "path:" "thread:" "id:" "date:" "from:" "to:"
> + "subject:" "attachment:")
> + (mapcar (lambda (tag) (concat "tag:" tag)) all-tags)
> + (mapcar (lambda (tag) (concat "is:" tag)) all-tags)
> + (mapcar (lambda (mimetype) (concat "mimetype:" mimetype))
> + (mailcap-mime-types))))
> + (keymap (copy-keymap minibuffer-local-map))
> + (current-query (cl-case major-mode
> + (notmuch-search-mode (notmuch-search-get-query))
> + (notmuch-show-mode (notmuch-show-get-query))
> + (notmuch-tree-mode (notmuch-tree-get-query))))
> + (minibuffer-completion-table
> + (completion-table-dynamic
> + (lambda (string)
> + ;; generate a list of possible completions for the current input
> + (cond
> + ;; this ugly regexp is used to get the last word of the input
> + ;; possibly preceded by a '('
> + ((string-match "\\(^\\|.* (?\\)\\([^ ]*\\)$" string)
> + (mapcar (lambda (compl)
> + (concat (match-string-no-properties 1 string) compl))
> + (all-completions (match-string-no-properties 2 string)
> + completions)))
> + (t (list string)))))))
> + ;; This was simpler than convincing completing-read to accept spaces:
> + (define-key keymap (kbd "TAB") 'minibuffer-complete)
> + (let ((history-delete-duplicates t))
> + (read-from-minibuffer prompt nil keymap nil
> + 'notmuch-search-history current-query nil))))
>
> (defun notmuch-search-get-query ()
> "Return the current query in this search buffer."
> @@ -1006,10 +1005,9 @@ (defun notmuch-search (&optional query oldest-first target-thread target-line no
> (setq notmuch-search-target-thread target-thread)
> (setq notmuch-search-target-line target-line)
> (notmuch-tag-clear-cache)
> - (let ((proc (get-buffer-process (current-buffer)))
> - (inhibit-read-only t))
> - (when proc
> - (error "notmuch search process already running for query `%s'" query))
> + (when (get-buffer-process buffer)
> + (error "notmuch search process already running for query `%s'" query))
> + (let ((inhibit-read-only t))
> (erase-buffer)
> (goto-char (point-min))
> (save-excursion
> @@ -1019,12 +1017,12 @@ (defun notmuch-search (&optional query oldest-first target-thread target-line no
> (if oldest-first
> "--sort=oldest-first"
> "--sort=newest-first")
> - query))
> - ;; Use a scratch buffer to accumulate partial output.
> - ;; This buffer will be killed by the sentinel, which
> - ;; should be called no matter how the process dies.
> - (parse-buf (generate-new-buffer " *notmuch search parse*")))
> - (process-put proc 'parse-buf parse-buf)
> + query)))
> + ;; Use a scratch buffer to accumulate partial output.
> + ;; This buffer will be killed by the sentinel, which
> + ;; should be called no matter how the process dies.
> + (process-put proc 'parse-buf
> + (generate-new-buffer " *notmuch search parse*"))
> (set-process-filter proc 'notmuch-search-process-filter)
> (set-process-query-on-exit-flag proc nil))))
> (run-hooks 'notmuch-search-hook)))
> --
> 2.29.1
> _______________________________________________
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-leave@notmuchmail.org
dme.
--
I just bite it, it's for the look I don't light it.
David Edmondson <dme@dme.org> writes: > On Sunday, 2020-11-08 at 20:03:11 +01, Jonas Bernoulli wrote: > > There were some places here where you capitalised comments (more > generally, turned them into English prose) when they were moving for > $reasons, and others where you left them alone. Was there a rationale > for the different treatment? I kept amending to this commit over time. I suppose this difference came about because apparently on some days such fuzzy comments bother me more than others. By the way, I am fairly strict about not sneaking unrelated changes into and such comment cosmetic are about the only exception I make. Anyway, I've amended this commit to improve two more comments. jrb > > Reviewed-by: David Edmondson <dme@dme.org> > >> --- >> emacs/notmuch-address.el | 31 ++++++-------- >> emacs/notmuch-hello.el | 28 +++++-------- >> emacs/notmuch-lib.el | 38 +++++++++-------- >> emacs/notmuch-mua.el | 10 ++--- >> emacs/notmuch-tag.el | 2 +- >> emacs/notmuch.el | 88 ++++++++++++++++++++-------------------- >> 6 files changed, 91 insertions(+), 106 deletions(-) >> >> diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el >> index 21d1d82f..0dedd5d5 100644 >> --- a/emacs/notmuch-address.el >> +++ b/emacs/notmuch-address.el >> @@ -21,6 +21,8 @@ >> >> ;;; Code: >> >> +(eval-when-compile (require 'cl-lib)) >> + >> (require 'message) >> (require 'notmuch-parser) >> (require 'notmuch-lib) >> @@ -154,15 +156,12 @@ (defcustom notmuch-address-use-company t >> :group 'notmuch-address) >> >> (defun notmuch-address-setup () >> - (let* ((setup-company (and notmuch-address-use-company >> - (require 'company nil t))) >> - (pair (cons notmuch-address-completion-headers-regexp >> - #'notmuch-address-expand-name))) >> - (when setup-company >> - (notmuch-company-setup)) >> - (unless (member pair message-completion-alist) >> - (setq message-completion-alist >> - (push pair message-completion-alist))))) >> + (when (and notmuch-address-use-company >> + (require 'company nil t)) >> + (notmuch-company-setup)) >> + (cl-pushnew (cons notmuch-address-completion-headers-regexp >> + #'notmuch-address-expand-name) >> + message-completion-alist :test #'equal)) >> >> (defun notmuch-address-toggle-internal-completion () >> "Toggle use of internal completion for current buffer. >> @@ -251,11 +250,8 @@ (defun notmuch-address-expand-name () >> (t nil))) >> >> (defun notmuch-address-harvest-addr (result) >> - (let ((name-addr (plist-get result :name-addr))) >> - (puthash name-addr t notmuch-address-completions))) >> - >> -(defun notmuch-address-harvest-handle-result (obj) >> - (notmuch-address-harvest-addr obj)) >> + (puthash (plist-get result :name-addr) >> + t notmuch-address-completions)) >> >> (defun notmuch-address-harvest-filter (proc string) >> (when (buffer-live-p (process-buffer proc)) >> @@ -264,7 +260,7 @@ (defun notmuch-address-harvest-filter (proc string) >> (goto-char (point-max)) >> (insert string)) >> (notmuch-sexp-parse-partial-list >> - 'notmuch-address-harvest-handle-result (process-buffer proc))))) >> + 'notmuch-address-harvest-addr (process-buffer proc))))) >> >> (defvar notmuch-address-harvest-procs '(nil . nil) >> "The currently running harvests. >> @@ -375,7 +371,7 @@ (defun notmuch-address--load-address-hash () >> (defun notmuch-address--save-address-hash () >> (when notmuch-address-save-filename >> (if (or (not (file-exists-p notmuch-address-save-filename)) >> - ;; The file exists, check it is a file we saved >> + ;; The file exists, check it is a file we saved. >> (notmuch-address--get-address-hash)) >> (with-temp-file notmuch-address-save-filename >> (let ((save-plist >> @@ -398,8 +394,7 @@ (defun notmuch-address-harvest-trigger () >> nil nil >> (lambda (proc event) >> ;; If harvest fails, we want to try >> - ;; again when the trigger is next >> - ;; called >> + ;; again when the trigger is next called. >> (if (string= event "finished\n") >> (progn >> (notmuch-address--save-address-hash) >> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el >> index fa31694f..80af7544 100644 >> --- a/emacs/notmuch-hello.el >> +++ b/emacs/notmuch-hello.el >> @@ -402,8 +402,7 @@ (defun notmuch-hello-add-saved-search (widget) >> ;; If an existing saved search with this name exists, remove it. >> (setq notmuch-saved-searches >> (cl-loop for elem in notmuch-saved-searches >> - if (not (equal name >> - (notmuch-saved-search-get elem :name))) >> + unless (equal name (notmuch-saved-search-get elem :name)) >> collect elem)) >> ;; Add the new one. >> (customize-save-variable 'notmuch-saved-searches >> @@ -446,18 +445,14 @@ (defun notmuch-hello-reflect (list ncols) >> append (notmuch-hello-reflect-generate-row ncols nrows row list)))) >> >> (defun notmuch-hello-widget-search (widget &rest ignore) >> - (cond >> - ((eq (widget-get widget :notmuch-search-type) 'tree) >> - (notmuch-tree (widget-get widget >> - :notmuch-search-terms))) >> - ((eq (widget-get widget :notmuch-search-type) 'unthreaded) >> - (notmuch-unthreaded (widget-get widget >> - :notmuch-search-terms))) >> + (cl-case (widget-get widget :notmuch-search-type) >> + (tree >> + (notmuch-tree (widget-get widget :notmuch-search-terms))) >> + (unthreaded >> + (notmuch-unthreaded (widget-get widget :notmuch-search-terms))) >> (t >> - (notmuch-search (widget-get widget >> - :notmuch-search-terms) >> - (widget-get widget >> - :notmuch-search-oldest-first))))) >> + (notmuch-search (widget-get widget :notmuch-search-terms) >> + (widget-get widget :notmuch-search-oldest-first))))) >> >> (defun notmuch-saved-search-count (search) >> (car (process-lines notmuch-command "count" search))) >> @@ -689,9 +684,7 @@ (define-derived-mode notmuch-hello-mode fundamental-mode "notmuch-hello" >> Complete list of currently available key bindings: >> >> \\{notmuch-hello-mode-map}" >> - (setq notmuch-buffer-refresh-function #'notmuch-hello-update) >> - ;;(setq buffer-read-only t) >> - ) >> + (setq notmuch-buffer-refresh-function #'notmuch-hello-update)) >> >> (defun notmuch-hello-generate-tag-alist (&optional hide-tags) >> "Return an alist from tags to queries to display in the all-tags section." >> @@ -775,8 +768,7 @@ (defun notmuch-hello-insert-search () >> ;; instead of a space to make `show-trailing-whitespace' >> ;; happy, i.e. avoid it marking the whole line as trailing >> ;; spaces. >> - (widget-insert ".") >> - (put-text-property (1- (point)) (point) 'invisible t) >> + (widget-insert (propertize "." 'invisible t)) >> (widget-insert "\n")) >> >> (defun notmuch-hello-insert-recent-searches () >> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el >> index e23999ad..aa48b949 100644 >> --- a/emacs/notmuch-lib.el >> +++ b/emacs/notmuch-lib.el >> @@ -186,8 +186,8 @@ (defun notmuch-command-to-string (&rest args) >> >> Otherwise the output will be returned." >> (with-temp-buffer >> - (let* ((status (apply #'call-process notmuch-command nil t nil args)) >> - (output (buffer-string))) >> + (let ((status (apply #'call-process notmuch-command nil t nil args)) >> + (output (buffer-string))) >> (notmuch-check-exit-status status (cons notmuch-command args) output) >> output))) >> >> @@ -239,8 +239,9 @@ (defun notmuch-config-get (item) >> (let* ((val (notmuch-command-to-string "config" "get" item)) >> (len (length val))) >> ;; Trim off the trailing newline (if the value is empty or not >> - ;; configured, there will be no newline) >> - (if (and (> len 0) (= (aref val (- len 1)) ?\n)) >> + ;; configured, there will be no newline). >> + (if (and (> len 0) >> + (= (aref val (- len 1)) ?\n)) >> (substring val 0 -1) >> val))) >> >> @@ -403,9 +404,9 @@ (defun notmuch-help () >> its prefixed behavior by setting the 'notmuch-prefix-doc property >> of its command symbol." >> (interactive) >> - (let* ((mode major-mode) >> - (doc (substitute-command-keys >> - (notmuch-substitute-command-keys (documentation mode t))))) >> + (let ((doc (substitute-command-keys >> + (notmuch-substitute-command-keys >> + (documentation major-mode t))))) >> (with-current-buffer (generate-new-buffer "*notmuch-help*") >> (insert doc) >> (goto-char (point-min)) >> @@ -467,8 +468,8 @@ (defun notmuch-refresh-all-buffers () >> (notmuch-refresh-this-buffer)))))) >> >> (defun notmuch-prettify-subject (subject) >> - ;; This function is used by `notmuch-search-process-filter' which >> - ;; requires that we not disrupt its' matching state. >> + ;; This function is used by `notmuch-search-process-filter', >> + ;; which requires that we not disrupt its matching state. >> (save-match-data >> (if (and subject >> (string-match "^[ \t]*$" subject)) >> @@ -525,13 +526,12 @@ (defun notmuch-common-do-stash (text) >> ;; >> >> (defun notmuch-plist-delete (plist property) >> - (let* ((xplist (cons nil plist)) >> - (pred xplist)) >> - (while (cdr pred) >> - (when (eq (cadr pred) property) >> - (setcdr pred (cdddr pred))) >> - (setq pred (cddr pred))) >> - (cdr xplist))) >> + (let (p) >> + (while plist >> + (unless (eq property (car plist)) >> + (setq p (plist-put p (car plist) (cadr plist)))) >> + (setq plist (cddr plist))) >> + p)) >> >> (defun notmuch-match-content-type (t1 t2) >> "Return t if t1 and t2 are matching content types, taking wildcards into account." >> @@ -540,8 +540,10 @@ (defun notmuch-match-content-type (t1 t2) >> (if (or (string= (cadr st1) "*") >> (string= (cadr st2) "*")) >> ;; Comparison of content types should be case insensitive. >> - (string= (downcase (car st1)) (downcase (car st2))) >> - (string= (downcase t1) (downcase t2))))) >> + (string= (downcase (car st1)) >> + (downcase (car st2))) >> + (string= (downcase t1) >> + (downcase t2))))) >> >> (defvar notmuch-multipart/alternative-discouraged >> '(;; Avoid HTML parts. >> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el >> index f9843546..8501e294 100644 >> --- a/emacs/notmuch-mua.el >> +++ b/emacs/notmuch-mua.el >> @@ -347,12 +347,10 @@ (defun notmuch-mua-pop-to-buffer (name switch-function) >> (select-window window)) >> (funcall switch-function buffer) >> (set-buffer buffer)) >> - (when (and (buffer-modified-p) >> - (not (prog1 >> - (y-or-n-p >> - "Message already being composed; erase? ") >> - (message nil)))) >> - (error "Message being composed"))) >> + (when (buffer-modified-p) >> + (if (y-or-n-p "Message already being composed; erase? ") >> + (message nil) >> + (error "Message being composed")))) >> (funcall switch-function name) >> (set-buffer name)) >> (erase-buffer) >> diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el >> index 925de78c..75e864a4 100644 >> --- a/emacs/notmuch-tag.el >> +++ b/emacs/notmuch-tag.el >> @@ -472,7 +472,7 @@ (defun notmuch-tag (query tag-changes) >> tag-changes) >> (unless query >> (error "Nothing to tag!")) >> - (unless (null tag-changes) >> + (when tag-changes >> (run-hooks 'notmuch-before-tag-hook) >> (if (<= (length query) notmuch-tag-argument-limit) >> (apply 'notmuch-call-notmuch-process "tag" >> diff --git a/emacs/notmuch.el b/emacs/notmuch.el >> index b221be05..8157bbf4 100644 >> --- a/emacs/notmuch.el >> +++ b/emacs/notmuch.el >> @@ -169,7 +169,7 @@ (defvar notmuch-search-mode-map >> (let ((map (make-sparse-keymap))) >> (set-keymap-parent map notmuch-common-keymap) >> (define-key map "x" 'notmuch-bury-or-kill-this-buffer) >> - (define-key map (kbd "<DEL>") 'notmuch-search-scroll-down) >> + (define-key map (kbd "DEL") 'notmuch-search-scroll-down) >> (define-key map "b" 'notmuch-search-scroll-down) >> (define-key map " " 'notmuch-search-scroll-up) >> (define-key map "<" 'notmuch-search-first-thread) >> @@ -923,40 +923,39 @@ (defun notmuch-read-query (prompt) >> "Read a notmuch-query from the minibuffer with completion. >> >> PROMPT is the string to prompt with." >> - (let* >> - ((all-tags >> - (mapcar (lambda (tag) (notmuch-escape-boolean-term tag)) >> - (process-lines notmuch-command "search" "--output=tags" "*"))) >> - (completions >> - (append (list "folder:" "path:" "thread:" "id:" "date:" "from:" "to:" >> - "subject:" "attachment:") >> - (mapcar (lambda (tag) (concat "tag:" tag)) all-tags) >> - (mapcar (lambda (tag) (concat "is:" tag)) all-tags) >> - (mapcar (lambda (mimetype) (concat "mimetype:" mimetype)) >> - (mailcap-mime-types))))) >> - (let ((keymap (copy-keymap minibuffer-local-map)) >> - (current-query (cl-case major-mode >> - (notmuch-search-mode (notmuch-search-get-query)) >> - (notmuch-show-mode (notmuch-show-get-query)) >> - (notmuch-tree-mode (notmuch-tree-get-query)))) >> - (minibuffer-completion-table >> - (completion-table-dynamic >> - (lambda (string) >> - ;; generate a list of possible completions for the current input >> - (cond >> - ;; this ugly regexp is used to get the last word of the input >> - ;; possibly preceded by a '(' >> - ((string-match "\\(^\\|.* (?\\)\\([^ ]*\\)$" string) >> - (mapcar (lambda (compl) >> - (concat (match-string-no-properties 1 string) compl)) >> - (all-completions (match-string-no-properties 2 string) >> - completions))) >> - (t (list string))))))) >> - ;; this was simpler than convincing completing-read to accept spaces: >> - (define-key keymap (kbd "TAB") 'minibuffer-complete) >> - (let ((history-delete-duplicates t)) >> - (read-from-minibuffer prompt nil keymap nil >> - 'notmuch-search-history current-query nil))))) >> + (let* ((all-tags >> + (mapcar (lambda (tag) (notmuch-escape-boolean-term tag)) >> + (process-lines notmuch-command "search" "--output=tags" "*"))) >> + (completions >> + (append (list "folder:" "path:" "thread:" "id:" "date:" "from:" "to:" >> + "subject:" "attachment:") >> + (mapcar (lambda (tag) (concat "tag:" tag)) all-tags) >> + (mapcar (lambda (tag) (concat "is:" tag)) all-tags) >> + (mapcar (lambda (mimetype) (concat "mimetype:" mimetype)) >> + (mailcap-mime-types)))) >> + (keymap (copy-keymap minibuffer-local-map)) >> + (current-query (cl-case major-mode >> + (notmuch-search-mode (notmuch-search-get-query)) >> + (notmuch-show-mode (notmuch-show-get-query)) >> + (notmuch-tree-mode (notmuch-tree-get-query)))) >> + (minibuffer-completion-table >> + (completion-table-dynamic >> + (lambda (string) >> + ;; generate a list of possible completions for the current input >> + (cond >> + ;; this ugly regexp is used to get the last word of the input >> + ;; possibly preceded by a '(' >> + ((string-match "\\(^\\|.* (?\\)\\([^ ]*\\)$" string) >> + (mapcar (lambda (compl) >> + (concat (match-string-no-properties 1 string) compl)) >> + (all-completions (match-string-no-properties 2 string) >> + completions))) >> + (t (list string))))))) >> + ;; This was simpler than convincing completing-read to accept spaces: >> + (define-key keymap (kbd "TAB") 'minibuffer-complete) >> + (let ((history-delete-duplicates t)) >> + (read-from-minibuffer prompt nil keymap nil >> + 'notmuch-search-history current-query nil)))) >> >> (defun notmuch-search-get-query () >> "Return the current query in this search buffer." >> @@ -1006,10 +1005,9 @@ (defun notmuch-search (&optional query oldest-first target-thread target-line no >> (setq notmuch-search-target-thread target-thread) >> (setq notmuch-search-target-line target-line) >> (notmuch-tag-clear-cache) >> - (let ((proc (get-buffer-process (current-buffer))) >> - (inhibit-read-only t)) >> - (when proc >> - (error "notmuch search process already running for query `%s'" query)) >> + (when (get-buffer-process buffer) >> + (error "notmuch search process already running for query `%s'" query)) >> + (let ((inhibit-read-only t)) >> (erase-buffer) >> (goto-char (point-min)) >> (save-excursion >> @@ -1019,12 +1017,12 @@ (defun notmuch-search (&optional query oldest-first target-thread target-line no >> (if oldest-first >> "--sort=oldest-first" >> "--sort=newest-first") >> - query)) >> - ;; Use a scratch buffer to accumulate partial output. >> - ;; This buffer will be killed by the sentinel, which >> - ;; should be called no matter how the process dies. >> - (parse-buf (generate-new-buffer " *notmuch search parse*"))) >> - (process-put proc 'parse-buf parse-buf) >> + query))) >> + ;; Use a scratch buffer to accumulate partial output. >> + ;; This buffer will be killed by the sentinel, which >> + ;; should be called no matter how the process dies. >> + (process-put proc 'parse-buf >> + (generate-new-buffer " *notmuch search parse*")) >> (set-process-filter proc 'notmuch-search-process-filter) >> (set-process-query-on-exit-flag proc nil)))) >> (run-hooks 'notmuch-search-hook))) >> -- >> 2.29.1 >> _______________________________________________ >> notmuch mailing list -- notmuch@notmuchmail.org >> To unsubscribe send an email to notmuch-leave@notmuchmail.org > > dme. > -- > I just bite it, it's for the look I don't light it.
David Edmondson <dme@dme.org> writes: > On Sunday, 2020-11-08 at 20:02:57 +01, Jonas Bernoulli wrote: > > With a suggested rewording below... > > Reviewed-by: David Edmondson <dme@dme.org> > >> --- >> emacs/notmuch-crypto.el | 3 +-- >> emacs/notmuch-hello.el | 3 +-- >> emacs/notmuch-mua.el | 11 ++++------- >> 3 files changed, 6 insertions(+), 11 deletions(-) >> >> diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el >> index 276c9859..4fab215a 100644 >> --- a/emacs/notmuch-crypto.el >> +++ b/emacs/notmuch-crypto.el >> @@ -103,8 +103,7 @@ (define-button-type 'notmuch-crypto-status-button-type >> :supertype 'notmuch-button-type) >> >> (defun notmuch-crypto-insert-sigstatus-button (sigstatus from) >> - "Insert a button describing the signature status SIGSTATUS sent >> -by user FROM." >> + "Insert a button describing the signature status SIGSTATUS sent by user FROM." >> (let* ((status (plist-get sigstatus :status)) >> (show-button t) >> (face 'notmuch-crypto-signature-unknown) >> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el >> index 003bec33..28784345 100644 >> --- a/emacs/notmuch-hello.el >> +++ b/emacs/notmuch-hello.el >> @@ -372,8 +372,7 @@ (defvar notmuch-hello-hidden-sections nil >> "List of sections titles whose contents are hidden.") >> >> (defvar notmuch-hello-first-run t >> - "True if `notmuch-hello' is run for the first time, set to nil >> -afterwards.") >> + "True if `notmuch-hello' is run for the first time, set to nil afterwards.") >> >> (defun notmuch-hello-nice-number (n) >> (let (result) >> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el >> index 9d08c2c9..62d615d1 100644 >> --- a/emacs/notmuch-mua.el >> +++ b/emacs/notmuch-mua.el >> @@ -73,8 +73,7 @@ (defcustom notmuch-mua-user-agent-function nil >> :group 'notmuch-send) >> >> (defcustom notmuch-mua-hidden-headers nil >> - "Headers that are added to the `message-mode' hidden headers >> -list." >> + "Headers that are added to the `message-mode' hidden headers list." >> :type '(repeat string) >> :group 'notmuch-send) >> >> @@ -167,8 +166,7 @@ (defun notmuch-mua-get-switch-function () >> (t (error "Invalid value for `notmuch-mua-compose-in'")))) >> >> (defun notmuch-mua-maybe-set-window-dedicated () >> - "Set the selected window as dedicated according to >> -`notmuch-mua-compose-in'." >> + "Set the selected window as dedicated according to `notmuch-mua-compose-in'." >> (when (or (eq notmuch-mua-compose-in 'new-frame) >> (eq notmuch-mua-compose-in 'new-window)) >> (set-window-dedicated-p (selected-window) t))) >> @@ -335,9 +333,8 @@ (define-derived-mode notmuch-message-mode message-mode "Message[Notmuch]" >> (put 'notmuch-message-mode 'flyspell-mode-predicate 'mail-mode-flyspell-verify) >> >> (defun notmuch-mua-pop-to-buffer (name switch-function) >> - "Pop to buffer NAME, and warn if it already exists and is >> -modified. This function is notmuch adaptation of >> -`message-pop-to-buffer'." >> + "Pop to buffer NAME, and warn if it already exists and is modified. >> +This function is notmuch adaptation of `message-pop-to-buffer'." > > "notmuch's adaptation" or "a notmuch adaptation", or just "an adaptation". > I switched it to Emacsspeak, which here is: Like `message-pop-to-buffer' but enable `notmuch-message-mode' instead of `message-mode' and SWITCH-FUNCTION is mandatory. >> (let ((buffer (get-buffer name))) >> (if (and buffer >> (buffer-name buffer)) >> -- >> 2.29.1 >> _______________________________________________ >> notmuch mailing list -- notmuch@notmuchmail.org >> To unsubscribe send an email to notmuch-leave@notmuchmail.org > > dme. > -- > You bring light in.
This remove the first four commits, which have already been applied to master. It also makes requested minor changes to the three marked commits. Jonas Bernoulli (23): emacs: remove redundant notmuch-hello-trim emacs: fix old bug in notmuch-mua-mail emacs: remove kludge for Emacs 23 from notmuch-mua-mail emacs: more cleanup since dropping support for Emacs 24 emacs: sanitize function that displays version emacs: define notmuch-hello-url as a constant emacs: shorten/replace first sentence of a few doc-strings emacs: place only first sentence on first doc-string line * emacs: place complete first sentence on first doc-string line emacs: always use elisp quoting style in doc-strings * emacs: misc doc-string improvements emacs: remove deprecated notmuch-folder command emacs: remove unnecessary notmuch-remove-if-not emacs: remove unused notmuch-address-locate-command emacs: remove unnecessary notmuch-tree-button-activate emacs: inline notmuch-documentation-first-line emacs: inline notmuch-split-content-type emacs: use defvar-local emacs: use setq-local emacs: use setq instead set emacs: do not quote self-quoting t emacs: avoid binding unnamed commands in keymaps * emacs: various cosmetic improvements emacs/coolj.el | 4 +- emacs/notmuch-address.el | 58 ++++-------- emacs/notmuch-company.el | 7 +- emacs/notmuch-compat.el | 9 +- emacs/notmuch-crypto.el | 7 +- emacs/notmuch-draft.el | 17 ++-- emacs/notmuch-hello.el | 123 +++++++++---------------- emacs/notmuch-jump.el | 5 -- emacs/notmuch-lib.el | 108 +++++++++------------- emacs/notmuch-maildir-fcc.el | 12 +-- emacs/notmuch-mua.el | 64 ++++++------- emacs/notmuch-parser.el | 5 +- emacs/notmuch-show.el | 56 ++++++------ emacs/notmuch-tag.el | 24 ++--- emacs/notmuch-tree.el | 170 ++++++++++++++++++----------------- emacs/notmuch.el | 108 +++++++++++----------- 16 files changed, 331 insertions(+), 446 deletions(-) -- 2.29.1
Use `string-trim', which exists since Emacs 24.4. --- emacs/notmuch-hello.el | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index bb60a890..b67a5e19 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -387,15 +387,9 @@ (defun notmuch-hello-nice-number (n) (format "%s%03d" notmuch-hello-thousands-separator elem)) (cdr result))))) -(defun notmuch-hello-trim (search) - "Trim whitespace." - (if (string-match "^[[:space:]]*\\(.*[^[:space:]]\\)[[:space:]]*$" search) - (match-string 1 search) - search)) - (defun notmuch-hello-search (&optional search) (unless (null search) - (setq search (notmuch-hello-trim search)) + (setq search (string-trim search)) (let ((history-delete-duplicates t)) (add-to-history 'notmuch-search-history search))) (notmuch-search search notmuch-search-oldest-first)) -- 2.29.1
This fixes a regression introduced in [1: 7e20d264]. If the argument RETURN-ACTION was non-nil then we should pass along the value of that argument. Instead we passed along the constant symbol `return-action'. 1: 7e20d26480553f57d53bd9ec28cae163c1ac91e3 emacs: Fix mail composition under Emacs 23 --- emacs/notmuch-mua.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 616b625c..1204fb6a 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -402,7 +402,7 @@ (defun notmuch-mua-mail (&optional to subject other-headers continue ;; argument. Pass it only if it is supplied by the caller. This ;; will never be the case when we're called by `compose-mail' in ;; Emacs 23. - (when return-action (nconc args '(return-action))) + (when return-action (nconc args (list return-action))) (apply 'message-setup-1 headers args)) (notmuch-fcc-header-setup) (message-sort-headers) -- 2.29.1
Notmuch requires at least Emacs version 25. The `return-action' argument was added prior to Emacs 24.1 in 25ca2e61403f97b5a023164f2924d5f8aca2492a. --- emacs/notmuch-mua.el | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 1204fb6a..869ec51a 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -394,16 +394,10 @@ (defun notmuch-mua-mail (&optional to subject other-headers continue (dolist (h other-headers other-headers) (when (stringp (car h)) (setcar h (intern (capitalize (car h)))))))) - (args (list yank-action send-actions)) ;; Cause `message-setup-1' to do things relevant for mail, ;; such as observe `message-default-mail-headers'. (message-this-is-mail t)) - ;; message-setup-1 in Emacs 23 does not accept return-action - ;; argument. Pass it only if it is supplied by the caller. This - ;; will never be the case when we're called by `compose-mail' in - ;; Emacs 23. - (when return-action (nconc args (list return-action))) - (apply 'message-setup-1 headers args)) + (message-setup-1 headers yank-action send-actions return-action)) (notmuch-fcc-header-setup) (message-sort-headers) (message-hide-headers) -- 2.29.1
Notmuch requires at least version 25 of Emacs now. Adjust comments that previously referenced version 24 specifically, even though they also apply to later releases. Remove documentation and code that no longer applies. - `mm-shr' no longer references `gnus-inhibit-images'. --- emacs/notmuch-compat.el | 9 +++++---- emacs/notmuch-hello.el | 16 +++++----------- emacs/notmuch-jump.el | 5 ----- emacs/notmuch-lib.el | 12 ------------ emacs/notmuch-mua.el | 17 ++++++----------- emacs/notmuch-show.el | 10 ++++------ emacs/notmuch-tree.el | 7 ++++--- 7 files changed, 24 insertions(+), 52 deletions(-) diff --git a/emacs/notmuch-compat.el b/emacs/notmuch-compat.el index 3ede6b36..2975f4c2 100644 --- a/emacs/notmuch-compat.el +++ b/emacs/notmuch-compat.el @@ -21,10 +21,11 @@ ;;; Code: -;; emacs master has a bugfix for folding long headers when sending -;; messages. Include the fix for earlier versions of emacs. To avoid -;; interfering with gnus we only run the hook when called from -;; notmuch-message-mode. +;; Before Emacs 26.1 lines that are longer than 998 octets were not. +;; folded. Commit 77bbca8c82f6e553c42abbfafca28f55fc995d00 fixed +;; that. Until we drop support for Emacs 25 we have to backport that +;; fix. To avoid interfering with Gnus we only run the hook when +;; called from notmuch-message-mode. (declare-function mail-header-fold-field "mail-parse" nil) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index b67a5e19..af170dd4 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -645,6 +645,7 @@ (defun notmuch-hello-window-configuration-change () ;; Refresh hello as soon as we get back to redisplay. On Emacs ;; 24, we can't do it right here because something in this ;; hook's call stack overrides hello's point placement. + ;; FIXME And on Emacs releases that we still support? (run-at-time nil nil #'notmuch-hello t)) (unless hello-buf ;; Clean up hook @@ -665,17 +666,10 @@ (defun notmuch-hello-versions () " (emacs mua version " notmuch-emacs-version ")"))))) (defvar notmuch-hello-mode-map - (let ((map (if (fboundp 'make-composed-keymap) - ;; Inherit both widget-keymap and - ;; notmuch-common-keymap. We have to use - ;; make-sparse-keymap to force this to be a new - ;; keymap (so that when we modify map it does not - ;; modify widget-keymap). - (make-composed-keymap (list (make-sparse-keymap) widget-keymap)) - ;; Before Emacs 24, keymaps didn't support multiple - ;; inheritance,, so just copy the widget keymap since - ;; it's unlikely to change. - (copy-keymap widget-keymap)))) + ;; Inherit both widget-keymap and notmuch-common-keymap. We have + ;; to use make-sparse-keymap to force this to be a new keymap (so + ;; that when we modify map it does not modify widget-keymap). + (let ((map (make-composed-keymap (list (make-sparse-keymap) widget-keymap)))) (set-keymap-parent map notmuch-common-keymap) (define-key map "v" 'notmuch-hello-versions) (define-key map (kbd "<C-tab>") 'widget-backward) diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el index 1e2d0497..ff622055 100644 --- a/emacs/notmuch-jump.el +++ b/emacs/notmuch-jump.el @@ -29,11 +29,6 @@ (eval-when-compile (require 'notmuch-lib) (require 'notmuch-hello) -(eval-and-compile - (unless (fboundp 'window-body-width) - ;; Compatibility for Emacs pre-24 - (defalias 'window-body-width 'window-width))) - ;;;###autoload (defun notmuch-jump-search () "Jump to a saved search by shortcut key. diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 118faf1e..edb40533 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -653,18 +653,6 @@ (defun notmuch-get-bodypart-text (msg part process-crypto &optional cache) MSG (if it isn't already)." (notmuch--get-bodypart-raw msg part process-crypto nil cache)) -;; Workaround: The call to `mm-display-part' below triggers a bug in -;; Emacs 24 if it attempts to use the shr renderer to display an HTML -;; part with images in it (demonstrated in 24.1 and 24.2 on Debian and -;; Fedora 17, though unreproducible in other configurations). -;; `mm-shr' references the variable `gnus-inhibit-images' without -;; first loading gnus-art, which defines it, resulting in a -;; void-variable error. Hence, we advise `mm-shr' to ensure gnus-art -;; is loaded. -(define-advice mm-shr (:before (_handle) notmuch--load-gnus-args) - "Require `gnus-art' since we use its variables." - (require 'gnus-art nil t)) - (defun notmuch-mm-display-part-inline (msg part content-type process-crypto) "Use the mm-decode/mm-view functions to display a part in the current buffer, if possible." diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 869ec51a..49bad00d 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -47,8 +47,7 @@ (defcustom notmuch-mua-send-hook nil :group 'notmuch-hooks) (defcustom notmuch-mua-compose-in 'current-window - (concat - "Where to create the mail buffer used to compose a new message. + "Where to create the mail buffer used to compose a new message. Possible values are `current-window' (default), `new-window' and `new-frame'. If set to `current-window', the mail buffer will be displayed in the current window, so the old buffer will be @@ -57,10 +56,6 @@ (defcustom notmuch-mua-compose-in 'current-window window/frame that will be destroyed when the buffer is killed. You may want to customize `message-kill-buffer-on-exit' accordingly." - (when (< emacs-major-version 24) - " Due to a known bug in Emacs 23, you should not set -this to `new-window' if `message-kill-buffer-on-exit' is -disabled: this would result in an incorrect behavior.")) :group 'notmuch-send :type '(choice (const :tag "Compose in the current window" current-window) (const :tag "Compose mail in a new window" new-window) @@ -212,7 +207,7 @@ (defun notmuch-mua-reply-crypto (parts) "multipart/*") do (notmuch-mua-reply-crypto (plist-get part :content)))) -;; There is a bug in emacs 23's message.el that results in a newline +;; There is a bug in Emacs' message.el that results in a newline ;; not being inserted after the References header, so the next header ;; is concatenated to the end of it. This function fixes the problem, ;; while guarding against the possibility that some current or future @@ -517,10 +512,10 @@ (defun notmuch-mua-new-reply (query-string &optional prompt-for-sender reply-all If PROMPT-FOR-SENDER is non-nil, the user will be prompted for the From: address first. If REPLY-ALL is non-nil, the message will be addressed to all recipients of the source message." - ;; In current emacs (24.3) select-active-regions is set to t by - ;; default. The reply insertion code sets the region to the quoted - ;; message to make it easy to delete (kill-region or C-w). These two - ;; things combine to put the quoted message in the primary selection. + ;; `select-active-regions' is t by default. The reply insertion code + ;; sets the region to the quoted message to make it easy to delete + ;; (kill-region or C-w). These two things combine to put the quoted + ;; message in the primary selection. ;; ;; This is not what the user wanted and is a privacy risk (accidental ;; pasting of the quoted message). We can avoid some of the problems diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index ec22fd94..6a757687 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -186,8 +186,7 @@ (defvar notmuch-show-attachment-debug nil When set to nil (the default) stdout and stderr from attachment handlers is discarded. When set to t the stdout and stderr from each attachment handler is logged in buffers with names beginning -\" *notmuch-part*\". This option requires emacs version at least -24.3 to work.") +\" *notmuch-part*\".") (defcustom notmuch-show-stash-mlarchive-link-alist '(("Gmane" . "https://mid.gmane.org/") @@ -2417,10 +2416,9 @@ (defun notmuch-show-apply-to-current-part-handle (fn &optional mime-type) is destroyed when FN returns. If MIME-TYPE is given then force part to be treated as if it had that mime-type." (let ((handle (notmuch-show-current-part-handle mime-type))) - ;; emacs 24.3+ puts stdout/stderr into the calling buffer so we - ;; call it from a temp-buffer, unless - ;; notmuch-show-attachment-debug is non-nil in which case we put - ;; it in " *notmuch-part*". + ;; Emacs puts stdout/stderr into the calling buffer so we call + ;; it from a temp-buffer, unless notmuch-show-attachment-debug + ;; is non-nil, in which case we put it in " *notmuch-part*". (unwind-protect (if notmuch-show-attachment-debug (with-current-buffer (generate-new-buffer " *notmuch-part*") diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index ad08f7c6..28c9372e 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -531,9 +531,10 @@ (defun notmuch-tree-message-window-kill-hook () (let ((buffer (current-buffer))) (when (and (window-live-p notmuch-tree-message-window) (eq (window-buffer notmuch-tree-message-window) buffer)) - ;; We do not want an error if this is the sole window in the - ;; frame and I do not know how to test for that in emacs pre - ;; 24. Hence we just ignore-errors. + ;; We could check whether this is the only window in its frame, + ;; but simply ignoring the error that is thrown otherwise is + ;; what we had to do for Emacs 24 and we stick to that because + ;; it is still the simplest approach. (ignore-errors (delete-window notmuch-tree-message-window))))) -- 2.29.1
Previously it was defined in "notmuch-hello.el" and its name contained "hello" solely because it replaced an anonymous function that was mistakenly only bound in `notmuch-hello-mode-map'. But it makes more sense to bind it in all notmuch modes and even if we did not change that aspect it still would make no sense to have "hello" in its name. --- emacs/notmuch-hello.el | 14 -------------- emacs/notmuch-lib.el | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index af170dd4..69d0ad64 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -652,26 +652,12 @@ (defun notmuch-hello-window-configuration-change () (remove-hook 'window-configuration-change-hook #'notmuch-hello-window-configuration-change)))) -;; the following variable is defined as being defconst in notmuch-version.el -(defvar notmuch-emacs-version) - -(defun notmuch-hello-versions () - "Display the notmuch version(s)." - (interactive) - (let ((notmuch-cli-version (notmuch-cli-version))) - (message "notmuch version %s" - (if (string= notmuch-emacs-version notmuch-cli-version) - notmuch-cli-version - (concat notmuch-cli-version - " (emacs mua version " notmuch-emacs-version ")"))))) - (defvar notmuch-hello-mode-map ;; Inherit both widget-keymap and notmuch-common-keymap. We have ;; to use make-sparse-keymap to force this to be a new keymap (so ;; that when we modify map it does not modify widget-keymap). (let ((map (make-composed-keymap (list (make-sparse-keymap) widget-keymap)))) (set-keymap-parent map notmuch-common-keymap) - (define-key map "v" 'notmuch-hello-versions) (define-key map (kbd "<C-tab>") 'widget-backward) map) "Keymap for \"notmuch hello\" buffers.") diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index edb40533..8ee3f17f 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -147,6 +147,7 @@ (defcustom notmuch-archive-tags '("-inbox") (defvar notmuch-common-keymap (let ((map (make-sparse-keymap))) (define-key map "?" 'notmuch-help) + (define-key map "v" 'notmuch-version) (define-key map "q" 'notmuch-bury-or-kill-this-buffer) (define-key map "s" 'notmuch-search) (define-key map "t" 'notmuch-search-by-tag) @@ -218,6 +219,21 @@ (defun notmuch-cli-version () (match-string 2 long-string) "unknown"))) +(defvar notmuch-emacs-version) + +(defun notmuch-version () + "Display the notmuch version. +The versions of the Emacs package and the `notmuch' executable +should match, but if and only if they don't, then this command +displays both values separately." + (interactive) + (let ((cli-version (notmuch-cli-version))) + (message "notmuch version %s" + (if (string= notmuch-emacs-version cli-version) + cli-version + (concat cli-version + " (emacs mua version " notmuch-emacs-version ")"))))) + (defun notmuch-config-get (item) "Return a value from the notmuch configuration." (let* ((val (notmuch-command-to-string "config" "get" item)) -- 2.29.1
--- emacs/notmuch-hello.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 69d0ad64..003bec33 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -282,7 +282,7 @@ (defcustom notmuch-hello-refresh-hook nil :group 'notmuch-hello :group 'notmuch-hooks) -(defvar notmuch-hello-url "https://notmuchmail.org" +(defconst notmuch-hello-url "https://notmuchmail.org" "The `notmuch' web site.") (defvar notmuch-hello-custom-section-options -- 2.29.1
The first sentence should fit on the first line. It is okay if the first sentence/line does not contain all the information that the rest of the doc-string covers. --- emacs/notmuch-show.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 6a757687..14250d34 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -2347,7 +2347,9 @@ (defun notmuch-show-stash-mlarchive-link-and-go (&optional mla) (browse-url (current-kill 0 t))) (defun notmuch-show-stash-git-helper (addresses prefix) - "Escape, trim, quote, and add PREFIX to each address in list of ADDRESSES, and return the result as a single string." + "Normalize all ADDRESSES while adding PREFIX. +Escape, trim, quote and add PREFIX to each address in list +of ADDRESSES, and return the result as a single string." (mapconcat (lambda (x) (concat prefix "\"" ;; escape double-quotes @@ -2360,10 +2362,12 @@ (defun notmuch-show-stash-git-helper (addresses prefix) addresses " ")) (put 'notmuch-show-stash-git-send-email 'notmuch-prefix-doc - "Copy From/To/Cc of current message to kill-ring in a form suitable for pasting to git send-email command line.") + "Copy From/To/Cc of current message to kill-ring. +Use a form suitable for pasting to git send-email command line.") (defun notmuch-show-stash-git-send-email (&optional no-in-reply-to) - "Copy From/To/Cc/Message-Id of current message to kill-ring in a form suitable for pasting to git send-email command line. + "Copy From/To/Cc/Message-Id of current message to kill-ring. +Use a form suitable for pasting to git send-email command line. If invoked with a prefix argument (or NO-IN-REPLY-TO is non-nil), omit --in-reply-to=<Message-Id>." -- 2.29.1
--- emacs/notmuch-mua.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 49bad00d..9d08c2c9 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -62,8 +62,8 @@ (defcustom notmuch-mua-compose-in 'current-window (const :tag "Compose mail in a new frame" new-frame))) (defcustom notmuch-mua-user-agent-function nil - "Function used to generate a `User-Agent:' string. If this is -`nil' then no `User-Agent:' will be generated." + "Function used to generate a `User-Agent:' string. +If this is `nil' then no `User-Agent:' will be generated." :type '(choice (const :tag "No user agent string" nil) (const :tag "Full" notmuch-mua-user-agent-full) (const :tag "Notmuch" notmuch-mua-user-agent-notmuch) -- 2.29.1
--- emacs/notmuch-crypto.el | 3 +-- emacs/notmuch-hello.el | 3 +-- emacs/notmuch-mua.el | 12 +++++------- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el index 276c9859..4fab215a 100644 --- a/emacs/notmuch-crypto.el +++ b/emacs/notmuch-crypto.el @@ -103,8 +103,7 @@ (define-button-type 'notmuch-crypto-status-button-type :supertype 'notmuch-button-type) (defun notmuch-crypto-insert-sigstatus-button (sigstatus from) - "Insert a button describing the signature status SIGSTATUS sent -by user FROM." + "Insert a button describing the signature status SIGSTATUS sent by user FROM." (let* ((status (plist-get sigstatus :status)) (show-button t) (face 'notmuch-crypto-signature-unknown) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 003bec33..28784345 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -372,8 +372,7 @@ (defvar notmuch-hello-hidden-sections nil "List of sections titles whose contents are hidden.") (defvar notmuch-hello-first-run t - "True if `notmuch-hello' is run for the first time, set to nil -afterwards.") + "True if `notmuch-hello' is run for the first time, set to nil afterwards.") (defun notmuch-hello-nice-number (n) (let (result) diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 9d08c2c9..05763928 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -73,8 +73,7 @@ (defcustom notmuch-mua-user-agent-function nil :group 'notmuch-send) (defcustom notmuch-mua-hidden-headers nil - "Headers that are added to the `message-mode' hidden headers -list." + "Headers that are added to the `message-mode' hidden headers list." :type '(repeat string) :group 'notmuch-send) @@ -167,8 +166,7 @@ (defun notmuch-mua-get-switch-function () (t (error "Invalid value for `notmuch-mua-compose-in'")))) (defun notmuch-mua-maybe-set-window-dedicated () - "Set the selected window as dedicated according to -`notmuch-mua-compose-in'." + "Set the selected window as dedicated according to `notmuch-mua-compose-in'." (when (or (eq notmuch-mua-compose-in 'new-frame) (eq notmuch-mua-compose-in 'new-window)) (set-window-dedicated-p (selected-window) t))) @@ -335,9 +333,9 @@ (define-derived-mode notmuch-message-mode message-mode "Message[Notmuch]" (put 'notmuch-message-mode 'flyspell-mode-predicate 'mail-mode-flyspell-verify) (defun notmuch-mua-pop-to-buffer (name switch-function) - "Pop to buffer NAME, and warn if it already exists and is -modified. This function is notmuch adaptation of -`message-pop-to-buffer'." + "Pop to buffer NAME, and warn if it already exists and is modified. +Like `message-pop-to-buffer' but enable `notmuch-message-mode' +instead of `message-mode' and SWITCH-FUNCTION is mandatory." (let ((buffer (get-buffer name))) (if (and buffer (buffer-name buffer)) -- 2.29.1
Emacs doc-strings use neither markdown nor lisp symbol quoting. --- emacs/notmuch-address.el | 2 +- emacs/notmuch-draft.el | 8 ++++---- emacs/notmuch-hello.el | 4 ++-- emacs/notmuch-maildir-fcc.el | 2 +- emacs/notmuch-tag.el | 20 ++++++++++---------- emacs/notmuch.el | 4 ++-- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el index 8a6d299c..561cc140 100644 --- a/emacs/notmuch-address.el +++ b/emacs/notmuch-address.el @@ -294,7 +294,7 @@ (defun notmuch-address-harvest (&optional addr-prefix synchronous callback) "Collect addresses completion candidates. It queries the notmuch database for messages sent/received (as -configured with `notmuch-address-command`) by the user, collects +configured with `notmuch-address-command') by the user, collects destination/source addresses from those messages and stores them in `notmuch-address-completions'. diff --git a/emacs/notmuch-draft.el b/emacs/notmuch-draft.el index 283830ad..b13eb51c 100644 --- a/emacs/notmuch-draft.el +++ b/emacs/notmuch-draft.el @@ -101,7 +101,7 @@ (defun notmuch-draft--mark-deleted () (notmuch-tag notmuch-draft-id '("+deleted")))) (defun notmuch-draft-quote-some-mml () - "Quote the mml tags in `notmuch-draft-quoted-tags`." + "Quote the mml tags in `notmuch-draft-quoted-tags'." (save-excursion ;; First we deal with any secure tag separately. (message-goto-body) @@ -122,7 +122,7 @@ (defun notmuch-draft-quote-some-mml () (insert "!")))))) (defun notmuch-draft-unquote-some-mml () - "Unquote the mml tags in `notmuch-draft-quoted-tags`." + "Unquote the mml tags in `notmuch-draft-quoted-tags'." (save-excursion (when notmuch-draft-quoted-tags (let ((re (concat "<#!+/?\\(" @@ -174,7 +174,7 @@ (defun notmuch-draft-save () "Save the current draft message in the notmuch database. This saves the current message in the database with tags -`notmuch-draft-tags` (in addition to any default tags +`notmuch-draft-tags' (in addition to any default tags applied to newly inserted messages)." (interactive) (when (notmuch-draft--has-encryption-tag) @@ -185,7 +185,7 @@ (defun notmuch-draft-save () ;; so that it is easier to search for the message, and the ;; latter so we have a way of accessing the saved message (for ;; example to delete it at a later time). We check that the - ;; user has these in `message-deletable-headers` (the default) + ;; user has these in `message-deletable-headers' (the default) ;; as otherwise they are doing something strange and we ;; shouldn't interfere. Note, since we are doing this in a new ;; buffer we don't change the version in the compose buffer. diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 28784345..bc07c29c 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -138,8 +138,8 @@ (defcustom notmuch-saved-searches shown. If not present then the :query property is used. :sort-order Specify the sort order to be used for the search. - Possible values are 'oldest-first 'newest-first or - nil. Nil means use the default sort order. + Possible values are `oldest-first', `newest-first' + or nil. Nil means use the default sort order. :search-type Specify whether to run the search in search-mode, tree mode or unthreaded mode. Set to 'tree to specify tree mode, 'unthreaded to specify unthreaded mode, and set to nil diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el index a9103a20..b1da93e6 100644 --- a/emacs/notmuch-maildir-fcc.el +++ b/emacs/notmuch-maildir-fcc.el @@ -196,7 +196,7 @@ (defun notmuch-maildir-message-do-fcc () (defun notmuch-fcc-handler (fcc-header) "Store message with notmuch insert or normal (file) fcc. -If `notmuch-maildir-use-notmuch-insert` is set then store the +If `notmuch-maildir-use-notmuch-insert' is set then store the message using notmuch insert. Otherwise store the message using normal fcc." (message "Doing Fcc...") diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el index 5d4a6865..dc9a2186 100644 --- a/emacs/notmuch-tag.el +++ b/emacs/notmuch-tag.el @@ -68,15 +68,15 @@ (defcustom notmuch-tagging-keys be used (either as a key, or as the start of a key sequence) as it is already bound: it switches the menu to a menu of the reverse tagging operations. The reverse of a tagging operation is -the same list of individual tag-ops but with `+tag` replaced by -`-tag` and vice versa. +the same list of individual tag-ops but with `+tag' replaced by +`-tag' and vice versa. If setting this variable outside of customize then it should be a list of triples (lists of three elements). Each triple should be of the form (key-binding tagging-operations name). KEY-BINDING can be a single character or a key sequence; TAGGING-OPERATIONS should either be a list of individual tag operations each of the -form `+tag` or `-tag`, or the variable name of a variable that is +form `+tag' or `-tag', or the variable name of a variable that is a list of tagging operations; NAME should be a name for the tagging operation, if omitted or empty than then name is taken from TAGGING-OPERATIONS." @@ -116,7 +116,7 @@ (defface notmuch-tag-unread '((t :foreground "red")) "Default face used for the unread tag. -Used in the default value of `notmuch-tag-formats`." +Used in the default value of `notmuch-tag-formats'." :group 'notmuch-faces) (defface notmuch-tag-flagged @@ -128,7 +128,7 @@ (defface notmuch-tag-flagged (:foreground "blue"))) "Face used for the flagged tag. -Used in the default value of `notmuch-tag-formats`." +Used in the default value of `notmuch-tag-formats'." :group 'notmuch-faces) (defcustom notmuch-tag-formats @@ -170,7 +170,7 @@ (defface notmuch-tag-deleted (t :inverse-video t)) "Face used to display deleted tags. -Used in the default value of `notmuch-tag-deleted-formats`." +Used in the default value of `notmuch-tag-deleted-formats'." :group 'notmuch-faces) (defcustom notmuch-tag-deleted-formats @@ -178,7 +178,7 @@ (defcustom notmuch-tag-deleted-formats (".*" (notmuch-apply-face tag `notmuch-tag-deleted))) "Custom formats for tags when deleted. -For deleted tags the formats in `notmuch-tag-formats` are applied +For deleted tags the formats in `notmuch-tag-formats' are applied first and then these formats are applied on top; that is `tag' passed to the function is the tag with all these previous formattings applied. The formatted can access the original @@ -199,14 +199,14 @@ (defface notmuch-tag-added '((t :underline "green")) "Default face used for added tags. -Used in the default value for `notmuch-tag-added-formats`." +Used in the default value for `notmuch-tag-added-formats'." :group 'notmuch-faces) (defcustom notmuch-tag-added-formats '((".*" (notmuch-apply-face tag 'notmuch-tag-added))) "Custom formats for tags when added. -For added tags the formats in `notmuch-tag-formats` are applied +For added tags the formats in `notmuch-tag-formats' are applied first and then these formats are applied on top. To disable special formatting of added tags, set this variable to @@ -506,7 +506,7 @@ (defun notmuch-tag-jump (reverse) Creates and displays a jump menu for the tagging operations specified in `notmuch-tagging-keys'. If REVERSE is set then it offers a menu of the reverses of the operations specified in -`notmuch-tagging-keys'; i.e. each `+tag` is replaced by `-tag` +`notmuch-tagging-keys'; i.e. each `+tag' is replaced by `-tag' and vice versa." ;; In principle this function is simple, but it has to deal with ;; lots of cases: different modes (search/show/tree), whether a name diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 165aaa43..3ca27b26 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -342,7 +342,7 @@ (defface notmuch-search-flagged-face "Face used in search mode face for flagged threads. This face is the default value for the \"flagged\" tag in -`notmuch-search-line-faces`." +`notmuch-search-line-faces'." :group 'notmuch-search :group 'notmuch-faces) @@ -352,7 +352,7 @@ (defface notmuch-search-unread-face "Face used in search mode for unread threads. This face is the default value for the \"unread\" tag in -`notmuch-search-line-faces`." +`notmuch-search-line-faces'." :group 'notmuch-search :group 'notmuch-faces) -- 2.29.1
--- emacs/notmuch-address.el | 6 +++--- emacs/notmuch-crypto.el | 4 ++-- emacs/notmuch-mua.el | 7 ++++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el index 561cc140..2c51e89b 100644 --- a/emacs/notmuch-address.el +++ b/emacs/notmuch-address.el @@ -36,9 +36,9 @@ (defvar notmuch-address-completions (make-hash-table :test 'equal) This variable is set by calling `notmuch-address-harvest'.") (defvar notmuch-address-full-harvest-finished nil - "t indicates that full completion address harvesting has been finished. -Use notmuch-address--harvest-ready to access as that will load a -saved hash if necessary (and available).") + "Whether full completion address harvesting has finished. +Use `notmuch-address--harvest-ready' to access as that will load +a saved hash if necessary (and available).") (defun notmuch-address--harvest-ready () "Return t if there is a full address hash available. diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el index 4fab215a..9e6f3a9d 100644 --- a/emacs/notmuch-crypto.el +++ b/emacs/notmuch-crypto.el @@ -27,7 +27,7 @@ (require 'notmuch-lib) (declare-function notmuch-show-get-message-id "notmuch-show" (&optional bare)) (defcustom notmuch-crypto-process-mime t - "Should cryptographic MIME parts be processed? + "Whether to process cryptographic MIME parts. If this variable is non-nil signatures in multipart/signed messages will be verified and multipart/encrypted parts will be @@ -46,7 +46,7 @@ (defcustom notmuch-crypto-process-mime t :group 'notmuch-crypto) (defcustom notmuch-crypto-get-keys-asynchronously t - "Retrieve gpg keys asynchronously." + "Whether to retrieve openpgp keys asynchronously." :type 'boolean :group 'notmuch-crypto) diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 05763928..29a2538b 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -82,10 +82,11 @@ (defgroup notmuch-reply nil :group 'notmuch) (defcustom notmuch-mua-cite-function 'message-cite-original - "*Function for citing an original message. + "Function for citing an original message. + Predefined functions include `message-cite-original' and -`message-cite-original-without-signature'. -Note that these functions use `mail-citation-hook' if that is non-nil." +`message-cite-original-without-signature'. Note that these +functions use `mail-citation-hook' if that is non-nil." :type '(radio (function-item message-cite-original) (function-item message-cite-original-without-signature) (function-item sc-cite-original) -- 2.29.1
It has been deprecated for a decade and it's time to let go. --- emacs/notmuch-hello.el | 5 ----- 1 file changed, 5 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index bc07c29c..f5d9e0ec 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -987,11 +987,6 @@ (defun notmuch-hello (&optional no-display) (run-hooks 'notmuch-hello-refresh-hook) (setq notmuch-hello-first-run nil)) -(defun notmuch-folder () - "Deprecated function for invoking notmuch---calling `notmuch' is preferred now." - (interactive) - (notmuch-hello)) - ;; (provide 'notmuch-hello) -- 2.29.1
We could just have switched to using `cl-remove-if-not' instead, but the two uses of the *remove-if-not function are pretty strange to begin with so we refactor to not use any such function at all. --- emacs/notmuch-hello.el | 43 ++++++++++++++++++++---------------------- emacs/notmuch-lib.el | 9 --------- 2 files changed, 20 insertions(+), 32 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index f5d9e0ec..fa31694f 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -21,8 +21,7 @@ ;;; Code: -(eval-when-compile (require 'cl-lib)) - +(require 'cl-lib) (require 'widget) (require 'wid-edit) ; For `widget-forward'. @@ -542,21 +541,19 @@ (defun notmuch-hello-query-counts (query-list &rest options) --batch'. In general we recommend running matching versions of the CLI and emacs interface.")) (goto-char (point-min)) - (notmuch-remove-if-not - #'identity - (mapcar - (lambda (elem) - (let* ((elem-plist (notmuch-hello-saved-search-to-plist elem)) - (search-query (plist-get elem-plist :query)) - (filtered-query (notmuch-hello-filtered-query - search-query (plist-get options :filter))) - (message-count (prog1 (read (current-buffer)) - (forward-line 1)))) - (when (and filtered-query (or (plist-get options :show-empty-searches) - (> message-count 0))) - (setq elem-plist (plist-put elem-plist :query filtered-query)) - (plist-put elem-plist :count message-count)))) - query-list)))) + (cl-mapcan + (lambda (elem) + (let* ((elem-plist (notmuch-hello-saved-search-to-plist elem)) + (search-query (plist-get elem-plist :query)) + (filtered-query (notmuch-hello-filtered-query + search-query (plist-get options :filter))) + (message-count (prog1 (read (current-buffer)) + (forward-line 1)))) + (when (and filtered-query (or (plist-get options :show-empty-searches) + (> message-count 0))) + (setq elem-plist (plist-put elem-plist :query filtered-query)) + (list (plist-put elem-plist :count message-count))))) + query-list))) (defun notmuch-hello-insert-buttons (searches) "Insert buttons for SEARCHES. @@ -698,12 +695,12 @@ (define-derived-mode notmuch-hello-mode fundamental-mode "notmuch-hello" (defun notmuch-hello-generate-tag-alist (&optional hide-tags) "Return an alist from tags to queries to display in the all-tags section." - (mapcar (lambda (tag) - (cons tag (concat "tag:" (notmuch-escape-boolean-term tag)))) - (notmuch-remove-if-not - (lambda (tag) - (not (member tag hide-tags))) - (process-lines notmuch-command "search" "--output=tags" "*")))) + (cl-mapcan (lambda (tag) + (and (not (member tag hide-tags)) + (list (cons tag + (concat "tag:" + (notmuch-escape-boolean-term tag)))))) + (process-lines notmuch-command "search" "--output=tags" "*"))) (defun notmuch-hello-insert-header () "Insert the default notmuch-hello header." diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 8ee3f17f..d7c6b737 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -534,15 +534,6 @@ (defun notmuch-common-do-stash (text) ;; -(defun notmuch-remove-if-not (predicate list) - "Return a copy of LIST with all items not satisfying PREDICATE removed." - (let (out) - (while list - (when (funcall predicate (car list)) - (push (car list) out)) - (setq list (cdr list))) - (nreverse out))) - (defun notmuch-plist-delete (plist property) (let* ((xplist (cons nil plist)) (pred xplist)) -- 2.29.1
We stopped using it in [1: 0e671478]. 1: 0e671478c6f37018973392f049979da5e1a8ff99 emacs: replace use of notmuch-address-message-insinuate --- emacs/notmuch-address.el | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el index 2c51e89b..71985ed7 100644 --- a/emacs/notmuch-address.el +++ b/emacs/notmuch-address.el @@ -250,25 +250,6 @@ (defun notmuch-address-expand-name () (ding)))) (t nil))) -;; Copied from `w3m-which-command'. -(defun notmuch-address-locate-command (command) - "Return non-nil if `command' is an executable either on -`exec-path' or an absolute pathname." - (and (stringp command) - (if (and (file-name-absolute-p command) - (file-executable-p command)) - command - (setq command (file-name-nondirectory command)) - (catch 'found-command - (let (bin) - (dolist (dir exec-path) - (setq bin (expand-file-name command dir)) - (when (or (and (file-executable-p bin) - (not (file-directory-p bin))) - (and (file-executable-p (setq bin (concat bin ".exe"))) - (not (file-directory-p bin)))) - (throw 'found-command bin)))))))) - (defun notmuch-address-harvest-addr (result) (let ((name-addr (plist-get result :name-addr))) (puthash name-addr t notmuch-address-completions))) -- 2.29.1
Since [1: f8bdba37] no key is bound to this command and it is redundant because the behavior of `push-command' is identical when called as a command. 1: f8bdba37d3f4c877e05e17b5b1c7d2d512106538 emacs: tree: remove binding for pressing button in message pane --- emacs/notmuch-tree.el | 8 -------- 1 file changed, 8 deletions(-) diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index 28c9372e..71b6387a 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -267,14 +267,6 @@ (defun notmuch-tree-inherit-from-message-pane (sym) (symbol-value sym)) (symbol-value sym))) -(defun notmuch-tree-button-activate (&optional button) - "Activate BUTTON or button at point. - -This function does not give an error if there is no button." - (interactive) - (let ((button (or button (button-at (point))))) - (when button (button-activate button)))) - (defun notmuch-tree-close-message-pane-and (func) "Close message pane and execute FUNC. -- 2.29.1
Inline a simplified version of `notmuch-documentation-first-line' into its only caller. The new code snippet differs from the removed function in that it returns nil instead of the empty string for symbols that have no function documentation. That value is ultimately used as an argument to `concat', which treats nil like the empty string. So we can do the logical thing without changing the behavior. --- emacs/notmuch-lib.el | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index d7c6b737..61107e38 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -287,18 +287,6 @@ (defun notmuch-bury-or-kill-this-buffer () (bury-buffer) (kill-buffer))) -(defun notmuch-documentation-first-line (symbol) - "Return the first line of the documentation string for SYMBOL." - (let ((doc (documentation symbol))) - (if doc - (with-temp-buffer - (insert (documentation symbol t)) - (goto-char (point-min)) - (let ((beg (point))) - (end-of-line) - (buffer-substring beg (point)))) - ""))) - (defun notmuch-prefix-key-description (key) "Given a prefix key code, return a human-readable string representation. @@ -331,7 +319,10 @@ (defun notmuch-describe-key (actual-key binding prefix ua-keys tail) (or (and (symbolp binding) (get binding 'notmuch-doc)) (and (functionp binding) - (notmuch-documentation-first-line binding)))) + (let ((doc (documentation binding))) + (and doc + (string-match "\\`.+" doc) + (match-string 0 doc)))))) tail))) tail) -- 2.29.1
This trivial helper function actually made things slightly *less* readable by adding an unnecessary indirection. --- emacs/notmuch-lib.el | 8 ++------ emacs/notmuch-show.el | 16 ++++++++-------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 61107e38..2c8de328 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -534,14 +534,10 @@ (defun notmuch-plist-delete (plist property) (setq pred (cddr pred))) (cdr xplist))) -(defun notmuch-split-content-type (content-type) - "Split content/type into 'content' and 'type'." - (split-string content-type "/")) - (defun notmuch-match-content-type (t1 t2) "Return t if t1 and t2 are matching content types, taking wildcards into account." - (let ((st1 (notmuch-split-content-type t1)) - (st2 (notmuch-split-content-type t2))) + (let ((st1 (split-string t1 "/")) + (st2 (split-string t2 "/"))) (if (or (string= (cadr st1) "*") (string= (cadr st2) "*")) ;; Comparison of content types should be case insensitive. diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 14250d34..09cdeaaa 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -573,12 +573,13 @@ (defun notmuch-show--register-cids (msg part) ;; alternative (even if we can't render it). (push (list content-id msg part) notmuch-show--cids))) ;; Recurse on sub-parts - (let ((ctype (notmuch-split-content-type - (downcase (plist-get part :content-type))))) - (cond ((equal (car ctype) "multipart") + (pcase-let ((`(,content ,type) + (split-string (downcase (plist-get part :content-type)) "/"))) + (cond ((equal content "multipart") (mapc (apply-partially #'notmuch-show--register-cids msg) (plist-get part :content))) - ((equal ctype '("message" "rfc822")) + ((and (equal content "message") + (equal type "rfc822")) (notmuch-show--register-cids msg (car (plist-get (car (plist-get part :content)) :body))))))) @@ -851,10 +852,9 @@ (defun notmuch-show-handlers-for (content-type) (push func result))) ;; Reverse order of prefrence. (list (intern (concat "notmuch-show-insert-part-*/*")) - (intern (concat - "notmuch-show-insert-part-" - (car (notmuch-split-content-type content-type)) - "/*")) + (intern (concat "notmuch-show-insert-part-" + (car (split-string content-type "/")) + "/*")) (intern (concat "notmuch-show-insert-part-" content-type)))) result)) -- 2.29.1
It is available since Emacs 24.3 and we require at least Emacs 25. --- emacs/coolj.el | 4 +--- emacs/notmuch-company.el | 4 ++-- emacs/notmuch-draft.el | 3 +-- emacs/notmuch-lib.el | 8 ++------ emacs/notmuch-show.el | 18 ++++++------------ emacs/notmuch-tree.el | 27 +++++++++------------------ 6 files changed, 21 insertions(+), 43 deletions(-) diff --git a/emacs/coolj.el b/emacs/coolj.el index 39a8de2b..0385872f 100644 --- a/emacs/coolj.el +++ b/emacs/coolj.el @@ -50,9 +50,7 @@ (defcustom coolj-line-prefix-regexp "^\\(>+ \\)*" :group 'coolj :type 'regexp) -(defvar coolj-wrap-point nil) - -(make-variable-buffer-local 'coolj-wrap-point) +(defvar-local coolj-wrap-point nil) (defun coolj-determine-prefix () "Determine the prefix for the current line." diff --git a/emacs/notmuch-company.el b/emacs/notmuch-company.el index 9ee8ceca..9e743029 100644 --- a/emacs/notmuch-company.el +++ b/emacs/notmuch-company.el @@ -36,8 +36,8 @@ (eval-when-compile (require 'cl-lib)) (require 'notmuch-lib) -(defvar notmuch-company-last-prefix nil) -(make-variable-buffer-local 'notmuch-company-last-prefix) +(defvar-local notmuch-company-last-prefix nil) + (declare-function company-begin-backend "company") (declare-function company-grab "company") (declare-function company-mode "company") diff --git a/emacs/notmuch-draft.el b/emacs/notmuch-draft.el index b13eb51c..ca720384 100644 --- a/emacs/notmuch-draft.el +++ b/emacs/notmuch-draft.el @@ -89,9 +89,8 @@ (defvar notmuch-draft-encryption-tag-regex "<#\\(part encrypt\\|secure.*mode=.*encrypt>\\)" "Regular expression matching mml tags indicating encryption of part or message.") -(defvar notmuch-draft-id nil +(defvar-local notmuch-draft-id nil "Message-id of the most recent saved draft of this message.") -(make-variable-buffer-local 'notmuch-draft-id) (defun notmuch-draft--mark-deleted () "Tag the last saved draft deleted. diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 2c8de328..e23999ad 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -435,9 +435,8 @@ (defun notmuch-subkeymap-help () (insert desc))) (pop-to-buffer (help-buffer))))) -(defvar notmuch-buffer-refresh-function nil +(defvar-local notmuch-buffer-refresh-function nil "Function to call to refresh the current buffer.") -(make-variable-buffer-local 'notmuch-buffer-refresh-function) (defun notmuch-refresh-this-buffer () "Refresh the current buffer." @@ -989,10 +988,7 @@ (defun notmuch-start-notmuch-error-sentinel (proc event) (find-file-noselect err-file)))) (when err-buffer (kill-buffer err-buffer)))) -;; This variable is used only buffer local, but it needs to be -;; declared globally first to avoid compiler warnings. -(defvar notmuch-show-process-crypto nil) -(make-variable-buffer-local 'notmuch-show-process-crypto) +(defvar-local notmuch-show-process-crypto nil) (defun notmuch-interactive-region () "Return the bounds of the current interactive region. diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 09cdeaaa..c9b1e966 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -162,23 +162,17 @@ (defcustom notmuch-show-text/html-blocked-images "." :type '(choice (const nil) regexp) :group 'notmuch-show) -(defvar notmuch-show-thread-id nil) -(make-variable-buffer-local 'notmuch-show-thread-id) +(defvar-local notmuch-show-thread-id nil) -(defvar notmuch-show-parent-buffer nil) -(make-variable-buffer-local 'notmuch-show-parent-buffer) +(defvar-local notmuch-show-parent-buffer nil) -(defvar notmuch-show-query-context nil) -(make-variable-buffer-local 'notmuch-show-query-context) +(defvar-local notmuch-show-query-context nil) -(defvar notmuch-show-process-crypto nil) -(make-variable-buffer-local 'notmuch-show-process-crypto) +(defvar-local notmuch-show-process-crypto nil) -(defvar notmuch-show-elide-non-matching-messages nil) -(make-variable-buffer-local 'notmuch-show-elide-non-matching-messages) +(defvar-local notmuch-show-elide-non-matching-messages nil) -(defvar notmuch-show-indent-content t) -(make-variable-buffer-local 'notmuch-show-indent-content) +(defvar-local notmuch-show-indent-content t) (defvar notmuch-show-attachment-debug nil "If t log stdout and stderr from attachment handlers. diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index 71b6387a..3b5dab3e 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -51,9 +51,8 @@ (declare-function notmuch-tree-from-search-thread "notmuch" ()) (defvar notmuch-search-query-string) ;; this variable distinguishes the unthreaded display from the normal tree display -(defvar notmuch-tree-unthreaded nil +(defvar-local notmuch-tree-unthreaded nil "A buffer local copy of argument unthreaded to the function notmuch-tree.") -(make-variable-buffer-local 'notmuch-tree-unthreaded) (defgroup notmuch-tree nil "Showing message and thread structure." @@ -207,44 +206,36 @@ (defface notmuch-tree-no-match-tag-face :group 'notmuch-tree :group 'notmuch-faces) -(defvar notmuch-tree-previous-subject +(defvar-local notmuch-tree-previous-subject "The subject of the most recent result shown during the async display.") -(make-variable-buffer-local 'notmuch-tree-previous-subject) -(defvar notmuch-tree-basic-query nil +(defvar-local notmuch-tree-basic-query nil "A buffer local copy of argument query to the function notmuch-tree.") -(make-variable-buffer-local 'notmuch-tree-basic-query) -(defvar notmuch-tree-query-context nil +(defvar-local notmuch-tree-query-context nil "A buffer local copy of argument query-context to the function notmuch-tree.") -(make-variable-buffer-local 'notmuch-tree-query-context) -(defvar notmuch-tree-target-msg nil +(defvar-local notmuch-tree-target-msg nil "A buffer local copy of argument target to the function notmuch-tree.") -(make-variable-buffer-local 'notmuch-tree-target-msg) -(defvar notmuch-tree-open-target nil +(defvar-local notmuch-tree-open-target nil "A buffer local copy of argument open-target to the function notmuch-tree.") -(make-variable-buffer-local 'notmuch-tree-open-target) -(defvar notmuch-tree-parent-buffer nil) -(make-variable-buffer-local 'notmuch-tree-parent-buffer) +(defvar-local notmuch-tree-parent-buffer nil) -(defvar notmuch-tree-message-window nil +(defvar-local notmuch-tree-message-window nil "The window of the message pane. It is set in both the tree buffer and the child show buffer. It is used to try and close the message pane when quitting tree view or the child show buffer.") -(make-variable-buffer-local 'notmuch-tree-message-window) (put 'notmuch-tree-message-window 'permanent-local t) -(defvar notmuch-tree-message-buffer nil +(defvar-local notmuch-tree-message-buffer nil "The buffer name of the show buffer in the message pane. This is used to try and make sure we don't close the message pane if the user has loaded a different buffer in that window.") -(make-variable-buffer-local 'notmuch-tree-message-buffer) (put 'notmuch-tree-message-buffer 'permanent-local t) (defun notmuch-tree-to-message-pane (func) -- 2.29.1
It is available since Emacs 24.3 and we require at least Emacs 25. It makes the variable buffer-local if it isn't always buffer-local anyway. --- emacs/notmuch-company.el | 3 +-- emacs/notmuch-parser.el | 5 ++--- emacs/notmuch.el | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/emacs/notmuch-company.el b/emacs/notmuch-company.el index 9e743029..b50e73c8 100644 --- a/emacs/notmuch-company.el +++ b/emacs/notmuch-company.el @@ -55,8 +55,7 @@ (defvar notmuch-address-command) ;;;###autoload (defun notmuch-company-setup () (company-mode) - (make-local-variable 'company-backends) - (setq company-backends '(notmuch-company)) + (setq-local company-backends '(notmuch-company)) ;; Disable automatic company completion unless an internal ;; completion method is configured. Company completion (using ;; internal completion) can still be accessed via standard company diff --git a/emacs/notmuch-parser.el b/emacs/notmuch-parser.el index 3aa5bd8f..4a437016 100644 --- a/emacs/notmuch-parser.el +++ b/emacs/notmuch-parser.el @@ -168,9 +168,8 @@ (defun notmuch-sexp-parse-partial-list (result-function result-buffer) move point in the input buffer." ;; Set up the initial state (unless (local-variable-p 'notmuch-sexp--parser) - (set (make-local-variable 'notmuch-sexp--parser) - (notmuch-sexp-create-parser)) - (set (make-local-variable 'notmuch-sexp--state) 'begin)) + (setq-local notmuch-sexp--parser (notmuch-sexp-create-parser)) + (setq-local notmuch-sexp--state 'begin)) (let (done) (while (not done) (cl-case notmuch-sexp--state diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 3ca27b26..95770fc3 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -391,7 +391,7 @@ (define-derived-mode notmuch-search-mode fundamental-mode "notmuch-search" (make-local-variable 'notmuch-search-target-thread) (make-local-variable 'notmuch-search-target-line) (setq notmuch-buffer-refresh-function #'notmuch-search-refresh-view) - (set (make-local-variable 'scroll-preserve-screen-position) t) + (setq-local scroll-preserve-screen-position t) (add-to-invisibility-spec (cons 'ellipsis t)) (setq truncate-lines t) (setq buffer-read-only t) -- 2.29.1
Commonly `set' is only used if there is no way around it; i.e. when the variable cannot be known until runtime. --- emacs/notmuch-tree.el | 2 +- emacs/notmuch.el | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index 3b5dab3e..7cc28b62 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -1115,7 +1115,7 @@ (defun notmuch-tree (&optional query query-context target buffer-name open-targe (inhibit-read-only t)) (pop-to-buffer-same-window buffer)) ;; Don't track undo information for this buffer - (set 'buffer-undo-list t) + (setq buffer-undo-list t) (notmuch-tree-worker query query-context target open-target unthreaded) (setq notmuch-tree-parent-buffer parent-buffer) (setq truncate-lines t)) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 95770fc3..b221be05 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -693,7 +693,7 @@ (defun notmuch-search-process-sentinel (proc msg) (throw 'return nil)) (when (and atbob (not (string= notmuch-search-target-thread "found"))) - (set 'never-found-target-thread t))))) + (setq never-found-target-thread t))))) (when (and never-found-target-thread notmuch-search-target-line) (goto-char (point-min)) @@ -1000,11 +1000,11 @@ (defun notmuch-search (&optional query oldest-first target-thread target-line no (unless (eq major-mode 'notmuch-search-mode) (notmuch-search-mode)) ;; Don't track undo information for this buffer - (set 'buffer-undo-list t) - (set 'notmuch-search-query-string query) - (set 'notmuch-search-oldest-first oldest-first) - (set 'notmuch-search-target-thread target-thread) - (set 'notmuch-search-target-line target-line) + (setq buffer-undo-list t) + (setq notmuch-search-query-string query) + (setq notmuch-search-oldest-first oldest-first) + (setq notmuch-search-target-thread target-thread) + (setq notmuch-search-target-line target-line) (notmuch-tag-clear-cache) (let ((proc (get-buffer-process (current-buffer))) (inhibit-read-only t)) @@ -1052,7 +1052,7 @@ (defun notmuch-search-toggle-order () This command toggles the sort order for the current search. The default sort order is defined by `notmuch-search-oldest-first'." (interactive) - (set 'notmuch-search-oldest-first (not notmuch-search-oldest-first)) + (setq notmuch-search-oldest-first (not notmuch-search-oldest-first)) (notmuch-search-refresh-view)) (defun notmuch-group-disjunctive-query-string (query-string) -- 2.29.1
--- emacs/notmuch-draft.el | 6 +++--- emacs/notmuch-maildir-fcc.el | 10 +++++----- emacs/notmuch-mua.el | 6 +++--- emacs/notmuch-show.el | 2 +- emacs/notmuch-tag.el | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/emacs/notmuch-draft.el b/emacs/notmuch-draft.el index ca720384..f928be87 100644 --- a/emacs/notmuch-draft.el +++ b/emacs/notmuch-draft.el @@ -135,7 +135,7 @@ (defun notmuch-draft-unquote-some-mml () (let (secure-tag) (save-restriction (message-narrow-to-headers) - (setq secure-tag (message-fetch-field "X-Notmuch-Emacs-Secure" 't)) + (setq secure-tag (message-fetch-field "X-Notmuch-Emacs-Secure" t)) (message-remove-header "X-Notmuch-Emacs-Secure")) (message-goto-body) (when secure-tag @@ -145,7 +145,7 @@ (defun notmuch-draft--has-encryption-tag () "Returns t if there is an mml secure tag." (save-excursion (message-goto-body) - (re-search-forward notmuch-draft-encryption-tag-regex nil 't))) + (re-search-forward notmuch-draft-encryption-tag-regex nil t))) (defun notmuch-draft--query-encryption () "Checks if we should save a message that should be encrypted. @@ -207,7 +207,7 @@ (defun notmuch-draft-save () (notmuch-draft-quote-some-mml) (notmuch-maildir-setup-message-for-saving) (notmuch-maildir-notmuch-insert-current-buffer - notmuch-draft-folder 't notmuch-draft-tags)) + notmuch-draft-folder t notmuch-draft-tags)) ;; We are now back in the original compose buffer. Note the ;; function notmuch-call-notmuch-process (called by ;; notmuch-maildir-notmuch-insert-current-buffer) signals an error diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el index b1da93e6..32b8100e 100644 --- a/emacs/notmuch-maildir-fcc.el +++ b/emacs/notmuch-maildir-fcc.el @@ -76,7 +76,7 @@ (defcustom notmuch-fcc-dirs "sent" :require 'notmuch-fcc-initialization :group 'notmuch-send) -(defcustom notmuch-maildir-use-notmuch-insert 't +(defcustom notmuch-maildir-use-notmuch-insert t "Should fcc use notmuch insert instead of simple fcc." :type '(choice :tag "Fcc Method" (const :tag "Use notmuch insert" t) @@ -246,8 +246,8 @@ (defun notmuch-maildir-fcc-with-notmuch-insert (fcc-header &optional create) \(r)etry, (c)reate folder, (i)gnore, or (e)dit the header? " '(?r ?c ?i ?e)))) (cl-case response (?r (notmuch-maildir-fcc-with-notmuch-insert fcc-header)) - (?c (notmuch-maildir-fcc-with-notmuch-insert fcc-header 't)) - (?i 't) + (?c (notmuch-maildir-fcc-with-notmuch-insert fcc-header t)) + (?i t) (?e (notmuch-maildir-fcc-with-notmuch-insert (read-from-minibuffer "Fcc header: " fcc-header))))))))) @@ -322,7 +322,7 @@ (defun notmuch-maildir-fcc-file-fcc (fcc-header) It offers the user a chance to correct the header, or filesystem, if needed." (if (notmuch-maildir-fcc-dir-is-maildir-p fcc-header) - (notmuch-maildir-fcc-write-buffer-to-maildir fcc-header 't) + (notmuch-maildir-fcc-write-buffer-to-maildir fcc-header t) ;; The fcc-header is not a valid maildir see if the user wants to ;; fix it in some way. (let* ((prompt (format "Fcc %s is not a maildir: \ @@ -335,7 +335,7 @@ (defun notmuch-maildir-fcc-file-fcc (fcc-header) (message "No permission to create %s." fcc-header) (sit-for 2)) (notmuch-maildir-fcc-file-fcc fcc-header)) - (?i 't) + (?i t) (?e (notmuch-maildir-fcc-file-fcc (read-from-minibuffer "Fcc header: " fcc-header))))))) diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 29a2538b..c38cb5aa 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -539,11 +539,11 @@ (defun notmuch-mua-check-no-misplaced-secure-tag () (goto-char (point-max)) (or ;; We are always fine if there is no secure tag. - (not (search-backward "<#secure" nil 't)) + (not (search-backward "<#secure" nil t)) ;; There is a secure tag, so it must be at the start of the ;; body, with no secure tag earlier (i.e., in the headers). (and (= (point) body-start) - (not (search-backward "<#secure" nil 't))) + (not (search-backward "<#secure" nil t))) ;; The user confirms they means it. (yes-or-no-p "\ There is a <#secure> tag not at the start of the body. It is @@ -583,7 +583,7 @@ (defun notmuch-mua-send-common (arg &optional exit) (defun notmuch-mua-send-and-exit (&optional arg) (interactive "P") - (notmuch-mua-send-common arg 't)) + (notmuch-mua-send-common arg t)) (defun notmuch-mua-send (&optional arg) (interactive "P") diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index c9b1e966..056c4e30 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1751,7 +1751,7 @@ (defun notmuch-show-command-hook () (funcall notmuch-show-mark-read-function (window-start) (window-end)) ((debug error) (unless notmuch-show--seen-has-errored - (setq notmuch-show--seen-has-errored 't) + (setq notmuch-show--seen-has-errored t) (setq header-line-format (concat header-line-format (propertize diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el index dc9a2186..925de78c 100644 --- a/emacs/notmuch-tag.el +++ b/emacs/notmuch-tag.el @@ -524,7 +524,7 @@ (defun notmuch-tag-jump (reverse) (symbol-value tag) tag)) (tag-change (if reverse - (notmuch-tag-change-list tag 't) + (notmuch-tag-change-list tag t) tag)) (name (or (and (not (string= name "")) name) -- 2.29.1
One should never bind unnamed commands in keymaps because doing that makes it needlessly hard for users to change these bindings. Replace such anonymous bindings with named commands that are generated using macros and some boilerplate. Using macros is better than using a simple loop because that makes it possible for `find-function' to find the definitions. Eat your boilerplate--it forms character. Admittedly this approach is quite ugly and it might be better to teach the original commands to support different buffers directly instead of requiring wrapper commands to do just that. Never-the-less as a short-term solution this is better than what we had before. --- emacs/notmuch-tree.el | 126 ++++++++++++++++++++++++------------------ 1 file changed, 72 insertions(+), 54 deletions(-) diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index 7cc28b62..17863f6a 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -238,57 +238,83 @@ (defvar-local notmuch-tree-message-buffer nil if the user has loaded a different buffer in that window.") (put 'notmuch-tree-message-buffer 'permanent-local t) -(defun notmuch-tree-to-message-pane (func) - "Execute FUNC in message pane. - -This function returns a function (so can be used as a keybinding) -which executes function FUNC in the message pane if it is -open (if the message pane is closed it does nothing)." - `(lambda () - ,(concat "(In message pane) " (documentation func t)) +(defmacro notmuch-tree--define-do-in-message-window (name cmd) + "Define NAME as a command that calls CMD interactively in the message window. +If the message pane is closed then this command does nothing. +Avoid using this macro in new code; it will be removed." + `(defun ,name () + ,(concat "(In message window) " (documentation cmd t)) (interactive) (when (window-live-p notmuch-tree-message-window) (with-selected-window notmuch-tree-message-window - (call-interactively #',func))))) - -(defun notmuch-tree-inherit-from-message-pane (sym) - "Return value of SYM in message-pane if open, or tree-pane if not." + (call-interactively #',cmd))))) + +(notmuch-tree--define-do-in-message-window + notmuch-tree-previous-message-button + notmuch-show-previous-button) +(notmuch-tree--define-do-in-message-window + notmuch-tree-next-message-button + notmuch-show-next-button) +(notmuch-tree--define-do-in-message-window + notmuch-tree-toggle-message-process-crypto + notmuch-show-toggle-process-crypto) + +(defun notmuch-tree--message-process-crypto () + "Return value of `notmuch-show-process-crypto' in the message window. +If that window isn't alive, then return the current value. +Avoid using this function in new code; it will be removed." (if (window-live-p notmuch-tree-message-window) (with-selected-window notmuch-tree-message-window - (symbol-value sym)) - (symbol-value sym))) - -(defun notmuch-tree-close-message-pane-and (func) - "Close message pane and execute FUNC. - -This function returns a function (so can be used as a keybinding) -which closes the message pane if open and then executes function -FUNC." - `(lambda () - ,(concat "(Close message pane and) " (documentation func t)) + notmuch-show-process-crypto) + notmuch-show-process-crypto)) + +(defmacro notmuch-tree--define-close-message-window-and (name cmd) + "Define NAME as a variant of CMD. + +NAME determines the value of `notmuch-show-process-crypto' in the +message window, closes the window, and then call CMD interactively +with that value let-bound. If the message window does not exist, +then NAME behaves like CMD." + `(defun ,name () + ,(concat "(Close message pane and) " (documentation cmd t)) (interactive) (let ((notmuch-show-process-crypto - (notmuch-tree-inherit-from-message-pane 'notmuch-show-process-crypto))) + (notmuch-tree--message-process-crypto))) (notmuch-tree-close-message-window) - (call-interactively #',func)))) + (call-interactively #',cmd)))) + +(notmuch-tree--define-close-message-window-and + notmuch-tree-help + notmuch-help) +(notmuch-tree--define-close-message-window-and + notmuch-tree-new-mail + notmuch-mua-new-mail) +(notmuch-tree--define-close-message-window-and + notmuch-tree-jump-search + notmuch-jump-search) +(notmuch-tree--define-close-message-window-and + notmuch-tree-forward-message + notmuch-show-forward-message) +(notmuch-tree--define-close-message-window-and + notmuch-tree-reply-sender + notmuch-show-reply-sender) +(notmuch-tree--define-close-message-window-and + notmuch-tree-reply + notmuch-show-reply) +(notmuch-tree--define-close-message-window-and + notmuch-tree-view-raw-message + notmuch-show-view-raw-message) (defvar notmuch-tree-mode-map (let ((map (make-sparse-keymap))) (set-keymap-parent map notmuch-common-keymap) - ;; The following override the global keymap. - ;; Override because we want to close message pane first. - (define-key map [remap notmuch-help] - (notmuch-tree-close-message-pane-and #'notmuch-help)) - ;; Override because we first close message pane and then close tree buffer. + ;; These bindings shadow common bindings with variants + ;; that additionally close the message window. (define-key map [remap notmuch-bury-or-kill-this-buffer] 'notmuch-tree-quit) - ;; Override because we close message pane after the search query is entered. - (define-key map [remap notmuch-search] 'notmuch-tree-to-search) - ;; Override because we want to close message pane first. - (define-key map [remap notmuch-mua-new-mail] - (notmuch-tree-close-message-pane-and #'notmuch-mua-new-mail)) - ;; Override because we want to close message pane first. - (define-key map [remap notmuch-jump-search] - (notmuch-tree-close-message-pane-and #'notmuch-jump-search)) + (define-key map [remap notmuch-search] 'notmuch-tree-to-search) + (define-key map [remap notmuch-help] 'notmuch-tree-help) + (define-key map [remap notmuch-mua-new-mail] 'notmuch-tree-new-mail) + (define-key map [remap notmuch-jump-search] 'notmuch-tree-jump-search) (define-key map "S" 'notmuch-search-from-tree-current-query) (define-key map "U" 'notmuch-unthreaded-from-tree-current-query) @@ -302,24 +328,16 @@ (defvar notmuch-tree-mode-map (define-key map "b" 'notmuch-show-resend-message) ;; these apply to the message pane - (define-key map (kbd "M-TAB") - (notmuch-tree-to-message-pane #'notmuch-show-previous-button)) - (define-key map (kbd "<backtab>") - (notmuch-tree-to-message-pane #'notmuch-show-previous-button)) - (define-key map (kbd "TAB") - (notmuch-tree-to-message-pane #'notmuch-show-next-button)) - (define-key map "$" - (notmuch-tree-to-message-pane #'notmuch-show-toggle-process-crypto)) + (define-key map (kbd "M-TAB") 'notmuch-tree-previous-message-button) + (define-key map (kbd "<backtab>") 'notmuch-tree-previous-message-button) + (define-key map (kbd "TAB") 'notmuch-tree-next-message-button) + (define-key map "$" 'notmuch-tree-toggle-message-process-crypto) ;; bindings from show (or elsewhere) but we close the message pane first. - (define-key map "f" - (notmuch-tree-close-message-pane-and #'notmuch-show-forward-message)) - (define-key map "r" - (notmuch-tree-close-message-pane-and #'notmuch-show-reply-sender)) - (define-key map "R" - (notmuch-tree-close-message-pane-and #'notmuch-show-reply)) - (define-key map "V" - (notmuch-tree-close-message-pane-and #'notmuch-show-view-raw-message)) + (define-key map "f" 'notmuch-tree-forward-message) + (define-key map "r" 'notmuch-tree-reply-sender) + (define-key map "R" 'notmuch-tree-reply) + (define-key map "V" 'notmuch-tree-view-raw-message) ;; The main tree view bindings (define-key map (kbd "RET") 'notmuch-tree-show-message) -- 2.29.1
--- emacs/notmuch-address.el | 31 ++++++-------- emacs/notmuch-hello.el | 28 +++++-------- emacs/notmuch-lib.el | 38 +++++++++-------- emacs/notmuch-mua.el | 10 ++--- emacs/notmuch-tag.el | 2 +- emacs/notmuch.el | 88 ++++++++++++++++++++-------------------- 6 files changed, 91 insertions(+), 106 deletions(-) diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el index 71985ed7..a00ca8d7 100644 --- a/emacs/notmuch-address.el +++ b/emacs/notmuch-address.el @@ -21,6 +21,8 @@ ;;; Code: +(eval-when-compile (require 'cl-lib)) + (require 'message) (require 'notmuch-parser) (require 'notmuch-lib) @@ -154,15 +156,12 @@ (defcustom notmuch-address-use-company t :group 'notmuch-address) (defun notmuch-address-setup () - (let* ((setup-company (and notmuch-address-use-company - (require 'company nil t))) - (pair (cons notmuch-address-completion-headers-regexp - #'notmuch-address-expand-name))) - (when setup-company - (notmuch-company-setup)) - (unless (member pair message-completion-alist) - (setq message-completion-alist - (push pair message-completion-alist))))) + (when (and notmuch-address-use-company + (require 'company nil t)) + (notmuch-company-setup)) + (cl-pushnew (cons notmuch-address-completion-headers-regexp + #'notmuch-address-expand-name) + message-completion-alist :test #'equal)) (defun notmuch-address-toggle-internal-completion () "Toggle use of internal completion for current buffer. @@ -251,11 +250,8 @@ (defun notmuch-address-expand-name () (t nil))) (defun notmuch-address-harvest-addr (result) - (let ((name-addr (plist-get result :name-addr))) - (puthash name-addr t notmuch-address-completions))) - -(defun notmuch-address-harvest-handle-result (obj) - (notmuch-address-harvest-addr obj)) + (puthash (plist-get result :name-addr) + t notmuch-address-completions)) (defun notmuch-address-harvest-filter (proc string) (when (buffer-live-p (process-buffer proc)) @@ -264,7 +260,7 @@ (defun notmuch-address-harvest-filter (proc string) (goto-char (point-max)) (insert string)) (notmuch-sexp-parse-partial-list - 'notmuch-address-harvest-handle-result (process-buffer proc))))) + 'notmuch-address-harvest-addr (process-buffer proc))))) (defvar notmuch-address-harvest-procs '(nil . nil) "The currently running harvests. @@ -375,7 +371,7 @@ (defun notmuch-address--load-address-hash () (defun notmuch-address--save-address-hash () (when notmuch-address-save-filename (if (or (not (file-exists-p notmuch-address-save-filename)) - ;; The file exists, check it is a file we saved + ;; The file exists, check it is a file we saved. (notmuch-address--get-address-hash)) (with-temp-file notmuch-address-save-filename (let ((save-plist @@ -398,8 +394,7 @@ (defun notmuch-address-harvest-trigger () nil nil (lambda (proc event) ;; If harvest fails, we want to try - ;; again when the trigger is next - ;; called + ;; again when the trigger is next called. (if (string= event "finished\n") (progn (notmuch-address--save-address-hash) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index fa31694f..80af7544 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -402,8 +402,7 @@ (defun notmuch-hello-add-saved-search (widget) ;; If an existing saved search with this name exists, remove it. (setq notmuch-saved-searches (cl-loop for elem in notmuch-saved-searches - if (not (equal name - (notmuch-saved-search-get elem :name))) + unless (equal name (notmuch-saved-search-get elem :name)) collect elem)) ;; Add the new one. (customize-save-variable 'notmuch-saved-searches @@ -446,18 +445,14 @@ (defun notmuch-hello-reflect (list ncols) append (notmuch-hello-reflect-generate-row ncols nrows row list)))) (defun notmuch-hello-widget-search (widget &rest ignore) - (cond - ((eq (widget-get widget :notmuch-search-type) 'tree) - (notmuch-tree (widget-get widget - :notmuch-search-terms))) - ((eq (widget-get widget :notmuch-search-type) 'unthreaded) - (notmuch-unthreaded (widget-get widget - :notmuch-search-terms))) + (cl-case (widget-get widget :notmuch-search-type) + (tree + (notmuch-tree (widget-get widget :notmuch-search-terms))) + (unthreaded + (notmuch-unthreaded (widget-get widget :notmuch-search-terms))) (t - (notmuch-search (widget-get widget - :notmuch-search-terms) - (widget-get widget - :notmuch-search-oldest-first))))) + (notmuch-search (widget-get widget :notmuch-search-terms) + (widget-get widget :notmuch-search-oldest-first))))) (defun notmuch-saved-search-count (search) (car (process-lines notmuch-command "count" search))) @@ -689,9 +684,7 @@ (define-derived-mode notmuch-hello-mode fundamental-mode "notmuch-hello" Complete list of currently available key bindings: \\{notmuch-hello-mode-map}" - (setq notmuch-buffer-refresh-function #'notmuch-hello-update) - ;;(setq buffer-read-only t) - ) + (setq notmuch-buffer-refresh-function #'notmuch-hello-update)) (defun notmuch-hello-generate-tag-alist (&optional hide-tags) "Return an alist from tags to queries to display in the all-tags section." @@ -775,8 +768,7 @@ (defun notmuch-hello-insert-search () ;; instead of a space to make `show-trailing-whitespace' ;; happy, i.e. avoid it marking the whole line as trailing ;; spaces. - (widget-insert ".") - (put-text-property (1- (point)) (point) 'invisible t) + (widget-insert (propertize "." 'invisible t)) (widget-insert "\n")) (defun notmuch-hello-insert-recent-searches () diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index e23999ad..aa48b949 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -186,8 +186,8 @@ (defun notmuch-command-to-string (&rest args) Otherwise the output will be returned." (with-temp-buffer - (let* ((status (apply #'call-process notmuch-command nil t nil args)) - (output (buffer-string))) + (let ((status (apply #'call-process notmuch-command nil t nil args)) + (output (buffer-string))) (notmuch-check-exit-status status (cons notmuch-command args) output) output))) @@ -239,8 +239,9 @@ (defun notmuch-config-get (item) (let* ((val (notmuch-command-to-string "config" "get" item)) (len (length val))) ;; Trim off the trailing newline (if the value is empty or not - ;; configured, there will be no newline) - (if (and (> len 0) (= (aref val (- len 1)) ?\n)) + ;; configured, there will be no newline). + (if (and (> len 0) + (= (aref val (- len 1)) ?\n)) (substring val 0 -1) val))) @@ -403,9 +404,9 @@ (defun notmuch-help () its prefixed behavior by setting the 'notmuch-prefix-doc property of its command symbol." (interactive) - (let* ((mode major-mode) - (doc (substitute-command-keys - (notmuch-substitute-command-keys (documentation mode t))))) + (let ((doc (substitute-command-keys + (notmuch-substitute-command-keys + (documentation major-mode t))))) (with-current-buffer (generate-new-buffer "*notmuch-help*") (insert doc) (goto-char (point-min)) @@ -467,8 +468,8 @@ (defun notmuch-refresh-all-buffers () (notmuch-refresh-this-buffer)))))) (defun notmuch-prettify-subject (subject) - ;; This function is used by `notmuch-search-process-filter' which - ;; requires that we not disrupt its' matching state. + ;; This function is used by `notmuch-search-process-filter', + ;; which requires that we not disrupt its matching state. (save-match-data (if (and subject (string-match "^[ \t]*$" subject)) @@ -525,13 +526,12 @@ (defun notmuch-common-do-stash (text) ;; (defun notmuch-plist-delete (plist property) - (let* ((xplist (cons nil plist)) - (pred xplist)) - (while (cdr pred) - (when (eq (cadr pred) property) - (setcdr pred (cdddr pred))) - (setq pred (cddr pred))) - (cdr xplist))) + (let (p) + (while plist + (unless (eq property (car plist)) + (setq p (plist-put p (car plist) (cadr plist)))) + (setq plist (cddr plist))) + p)) (defun notmuch-match-content-type (t1 t2) "Return t if t1 and t2 are matching content types, taking wildcards into account." @@ -540,8 +540,10 @@ (defun notmuch-match-content-type (t1 t2) (if (or (string= (cadr st1) "*") (string= (cadr st2) "*")) ;; Comparison of content types should be case insensitive. - (string= (downcase (car st1)) (downcase (car st2))) - (string= (downcase t1) (downcase t2))))) + (string= (downcase (car st1)) + (downcase (car st2))) + (string= (downcase t1) + (downcase t2))))) (defvar notmuch-multipart/alternative-discouraged '(;; Avoid HTML parts. diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index c38cb5aa..01c1d520 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -348,12 +348,10 @@ (defun notmuch-mua-pop-to-buffer (name switch-function) (select-window window)) (funcall switch-function buffer) (set-buffer buffer)) - (when (and (buffer-modified-p) - (not (prog1 - (y-or-n-p - "Message already being composed; erase? ") - (message nil)))) - (error "Message being composed"))) + (when (buffer-modified-p) + (if (y-or-n-p "Message already being composed; erase? ") + (message nil) + (error "Message being composed")))) (funcall switch-function name) (set-buffer name)) (erase-buffer) diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el index 925de78c..75e864a4 100644 --- a/emacs/notmuch-tag.el +++ b/emacs/notmuch-tag.el @@ -472,7 +472,7 @@ (defun notmuch-tag (query tag-changes) tag-changes) (unless query (error "Nothing to tag!")) - (unless (null tag-changes) + (when tag-changes (run-hooks 'notmuch-before-tag-hook) (if (<= (length query) notmuch-tag-argument-limit) (apply 'notmuch-call-notmuch-process "tag" diff --git a/emacs/notmuch.el b/emacs/notmuch.el index b221be05..80aa8566 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -169,7 +169,7 @@ (defvar notmuch-search-mode-map (let ((map (make-sparse-keymap))) (set-keymap-parent map notmuch-common-keymap) (define-key map "x" 'notmuch-bury-or-kill-this-buffer) - (define-key map (kbd "<DEL>") 'notmuch-search-scroll-down) + (define-key map (kbd "DEL") 'notmuch-search-scroll-down) (define-key map "b" 'notmuch-search-scroll-down) (define-key map " " 'notmuch-search-scroll-up) (define-key map "<" 'notmuch-search-first-thread) @@ -923,40 +923,39 @@ (defun notmuch-read-query (prompt) "Read a notmuch-query from the minibuffer with completion. PROMPT is the string to prompt with." - (let* - ((all-tags - (mapcar (lambda (tag) (notmuch-escape-boolean-term tag)) - (process-lines notmuch-command "search" "--output=tags" "*"))) - (completions - (append (list "folder:" "path:" "thread:" "id:" "date:" "from:" "to:" - "subject:" "attachment:") - (mapcar (lambda (tag) (concat "tag:" tag)) all-tags) - (mapcar (lambda (tag) (concat "is:" tag)) all-tags) - (mapcar (lambda (mimetype) (concat "mimetype:" mimetype)) - (mailcap-mime-types))))) - (let ((keymap (copy-keymap minibuffer-local-map)) - (current-query (cl-case major-mode - (notmuch-search-mode (notmuch-search-get-query)) - (notmuch-show-mode (notmuch-show-get-query)) - (notmuch-tree-mode (notmuch-tree-get-query)))) - (minibuffer-completion-table - (completion-table-dynamic - (lambda (string) - ;; generate a list of possible completions for the current input - (cond - ;; this ugly regexp is used to get the last word of the input - ;; possibly preceded by a '(' - ((string-match "\\(^\\|.* (?\\)\\([^ ]*\\)$" string) - (mapcar (lambda (compl) - (concat (match-string-no-properties 1 string) compl)) - (all-completions (match-string-no-properties 2 string) - completions))) - (t (list string))))))) - ;; this was simpler than convincing completing-read to accept spaces: - (define-key keymap (kbd "TAB") 'minibuffer-complete) - (let ((history-delete-duplicates t)) - (read-from-minibuffer prompt nil keymap nil - 'notmuch-search-history current-query nil))))) + (let* ((all-tags + (mapcar (lambda (tag) (notmuch-escape-boolean-term tag)) + (process-lines notmuch-command "search" "--output=tags" "*"))) + (completions + (append (list "folder:" "path:" "thread:" "id:" "date:" "from:" "to:" + "subject:" "attachment:") + (mapcar (lambda (tag) (concat "tag:" tag)) all-tags) + (mapcar (lambda (tag) (concat "is:" tag)) all-tags) + (mapcar (lambda (mimetype) (concat "mimetype:" mimetype)) + (mailcap-mime-types)))) + (keymap (copy-keymap minibuffer-local-map)) + (current-query (cl-case major-mode + (notmuch-search-mode (notmuch-search-get-query)) + (notmuch-show-mode (notmuch-show-get-query)) + (notmuch-tree-mode (notmuch-tree-get-query)))) + (minibuffer-completion-table + (completion-table-dynamic + (lambda (string) + ;; Generate a list of possible completions for the current input. + (cond + ;; This ugly regexp is used to get the last word of the input + ;; possibly preceded by a '('. + ((string-match "\\(^\\|.* (?\\)\\([^ ]*\\)$" string) + (mapcar (lambda (compl) + (concat (match-string-no-properties 1 string) compl)) + (all-completions (match-string-no-properties 2 string) + completions))) + (t (list string))))))) + ;; This was simpler than convincing completing-read to accept spaces: + (define-key keymap (kbd "TAB") 'minibuffer-complete) + (let ((history-delete-duplicates t)) + (read-from-minibuffer prompt nil keymap nil + 'notmuch-search-history current-query nil)))) (defun notmuch-search-get-query () "Return the current query in this search buffer." @@ -1006,10 +1005,9 @@ (defun notmuch-search (&optional query oldest-first target-thread target-line no (setq notmuch-search-target-thread target-thread) (setq notmuch-search-target-line target-line) (notmuch-tag-clear-cache) - (let ((proc (get-buffer-process (current-buffer))) - (inhibit-read-only t)) - (when proc - (error "notmuch search process already running for query `%s'" query)) + (when (get-buffer-process buffer) + (error "notmuch search process already running for query `%s'" query)) + (let ((inhibit-read-only t)) (erase-buffer) (goto-char (point-min)) (save-excursion @@ -1019,12 +1017,12 @@ (defun notmuch-search (&optional query oldest-first target-thread target-line no (if oldest-first "--sort=oldest-first" "--sort=newest-first") - query)) - ;; Use a scratch buffer to accumulate partial output. - ;; This buffer will be killed by the sentinel, which - ;; should be called no matter how the process dies. - (parse-buf (generate-new-buffer " *notmuch search parse*"))) - (process-put proc 'parse-buf parse-buf) + query))) + ;; Use a scratch buffer to accumulate partial output. + ;; This buffer will be killed by the sentinel, which + ;; should be called no matter how the process dies. + (process-put proc 'parse-buf + (generate-new-buffer " *notmuch search parse*")) (set-process-filter proc 'notmuch-search-process-filter) (set-process-query-on-exit-flag proc nil)))) (run-hooks 'notmuch-search-hook))) -- 2.29.1
On Monday, 2020-11-16 at 22:28:20 +01, Jonas Bernoulli wrote: > This remove the first four commits, which have already been > applied to master. It also makes requested minor changes > to the three marked commits. For the set... Reviewed-by: David Edmondson <dme@dme.org> > Jonas Bernoulli (23): > emacs: remove redundant notmuch-hello-trim > emacs: fix old bug in notmuch-mua-mail > emacs: remove kludge for Emacs 23 from notmuch-mua-mail > emacs: more cleanup since dropping support for Emacs 24 > emacs: sanitize function that displays version > emacs: define notmuch-hello-url as a constant > emacs: shorten/replace first sentence of a few doc-strings > emacs: place only first sentence on first doc-string line > * emacs: place complete first sentence on first doc-string line > emacs: always use elisp quoting style in doc-strings > * emacs: misc doc-string improvements > emacs: remove deprecated notmuch-folder command > emacs: remove unnecessary notmuch-remove-if-not > emacs: remove unused notmuch-address-locate-command > emacs: remove unnecessary notmuch-tree-button-activate > emacs: inline notmuch-documentation-first-line > emacs: inline notmuch-split-content-type > emacs: use defvar-local > emacs: use setq-local > emacs: use setq instead set > emacs: do not quote self-quoting t > emacs: avoid binding unnamed commands in keymaps > * emacs: various cosmetic improvements > > emacs/coolj.el | 4 +- > emacs/notmuch-address.el | 58 ++++-------- > emacs/notmuch-company.el | 7 +- > emacs/notmuch-compat.el | 9 +- > emacs/notmuch-crypto.el | 7 +- > emacs/notmuch-draft.el | 17 ++-- > emacs/notmuch-hello.el | 123 +++++++++---------------- > emacs/notmuch-jump.el | 5 -- > emacs/notmuch-lib.el | 108 +++++++++------------- > emacs/notmuch-maildir-fcc.el | 12 +-- > emacs/notmuch-mua.el | 64 ++++++------- > emacs/notmuch-parser.el | 5 +- > emacs/notmuch-show.el | 56 ++++++------ > emacs/notmuch-tag.el | 24 ++--- > emacs/notmuch-tree.el | 170 ++++++++++++++++++----------------- > emacs/notmuch.el | 108 +++++++++++----------- > 16 files changed, 331 insertions(+), 446 deletions(-) > > -- > 2.29.1 > _______________________________________________ > notmuch mailing list -- notmuch@notmuchmail.org > To unsubscribe send an email to notmuch-leave@notmuchmail.org dme. -- Come down, come talk to me.
Jonas Bernoulli <jonas@bernoul.li> writes:
> ---
> emacs/notmuch-address.el | 31 ++++++--------
> emacs/notmuch-hello.el | 28 +++++--------
> emacs/notmuch-lib.el | 38 +++++++++--------
> emacs/notmuch-mua.el | 10 ++---
> emacs/notmuch-tag.el | 2 +-
> emacs/notmuch.el | 88 ++++++++++++++++++++--------------------
> 6 files changed, 91 insertions(+), 106 deletions(-)
>
Apologies for the delay, I missed the second review. I've applied the
first 22, but this last one is not applying to (current) master for me.
d
David Bremner <david@tethera.net> writes: > Apologies for the delay, I missed the second review. No problem, I probably should just have pinged after a week or so. Will do that next time. Sorry for being slow to respond myself! By the way, you seem to have missed some more patch series of mine: - id:20201108231150.5419-1-jonas@bernoul.li Improves notmuch-address.el a bit. - id:20201108174929.1227-1-jonas@bernoul.li Fixes a regression that also came up in id:877dqtkqs9.fsf@uwaterloo.ca I had the same issue as mentioned there. Since applying this patch, I haven't seen it. > I've applied the first 22, but this last one is not applying to > (current) master for me. You seem to have accidentally dropped another commits, which is why this commit did not apply. I have another series with a "few" commits waiting for submissions and will just lead that with these two commits from the last series. Jonas
Jonas Bernoulli <jonas@bernoul.li> writes:
> David Bremner <david@tethera.net> writes:
>
> You seem to have accidentally dropped another commits, which is why
> this commit did not apply. I have another series with a "few" commits
> waiting for submissions and will just lead that with these two commits
> from the last series.
Sounds good. Sorry for the extra work.
d
Jonas Bernoulli <jonas@bernoul.li> writes:
> - -(defun notmuch-tree-close-message-pane-and (func) - "Close
> message pane and execute FUNC.
I am confused why a function used in config files and documented
on the notmuch website (to this moment) as an example of how to
configure something would be removed, and to be removed without
any announcement.
I argue that a user (who is not literally an author of notmuch)
should be able to reliably use the software, which involves configuring
it and having that configuration continue to work. It's not like it was
remotely easy getting that config setup in the first place.
[-- Attachment #1.1: Type: text/plain, Size: 1305 bytes --] Am Sa., 28. Okt. 2023 um 06:22 Uhr schrieb Ryan Tate <ryantate@ryantate.com >: > > Jonas Bernoulli <jonas@bernoul.li> writes: > > > - -(defun notmuch-tree-close-message-pane-and (func) - "Close > > message pane and execute FUNC. > > I am confused why a function used in config files and documented > on the notmuch website (to this moment) as an example of how to > configure something would be removed, and to be removed without > any announcement. > > I argue that a user (who is not literally an author of notmuch) > should be able to reliably use the software, which involves configuring > it and having that configuration continue to work. It's not like it was > remotely easy getting that config setup in the first place. > _______________________________________________ > With all due respect, I suggest you try to (re-)read your posts again through the eyes of a notmuch author or contributor, for a change of perspective. Do you still consider your tone appropriate? Bug reports and constructive suggestions are always welcome here. In fact, I experienced the notmuch community as absolutely welcoming and zero-drama. Let's keep it that way. Maybe you can help us by rephrasing your complaints into suggestions for documentation updates, and thus help others getting less confused? Michael [-- Attachment #1.2: Type: text/html, Size: 1821 bytes --] [-- Attachment #2: Type: text/plain, Size: 0 bytes --]
> On Oct 28, 2023, at 5:32 AM, Michael J Gruber <michaeljgruber+grubix+git@gmail.com> > Maybe you can help us by rephrasing your complaints into suggestions for documentation updates, and thus help others getting less confused? I’ve updated the documentation before when I discovered changes after the fact, in coordination with this list. I think in cases where the developers here don’t want to do that others might be again willing to help. But it would really help if breaking changes were prominently flagged. That said, it’s a small group of volunteers, and I’m not sure avoiding breakage or taking the time to notice breaking changes and send emails to this list is a priority. Totally fine and as I’ve expressed before on this list you all have my eternal gratitude for your work. It’s just a culture thing. I felt the need to express what it feels like on the other side but I won’t in the future. Cheers.
Ryan Tate <ryantate@ryantate.com> writes: > Jonas Bernoulli <jonas@bernoul.li> writes: > >> - -(defun notmuch-tree-close-message-pane-and (func) - "Close >> message pane and execute FUNC. > > I am confused why a function used in config files and documented > on the notmuch website (to this moment) as an example of how to > configure something would be removed, and to be removed without > any announcement. We try our best to minimize the amount of breaking changes (and to announce them when they happen), but sometimes things slip through. BTW notmuchmail.org is mostly a wiki, and we rely on the user community to update it. If you would like to help with that (e.g. to mark those snippets as broken), see https://notmuchmail.org/wikiwriteaccess/ > I argue that a user (who is not literally an author of notmuch) > should be able to reliably use the software, which involves configuring > it and having that configuration continue to work. Sure, that the intention. This is somewhat challenging with the emacs UI as it exists, since the line between API that people can rely on and internals is not well drawn in the older code. The changes under discussion actually make that a bit better by marking some macros as internal. As far as your specific technical issue, I guess you can recover the deleted functions and put them (possibly renamed) in your init.el. Since you are using Debian, you might be interested in using notmuch from stable backports; this would mean you will not see several years of changes all at once. It's a personal thing whether you prefer more smaller disruptions over fewer larger ones.