[PATCH v5] Emacs: Ensure left-to-right display for message headers

2020-08-06 Thread Teemu Likonen
In notmuch-show buffer insert invisible U+200E LEFT-TO-RIGHT MARK
character at the beginning of message header paragraph if the From
header contains a right-to-left character. This ensures that the
header paragraph is always rendered in left-to-right mode.

See Emacs Lisp reference manual section "(elisp) Bidirectional
Display" for more info.
---
 emacs/notmuch-show.el | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)


As the commit description says this version inserts U+200E
LEFT-TO-RIGHT MARK only if the first header line (From header)
contains a right-to-left character.

This version is probably friendlier to the current test files which
don't expect to see U+200E LEFT-TO-RIGHT MARK in the output.


diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index c9170466..0eb27e33 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -466,10 +466,16 @@ unchanged ADDRESS if parsing fails."
 (defun notmuch-show-insert-headerline (headers date tags depth)
   "Insert a notmuch style headerline based on HEADERS for a
 message at DEPTH in the current thread."
-  (let ((start (point)))
+  (let ((start (point))
+   (from (notmuch-sanitize
+  (notmuch-show-clean-address (plist-get headers :From)
+(when (string-match "\\cR" from)
+  ;; If the From header has a right-to-left character add
+  ;; invisible U+200E LEFT-TO-RIGHT MARK character which forces
+  ;; the header paragraph as left-to-right text.
+  (insert (propertize (string ?\x200e) 'invisible t)))
 (insert (notmuch-show-spaces-n (* notmuch-show-indent-messages-width 
depth))
-   (notmuch-sanitize
-(notmuch-show-clean-address (plist-get headers :From)))
+   from
" ("
date
") ("
-- 
2.20.1
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Emacs tests timeout with Emacs 27.1 (release candidate)

2020-08-06 Thread Jack Hill

On Thu, 6 Aug 2020, Jack Hill wrote:


Ahoy notmuch!

I'm tryihng to build notmuch 0.30 with the Emacs 27.1 release candidate. 
However, the Emacs tests seem to get stuck:


Oops, now I see that there has already been some work  in this area. Sorry 
for the noise.


Best,
Jack
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Emacs tests timeout with Emacs 27.1 (release candidate)

2020-08-06 Thread Jack Hill

Ahoy notmuch!

I'm tryihng to build notmuch 0.30 with the Emacs 27.1 release candidate. 
However, the Emacs tests seem to get stuck:


T310-emacs: Testing emacs interface
 PASS   Syntax of emacs test library
 PASS   Basic notmuch-hello view in emacs
 PASS   Saved search with 0 results
 PASS   No saved searches displayed (all with 0 results)
 PASS   Basic notmuch-search view in emacs
 PASS   Incremental parsing of search results
 PASS   Navigation of notmuch-hello to search results
 PASS   Basic notmuch-show view in emacs
 PASS   Basic notmuch-show view in emacs default indentation
 PASS   Basic notmuch-show view in emacs without indentation
 PASS   Basic notmuch-show view in emacs with fourfold indentation
 PASS   notmuch-show for message with invalid From
 PASS   Navigation of notmuch-search to thread view
 PASS   Add tag from search view
 PASS   Remove tag from search view
 PASS   Add tag (large query)
 PASS   notmuch-show: add single tag to single message
 PASS   notmuch-show: remove single tag from single message
 PASS   notmuch-show: add multiple tags to single message
 PASS   notmuch-show: remove multiple tags from single message
 PASS   Message with .. in Message-Id:
 PASS   Message with quote in Message-Id:
FATAL: /tmp/guix-build-notmuch-0.30.drv-0/notmuch-0.30/test/T310-emacs.sh: 
interrupted by signal 15

Notmuch test suite complete.
All 536 tests passed.
2 tests skipped.
ERROR: Aborting on T310-emacs (returned 124)
make: *** [test/Makefile.local:75: test] Error 124

Test suite failed, dumping logs.
command "make" "check" "-j" "4" "V=1" "NOTMUCH_TEST_TIMEOUT=1h" failed with 
status 2

Best,
Jack
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH v4] Emacs: Force left-to-right display for message headers

2020-08-06 Thread Teemu Likonen
* 2020-08-06 17:50:36+03, Teemu Likonen wrote:

> But here is another idea for the whole thing: When displaying a message
> in notmuch-show buffer check if message's From header has any
> right-to-left characters and only if it does add invisible U+200E
> character at the beginning, otherwise don't bother. This way those tests
> probably won't be affected. What do you think?
>
> Below is a quick try on the top of my previous (v4) patch. I'll do a
> proper patch later.

Better version which is not based on any patches but the Git version:


diff --git c/emacs/notmuch-show.el w/emacs/notmuch-show.el
index c9170466..0eb27e33 100644
--- c/emacs/notmuch-show.el
+++ w/emacs/notmuch-show.el
@@ -466,10 +466,16 @@ unchanged ADDRESS if parsing fails."
 (defun notmuch-show-insert-headerline (headers date tags depth)
   "Insert a notmuch style headerline based on HEADERS for a
 message at DEPTH in the current thread."
-  (let ((start (point)))
+  (let ((start (point))
+   (from (notmuch-sanitize
+  (notmuch-show-clean-address (plist-get headers :From)
+(when (string-match "\\cR" from)
+  ;; If the From header has a right-to-left character add
+  ;; invisible U+200E LEFT-TO-RIGHT MARK character which forces
+  ;; the header paragraph as left-to-right text.
+  (insert (propertize (string ?\x200e) 'invisible t)))
 (insert (notmuch-show-spaces-n (* notmuch-show-indent-messages-width 
depth))
-   (notmuch-sanitize
-(notmuch-show-clean-address (plist-get headers :From)))
+   from
" ("
date
") ("

-- 
/// Teemu Likonen - .-.. http://www.iki.fi/tlikonen/
// OpenPGP: 4E1055DC84E9DFF613D78557719D69D324539450


signature.asc
Description: PGP signature
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH v4] Emacs: Force left-to-right display for message headers

2020-08-06 Thread Teemu Likonen
* 2020-08-06 09:04:50-03, David Bremner wrote:

> This causes 10 tests to fail for me. At a guess, the added
> LEFT-TO-RIGHT MARK should probably be stripped out in the test
> framework. Either that or added to test output files. The latter
> sounds easy to miss when editing.

For the first time I ran the tests and got over 60 test fails. :-) I'm
probably doing something wrong and have to study the test framework
better.

I don't know which tests are related to the U+200E LEFT-TO-RIGHT MARK
patch but if test output files are representing the content of
notmuch-show-mode buffer then I think U+200E belongs in those expected
output files, even if the character is invisible.

But here is another idea for the whole thing: When displaying a message
in notmuch-show buffer check if message's From header has any
right-to-left characters and only if it does add invisible U+200E
character at the beginning, otherwise don't bother. This way those tests
probably won't be affected. What do you think?

Below is a quick try on the top of my previous (v4) patch. I'll do a
proper patch later.


diff --git i/emacs/notmuch-show.el w/emacs/notmuch-show.el
index 6548891f..6b7d70d9 100644
--- i/emacs/notmuch-show.el
+++ w/emacs/notmuch-show.el
@@ -465,22 +465,23 @@ unchanged ADDRESS if parsing fails."
 
 (defun notmuch-show-insert-headerline (headers date tags depth)
   "Insert a notmuch style headerline based on HEADERS for a
 message at DEPTH in the current thread."
-  (let ((start (point)))
-(insert (propertize (string ?\x200e) 'invisible t)
-   ;; Add invisible U+200E LEFT-TO-RIGHT MARK character (see
-   ;; above) to force the header paragraph as left-to-right
-   ;; text even if the header content started with
-   ;; right-to-left characters.
-   (notmuch-show-spaces-n (* notmuch-show-indent-messages-width depth))
-   (notmuch-sanitize
-(notmuch-show-clean-address (plist-get headers :From)))
-   " ("
-   date
-   ") ("
-   (notmuch-tag-format-tags tags tags)
-   ")\n")
+  (let ((start (point))
+(from (notmuch-sanitize
+   (notmuch-show-clean-address (plist-get headers :From)
+(insert (when (string-match "\\cR" from)
+  ;; If the From header has a right-to-left character add
+  ;; invisible U+200E LEFT-TO-RIGHT MARK character which
+  ;; forces the header paragraph as left-to-right text.
+  (propertize (string ?\x200e) 'invisible t))
+(notmuch-show-spaces-n (* notmuch-show-indent-messages-width 
depth))
+from
+" ("
+date
+") ("
+(notmuch-tag-format-tags tags tags)
+")\n")
 (overlay-put (make-overlay start (point)) 'face 
'notmuch-message-summary-face)))
 
 (defun notmuch-show-insert-header (header header-value)
   "Insert a single header."


-- 
/// Teemu Likonen - .-.. http://www.iki.fi/tlikonen/
// OpenPGP: 4E1055DC84E9DFF613D78557719D69D324539450


signature.asc
Description: PGP signature
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH v2 06/23] emacs: Use cl-incf where appropriate

2020-08-06 Thread Jonas Bernoulli
David Bremner  writes:
> "cl-incf is a Lisp macro in ‘aquamacs-tools.el’."
>
> What the actual heck?

Indeed.  Did you follow the link to the definition to figure out what's
going on?

Ah... I found this: https://github.com/dholm/tabbar/commit/6d5a6935879.
IMO it's wrong to do that, but that is of no concern here.

> Anyway, that aside, what version of emacs is this available from?

Emacs 24.3.  A forward compatibility implementation for older versions
is available at https://elpa.gnu.org/packages/cl-lib.html.

I didn't find any information about what minimal Emacs version Notmuch
expects but https://notmuchmail.org/emacstips/#index1h2 implies that it
is 24.1.

IMO it would be reasonable to expect at least 24.3, 24.5 or even 25.1.
See https://www.gnu.org/software/emacs/history.html for release dates.

Or you might want to just drop this commit.  Or we could update the FAQ
to mention that one has to install cl-lib from GNU ELPA if one uses such
an ancient Emacs release.

 Jonas
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH v4] Emacs: Force left-to-right display for message headers

2020-08-06 Thread David Bremner
Teemu Likonen  writes:

> Insert invisible U+200E LEFT-TO-RIGHT MARK character at the beginning
> of message header paragraph in notmuch-show buffer. The U+200E
> character forces the header paragraph as left-to-right text even if
> the header content started with right-to-left characters.
>
> See Emacs Lisp reference manual section "(elisp) Bidirectional
> Display" for more info.

This causes 10 tests to fail for me. At a guess, the added LEFT-TO-RIGHT MARK
should probably be stripped out in the test framework. Either that or
added to test output files. The latter sounds easy to miss when editing.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH v2 06/23] emacs: Use cl-incf where appropriate

2020-08-06 Thread David Bremner
Jonas Bernoulli  writes:

> It's shorter.  That's it pretty much.
> ---
>  emacs/notmuch-hello.el | 2 +-
>  emacs/notmuch-lib.el   | 2 +-

"cl-incf is a Lisp macro in ‘aquamacs-tools.el’."

What the actual heck?

Anyway, that aside, what version of emacs is this available from?

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 21/23] Fix typos

2020-08-06 Thread Jonas Bernoulli
---
 NEWS   |  2 +-
 bindings/python-cffi/notmuch2/__init__.py  |  2 +-
 bindings/python-cffi/notmuch2/_base.py |  6 +++---
 bindings/python-cffi/notmuch2/_database.py |  8 
 bindings/python-cffi/notmuch2/_message.py  |  4 ++--
 bindings/python-cffi/notmuch2/_tags.py |  8 
 bindings/python-cffi/tests/conftest.py |  2 +-
 bindings/python/notmuch/database.py| 12 ++--
 bindings/python/notmuch/query.py   |  2 +-
 emacs/notmuch-crypto.el|  2 +-
 emacs/notmuch-lib.el   |  2 +-
 emacs/notmuch-mua.el   |  2 +-
 lib/notmuch.h  |  4 ++--
 tag-util.c |  2 +-
 tag-util.h |  2 +-
 test/T610-message-property.sh  |  2 +-
 test/T710-message-id.sh|  2 +-
 test/random-corpus.c   |  2 +-
 test/test-lib.el   |  2 +-
 19 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/NEWS b/NEWS
index 0d8b930f..9f0db031 100644
--- a/NEWS
+++ b/NEWS
@@ -116,7 +116,7 @@ information about cryptographic protections for the Subject 
header.
 Emacs
 -
 
-Optionally check for missing attachements in outgoing messages (see
+Optionally check for missing attachments in outgoing messages (see
 function `notmuch-mua-attachment-check`).
 
 Bind `B` to browse URLs in current message.
diff --git a/bindings/python-cffi/notmuch2/__init__.py 
b/bindings/python-cffi/notmuch2/__init__.py
index 613317e0..f281edc1 100644
--- a/bindings/python-cffi/notmuch2/__init__.py
+++ b/bindings/python-cffi/notmuch2/__init__.py
@@ -10,7 +10,7 @@ should consider their signatures implementation details.
 Errors
 ==
 
-All errors occuring due to errors from the underlying notmuch database
+All errors occurring due to errors from the underlying notmuch database
 are subclasses of the :exc:`NotmuchError`.  Due to memory management
 it is possible to try and use an object after it has been freed.  In
 this case a :exc:`ObjectDestroyedError` will be raised.
diff --git a/bindings/python-cffi/notmuch2/_base.py 
b/bindings/python-cffi/notmuch2/_base.py
index 31258149..1cf03c88 100644
--- a/bindings/python-cffi/notmuch2/_base.py
+++ b/bindings/python-cffi/notmuch2/_base.py
@@ -29,7 +29,7 @@ class NotmuchObject(metaclass=abc.ABCMeta):
 However during some peculiar situations, e.g. interpreter
 shutdown, it is possible for the :meth:`__del__` method to have
 been called, whele there are still references to an object.  This
-could result in child objects asking their memeory to be freed
+could result in child objects asking their memory to be freed
 after the parent has already freed the memory, making things
 rather unhappy as double frees are not taken lightly in C.  To
 handle this case all objects need to follow the same protocol to
@@ -73,7 +73,7 @@ class NotmuchObject(metaclass=abc.ABCMeta):
 def _destroy(self):
 """Destroy the object, freeing all memory.
 
-This method needs to destory the object on the
+This method needs to destroy the object on the
 libnotmuch-level.  It must ensure it's not been destroyed by
 it's parent object yet before doing so.  It also must be
 idempotent.
@@ -134,7 +134,7 @@ class BinString(str):
 
 Most data in libnotmuch should be valid ASCII or valid UTF-8.
 However since it is a C library these are represented as
-bytestrings intead which means on an API level we can not
+bytestrings instead which means on an API level we can not
 guarantee that decoding this to UTF-8 will both succeed and be
 lossless.  This string type converts bytes to unicode in a lossy
 way, but also makes the raw bytes available.
diff --git a/bindings/python-cffi/notmuch2/_database.py 
b/bindings/python-cffi/notmuch2/_database.py
index 7db5a7f8..5ab0f20a 100644
--- a/bindings/python-cffi/notmuch2/_database.py
+++ b/bindings/python-cffi/notmuch2/_database.py
@@ -422,7 +422,7 @@ class Database(base.NotmuchObject):
of it as ``dup = db.remove_message(name); if dup: ...``.
 :rtype: bool
 
-:raises XapianError: A Xapian exception ocurred.
+:raises XapianError: A Xapian exception occurred.
 :raises ReadOnlyDatabaseError: The database is opened in
READ_ONLY mode.
 :raises UpgradeRequiredError: The database must be upgraded
@@ -458,7 +458,7 @@ class Database(base.NotmuchObject):
 :raises LookupError: If no message was found.
 :raises OutOfMemoryError: When there is no memory to allocate
the message instance.
-:raises XapianError: A Xapian exception ocurred.
+:raises XapianError: A Xapian exception occurred.
 :raises ObjectDestroyedError: if used after destroyed.
 """
 msg_pp = capi.ffi.new('notmuch_message_t **')
@@ -4

[PATCH v2 09/23] emacs: Use 'when' instead of 'if' when there is no ELSE part

2020-08-06 Thread Jonas Bernoulli
---
 emacs/notmuch-address.el |   8 ++--
 emacs/notmuch-compat.el  |   6 +--
 emacs/notmuch-hello.el   |   8 ++--
 emacs/notmuch-jump.el|  54 ++---
 emacs/notmuch-lib.el |  10 ++--
 emacs/notmuch-mua.el |  24 +-
 emacs/notmuch-query.el   |   4 +-
 emacs/notmuch-show.el|  93 ++--
 emacs/notmuch-tree.el|  30 ++--
 emacs/notmuch-wash.el|  68 +-
 emacs/notmuch.el | 100 +++
 test/test-lib.el |   4 +-
 12 files changed, 206 insertions(+), 203 deletions(-)

diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
index 2dd08661..85531489 100644
--- a/emacs/notmuch-address.el
+++ b/emacs/notmuch-address.el
@@ -171,10 +171,10 @@ (defun notmuch-address-toggle-internal-completion ()
   (if (local-variable-p 'notmuch-address-command)
   (kill-local-variable 'notmuch-address-command)
 (notmuch-setq-local notmuch-address-command 'internal))
-  (if (boundp 'company-idle-delay)
-  (if (local-variable-p 'company-idle-delay)
- (kill-local-variable 'company-idle-delay)
-   (notmuch-setq-local company-idle-delay nil
+  (when (boundp 'company-idle-delay)
+(if (local-variable-p 'company-idle-delay)
+   (kill-local-variable 'company-idle-delay)
+  (notmuch-setq-local company-idle-delay nil
 
 (defun notmuch-address-matching (substring)
   "Returns a list of completion candidates matching SUBSTRING.
diff --git a/emacs/notmuch-compat.el b/emacs/notmuch-compat.el
index 388ef70f..3340918f 100644
--- a/emacs/notmuch-compat.el
+++ b/emacs/notmuch-compat.el
@@ -68,9 +68,9 @@ (if (fboundp 'read-char-choice)
   ;; This is an inlined copy of help-form-show as that
   ;; was introduced in emacs 24 too.
   (let ((msg (eval help-form)))
-(if (stringp msg)
-(with-output-to-temp-buffer " *Char Help*"
-  (princ msg))
+(when (stringp msg)
+  (with-output-to-temp-buffer " *Char Help*"
+(princ msg))
 ((memq char chars)
  (setq done t))
 ((and executing-kbd-macro (= char -1))
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 25e28a52..3127de86 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -589,8 +589,8 @@ (defun notmuch-hello-insert-buttons (searches)
 (mapc (lambda (elem)
;; (not elem) indicates an empty slot in the matrix.
(when elem
- (if (> column-indent 0)
- (widget-insert (make-string column-indent ? )))
+ (when (> column-indent 0)
+   (widget-insert (make-string column-indent ? )))
  (let* ((name (plist-get elem :name))
 (query (plist-get elem :query))
 (oldest-first (cl-case (plist-get elem :sort-order)
@@ -890,8 +890,8 @@ (defun notmuch-hello-insert-searches (title query-list 
&rest options)
the same values as :filter. If :filter and :filter-count are specified, this
will be used instead of :filter, not in conjunction with it."
   (widget-insert title ": ")
-  (if (and notmuch-hello-first-run (plist-get options :initially-hidden))
-  (add-to-list 'notmuch-hello-hidden-sections title))
+  (when (and notmuch-hello-first-run (plist-get options :initially-hidden))
+(add-to-list 'notmuch-hello-hidden-sections title))
   (let ((is-hidden (member title notmuch-hello-hidden-sections))
(start (point)))
 (if is-hidden
diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el
index adf79650..e302fe00 100644
--- a/emacs/notmuch-jump.el
+++ b/emacs/notmuch-jump.el
@@ -169,37 +169,37 @@ (defun notmuch-jump--make-keymap (action-map prompt)
   (let ((map (make-sparse-keymap)))
 (set-keymap-parent map notmuch-jump-minibuffer-map)
 (pcase-dolist (`(,key ,name ,fn) action-map)
-  (if (= (length key) 1)
- (define-key map key
-   `(lambda () (interactive)
-  (setq notmuch-jump--action ',fn)
-  (exit-minibuffer)
+  (when (= (length key) 1)
+   (define-key map key
+ `(lambda () (interactive)
+(setq notmuch-jump--action ',fn)
+(exit-minibuffer)
 ;; By doing this in two passes (and checking if we already have a
 ;; binding) we avoid problems if the user specifies a binding which
 ;; is a prefix of another binding.
 (pcase-dolist (`(,key ,name ,fn) action-map)
-  (if (> (length key) 1)
- (let* ((key (elt key 0))
-(keystr (string key))
-(new-prompt (concat prompt (format-kbd-macro keystr) " "))
-(action-submap nil))
-   (unless (lookup-key map keystr)
- (pcase-dolist (`(,k ,n ,f) action-map)
-   (when (= key (elt k 0))
-  

[PATCH v2 23/23] test: Fix indentation

2020-08-06 Thread Jonas Bernoulli
Fix it to consistently match the style we have configured in
".dir-locals.el".
---
 test/test-lib.sh | 36 ++--
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/test/test-lib.sh b/test/test-lib.sh
index 31c858d1..167fa621 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -136,16 +136,16 @@ add_gpgsm_home ()
 at_exit_function _gnupg_exit
 mkdir -p -m 0700 "$GNUPGHOME"
 openssl pkcs12 -export -passout pass: -inkey 
"$NOTMUCH_SRCDIR/test/smime/key+cert.pem" \
-< "$NOTMUCH_SRCDIR/test/smime/test.crt" | \
-gpgsm --batch --no-tty --no-common-certs-import 
--pinentry-mode=loopback --passphrase-fd 3 \
-  --disable-dirmngr --import  >"$GNUPGHOME"/import.log 2>&1 3<<<''
+   < "$NOTMUCH_SRCDIR/test/smime/test.crt" | \
+   gpgsm --batch --no-tty --no-common-certs-import 
--pinentry-mode=loopback --passphrase-fd 3 \
+ --disable-dirmngr --import  >"$GNUPGHOME"/import.log 2>&1 3<<<''
 fpr=$(gpgsm --batch --list-key test_su...@notmuchmail.org | sed -n 
's/.*fingerprint: //p')
 echo "$fpr S relax" >> "$GNUPGHOME/trustlist.txt"
 gpgsm --quiet --batch --no-tty --no-common-certs-import --disable-dirmngr 
--import < $NOTMUCH_SRCDIR/test/smime/ca.crt
 echo "4D:E0:FF:63:C0:E9:EC:01:29:11:C8:7A:EE:DA:3A:9A:7F:6E:C1:0D S" >> 
"$GNUPGHOME/trustlist.txt"
 printf '%s::1\n' include-certs disable-crl-checks | gpgconf --output 
/dev/null --change-options gpgsm
 gpgsm --batch --no-tty --no-common-certs-import --pinentry-mode=loopback 
--passphrase-fd 3 \
-  --disable-dirmngr --import "$NOTMUCH_SRCDIR/test/smime/bob.p12" 
>>"$GNUPGHOME"/import.log 2>&1 3<<<''
+ --disable-dirmngr --import "$NOTMUCH_SRCDIR/test/smime/bob.p12" 
>>"$GNUPGHOME"/import.log 2>&1 3<<<''
 test_debug "cat $GNUPGHOME/import.log"
 }
 
@@ -394,8 +394,8 @@ emacs_fcc_message ()
 local nmn_args subject body
 nmn_args=''
 while [[ "$1" =~ ^-- ]]; do
-nmn_args="$nmn_args $1"
-shift
+   nmn_args="$nmn_args $1"
+   shift
 done
 subject="$1"
 body="$2"
@@ -405,7 +405,7 @@ emacs_fcc_message ()
 
 test_emacs \
"(let ((message-send-mail-function (lambda () t))
-   (mail-host-address \"example.com\"))
+  (mail-host-address \"example.com\"))
   (notmuch-mua-mail)
   (message-goto-to)
   (insert \"test_su...@notmuchmail.org\nDate: 01 Jan 2000 12:00:00 
-\")
@@ -524,9 +524,9 @@ test_expect_equal_json () {
 # override Python's stdio encoding defaults.
 script='import json, sys; json.dump(json.load(sys.stdin), sys.stdout, 
sort_keys=True, indent=4)'
 output=$(echo "$1" | PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -c "$script" \
-|| echo "$1")
+   || echo "$1")
 expected=$(echo "$2" | PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -c "$script" 
\
-|| echo "$2")
+   || echo "$2")
 shift 2
 test_expect_equal "$output" "$expected" "$@"
 }
@@ -540,15 +540,15 @@ test_valid_json () {
 # Sort the top-level list of JSON data from stdin.
 test_sort_json () {
 PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -c \
-"import sys, json; json.dump(sorted(json.load(sys.stdin)),sys.stdout)"
+   "import sys, json; json.dump(sorted(json.load(sys.stdin)),sys.stdout)"
 }
 
 # test for json objects:
 # read the source of test/json_check_nodes.py (or the output when
 # invoking it without arguments) for an explanation of the syntax.
 test_json_nodes () {
-local output
-exec 1>&6 2>&7 # Restore stdout and stderr
+   local output
+   exec 1>&6 2>&7  # Restore stdout and stderr
if [ -z "$inside_subtest" ]; then
error "bug in the test script: test_json_eval without 
test_begin_subtest"
fi
@@ -662,7 +662,7 @@ notmuch_json_show_sanitize ()
-e 's|"filename": "signature.asc",||g' \
-e 's|"filename": \["/[^"]*"\],|"filename": \["Y"\],|g' \
-e 's|"timestamp": 97...|"timestamp": 42|g' \
--e 's|"content-length": [1-9][0-9]*|"content-length": "NONZERO"|g'
+   -e 's|"content-length": [1-9][0-9]*|"content-length": "NONZERO"|g'
 }
 
 notmuch_emacs_error_sanitize ()
@@ -673,7 +673,7 @@ notmuch_emacs_error_sanitize ()
 for file in "$@"; do
echo "=== $file ==="
cat "$file"
-done | sed  \
+done | sed \
-e 's/^\[.*\]$/[XXX]/' \
-e "s|^\(command: \)\{0,1\}/.*/$command|\1YYY/$command|"
 }
@@ -929,8 +929,8 @@ test_expect_code () {
 # but is a prefix that can be used in the test script, like:
 #
 #  test_expect_success 'complain and die' '
-#   do something &&
-#   do something else &&
+#  do something &&
+#  do something else &&
 #  test_must_fail git checkout ../outerspace
 #  '
 #
@@ -1020,8 +1020,8 @@ export NOTMUCH_CONFIG=$NOTMUCH_CONFIG
 
 # Here's what we are using here:
 #
-# --quick  Use minimal

[PATCH v2 19/23] emacs: Various cosmetic changes

2020-08-06 Thread Jonas Bernoulli
---
 emacs/make-deps.el  |  3 ++-
 emacs/notmuch-lib.el|  8 +++-
 emacs/notmuch-parser.el |  9 +++--
 emacs/notmuch-show.el   | 18 +++---
 emacs/rstdoc.el |  9 -
 test/test-lib.el| 31 +++
 6 files changed, 34 insertions(+), 44 deletions(-)

diff --git a/emacs/make-deps.el b/emacs/make-deps.el
index dcac319c..91f4ef3d 100644
--- a/emacs/make-deps.el
+++ b/emacs/make-deps.el
@@ -36,7 +36,8 @@ (defun make-deps (&optional dir)
 This prints make dependencies to `standard-output' based on the
 top-level `require' expressions in the current buffer.  Paths in
 rules will be given relative to DIR, or `default-directory'."
-  (setq dir (or dir default-directory))
+  (unless dir
+(setq dir default-directory))
   (save-excursion
 (goto-char (point-min))
 (condition-case nil
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 549161f3..a057140f 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -53,9 +53,8 @@ (defgroup notmuch-show nil
 
 (defgroup notmuch-send nil
   "Sending messages from Notmuch."
-  :group 'notmuch)
-
-(custom-add-to-group 'notmuch-send 'message 'custom-group)
+  :group 'notmuch
+  :group 'message)
 
 (defgroup notmuch-tag nil
   "Tags and tagging in Notmuch."
@@ -782,8 +781,7 @@ (defun notmuch-logged-error (msg &optional extra)
(insert extra)
(unless (bolp)
  (newline)
-  (error "%s"
-(concat msg (and extra " (see *Notmuch errors* for more details)"
+  (error "%s%s" msg (if extra " (see *Notmuch errors* for more details)" "")))
 
 (defun notmuch-check-async-exit-status (proc msg &optional command err)
   "If PROC exited abnormally, pop up an error buffer and signal an error.
diff --git a/emacs/notmuch-parser.el b/emacs/notmuch-parser.el
index fbcfc2ef..3aa5bd8f 100644
--- a/emacs/notmuch-parser.el
+++ b/emacs/notmuch-parser.el
@@ -39,12 +39,9 @@ (defun notmuch-sexp-create-parser ()
 buffer.  Hence, the caller is allowed to delete any data before
 point and may resynchronize after an error by moving point."
   (vector 'notmuch-sexp-parser
- ;; List depth
- 0
- ;; Partial parse position marker
- nil
- ;; Partial parse state
- nil))
+ 0 ; List depth
+ nil   ; Partial parse position marker
+ nil)) ; Partial parse state
 
 (defmacro notmuch-sexp--depth (sp) `(aref ,sp 1))
 (defmacro notmuch-sexp--partial-pos (sp)   `(aref ,sp 2))
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 015edb0c..5640346f 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -499,21 +499,17 @@ (define-button-type 'notmuch-show-part-button-type
 
 (defun notmuch-show-insert-part-header (nth content-type declared-type
&optional name comment)
-  (let ((button)
-   (base-label (concat (and name (concat name ": "))
+  (let ((base-label (concat (and name (concat name ": "))
declared-type
(and (not (string-equal declared-type content-type))
 (concat " (as " content-type ")"))
comment)))
-(setq button
- (insert-button
-  (concat "[ " base-label " ]")
-  :base-label base-label
-  :type 'notmuch-show-part-button-type
-  :notmuch-part-hidden nil))
-(insert "\n")
-;; return button
-button))
+(prog1 (insert-button
+   (concat "[ " base-label " ]")
+   :base-label base-label
+   :type 'notmuch-show-part-button-type
+   :notmuch-part-hidden nil)
+  (insert "\n"
 
 (defun notmuch-show-toggle-part-invisibility (&optional button)
   (interactive)
diff --git a/emacs/rstdoc.el b/emacs/rstdoc.el
index 92a337c8..41390bbe 100644
--- a/emacs/rstdoc.el
+++ b/emacs/rstdoc.el
@@ -24,7 +24,6 @@
 ;;
 
 ;;; Commentary:
-;;
 
 ;; Rstdoc provides a facility to extract all of the docstrings defined in
 ;; an elisp source file. Usage:
@@ -68,10 +67,10 @@ (defun rstdoc--insert-docstring (symbol docstring)
   (insert "\n"))
 
 (defvar rst--escape-alist
-  '( ("='" . "'")
- ("\\([^\\]\\)'" . "\\1`")
- ("^[[:space:]\t]*$" . "|br|")
- ("^[[:space:]\t]" . "|indent| "))
+  '(("='" . "'")
+("\\([^\\]\\)'" . "\\1`")
+("^[[:space:]\t]*$" . "|br|")
+("^[[:space:]\t]" . "|indent| "))
   "List of (regex . replacement) pairs.")
 
 (defun rstdoc--rst-quote-string (str)
diff --git a/test/test-lib.el b/test/test-lib.el
index 6a39bbe2..e9e7c379 100644
--- a/test/test-lib.el
+++ b/test/test-lib.el
@@ -154,22 +154,21 @@ (defun notmuch-test-report-unexpected (output expected)
 
 (defun notmuch-test-expect-equal (output expected)
   "Compare OUTPUT with EXPECTED. Report any discrepencies."
-  (if (equal output expected)
-  t
-(cond
- ((and (listp output)
-  (listp expected))
-  ;; Reporting the dif

[PATCH v2 20/23] emacs: Increase consistency of library headers

2020-08-06 Thread Jonas Bernoulli
---
 emacs/notmuch-company.el | 36 +++--
 emacs/notmuch-compat.el  | 15 ++
 emacs/notmuch-crypto.el  |  2 +-
 emacs/notmuch-lib.el |  2 --
 emacs/notmuch-maildir-fcc.el | 39 ++--
 emacs/notmuch-print.el   |  2 +-
 emacs/notmuch-show.el|  2 +-
 emacs/notmuch-tree.el|  2 +-
 emacs/notmuch.el |  2 +-
 9 files changed, 60 insertions(+), 42 deletions(-)

diff --git a/emacs/notmuch-company.el b/emacs/notmuch-company.el
index c1f3594e..88b1c533 100644
--- a/emacs/notmuch-company.el
+++ b/emacs/notmuch-company.el
@@ -1,29 +1,35 @@
 ;;; notmuch-company.el --- Mail address completion for notmuch via 
company-mode  -*- lexical-binding: t -*-
 
-;; Authors: Trevor Jim 
-;; Michal Sojka 
+;; Copyright © Trevor Jim
+;; Copyright © Michal Sojka
 ;;
-;; Keywords: mail, completion
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
+;; This file is part of Notmuch.
+;;
+;; Notmuch is free software: you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
 ;; the Free Software Foundation, either version 3 of the License, or
 ;; (at your option) any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
+;;
+;; Notmuch is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+;;
 ;; You should have received a copy of the GNU General Public License
-;; along with this program.  If not, see .
+;; along with Notmuch.  If not, see .
+;;
+;; Authors: Trevor Jim 
+;; Michal Sojka 
+;;
+;; Keywords: mail, completion
 
 ;;; Commentary:
 
-;; To enable this, install company mode (https://company-mode.github.io/)
+;; Mail address completion for notmuch via company-mode.  To enable
+;; this, install company mode from .
 ;;
 ;; NB company-minimum-prefix-length defaults to 3 so you don't get
-;; completion unless you type 3 characters
+;; completion unless you type 3 characters.
 
 ;;; Code:
 
diff --git a/emacs/notmuch-compat.el b/emacs/notmuch-compat.el
index 3340918f..43b60ae3 100644
--- a/emacs/notmuch-compat.el
+++ b/emacs/notmuch-compat.el
@@ -3,6 +3,21 @@
 ;; The functions in this file are copied from more modern versions of
 ;; emacs and are Copyright (C) 1985-1986, 1992, 1994-1995, 1999-2017
 ;; Free Software Foundation, Inc.
+;;
+;; This file is part of Notmuch.
+;;
+;; Notmuch is free software: you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; Notmuch is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with Notmuch.  If not, see .
 
 
 ;; emacs master has a bugfix for folding long headers when sending
diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el
index e6bf8339..6df1dd64 100644
--- a/emacs/notmuch-crypto.el
+++ b/emacs/notmuch-crypto.el
@@ -1,4 +1,4 @@
-;;; notmuch-crypto.el --- functions for handling display of cryptographic 
metadata.
+;;; notmuch-crypto.el --- functions for handling display of cryptographic 
metadata
 ;;
 ;; Copyright © Jameson Rollins
 ;;
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index a057140f..dbdc99c1 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -19,8 +19,6 @@
 ;;
 ;; Authors: Carl Worth 
 
-;; This is an part of an emacs-based interface to the notmuch mail system.
-
 ;;; Code:
 
 (require 'cl-lib)
diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index 1027e1a7..aa07b26a 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -1,24 +1,23 @@
-;;; notmuch-maildir-fcc.el ---
-
-;; This file is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published
-;; by the Free Software Foundation; either version 2, or (at your
-;; option) any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; with

[PATCH v2 18/23] emacs: Autoload notmuch-jump using an autoload cookie

2020-08-06 Thread Jonas Bernoulli
Doing that is better than using an `autoload' form because the latter
may result in dependencies getting hidden and indeed it turns out we
have to declare `notmuch-jump' in "notmuch-tag.el".
---
 emacs/notmuch-jump.el | 1 +
 emacs/notmuch-tag.el  | 3 +--
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el
index e302fe00..1e2d0497 100644
--- a/emacs/notmuch-jump.el
+++ b/emacs/notmuch-jump.el
@@ -73,6 +73,7 @@ (defun notmuch-jump-search ()
 
 (defvar notmuch-jump--action nil)
 
+;;;###autoload
 (defun notmuch-jump (action-map prompt)
   "Interactively prompt for one of the keys in ACTION-MAP.
 
diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el
index 1cef17e1..ccc1321f 100644
--- a/emacs/notmuch-tag.el
+++ b/emacs/notmuch-tag.el
@@ -36,8 +36,7 @@ (declare-function notmuch-search-tag "notmuch"
  (tag-changes &optional beg end only-matched))
 (declare-function notmuch-show-tag "notmuch-show" (tag-changes))
 (declare-function notmuch-tree-tag "notmuch-tree" (tag-changes))
-
-(autoload 'notmuch-jump "notmuch-jump")
+(declare-function notmuch-jump "notmuch-jump" (action-map prompt))
 
 (define-widget 'notmuch-tag-key-type 'list
   "A single key tagging binding."
-- 
2.28.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 13/23] emacs: No longer define notmuch-hello-mode-map as a function

2020-08-06 Thread Jonas Bernoulli
It was defined as such for a decade; ever since
a56010ac8b89a2489eee5c78469f05cee85ec858 but there
wasn't a reason to do that then nor is there now.
---
 emacs/notmuch-hello.el | 1 -
 1 file changed, 1 deletion(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 3127de86..c127bba9 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -687,7 +687,6 @@ (defvar notmuch-hello-mode-map
 (define-key map (kbd "") 'widget-backward)
 map)
   "Keymap for \"notmuch hello\" buffers.")
-(fset 'notmuch-hello-mode-map notmuch-hello-mode-map)
 
 (define-derived-mode notmuch-hello-mode fundamental-mode "notmuch-hello"
   "Major mode for convenient notmuch navigation. This is your entry portal 
into notmuch.
-- 
2.28.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 02/23] emacs: Remove excess empty lines

2020-08-06 Thread Jonas Bernoulli
Most people who write lots of lisp tend to only sparsely use empty
"separator" lines within forms.  In lisp they feel unnecessary and
since most files stick to this convention we get a bit confused
when there are extra empty lines.  It feels like the s-expressions
are falling into pieces.

All of this is especially true between a function's doc-string and
body because the doc-string is colored differently, which visually
already separates it quite sufficiently from the code that follows.
---
 emacs/make-deps.el   |  2 -
 emacs/notmuch-address.el |  2 -
 emacs/notmuch-crypto.el  |  4 --
 emacs/notmuch-hello.el   | 18 -
 emacs/notmuch-jump.el|  5 ---
 emacs/notmuch-lib.el | 10 -
 emacs/notmuch-maildir-fcc.el |  7 
 emacs/notmuch-mua.el | 26 -
 emacs/notmuch-parser.el  |  5 ---
 emacs/notmuch-show.el| 75 ++--
 emacs/notmuch-tag.el |  3 --
 emacs/notmuch-tree.el|  9 -
 emacs/notmuch-wash.el| 18 +
 emacs/notmuch.el |  7 
 14 files changed, 5 insertions(+), 186 deletions(-)

diff --git a/emacs/make-deps.el b/emacs/make-deps.el
index 5b6db698..dcac319c 100644
--- a/emacs/make-deps.el
+++ b/emacs/make-deps.el
@@ -23,7 +23,6 @@
 
 (defun batch-make-deps ()
   "Invoke `make-deps' for each file on the command line."
-
   (setq debug-on-error t)
   (dolist (file command-line-args-left)
 (let ((default-directory command-line-default-directory))
@@ -37,7 +36,6 @@ (defun make-deps (&optional dir)
 This prints make dependencies to `standard-output' based on the
 top-level `require' expressions in the current buffer.  Paths in
 rules will be given relative to DIR, or `default-directory'."
-
   (setq dir (or dir default-directory))
   (save-excursion
 (goto-char (point-min))
diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
index 2a9c411a..ca4da3f3 100644
--- a/emacs/notmuch-address.el
+++ b/emacs/notmuch-address.el
@@ -302,7 +302,6 @@ (defun notmuch-address-harvest (&optional addr-prefix 
synchronous callback)
 Address harvesting may take some time so the address collection runs
 asynchronously unless SYNCHRONOUS is t. In case of asynchronous
 execution, CALLBACK is called when harvesting finishes."
-
   (let* ((sent (eq (car notmuch-address-internal-completion) 'sent))
 (config-query (cadr notmuch-address-internal-completion))
 (prefix-query (when addr-prefix
@@ -335,7 +334,6 @@ (defun notmuch-address-harvest (&optional addr-prefix 
synchronous callback)
;; Kill any existing process
(when current-proc
  (kill-buffer (process-buffer current-proc))) ; this also kills the 
process
-
(setq current-proc
  (apply 'notmuch-start-notmuch proc-name proc-buf
 callback   ; process sentinel
diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el
index 2327ff1f..58947a20 100644
--- a/emacs/notmuch-crypto.el
+++ b/emacs/notmuch-crypto.el
@@ -123,17 +123,14 @@ (defun notmuch-crypto-insert-sigstatus-button (sigstatus 
from)
face 'notmuch-crypto-signature-good-key))
(setq button-action 'notmuch-crypto-sigstatus-good-callback
  help-msg (concat "Click to list key ID 0x" fingerprint "."
-
  ((string= status "error")
   (setq label (concat "Unknown key ID " keyid " or unsupported algorithm")
button-action 'notmuch-crypto-sigstatus-error-callback
help-msg (concat "Click to retrieve key ID " keyid
 " from keyserver.")))
-
  ((string= status "bad")
   (setq label (concat "Bad signature (claimed key ID " keyid ")")
face 'notmuch-crypto-signature-bad))
-
  (status
   (setq label (concat "Unknown signature status: " status)))
  (t
@@ -232,7 +229,6 @@ (defun notmuch-crypto-sigstatus-error-callback (button)
(process-put p :notmuch-show-buffer (current-buffer))
(process-put p :notmuch-show-point (point))
(message "Getting the GPG key %s asynchronously..." keyid)))
-
   (let ((window (display-buffer buffer)))
(with-selected-window window
  (with-current-buffer buffer
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 11c625ea..e71e55f3 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -150,7 +150,6 @@ (defcustom notmuch-saved-searches
 ;; The saved-search format is also used by the all-tags notmuch-hello
 ;; section. This section generates its own saved-search list in one of
 ;; the latter two forms.
-
   :get 'notmuch-hello--saved-searches-to-plist
   :type '(repeat notmuch-saved-search-plist)
   :tag "List of Saved Searches"
@@ -482,20 +481,17 @@ (defun notmuch-hello-tags-per-line (widest)
   ;; Count is 9 wide (8 digits plus space), 1 for the space
   ;; after the name.
   (+ 9 1 (max no

[PATCH v2 16/23] emacs: Improve doc-strings

2020-08-06 Thread Jonas Bernoulli
- The first sentence should fit on the first line in full.  This is
  even the case when that causes the line to get a bit long.  If it
  gets very long, then it should be made shorter.

- Even even the second sentence would fit on the first line, if it
  just provides some details, then it shouldn't be done.

- Symbols are quoted like `so'.

- There is no clear rule on how to (not) quote non-atomic
  s-expressions, but quoting like '(this) is definitely weird.

- It is a good idea to remember that \" becomes " and to take
  that in mind when adjusting the automatic filling by hand.

- Use the imperative form.

- Arguments are written in all uppercase.
---
 emacs/notmuch-address.el | 42 +---
 emacs/notmuch-query.el   | 19 +-
 emacs/notmuch-show.el|  4 ++--
 emacs/notmuch-tree.el|  5 +++--
 emacs/notmuch.el |  9 -
 emacs/rstdoc.el  |  6 +++---
 6 files changed, 43 insertions(+), 42 deletions(-)

diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
index 85531489..cd0ffb67 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).")
+  "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).")
 
 (defun notmuch-address--harvest-ready ()
   "Return t if there is a full address hash available.
@@ -54,9 +54,9 @@ (defcustom notmuch-address-command 'internal
 which must take a single argument (searched string) and output a
 list of completion candidates, one per line.
 
-Alternatively, it can be the symbol 'internal, in which case
+Alternatively, it can be the symbol `internal', in which case
 internal completion is used; the variable
-`notmuch-address-internal-completion` can be used to customize
+`notmuch-address-internal-completion' can be used to customize
 this case.
 
 Finally, if this variable is nil then address completion is
@@ -72,12 +72,12 @@ (defcustom notmuch-address-command 'internal
 (defcustom notmuch-address-internal-completion '(sent nil)
   "Determines how internal address completion generates candidates.
 
-This should be a list of the form '(DIRECTION FILTER), where
+This should be a list of the form (DIRECTION FILTER), where
 DIRECTION is either sent or received and specifies whether the
 candidates are searched in messages sent by the user or received
 by the user (note received by is much faster), and FILTER is
-either nil or a filter-string, such as \"date:1y..\" to append
-to the query."
+either nil or a filter-string, such as \"date:1y..\" to append to
+the query."
   :type '(list :tag "Use internal address completion"
   (radio
:tag "Base completion on messages you have"
@@ -101,8 +101,8 @@ (defcustom notmuch-address-save-filename nil
   "Filename to save the cached completion addresses.
 
 All the addresses notmuch uses for address completion will be
-cached in this file. This has obvious privacy implications so you
-should make sure it is not somewhere publicly readable."
+cached in this file.  This has obvious privacy implications so
+you should make sure it is not somewhere publicly readable."
   :type '(choice (const :tag "Off" nil)
 (file :tag "Filename"))
   :group 'notmuch-send
@@ -110,12 +110,14 @@ (defcustom notmuch-address-save-filename nil
   :group 'notmuch-external)
 
 (defcustom notmuch-address-selection-function 
'notmuch-address-selection-function
-  "The function to select address from given list. The function is
-called with PROMPT, COLLECTION, and INITIAL-INPUT as arguments
-(subset of what `completing-read' can be called with).
-While executed the value of `completion-ignore-case' is t.
-See documentation of function `notmuch-address-selection-function'
-to know how address selection is made by default."
+  "The function to select address from given list.
+
+The function is called with PROMPT, COLLECTION, and INITIAL-INPUT
+as arguments (subset of what `completing-read' can be called
+with).  While executed the value of `completion-ignore-case'
+is t.  See documentation of function
+`notmuch-address-selection-function' to know how address
+selection is made by default."
   :type 'function
   :group 'notmuch-send
   :group 'notmuch-address
@@ -188,9 +190,9 @@ (defun notmuch-address-matching (substring)
 candidates))
 
 (defun notmuch-address-options (original)
-  "Returns a list of completion candidates. Uses either
-elisp-based implementation or older implementation requiring
-external commands."
+  "Return a list of

[PATCH v2 08/23] emacs: Use 'unless' instead of 'when' and 'not'

2020-08-06 Thread Jonas Bernoulli
Also use 'unless' in a few cases where previously 'if' was used with
'not' but without an ELSE part.
---
 emacs/notmuch-hello.el  | 6 +++---
 emacs/notmuch-mua.el| 4 ++--
 emacs/notmuch-parser.el | 2 +-
 emacs/notmuch-show.el   | 3 +--
 emacs/notmuch-tag.el| 4 ++--
 emacs/notmuch-tree.el   | 8 
 emacs/notmuch.el| 4 ++--
 test/test-lib.el| 6 +++---
 8 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 1c084bf7..25e28a52 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -638,7 +638,7 @@ (defun notmuch-hello-window-configuration-change ()
 (dolist (window (window-list))
   (let ((last-buf (window-parameter window 'notmuch-hello-last-buffer))
(cur-buf (window-buffer window)))
-   (when (not (eq last-buf cur-buf))
+   (unless (eq last-buf cur-buf)
  ;; This window changed or is new.  Update recorded buffer
  ;; for next time.
  (set-window-parameter window 'notmuch-hello-last-buffer cur-buf)
@@ -652,7 +652,7 @@ (defun notmuch-hello-window-configuration-change ()
   ;; 24, we can't do it right here because something in this
   ;; hook's call stack overrides hello's point placement.
   (run-at-time nil nil #'notmuch-hello t))
-(when (null hello-buf)
+(unless hello-buf
   ;; Clean up hook
   (remove-hook 'window-configuration-change-hook
   #'notmuch-hello-window-configuration-change
@@ -908,7 +908,7 @@ (defun notmuch-hello-insert-searches (title query-list 
&rest options)
(notmuch-hello-update))
 "hide"))
 (widget-insert "\n")
-(when (not is-hidden)
+(unless is-hidden
   (let ((searches (apply 'notmuch-hello-query-counts query-list options)))
(when (or (not (plist-get options :hide-if-empty))
  searches)
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index f6d8ffc5..dc1f518c 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -198,7 +198,7 @@ (defun notmuch-mua-user-agent-emacs ()
 (defun notmuch-mua-add-more-hidden-headers ()
   "Add some headers to the list that are hidden by default."
   (mapc (lambda (header)
- (when (not (member header message-hidden-headers))
+ (unless (member header message-hidden-headers)
(push header message-hidden-headers)))
notmuch-mua-hidden-headers))
 
@@ -368,7 +368,7 @@ (defun notmuch-mua-mail (&optional to subject other-headers 
continue
   (interactive)
   (when notmuch-mua-user-agent-function
 (let ((user-agent (funcall notmuch-mua-user-agent-function)))
-  (when (not (string= "" user-agent))
+  (unless (string= "" user-agent)
(push (cons 'User-Agent user-agent) other-headers
   (unless (assq 'From other-headers)
 (push (cons 'From (message-make-from
diff --git a/emacs/notmuch-parser.el b/emacs/notmuch-parser.el
index 06e7487b..fbcfc2ef 100644
--- a/emacs/notmuch-parser.el
+++ b/emacs/notmuch-parser.el
@@ -78,7 +78,7 @@ (defun notmuch-sexp-read (sp)
 ;; parse, extend the partial parse to figure out when we
 ;; have a complete list.
 (catch 'return
-  (when (null (notmuch-sexp--partial-state sp))
+  (unless (notmuch-sexp--partial-state sp)
 (let ((start (point)))
   (condition-case nil
   (throw 'return (read (current-buffer)))
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 211be091..6102ca2e 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1060,8 +1060,7 @@ (defun notmuch-show-insert-msg (msg depth)
   ;; If the subject of this message is the same as that of the
   ;; previous message, don't display it when this message is
   ;; collapsed.
-  (when (not (string= notmuch-show-previous-subject
- bare-subject))
+  (unless (string= notmuch-show-previous-subject bare-subject)
(forward-line 1))
   (setq headers-start (point-marker)))
 (setq headers-end (point-marker))
diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el
index 2fcf5a9e..1067f185 100644
--- a/emacs/notmuch-tag.el
+++ b/emacs/notmuch-tag.el
@@ -382,8 +382,8 @@ (defun notmuch-tag-completions (&rest search-terms)
   "Return a list of tags for messages matching SEARCH-TERMS.
 
 Returns all tags if no search terms are given."
-  (if (null search-terms)
-  (setq search-terms (list "*")))
+  (unless search-terms
+(setq search-terms (list "*")))
   (split-string
(with-output-to-string
  (with-current-buffer standard-output
diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index 37a5d1c8..a5ae0edb 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -1063,10 +1063,10 @@ (defun notmuch-tree (&optional query query-context 
target buffer-name open-targe
   OPEN-TARGET: If TRUE open the target message in the message pane.
   UNTHREA

[PATCH v2 22/23] .dir-locals.el: Set variables for correct "shell" mode

2020-08-06 Thread Jonas Bernoulli
The major mode used for shell scripts is named 'sh-mode'.
'shell-mode' on the other hand implements an interactive
shell in emacs-lisp.
---
 .dir-locals.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.dir-locals.el b/.dir-locals.el
index fc75ae61..b3ddffe8 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -15,7 +15,7 @@ ((c-mode
  (emacs-lisp-mode
   (indent-tabs-mode . t)
   (tab-width . 8))
- (shell-mode
+ (sh-mode
   (indent-tabs-mode . t)
   (tab-width . 8)
   (sh-basic-offset . 4)
-- 
2.28.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 10/23] emacs: Use one or three lines for 'if' forms

2020-08-06 Thread Jonas Bernoulli
Putting the COND and THEN parts on the same line but ELSE on a
separate line makes it harder to determine if there actually is
an ELSE part.
---
 emacs/notmuch-lib.el  | 6 --
 emacs/notmuch-tag.el  | 3 ++-
 emacs/notmuch-tree.el | 3 ++-
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 6110e45d..fc76fd67 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -611,7 +611,8 @@ (defun notmuch--get-bodypart-raw (msg part process-crypto 
binaryp cache)
   ,@(and process-crypto '("--decrypt=true"))
   ,(notmuch-id-to-query (plist-get msg :id
   (coding-system-for-read
-   (if binaryp 'no-conversion
+   (if binaryp
+   'no-conversion
  (let ((coding-system
 (mm-charset-to-coding-system
  (plist-get part :content-charset
@@ -680,7 +681,8 @@ (defun notmuch-mm-display-part-inline (msg part 
content-type process-crypto)
   ;; `gnus-decoded' charset.  Otherwise, we'll fetch the binary
   ;; part content and let mm-* decode it.
   (let* ((have-content (plist-member part :content))
-(charset (if have-content 'gnus-decoded
+(charset (if have-content
+ 'gnus-decoded
(plist-get part :content-charset)))
 (handle (mm-make-handle (current-buffer)
 `(,content-type (charset . ,charset)
diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el
index 1067f185..e71de041 100644
--- a/emacs/notmuch-tag.el
+++ b/emacs/notmuch-tag.el
@@ -532,7 +532,8 @@ (defun notmuch-tag-jump (reverse)
   (and (symbolp name)
(symbol-name name
 (name-string (if name
- (if reverse (concat "Reverse " name)
+ (if reverse
+ (concat "Reverse " name)
name)
(mapconcat #'identity tag-change " "
(push (list key name-string
diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index 6a619ec2..b498db07 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -1009,7 +1009,8 @@ (defun notmuch-tree-worker (basic-query &optional 
query-context target open-targ
   (setq notmuch-tree-basic-query basic-query)
   (setq notmuch-tree-query-context (if (or (string= query-context "")
   (string= query-context "*"))
-  nil query-context))
+  nil
+query-context))
   (setq notmuch-tree-target-msg target)
   (setq notmuch-tree-open-target open-target)
   ;; Set the default value for `notmuch-show-process-crypto' in this
-- 
2.28.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 01/23] emacs: Shorten long lines

2020-08-06 Thread Jonas Bernoulli
---
 emacs/coolj.el   |   2 +-
 emacs/notmuch-address.el |  38 +++--
 emacs/notmuch-company.el |  17 --
 emacs/notmuch-crypto.el  |  16 +++---
 emacs/notmuch-draft.el   |  12 ++--
 emacs/notmuch-hello.el   |  43 ++-
 emacs/notmuch-jump.el|   7 ++-
 emacs/notmuch-lib.el |  62 +
 emacs/notmuch-maildir-fcc.el |  14 ++---
 emacs/notmuch-message.el |   3 +-
 emacs/notmuch-mua.el |  78 +++---
 emacs/notmuch-show.el| 103 +++
 emacs/notmuch-tag.el |  14 +++--
 emacs/notmuch-tree.el|  55 +--
 emacs/notmuch-wash.el|  19 +--
 emacs/notmuch.el |  27 ++---
 emacs/rstdoc.el  |   3 +-
 17 files changed, 326 insertions(+), 187 deletions(-)

diff --git a/emacs/coolj.el b/emacs/coolj.el
index 350d537f..5d311170 100644
--- a/emacs/coolj.el
+++ b/emacs/coolj.el
@@ -1,6 +1,6 @@
 ;;; coolj.el --- automatically wrap long lines  -*- coding:utf-8 -*-
 
-;; Copyright (C) 2000, 2001, 2004, 2005, 2006, 2007, 2008, 2009 Free Software 
Foundation, Inc.
+;; Copyright (C) 2000, 2001, 2004-2009 Free Software Foundation, Inc.
 
 ;; Authors:Kai Grossjohann 
 ;; Alex Schroeder 
diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
index 0d56fba7..2a9c411a 100644
--- a/emacs/notmuch-address.el
+++ b/emacs/notmuch-address.el
@@ -195,10 +195,11 @@ (defun notmuch-address-options (original)
((eq notmuch-address-command 'internal)
 (unless (notmuch-address--harvest-ready)
   ;; First, run quick synchronous harvest based on what the user
-  ;; entered so far
+  ;; entered so far.
   (notmuch-address-harvest original t))
 (prog1 (notmuch-address-matching original)
-  ;; Then start the (potentially long-running) full asynchronous harvest 
if necessary
+  ;; Then start the (potentially long-running) full asynchronous
+  ;; harvest if necessary.
   (notmuch-address-harvest-trigger)))
(t
 (process-lines notmuch-address-command original
@@ -241,7 +242,8 @@ (defun notmuch-address-expand-name ()
(push chosen notmuch-address-history)
(delete-region beg end)
(insert chosen)
-   (run-hook-with-args 'notmuch-address-post-completion-functions 
chosen))
+   (run-hook-with-args 'notmuch-address-post-completion-functions
+   chosen))
(message "No matches.")
(ding
(t nil)))
@@ -393,10 +395,11 @@ (defun notmuch-address--save-address-hash ()
  ;; 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 (list :version notmuch-address--save-hash-version
- :completion-settings 
notmuch-address-internal-completion
- :last-harvest notmuch-address-last-harvest
- :completions notmuch-address-completions)))
+ (let ((save-plist
+(list :version notmuch-address--save-hash-version
+  :completion-settings notmuch-address-internal-completion
+  :last-harvest notmuch-address-last-harvest
+  :completions notmuch-address-completions)))
(print "notmuch-address-hash" (current-buffer))
(print save-plist (current-buffer
   (message "\
@@ -408,16 +411,17 @@ (defun notmuch-address-harvest-trigger ()
   (let ((now (float-time)))
 (when (> (- now notmuch-address-last-harvest) 86400)
   (setq notmuch-address-last-harvest now)
-  (notmuch-address-harvest nil nil
-  (lambda (proc event)
-;; If harvest fails, we want to try
-;; again when the trigger is next
-;; called
-(if (string= event "finished\n")
-(progn
-  (notmuch-address--save-address-hash)
-  (setq 
notmuch-address-full-harvest-finished t))
-  (setq notmuch-address-last-harvest 0)))
+  (notmuch-address-harvest
+   nil nil
+   (lambda (proc event)
+;; If harvest fails, we want to try
+;; again when the trigger is next
+;; called
+(if (string= event "finished\n")
+(progn
+  (notmuch-address--save-address-hash)
+  (setq notmuch-address-full-harvest-finished t))
+  (setq notmuch-address-last-harvest 0)))
 
 ;;
 
diff --git a/emacs/notmuch-company.el b/emacs/notmuch-company.el
index ac998f9b..c1f3594e 100644
--- a/emacs/notmuch-company.el
+++ b/emacs/notmuch-company.el
@@ -69,9 +69,11 @@ (defu

[PATCH v2 14/23] emacs: notmuch-poll: Let the user know we are polling

2020-08-06 Thread Jonas Bernoulli
It is done synchronously and it can take a while,
so we should let the user know what is going on.
---
 emacs/notmuch-lib.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index fc76fd67..069a19e9 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -259,11 +259,13 @@ (defun notmuch-poll ()
 Invokes `notmuch-poll-script', \"notmuch new\", or does nothing
 depending on the value of `notmuch-poll-script'."
   (interactive)
+  (message "Polling mail...")
   (if (stringp notmuch-poll-script)
   (unless (string= notmuch-poll-script "")
(unless (equal (call-process notmuch-poll-script nil nil) 0)
  (error "Notmuch: poll script `%s' failed!" notmuch-poll-script)))
-(notmuch-call-notmuch-process "new")))
+(notmuch-call-notmuch-process "new"))
+  (message "Polling mail...done"))
 
 (defun notmuch-bury-or-kill-this-buffer ()
   "Undisplay the current buffer.
-- 
2.28.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 15/23] emacs: Use makefile-gmake-mode in Makefile*s

2020-08-06 Thread Jonas Bernoulli
Use `makefile-gmake-mode' instead of `makefile-mode' because the
former also highlights ifdef et al. while the latter does not.

"./Makefile.global" and one "Makefile.local" failed to specify any
major mode at all but doing so is necessary because Emacs does not
automatically figure out that these are Makefiles (of any flavor).
---
 Makefile.global  | 1 +
 Makefile.local   | 2 +-
 bindings/Makefile.local  | 2 +-
 compat/Makefile.local| 2 +-
 completion/Makefile.local| 2 +-
 doc/Makefile.local   | 2 +-
 emacs/Makefile.local | 2 +-
 lib/Makefile.local   | 2 +-
 parse-time-string/Makefile.local | 2 ++
 performance-test/Makefile.local  | 2 +-
 test/Makefile.local  | 2 +-
 util/Makefile.local  | 2 +-
 12 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/Makefile.global b/Makefile.global
index 98b6962e..c8812f9d 100644
--- a/Makefile.global
+++ b/Makefile.global
@@ -1,3 +1,4 @@
+# -*- makefile-gmake -*-
 # Here's the (hopefully simple) versioning scheme.
 #
 # Releases of notmuch have a two-digit version (0.1, 0.2, etc.). We
diff --git a/Makefile.local b/Makefile.local
index 22577617..77bc9850 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -1,4 +1,4 @@
-# -*- makefile -*-
+# -*- makefile-gmake -*-
 
 .PHONY: all
 all: notmuch notmuch-shared build-man build-info ruby-bindings 
python-cffi-bindings
diff --git a/bindings/Makefile.local b/bindings/Makefile.local
index 19ddd6ea..bc960bbc 100644
--- a/bindings/Makefile.local
+++ b/bindings/Makefile.local
@@ -1,4 +1,4 @@
-# -*- makefile -*-
+# -*- makefile-gmake -*-
 
 dir := bindings
 
diff --git a/compat/Makefile.local b/compat/Makefile.local
index bcb9f0ec..2ee1b399 100644
--- a/compat/Makefile.local
+++ b/compat/Makefile.local
@@ -1,4 +1,4 @@
-# -*- makefile -*-
+# -*- makefile-gmake -*-
 
 dir := compat
 extra_cflags += -I$(srcdir)/$(dir)
diff --git a/completion/Makefile.local b/completion/Makefile.local
index 8e86c9d2..54df463c 100644
--- a/completion/Makefile.local
+++ b/completion/Makefile.local
@@ -1,4 +1,4 @@
-# -*- makefile -*-
+# -*- makefile-gmake -*-
 
 dir := completion
 
diff --git a/doc/Makefile.local b/doc/Makefile.local
index 30411341..60bd7184 100644
--- a/doc/Makefile.local
+++ b/doc/Makefile.local
@@ -1,4 +1,4 @@
-# -*- makefile -*-
+# -*- makefile-gmake -*-
 
 dir := doc
 
diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index 141f5868..d1b320c3 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -1,4 +1,4 @@
-# -*- makefile -*-
+# -*- makefile-gmake -*-
 
 dir := emacs
 emacs_sources := \
diff --git a/lib/Makefile.local b/lib/Makefile.local
index 5dc057c0..a6400126 100644
--- a/lib/Makefile.local
+++ b/lib/Makefile.local
@@ -1,4 +1,4 @@
-# -*- makefile -*-
+# -*- makefile-gmake -*-
 
 dir := lib
 
diff --git a/parse-time-string/Makefile.local b/parse-time-string/Makefile.local
index 53534f3e..ee8030cc 100644
--- a/parse-time-string/Makefile.local
+++ b/parse-time-string/Makefile.local
@@ -1,3 +1,5 @@
+# -*- makefile-gmake -*-
+
 dir := parse-time-string
 extra_cflags += -I$(srcdir)/$(dir)
 
diff --git a/performance-test/Makefile.local b/performance-test/Makefile.local
index 9dc260e3..b9f580c7 100644
--- a/performance-test/Makefile.local
+++ b/performance-test/Makefile.local
@@ -1,4 +1,4 @@
-# -*- makefile -*-
+# -*- makefile-gmake -*-
 
 dir := performance-test
 
diff --git a/test/Makefile.local b/test/Makefile.local
index 47244e8f..40574739 100644
--- a/test/Makefile.local
+++ b/test/Makefile.local
@@ -1,4 +1,4 @@
-# -*- makefile -*-
+# -*- makefile-gmake -*-
 
 dir := test
 
diff --git a/util/Makefile.local b/util/Makefile.local
index f5d72f79..7ef029a5 100644
--- a/util/Makefile.local
+++ b/util/Makefile.local
@@ -1,4 +1,4 @@
-# -*- makefile -*-
+# -*- makefile-gmake -*-
 
 dir := util
 extra_cflags += -I$(srcdir)/$(dir)
-- 
2.28.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 11/23] emacs: Extend face to window edge again

2020-08-06 Thread Jonas Bernoulli
Since Emacs 27 each face has to be explicitly configured to "extend
to the edge of the window".  Without doing that the face used for
the newline character only has an effect that spans "one character"
(i.e. it looks like there is a single trailing space character).

We don't want that so extend the face in Emacs 27, so that it looks
the same as it did in older Emacs releases.  We have to do this
conditionally, otherwise older Emacsen would choke on it.
---
 emacs/notmuch.el | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 4fc338e2..5562ad10 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -273,8 +273,12 @@ (defun notmuch-search-first-thread ()
   (goto-char (point-min)))
 
 (defface notmuch-message-summary-face
-  'class color) (background light)) (:background "#f0f0f0"))
-(((class color) (background dark)) (:background "#303030")))
+  `class color) (background light))
+ ,@(and (>= emacs-major-version 27) '(:extend t))
+ (:background "#f0f0f0"))
+(((class color) (background dark))
+ ,@(and (>= emacs-major-version 27) '(:extend t))
+ (:background "#303030")))
   "Face for the single-line message summary in notmuch-show-mode."
   :group 'notmuch-show
   :group 'notmuch-faces)
-- 
2.28.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 07/23] emacs: Use 'and' instead of 'when' when the return value matters

2020-08-06 Thread Jonas Bernoulli
Also do so for some 'if' forms that lack an ELSE part.
Even go as far as using 'and' and 'not' instead of 'unless'.
---
 emacs/coolj.el   | 12 +++---
 emacs/notmuch-address.el | 72 ++--
 emacs/notmuch-crypto.el  |  2 +-
 emacs/notmuch-draft.el   |  2 +-
 emacs/notmuch-lib.el | 37 +-
 emacs/notmuch-maildir-fcc.el |  4 +-
 emacs/notmuch-mua.el | 13 +++
 emacs/notmuch-show.el| 45 +++---
 emacs/notmuch-tree.el|  4 +-
 emacs/notmuch-wash.el|  8 ++--
 emacs/notmuch.el | 28 --
 11 files changed, 114 insertions(+), 113 deletions(-)

diff --git a/emacs/coolj.el b/emacs/coolj.el
index 961db606..39a8de2b 100644
--- a/emacs/coolj.el
+++ b/emacs/coolj.el
@@ -107,12 +107,12 @@ (defun coolj-set-breakpoint (prefix)
 If the line should not be broken, return nil; point remains on the
 line."
   (move-to-column fill-column)
-  (if (and (re-search-forward "[^ ]" (line-end-position) 1)
-  (> (current-column) fill-column))
-  ;; This line is too long.  Can we break it?
-  (or (coolj-find-break-backward prefix)
- (progn (move-to-column fill-column)
-(coolj-find-break-forward)
+  (and (re-search-forward "[^ ]" (line-end-position) 1)
+   (> (current-column) fill-column)
+   ;; This line is too long.  Can we break it?
+   (or (coolj-find-break-backward prefix)
+  (progn (move-to-column fill-column)
+ (coolj-find-break-forward)
 
 (defun coolj-find-break-backward (prefix)
   "Move point backward to the first available breakpoint and return t.
diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
index 4db7096c..2dd08661 100644
--- a/emacs/notmuch-address.el
+++ b/emacs/notmuch-address.el
@@ -252,20 +252,20 @@ (defun notmuch-address-expand-name ()
 (defun notmuch-address-locate-command (command)
   "Return non-nil if `command' is an executable either on
 `exec-path' or an absolute pathname."
-  (when (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
+  (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)))
@@ -304,18 +304,20 @@ (defun notmuch-address-harvest (&optional addr-prefix 
synchronous callback)
 execution, CALLBACK is called when harvesting finishes."
   (let* ((sent (eq (car notmuch-address-internal-completion) 'sent))
 (config-query (cadr notmuch-address-internal-completion))
-(prefix-query (when addr-prefix
-(format "%s:%s*" (if sent "to" "from") addr-prefix)))
+(prefix-query (and addr-prefix
+   (format "%s:%s*"
+   (if sent "to" "from")
+   addr-prefix)))
 (from-or-to-me-query
  (mapconcat (lambda (x)
   (concat (if sent "from:" "to:") x))
 (notmuch-user-emails) " or "))
 (query (if (or prefix-query config-query)
(concat (format "(%s)" from-or-to-me-query)
-   (when prefix-query
- (format " and (%s)" prefix-query))
-   (when config-query
- (format " and (%s)" config-query)))
+   (and prefix-query
+(format " and (%s)" prefix-query))
+   (and config-query
+(format " and (%s)" config-query)))
  from-or-to-me-query))
 (args `("address" "--format=sexp" "--format-version=4"
 ,(if sent "--output=recipients" "--output=sender")
@@ -354,21 +356,21 @@ (defun notmuch-address--get-address-hash ()
 

[PATCH v2 17/23] emacs: Autoload notmuch-jump-search only once

2020-08-06 Thread Jonas Bernoulli
This function is being autoloaded using an autoload cookie, so it
shouldn't additionally be autoloaded using an `autoload' form.

When building libraries we don't actually load the autoloads file and
dropping the `autoload' form results in an error, which reveals a so
far unspecified dependency: `notmuch-tree' needs `notmuch-jump'.

Before this commit compiling (or even just loading) `notmuch-tree'
resulted in `notmuch-jump' being loaded because the former requires
`notmuch-lib', which autoloaded `notmuch-jump-search'.

The bug was that this dependency was not explicitly specified, which
we fix by adding the respective `require' form.
---
 emacs/notmuch-lib.el  | 3 ---
 emacs/notmuch-tree.el | 1 +
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 069a19e9..549161f3 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -35,9 +35,6 @@ (unless (require 'notmuch-version nil t)
   (defconst notmuch-emacs-version "unknown"
 "Placeholder variable when notmuch-version.el[c] is not available."))
 
-(autoload 'notmuch-jump-search "notmuch-jump"
-  "Jump to a saved search by shortcut key." t)
-
 (defgroup notmuch nil
   "Notmuch mail reader for Emacs."
   :group 'mail)
diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index 364da240..b538cef9 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -33,6 +33,7 @@ (require 'notmuch-query)
 (require 'notmuch-show)
 (require 'notmuch-tag)
 (require 'notmuch-parser)
+(require 'notmuch-jump)
 
 (declare-function notmuch-search "notmuch"
  (&optional query oldest-first target-thread target-line))
-- 
2.28.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 12/23] emacs: Fix some function declarations

2020-08-06 Thread Jonas Bernoulli
---
 emacs/notmuch-tag.el | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el
index e71de041..1cef17e1 100644
--- a/emacs/notmuch-tag.el
+++ b/emacs/notmuch-tag.el
@@ -32,9 +32,10 @@ (require 'crm)
 
 (require 'notmuch-lib)
 
-(declare-function notmuch-search-tag "notmuch" tag-changes)
-(declare-function notmuch-show-tag "notmuch-show" tag-changes)
-(declare-function notmuch-tree-tag "notmuch-tree" tag-changes)
+(declare-function notmuch-search-tag "notmuch"
+ (tag-changes &optional beg end only-matched))
+(declare-function notmuch-show-tag "notmuch-show" (tag-changes))
+(declare-function notmuch-tree-tag "notmuch-tree" (tag-changes))
 
 (autoload 'notmuch-jump "notmuch-jump")
 
-- 
2.28.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 04/23] emacs: Closing parenthesis go on the same line

2020-08-06 Thread Jonas Bernoulli
---
 emacs/notmuch-lib.el  |  6 ++
 emacs/notmuch-show.el | 19 ---
 emacs/notmuch-tree.el |  4 ++--
 emacs/notmuch.el  |  6 ++
 4 files changed, 14 insertions(+), 21 deletions(-)

diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 7994d5ad..f8958a91 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -555,13 +555,11 @@ (defun notmuch-match-content-type (t1 t2)
   (string= (downcase t1) (downcase t2)
 
 (defvar notmuch-multipart/alternative-discouraged
-  '(
-;; Avoid HTML parts.
+  '(;; Avoid HTML parts.
 "text/html"
 ;; multipart/related usually contain a text/html part and some
 ;; associated graphics.
-"multipart/related"
-))
+"multipart/related"))
 
 (defun notmuch-multipart/alternative-determine-discouraged (msg)
   "Return the discouraged alternatives for the specified message."
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index f38866b0..8592936f 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -297,13 +297,12 @@ (defun notmuch-show-view-all-mime-parts ()
;;
;; Any MIME part not explicitly mentioned here will be handled by an
;; external viewer as configured in the various mailcap files.
-   (let ((mm-inline-media-tests '(
- ("text/.*" ignore identity)
- ("application/pgp-signature" ignore identity)
- ("multipart/alternative" ignore identity)
- ("multipart/mixed" ignore identity)
- ("multipart/related" ignore identity)
- )))
+   (let ((mm-inline-media-tests
+ '(("text/.*" ignore identity)
+   ("application/pgp-signature" ignore identity)
+   ("multipart/alternative" ignore identity)
+   ("multipart/mixed" ignore identity)
+   ("multipart/related" ignore identity
  (mm-display-parts (mm-dissect-buffer)
 
 (defun notmuch-show-save-attachments ()
@@ -1785,10 +1784,8 @@ (defun notmuch-show-get-message-ids-for-open-messages ()
(if (notmuch-show-message-visible-p)
(setq message-ids
  (append message-ids (list (notmuch-show-get-message-id)
-   (setq done (not (notmuch-show-goto-message-next)))
-   )
-  message-ids
-  )))
+   (setq done (not (notmuch-show-goto-message-next
+  message-ids)))
 
 ;; Commands typically bound to keys.
 
diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index 6ac0c62d..b1bb40b1 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -1020,8 +1020,8 @@ (defun notmuch-tree-worker (basic-query &optional 
query-context target open-targ
   (erase-buffer)
   (goto-char (point-min))
   (let* ((search-args (concat basic-query
- (if query-context (concat " and (" query-context 
")"))
- ))
+ (if query-context
+ (concat " and (" query-context ")"
 (message-arg (if unthreaded "--unthreaded" "--entire-thread")))
 (if (equal (car (process-lines notmuch-command "count" search-args)) "0")
(setq search-args basic-query))
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 2e84cd34..d6e0a9d5 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -910,8 +910,7 @@ (defun notmuch-search-buffer-title (query)
query)
   "*"))
  (t
-  (concat "*notmuch-search-" query "*"))
- )))
+  (concat "*notmuch-search-" query "*")
 
 (defun notmuch-read-query (prompt)
   "Read a notmuch-query from the minibuffer with completion.
@@ -1003,8 +1002,7 @@ (defun notmuch-search (&optional query oldest-first 
target-thread target-line no
 (let ((proc (get-buffer-process (current-buffer)))
  (inhibit-read-only t))
   (if proc
- (error "notmuch search process already running for query `%s'" query)
-   )
+ (error "notmuch search process already running for query `%s'" query))
   (erase-buffer)
   (goto-char (point-min))
   (save-excursion
-- 
2.28.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 00/23] A great number of cosmetic changes

2020-08-06 Thread Jonas Bernoulli
I have addressed the feedback from v1, making a change
to commit (1), leading to a minor conflict in commit (2).
Otherwise this is unchanged.

 Cheers,
 Jonas


Jonas Bernoulli (23):
  emacs: Shorten long lines
  emacs: Remove excess empty lines
1 emacs: Fix indentation
  emacs: Closing parenthesis go on the same line
  emacs: Only set one variable per setq form
  emacs: Use cl-incf where appropriate
2 emacs: Use 'and' instead of 'when' when the return value matters
  emacs: Use 'unless' instead of 'when' and 'not'
  emacs: Use 'when' instead of 'if' when there is no ELSE part
  emacs: Use one or three lines for 'if' forms
  emacs: Extend face to window edge again
  emacs: Fix some function declarations
  emacs: No longer define notmuch-hello-mode-map as a function
  emacs: notmuch-poll: Let the user know we are polling
  emacs: Use makefile-gmake-mode in Makefile*s
  emacs: Improve doc-strings
  emacs: Autoload notmuch-jump-search only once
  emacs: Autoload notmuch-jump using an autoload cookie
  emacs: Various cosmetic changes
  emacs: Increase consistency of library headers
  Fix typos
  .dir-locals.el: Set variables for correct "shell" mode
  test: Fix indentation

 .dir-locals.el |   2 +-
 Makefile.global|   1 +
 Makefile.local |   2 +-
 NEWS   |   2 +-
 bindings/Makefile.local|   2 +-
 bindings/python-cffi/notmuch2/__init__.py  |   2 +-
 bindings/python-cffi/notmuch2/_base.py |   6 +-
 bindings/python-cffi/notmuch2/_database.py |   8 +-
 bindings/python-cffi/notmuch2/_message.py  |   4 +-
 bindings/python-cffi/notmuch2/_tags.py |   8 +-
 bindings/python-cffi/tests/conftest.py |   2 +-
 bindings/python/notmuch/database.py|  12 +-
 bindings/python/notmuch/query.py   |   2 +-
 compat/Makefile.local  |   2 +-
 completion/Makefile.local  |   2 +-
 doc/Makefile.local |   2 +-
 emacs/Makefile.local   |   2 +-
 emacs/coolj.el |  24 +-
 emacs/make-deps.el |   5 +-
 emacs/notmuch-address.el   | 186 -
 emacs/notmuch-company.el   |  53 ++-
 emacs/notmuch-compat.el|  99 +++--
 emacs/notmuch-crypto.el|  49 ++-
 emacs/notmuch-draft.el |  24 +-
 emacs/notmuch-hello.el | 102 +++--
 emacs/notmuch-jump.el  |  61 ++-
 emacs/notmuch-lib.el   | 204 +-
 emacs/notmuch-maildir-fcc.el   | 122 +++---
 emacs/notmuch-message.el   |   3 +-
 emacs/notmuch-mua.el   | 189 +
 emacs/notmuch-parser.el|  16 +-
 emacs/notmuch-print.el |   2 +-
 emacs/notmuch-query.el |  29 +-
 emacs/notmuch-show.el  | 439 ++---
 emacs/notmuch-tag.el   |  38 +-
 emacs/notmuch-tree.el  | 189 -
 emacs/notmuch-wash.el  | 109 +++--
 emacs/notmuch.el   | 276 ++---
 emacs/rstdoc.el|  18 +-
 lib/Makefile.local |   2 +-
 lib/notmuch.h  |   4 +-
 parse-time-string/Makefile.local   |   2 +
 performance-test/Makefile.local|   2 +-
 tag-util.c |   2 +-
 tag-util.h |   2 +-
 test/Makefile.local|   2 +-
 test/T610-message-property.sh  |   2 +-
 test/T710-message-id.sh|   2 +-
 test/emacs-address-cleaning.el |   2 +-
 test/random-corpus.c   |   2 +-
 test/test-lib.el   |  43 +-
 test/test-lib.sh   |  36 +-
 util/Makefile.local|   2 +-
 53 files changed, 1192 insertions(+), 1211 deletions(-)

-- 
2.28.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 06/23] emacs: Use cl-incf where appropriate

2020-08-06 Thread Jonas Bernoulli
It's shorter.  That's it pretty much.
---
 emacs/notmuch-hello.el | 2 +-
 emacs/notmuch-lib.el   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 89e03c36..1c084bf7 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -609,7 +609,7 @@ (defun notmuch-hello-insert-buttons (searches)
   name)
(setq column-indent
  (1+ (max 0 (- column-width (length name)))
-   (setq count (1+ count))
+   (cl-incf count)
(when (eq (% count tags-per-line) 0)
  (setq column-indent 0)
  (widget-insert "\n")))
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 886da99f..5d0c373a 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -417,7 +417,7 @@ (defun notmuch-subkeymap-help ()
 (i 0))
 (while (< i (length prefix))
   (aset prefix i (aref key i))
-  (setq i (1+ i)))
+  (cl-incf i))
 (let* ((subkeymap (key-binding prefix))
   (ua-keys (where-is-internal 'universal-argument nil t))
   (prefix-string (notmuch-prefix-key-description prefix))
-- 
2.28.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 05/23] emacs: Only set one variable per setq form

2020-08-06 Thread Jonas Bernoulli
It's a bit weird to avoid having to write the "(setq ... )" more than
once, just because we can.  In a language that uses '=' for the same
purpose we also happily use that once per assignment.

While there are no benefit to using just one 'setq' there are some
drawbacks.  It is not always clear on first what is a key and what a
value and as a result it is easy to make a mistake.  Also it becomes
harder to comment out just one assignment.
---
 emacs/notmuch-address.el |  6 +++---
 emacs/notmuch-crypto.el  | 23 ---
 emacs/notmuch-lib.el |  8 
 emacs/notmuch-show.el| 26 ++
 emacs/notmuch-tree.el|  4 ++--
 emacs/notmuch.el | 35 ++-
 6 files changed, 53 insertions(+), 49 deletions(-)

diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
index 09dda247..4db7096c 100644
--- a/emacs/notmuch-address.el
+++ b/emacs/notmuch-address.el
@@ -381,9 +381,9 @@ (defun notmuch-address--load-address-hash ()
  notmuch-address-internal-completion)
   (equal (plist-get load-plist :version)
  notmuch-address--save-hash-version))
-  (setq notmuch-address-last-harvest (plist-get load-plist :last-harvest)
-   notmuch-address-completions (plist-get load-plist :completions)
-   notmuch-address-full-harvest-finished t)
+  (setq notmuch-address-last-harvest (plist-get load-plist :last-harvest))
+  (setq notmuch-address-completions (plist-get load-plist :completions))
+  (setq notmuch-address-full-harvest-finished t)
   ;; Return t to say load was successful.
   t)))
 
diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el
index 58947a20..420b008f 100644
--- a/emacs/notmuch-crypto.el
+++ b/emacs/notmuch-crypto.el
@@ -117,20 +117,21 @@ (defun notmuch-crypto-insert-sigstatus-button (sigstatus 
from)
(userid (plist-get sigstatus :userid)))
;; If userid is present it has full or greater validity.
(if userid
-   (setq label (concat "Good signature by: " userid)
- face 'notmuch-crypto-signature-good)
- (setq label (concat "Good signature by key: " fingerprint)
-   face 'notmuch-crypto-signature-good-key))
-   (setq button-action 'notmuch-crypto-sigstatus-good-callback
- help-msg (concat "Click to list key ID 0x" fingerprint "."
+   (progn
+ (setq label (concat "Good signature by: " userid))
+ (setq face 'notmuch-crypto-signature-good))
+ (setq label (concat "Good signature by key: " fingerprint))
+ (setq face 'notmuch-crypto-signature-good-key))
+   (setq button-action 'notmuch-crypto-sigstatus-good-callback)
+   (setq help-msg (concat "Click to list key ID 0x" fingerprint "."
  ((string= status "error")
-  (setq label (concat "Unknown key ID " keyid " or unsupported algorithm")
-   button-action 'notmuch-crypto-sigstatus-error-callback
-   help-msg (concat "Click to retrieve key ID " keyid
+  (setq label (concat "Unknown key ID " keyid " or unsupported algorithm"))
+  (setq button-action 'notmuch-crypto-sigstatus-error-callback)
+  (setq help-msg (concat "Click to retrieve key ID " keyid
 " from keyserver.")))
  ((string= status "bad")
-  (setq label (concat "Bad signature (claimed key ID " keyid ")")
-   face 'notmuch-crypto-signature-bad))
+  (setq label (concat "Bad signature (claimed key ID " keyid ")"))
+  (setq face 'notmuch-crypto-signature-bad))
  (status
   (setq label (concat "Unknown signature status: " status)))
  (t
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index f8958a91..886da99f 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -861,8 +861,8 @@ (defun notmuch-call-notmuch--helper (destination args)
   (let (stdin-string)
 (while (keywordp (car args))
   (cl-case (car args)
-   (:stdin-string (setq stdin-string (cadr args)
-args (cddr args)))
+   (:stdin-string (setq stdin-string (cadr args))
+  (setq args (cddr args)))
(otherwise
 (error "Unknown keyword argument: %s" (car args)
 (if (null stdin-string)
@@ -939,8 +939,8 @@ (defun notmuch-start-notmuch (name buffer sentinel &rest 
args)
  :buffer buffer
  :command (cons command args)
  :connection-type 'pipe
- :stderr err-buffer)
-   err-proc (get-buffer-process err-buffer))
+ :stderr err-buffer))
+ (setq err-proc (get-buffer-process err-buffer))
  (process-put proc 'err-buffer err-buffer)
 
  (process-put err-proc 'err-file err-file)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 8592936f..a0a6c09d 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch

[PATCH v2 03/23] emacs: Fix indentation

2020-08-06 Thread Jonas Bernoulli
---
 emacs/coolj.el |  16 ++---
 emacs/notmuch-address.el   |  18 +++---
 emacs/notmuch-compat.el|  86 -
 emacs/notmuch-draft.el |  18 +++---
 emacs/notmuch-hello.el |  24 +++
 emacs/notmuch-lib.el   |  56 -
 emacs/notmuch-maildir-fcc.el   |  58 -
 emacs/notmuch-mua.el   |  42 +++--
 emacs/notmuch-query.el |   6 +-
 emacs/notmuch-show.el  | 111 +
 emacs/notmuch-tag.el   |   4 +-
 emacs/notmuch-tree.el  | 102 +++---
 emacs/notmuch-wash.el  |   2 +-
 emacs/notmuch.el   |  76 +++---
 test/emacs-address-cleaning.el |   2 +-
 15 files changed, 312 insertions(+), 309 deletions(-)

diff --git a/emacs/coolj.el b/emacs/coolj.el
index 5d311170..961db606 100644
--- a/emacs/coolj.el
+++ b/emacs/coolj.el
@@ -108,11 +108,11 @@ (defun coolj-set-breakpoint (prefix)
 line."
   (move-to-column fill-column)
   (if (and (re-search-forward "[^ ]" (line-end-position) 1)
-   (> (current-column) fill-column))
+  (> (current-column) fill-column))
   ;; This line is too long.  Can we break it?
   (or (coolj-find-break-backward prefix)
-  (progn (move-to-column fill-column)
- (coolj-find-break-forward)
+ (progn (move-to-column fill-column)
+(coolj-find-break-forward)
 
 (defun coolj-find-break-backward (prefix)
   "Move point backward to the first available breakpoint and return t.
@@ -135,12 +135,12 @@ (defun coolj-find-break-forward ()
 If no break point is found, return nil."
   (and (search-forward " " (line-end-position) 1)
(progn (skip-chars-forward " " (line-end-position))
-  (null (eolp)))
+ (null (eolp)))
(if (and fill-nobreak-predicate
-(run-hook-with-args-until-success
- 'fill-nobreak-predicate))
-   (coolj-find-break-forward)
- t)))
+   (run-hook-with-args-until-success
+'fill-nobreak-predicate))
+  (coolj-find-break-forward)
+t)))
 
 (provide 'coolj)
 
diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
index ca4da3f3..09dda247 100644
--- a/emacs/notmuch-address.el
+++ b/emacs/notmuch-address.el
@@ -153,14 +153,14 @@ (defcustom notmuch-address-use-company t
 
 (defun notmuch-address-setup ()
   (let* ((setup-company (and notmuch-address-use-company
-  (require 'company nil t)))
+(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)
+#'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)
 
 (defun notmuch-address-toggle-internal-completion ()
   "Toggle use of internal completion for current buffer.
@@ -323,7 +323,7 @@ (defun notmuch-address-harvest (&optional addr-prefix 
synchronous callback)
 ,query)))
 (if synchronous
(mapc #'notmuch-address-harvest-addr
-  (apply 'notmuch-call-notmuch-sexp args))
+ (apply 'notmuch-call-notmuch-sexp args))
   ;; Asynchronous
   (let* ((current-proc (if addr-prefix
   (car notmuch-address-harvest-procs)
@@ -390,7 +390,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
diff --git a/emacs/notmuch-compat.el b/emacs/notmuch-compat.el
index 2cedd39d..388ef70f 100644
--- a/emacs/notmuch-compat.el
+++ b/emacs/notmuch-compat.el
@@ -35,7 +35,7 @@ (if (fboundp 'setq-local)
 (if (fboundp 'read-char-choice)
 (defalias 'notmuch-read-char-choice 'read-char-choice)
   (defun notmuch-read-char-choice (prompt chars &optional 
inhibit-keyboard-quit)
-  "Read and return one of CHARS, prompting for PROMPT.
+"Read and return one of CHARS, prompting for PROMPT.
 Any input that is not one of CHARS is ignored.
 
 If optional argument INHIBIT-KEYBOARD-QUIT is non-nil, ignore
@@ -44,49 +44,49 @@ (if (fboundp 'read-char-choice)
 This is an exact copy of this function from emacs 24 for use on
 ema