Re: [PATCH v2] emacs: add notmuch-expr, sexp-style queries

2020-11-16 Thread David Edmondson
On Friday, 2020-11-13 at 23:01:22 +11, Tom Fitzhenry wrote:

> From: Tom Fitzhenry 
>
> notmuch-expr allows you to write notmuch search queries in sexp style like:
>
> (notmuch-expr
>   '(and
> (to "emacs-devel")
> "info manual"
> (or
>   (not (is "spam"))
>   (is "important"
>
> which will generate the textual query:
>
> "to:emacs-devel AND (NOT is:spam OR is:important) AND \"info manual\""

Reviewed-by: David Edmondson 

> ---
>  emacs/Makefile.local   |   1 +
>  emacs/notmuch-expr-test.el |  96 
>  emacs/notmuch-expr.el  | 124 +
>  emacs/notmuch.el   |   1 +
>  4 files changed, 222 insertions(+)
>  create mode 100644 emacs/notmuch-expr-test.el
>  create mode 100644 emacs/notmuch-expr.el
>
> diff --git a/emacs/Makefile.local b/emacs/Makefile.local
> index d1b320c3..f68e6e31 100644
> --- a/emacs/Makefile.local
> +++ b/emacs/Makefile.local
> @@ -22,6 +22,7 @@ emacs_sources := \
>   $(dir)/notmuch-version.el \
>   $(dir)/notmuch-jump.el \
>   $(dir)/notmuch-company.el \
> + $(dir)/notmuch-expr.el \
>   $(dir)/notmuch-draft.el
>  
>  elpa_sources := ${emacs_sources} $(dir)/notmuch-pkg.el
> diff --git a/emacs/notmuch-expr-test.el b/emacs/notmuch-expr-test.el
> new file mode 100644
> index ..92029fec
> --- /dev/null
> +++ b/emacs/notmuch-expr-test.el
> @@ -0,0 +1,96 @@
> +(require 'ert)
> +(require 'notmuch-expr)
> +
> +(ert-deftest and ()
> +  (should
> +(equal
> +  "(\"valued\" AND is:unread AND from:s...@example.com)"
> +  (notmuch-expr
> +   '(and
> + "valued"
> + (is "unread")
> + (from "s...@example.com"))
> +
> +(ert-deftest body ()
> +  (should
> +   (equal
> +"(body:wallace AND from:gromit)"
> +(notmuch-expr
> + '(and
> +   (body "wallace")
> +   (from "gromit"))
> +
> +(ert-deftest regex ()
> +  (should
> +   (equal
> +"(subject:\"/Ca+sh/\" AND NOT is:important)"
> +(notmuch-expr
> + '(and
> +   (subject "/Ca+sh/")
> +   (not (is "important")))
> +
> +(ert-deftest precedence ()
> +  (should
> +   (equal
> +"(to:emacs-devel AND (NOT is:spam OR is:important))"
> +(notmuch-expr
> + '(and
> +   (to "emacs-devel")
> +   (or
> + (not (is "spam"))
> + (is "important")))
> +
> +(ert-deftest xor ()
> +  (should
> +   (equal
> +"is:inbox XOR is:sent"
> +(notmuch-expr
> + '(xor
> +   (is "inbox")
> +   (is "sent"))
> +
> +(ert-deftest literal ()
> +  (should
> +   (equal
> +"(is:inbox OR from:foo)"
> +(notmuch-expr
> + '(or
> +   (is "inbox")
> +   (literal "from:foo"))
> +
> +(ert-deftest string ()
> +  (should
> +   (equal
> +"(is:inbox OR \"from:foo\")"
> +(notmuch-expr
> + '(or
> +   (is "inbox")
> +   "from:foo")
> +
> +(ert-deftest tag-with-spaces ()
> +  (should
> +   (equal
> +"is:\"a tag\""
> +(notmuch-expr
> + '(tag "a tag")
> +
> +(ert-deftest quoted-spaces ()
> +  (should
> +   (equal
> +"subject:\"Hello there\""
> +(notmuch-expr
> + '(subject "Hello there")
> +
> +(ert-deftest quoted-backslash ()
> +  (should
> +   (equal
> +"subject:\"A celebration! \\o/ Woo.\""
> +(notmuch-expr
> + '(subject "A celebration! \\o/ Woo.")
> +
> +(ert-deftest quoted-quote ()
> +  (should
> +   (equal
> +"subject:\"Gandalf: \\\"Use the force!\\\" 2001\""
> +(notmuch-expr
> + '(subject "Gandalf: \"Use the force!\" 2001")
> diff --git a/emacs/notmuch-expr.el b/emacs/notmuch-expr.el
> new file mode 100644
> index ..f5a3429f
> --- /dev/null
> +++ b/emacs/notmuch-expr.el
> @@ -0,0 +1,124 @@
> +;;; notmuch-expr.el --- An S-exp library for building notmuch search queries 
> -*- lexical-binding: t; -*-
> +
> +;; Author: Tom Fitzhenry 
> +;; Package-Requires: ((emacs "24.1"))
> +;; URL: https://notmuchmail.org
> +
> +;;; Commentary:
> +
> +;; This package provides a way to build notmuch search queries via 
> s-expressions.
> +;;
> +;; For example, rather than write:
> +
> +;; "to:emacs-devel AND (NOT is:spam OR is:important) AND \"info manual\""
> +;;
> +;; this package allows you to generate the same query via s-expressions:
> +;;
> +;; (notmuch-expr
> +;;  '(and
> +;;(to "emacs-devel")
> +;;"info manual"
> +;;(or
> +;;  (not (is "spam"))
> +;;  (is "important"
> +;;
> +;; See notmuch-expr-test.el for more examples.
> +;;
> +;; Some search terms are unsupported. To use those, use the `literal' atom.
> +;; For example: (literal "path:spam")
> +;;
> +;; man page: notmuch-search-terms(7).
> +;; The generated search query may change across different versions.
> +
> +;;; Code:
> +
> +(defmacro notmuch-expr (query)
> +  "Compile an sexp QUERY into a textual notmuch query."
> +  `(notmuch-expr--eval ,query))
> +
> +(defun notmuch-expr--eval (expr)
> +  (pcase expr
> +(`(tag ,s) (notmuch-expr--is 

Why some characters are not displayed correctly when setting mm-text-html-renderer to links

2020-11-16 Thread Wenlong Dai
I'm using gccemcs under WSL2 and trying to switch from mu4e to notmuch.
One thing I immediately like about notmuch is that it's much more faster
than mu4e.

But I also almost immediately ran into some issues. The one that bothers me
the most is,
when I hit ENTER to open a long thread from notmuch-search mode, it takes a
very long time to load.
Sometimes, this can take 30 seconds or more. My understanding is that
notmuch needs to load all the messages
(in my case, I tried threads with 20+ messages), and the default shr
renderer is not great at dealing with large amount of data.

After some research, I found that setting mm-text-html-renderer to links
would reduce the load time from 
to around 2 seconds or less. But one small issue with this is some
characters are not displayed correctly, for example the
RIGHT SINGLE QUOTATION MARK, which would be displayed as \342\200\231

A bit more research lead me to the toggle-enable-multibyte-characters
function, I found that if I invoke this function
twice interactively, the display would be fixed.

I guess my question is, how do I make notmuch-show display characters like
RIGHT SINGLE QUOTATION MARK correctly
when I use links as html renderer? And why would invoking
 toggle-enable-multibyte-characters fix the issue?
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 13/27] emacs: place complete first sentence on first doc-string line

2020-11-16 Thread Jonas Bernoulli
David Edmondson  writes:

> On Sunday, 2020-11-08 at 20:02:57 +01, Jonas Bernoulli wrote:
>
> With a suggested rewording below...
>
> Reviewed-by: David Edmondson 
>
>> ---
>>  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-le...@notmuchmail.org
>
> dme.
> -- 
> You bring light in.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 13/23] emacs: remove unnecessary notmuch-remove-if-not

2020-11-16 Thread Jonas Bernoulli
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  
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 ( 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
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 06/23] emacs: define notmuch-hello-url as a constant

2020-11-16 Thread Jonas Bernoulli
---
 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
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 02/23] emacs: fix old bug in notmuch-mua-mail

2020-11-16 Thread Jonas Bernoulli
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 ( 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-le...@notmuchmail.org


[PATCH v2 01/23] emacs: remove redundant notmuch-hello-trim

2020-11-16 Thread Jonas Bernoulli
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 ( 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
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 03/23] emacs: remove kludge for Emacs 23 from notmuch-mua-mail

2020-11-16 Thread Jonas Bernoulli
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 ( 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 mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 04/23] emacs: more cleanup since dropping support for Emacs 24

2020-11-16 Thread Jonas Bernoulli
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 "") '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 
 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
+++ 

[PATCH v2 08/23] emacs: place only first sentence on first doc-string line

2020-11-16 Thread Jonas Bernoulli
---
 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
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 07/23] emacs: shorten/replace first sentence of a few doc-strings

2020-11-16 Thread Jonas Bernoulli
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 
( 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 ( 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=."
-- 
2.29.1
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH 00/23] Another set up Emacs cleanup

2020-11-16 Thread Jonas Bernoulli
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
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 05/23] emacs: sanitize function that displays version

2020-11-16 Thread Jonas Bernoulli
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 "") '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
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 19/23] emacs: use setq-local

2020-11-16 Thread Jonas Bernoulli
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
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 17/23] emacs: inline notmuch-split-content-type

2020-11-16 Thread Jonas Bernoulli
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
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 11/23] emacs: misc doc-string improvements

2020-11-16 Thread Jonas Bernoulli
---
 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" ( 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
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 12/23] emacs: remove deprecated notmuch-folder command

2020-11-16 Thread Jonas Bernoulli
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 ( 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
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 09/23] emacs: place complete first sentence on first doc-string line

2020-11-16 Thread Jonas Bernoulli
---
 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
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 00/23] Another set up Emacs cleanup

2020-11-16 Thread David Edmondson
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 

> 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-le...@notmuchmail.org

dme.
-- 
Come down, come talk to me.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH v2] emacs: add notmuch-expr, sexp-style queries

2020-11-16 Thread Jonas Bernoulli
Tom Fitzhenry  writes:

> From: Tom Fitzhenry 
>
> notmuch-expr allows you to write notmuch search queries in sexp style like:
>
> (notmuch-expr
>   '(and
> (to "emacs-devel")
> "info manual"
> (or
>   (not (is "spam"))
>   (is "important"
>
> which will generate the textual query:
>
> "to:emacs-devel AND (NOT is:spam OR is:important) AND \"info manual\""
> ---
>  emacs/Makefile.local   |   1 +
>  emacs/notmuch-expr-test.el |  96 
>  emacs/notmuch-expr.el  | 124 +
>  emacs/notmuch.el   |   1 +
>  4 files changed, 222 insertions(+)
>  create mode 100644 emacs/notmuch-expr-test.el
>  create mode 100644 emacs/notmuch-expr.el
>
> diff --git a/emacs/Makefile.local b/emacs/Makefile.local
> index d1b320c3..f68e6e31 100644
> --- a/emacs/Makefile.local
> +++ b/emacs/Makefile.local
> @@ -22,6 +22,7 @@ emacs_sources := \
>   $(dir)/notmuch-version.el \
>   $(dir)/notmuch-jump.el \
>   $(dir)/notmuch-company.el \
> + $(dir)/notmuch-expr.el \
>   $(dir)/notmuch-draft.el
>  
>  elpa_sources := ${emacs_sources} $(dir)/notmuch-pkg.el
> diff --git a/emacs/notmuch-expr-test.el b/emacs/notmuch-expr-test.el
> new file mode 100644
> index ..92029fec
> --- /dev/null
> +++ b/emacs/notmuch-expr-test.el
> @@ -0,0 +1,96 @@
> +(require 'ert)
> +(require 'notmuch-expr)
> +
> +(ert-deftest and ()
> +  (should
> +(equal
> +  "(\"valued\" AND is:unread AND from:s...@example.com)"
> +  (notmuch-expr
> +   '(and
> + "valued"
> + (is "unread")
> + (from "s...@example.com"))
> +
> +(ert-deftest body ()
> +  (should
> +   (equal
> +"(body:wallace AND from:gromit)"
> +(notmuch-expr
> + '(and
> +   (body "wallace")
> +   (from "gromit"))
> +
> +(ert-deftest regex ()
> +  (should
> +   (equal
> +"(subject:\"/Ca+sh/\" AND NOT is:important)"
> +(notmuch-expr
> + '(and
> +   (subject "/Ca+sh/")
> +   (not (is "important")))
> +
> +(ert-deftest precedence ()
> +  (should
> +   (equal
> +"(to:emacs-devel AND (NOT is:spam OR is:important))"
> +(notmuch-expr
> + '(and
> +   (to "emacs-devel")
> +   (or
> + (not (is "spam"))
> + (is "important")))
> +
> +(ert-deftest xor ()
> +  (should
> +   (equal
> +"is:inbox XOR is:sent"
> +(notmuch-expr
> + '(xor
> +   (is "inbox")
> +   (is "sent"))
> +
> +(ert-deftest literal ()
> +  (should
> +   (equal
> +"(is:inbox OR from:foo)"
> +(notmuch-expr
> + '(or
> +   (is "inbox")
> +   (literal "from:foo"))
> +
> +(ert-deftest string ()
> +  (should
> +   (equal
> +"(is:inbox OR \"from:foo\")"
> +(notmuch-expr
> + '(or
> +   (is "inbox")
> +   "from:foo")
> +
> +(ert-deftest tag-with-spaces ()
> +  (should
> +   (equal
> +"is:\"a tag\""
> +(notmuch-expr
> + '(tag "a tag")
> +
> +(ert-deftest quoted-spaces ()
> +  (should
> +   (equal
> +"subject:\"Hello there\""
> +(notmuch-expr
> + '(subject "Hello there")
> +
> +(ert-deftest quoted-backslash ()
> +  (should
> +   (equal
> +"subject:\"A celebration! \\o/ Woo.\""
> +(notmuch-expr
> + '(subject "A celebration! \\o/ Woo.")
> +
> +(ert-deftest quoted-quote ()
> +  (should
> +   (equal
> +"subject:\"Gandalf: \\\"Use the force!\\\" 2001\""
> +(notmuch-expr
> + '(subject "Gandalf: \"Use the force!\" 2001")
> diff --git a/emacs/notmuch-expr.el b/emacs/notmuch-expr.el
> new file mode 100644
> index ..f5a3429f
> --- /dev/null
> +++ b/emacs/notmuch-expr.el
> @@ -0,0 +1,124 @@
> +;;; notmuch-expr.el --- An S-exp library for building notmuch search queries 
> -*- lexical-binding: t; -*-
> +
> +;; Author: Tom Fitzhenry 
> +;; Package-Requires: ((emacs "24.1"))
> +;; URL: https://notmuchmail.org

I recently improved consistency of the library headers.  They
don't confirm to the Emacs conventions but its close enough,
and I think internal consistency would be nice to maintain here.

Don't specify "URL".  "Homepage" would be better, but since this
is not an entry point library its better to omit this.  I think
"notmuch.el" is the only library that specifies this currently.

Likewise because "notmuch-expr" is not a standalone _package_
"Package-Requires" should not be specified.  By the way, notmuch
now requires emacs 25.1, so specifying a lower version would not
make sense here anyway.

 Cheers,
 Jonas

> +
> +;;; Commentary:
> +
> +;; This package provides a way to build notmuch search queries via 
> s-expressions.
> +;;
> +;; For example, rather than write:
> +
> +;; "to:emacs-devel AND (NOT is:spam OR is:important) AND \"info manual\""
> +;;
> +;; this package allows you to generate the same query via s-expressions:
> +;;
> +;; (notmuch-expr
> +;;  '(and
> +;;(to "emacs-devel")
> +;;"info manual"
> +;;(or
> +;;  (not (is "spam"))
> +;;  (is 

[PATCH v2 23/23] emacs: various cosmetic improvements

2020-11-16 Thread Jonas Bernoulli
---
 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  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 

[PATCH v2 10/23] emacs: always use elisp quoting style in doc-strings

2020-11-16 Thread Jonas Bernoulli
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 ( 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
 

[PATCH v2 14/23] emacs: remove unused notmuch-address-locate-command

2020-11-16 Thread Jonas Bernoulli
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
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 16/23] emacs: inline notmuch-documentation-first-line

2020-11-16 Thread Jonas Bernoulli
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
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 21/23] emacs: do not quote self-quoting t

2020-11-16 Thread Jonas Bernoulli
---
 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 
 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  exit)
 
 (defun notmuch-mua-send-and-exit ( arg)
   (interactive "P")
-  (notmuch-mua-send-common arg 't))
+  (notmuch-mua-send-common arg t))
 
 (defun notmuch-mua-send ( 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 

[PATCH v2 22/23] emacs: avoid binding unnamed commands in keymaps

2020-11-16 Thread Jonas Bernoulli
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.
-

[PATCH v2 18/23] emacs: use defvar-local

2020-11-16 Thread Jonas Bernoulli
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 

[PATCH v2 15/23] emacs: remove unnecessary notmuch-tree-button-activate

2020-11-16 Thread Jonas Bernoulli
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 ( 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
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 20/23] emacs: use setq instead set

2020-11-16 Thread Jonas Bernoulli
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 ( 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 ( 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
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 27/27] emacs: various cosmetic improvements

2020-11-16 Thread Jonas Bernoulli
David Edmondson  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 
>
>> ---
>>  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