Commit graph

6611 commits

Author SHA1 Message Date
Jonas Bernoulli
1c80020e70 try-emacs-mua: Trim `require' advice for Emacs 25
- Since Emacs 25 comes with `load-prefer-newer' we can remove the
  complicated variant of the advice, which implemented a poorman's
  version of that.

- Since Emacs 25 comes with the new advice mechanism, we can use
  that now for the simple variant of the advice, which just informs
  about the library that is being required.
2020-08-09 21:17:50 -03:00
Jonas Bernoulli
6336c26d23 emacs: Use new advice mechanism do advice mm-shr
Also because we now only support Emacs >= 25,
we can remove the check for Emacs >= 24.
2020-08-09 21:17:39 -03:00
Jonas Bernoulli
3665914f71 emacs: Do not abuse advice to monkey patch while testing
Use `cl-letf*' instead.
2020-08-09 21:17:06 -03:00
Jonas Bernoulli
96baa22318 emacs: Drop old advices that were only need for Emacs 23 2020-08-09 21:16:12 -03:00
Jonas Bernoulli
08b26f449d emacs: Remove notmuch-read-char-choice
Just use `read-char-choice', which existed since Emacs 24.1.
2020-08-09 21:15:54 -03:00
Jonas Bernoulli
2156517d90 emacs: Remove notmuch-setq-local
Just use setq-local, which existed since Emacs 24.3.
2020-08-09 21:15:27 -03:00
Jonas Bernoulli
9946380e47 emacs: Use cl-incf where appropriate
It's shorter.  That's it pretty much.
2020-08-09 21:15:27 -03:00
Jonas Bernoulli
42781f1821 NEWS: At least Emacs 25.1 is required now
Some backward incompatible changes follow in the next few commits
and going forward contributors don't have to worry about Emacs 24
at all anymore.
2020-08-09 21:14:36 -03:00
Jonas Bernoulli
b614d3cc0b NEWS: Add stub for 0.31 2020-08-09 21:14:36 -03:00
Jonas Bernoulli
a1b757c1ca emacs: Add end-of-file line to libraries that lack it 2020-08-09 21:14:36 -03:00
Jonas Bernoulli
254d0f9515 emacs: Provide 'rstdoc' feature at end of file
Features should nearly always be provided at the very end of their
libraries.  This feature isn't one of the rare exceptions.
2020-08-09 21:14:36 -03:00
Jonas Bernoulli
2a0d4c5965 .gitignore: Sort using sort-lines 2020-08-09 21:14:36 -03:00
Jonas Bernoulli
bb15524c12 test: Fix indentation
Fix it to consistently match the style we have configured in
".dir-locals.el".
2020-08-09 21:14:36 -03:00
Jonas Bernoulli
8cf6af449e .dir-locals.el: Set variables for correct "shell" mode
The major mode used for shell scripts is named 'sh-mode'.
'shell-mode' on the other hand implements an interactive
shell in emacs-lisp.
2020-08-09 21:14:36 -03:00
Jonas Bernoulli
6c84dee531 Fix typos 2020-08-09 21:14:36 -03:00
Jonas Bernoulli
df3fab18fe emacs: Increase consistency of library headers 2020-08-09 21:14:36 -03:00
Jonas Bernoulli
73b8f0b8d7 emacs: Various cosmetic changes 2020-08-09 21:14:36 -03:00
Jonas Bernoulli
73cc4105aa emacs: Autoload notmuch-jump using an autoload cookie
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".
2020-08-09 21:14:36 -03:00
Jonas Bernoulli
c2e9ec17fd emacs: Autoload notmuch-jump-search only once
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.
2020-08-09 21:14:36 -03:00
Jonas Bernoulli
e63f37a4a9 emacs: Improve doc-strings
- 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.
2020-08-09 21:14:36 -03:00
Jonas Bernoulli
c454135376 emacs: Use makefile-gmake-mode in Makefile*s
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).
2020-08-09 21:14:36 -03:00
Jonas Bernoulli
177cd31fbd emacs: notmuch-poll: Let the user know we are polling
It is done synchronously and it can take a while,
so we should let the user know what is going on.
2020-08-09 20:59:11 -03:00
Jonas Bernoulli
14c4533c43 emacs: No longer define notmuch-hello-mode-map as a function
It was defined as such for a decade; ever since
a56010ac8b but there
wasn't a reason to do that then nor is there now.
2020-08-09 20:58:05 -03:00
Jonas Bernoulli
82390b2807 emacs: Fix some function declarations 2020-08-09 20:57:51 -03:00
Jonas Bernoulli
a2388bc56e emacs: Extend face to window edge again
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.
2020-08-09 20:53:46 -03:00
Jonas Bernoulli
99b6e780c8 emacs: Use one or three lines for 'if' forms
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.
2020-08-09 20:53:30 -03:00
Jonas Bernoulli
e1a700067a emacs: Use 'when' instead of 'if' when there is no ELSE part 2020-08-09 20:52:34 -03:00
Jonas Bernoulli
09f6533c37 emacs: Use 'unless' instead of 'when' and 'not'
Also use 'unless' in a few cases where previously 'if' was used with
'not' but without an ELSE part.
2020-08-09 20:51:26 -03:00
Jonas Bernoulli
dfb1b8eb89 emacs: Use 'and' instead of 'when' when the return value matters
Also do so for some 'if' forms that lack an ELSE part.
Even go as far as using 'and' and 'not' instead of 'unless'.
2020-08-09 20:51:16 -03:00
Jonas Bernoulli
18d289c863 emacs: Only set one variable per setq form
It's a bit weird to avoid having to write the "(setq ... )" more than
once, just because we can.  In a language that uses '=' for the same
purpose we also happily use that once per assignment.

While there are no benefit to using just one 'setq' there are some
drawbacks.  It is not always clear on first what is a key and what a
value and as a result it is easy to make a mistake.  Also it becomes
harder to comment out just one assignment.
2020-08-09 20:50:50 -03:00
Jonas Bernoulli
2ee8e971c5 emacs: Closing parenthesis go on the same line 2020-08-09 20:50:36 -03:00
Jonas Bernoulli
caaa108760 emacs: Fix indentation 2020-08-09 20:48:09 -03:00
Jonas Bernoulli
6fb7d35069 emacs: Remove excess empty lines
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.
2020-08-09 20:47:52 -03:00
Jonas Bernoulli
a4617f29ce emacs: Shorten long lines 2020-08-09 19:48:36 -03:00
Teemu Likonen
e3fd546ad7 Emacs: Ensure left-to-right display for message headers
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.
2020-08-08 16:18:23 -03:00
Đoàn Trần Công Danh
f5ae8040b3 T355: specify hash algorithm explicitly
On some systems (notably, the one shipped with LibreSSL),
default fingerprint digest algorithm is SHA256.

On other systems, users can change default digest algorithm by changing
default_md in /etc/ssl/default_md.

Let's ask openssl to provide us specific algorithm to make the test
more deterministic.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
2020-08-08 16:04:27 -03:00
Đoàn Trần Công Danh
9ca14bcbab configure: drop check for default xapian backend
Starting from xapian 1.3.5, xapian switched default backend to glass.

From 00cdfe10 (build: drop support for xapian versions less than 1.4,
2020-04-22), we only support xapian 1.4.0+. Effectively, we don't need
to check for default xapian backend anymore.

Further more, from 99a7aac8 (test: drop use of db_ending, 2020-07-29),
our test framework has become independence from default xapian.

Let's drop it.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
2020-08-08 16:01:02 -03:00
Đoàn Trần Công Danh
e4c4cc1b34 configure: check for pytest with python -m pytest
On different distro, pytest is suffixed with different patterns.

On the other hand, `python3-pytest' could be invoked correctly,
via `python3 -m pytest', the latter is used by our tests, now.

Switch to `$python -m pytest` to fix address all incompatible naming.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
2020-08-08 15:58:59 -03:00
David Bremner
0e4695abaa test: regression tests for n_indexopts_{get,set}_decrypt_policy
The main criteria is that they don't crash. Working with a closed
database is a bonus.
2020-08-03 21:05:29 -03:00
David Bremner
e3f88436b7 test: regression test for traversing config list with closed db
Also mention error return in API docs
2020-08-03 21:03:43 -03:00
David Bremner
a0b2a54aa7 test: regression test for n_d_get_config_list on closed db.
Exception is caught.
2020-08-03 21:01:53 -03:00
David Bremner
e8ffbf84ff test: regression test for n_directory_{get,set}_mtime
The mtime is cached, so closing the db is not a problem. Writing the
mtime throws an exception, which is caught.
2020-08-03 21:00:25 -03:00
David Bremner
f4f5db0f1a lib: fix return value for n_directory_delete
Falling out of the catch meant the error return was lost
2020-08-03 20:59:06 -03:00
David Bremner
b03cc6cf90 test: known broken test for n_directory_delete with closed db.
There is a return value bug in notmuch_directory_delete that is hiding
the exception.
2020-08-03 20:57:43 -03:00
David Bremner
337665e26a lib: catch exceptions in n_directory_get_child_files
Also clarify API in error case.
2020-08-03 20:56:09 -03:00
David Bremner
3890d98966 test: add known broken test for n_directory_get_child_files
This is a clone of the one for get_child_directories
2020-08-03 20:54:26 -03:00
David Bremner
9668583a49 lib: catch exceptions in n_directory_get_child_directories
Also clarify API in error case.
2020-08-03 20:53:04 -03:00
David Bremner
919b89156c test: add known broken test for n_directory_get_child_directories
Start a new test file (for the notmuch_directory_* API group) to hold
this test.
2020-08-03 20:51:40 -03:00
David Bremner
c151506773 test: regression test for n_m_get_filenames
Closing the database after the iterator is created is not a problem.
2020-08-03 20:50:15 -03:00
David Bremner
2b6e73d895 test: split header for lib-message tests.
This allows finer control over when to close the database.
2020-08-03 20:48:51 -03:00