Jonas Bernoulli [Sat, 8 Aug 2020 11:49:52 +0000 (13:49 +0200)]
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".
Jonas Bernoulli [Sat, 8 Aug 2020 11:49:51 +0000 (13:49 +0200)]
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.
Jonas Bernoulli [Sat, 8 Aug 2020 11:49:50 +0000 (13:49 +0200)]
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.
Jonas Bernoulli [Sat, 8 Aug 2020 11:49:49 +0000 (13:49 +0200)]
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).
Jonas Bernoulli [Sat, 8 Aug 2020 11:49:45 +0000 (13:49 +0200)]
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.
Jonas Bernoulli [Sat, 8 Aug 2020 11:49:40 +0000 (13:49 +0200)]
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.
Jonas Bernoulli [Sat, 8 Aug 2020 11:49:37 +0000 (13:49 +0200)]
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.
Teemu Likonen [Fri, 7 Aug 2020 04:46:41 +0000 (07:46 +0300)]
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.
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>
David Bremner [Thu, 16 Jul 2020 11:11:26 +0000 (08:11 -0300)]
build: upload html docs as part of release process
Use a URL https://notmuchmail.org/doc/latest to leave room for a
future more ambitious scheme deploying multiple versions.
This also forces the html docs to built as part of the release
process. In the future this should be updated to tolerate generating a
release without sphinx installed. This needs a new target analogous to
build-info and build-man that does nothing if sphinx is not installed.
David Bremner [Fri, 24 Jul 2020 11:14:02 +0000 (08:14 -0300)]
test: add regression test for n_t_get_messages
This is similar to the case of toplevel messages. Currently everything
is cached, so no database access is necessary. This might change in
the future, but it should not crash in either case.
David Bremner [Sun, 26 Jul 2020 23:31:36 +0000 (20:31 -0300)]
lib: replace use of static_cast for writable databases
static_cast is a bit tricky to understand and error prone, so add a
second pointer to (potentially the same) Xapian database object that
we know has the right subclass.
David Bremner [Sun, 26 Jul 2020 23:31:34 +0000 (20:31 -0300)]
lib: drop two gratuitous assignments to database mode
I'm not sure what the point of modifying that right before destroying
the object is. In a future commit I want to remove that element of the
object, so simplify that task.
Jonas Bernoulli [Mon, 27 Jul 2020 15:25:02 +0000 (17:25 +0200)]
test: Remove misguided emacs testing utilities
The goal of this abstraction was to save space. But that failed as
the result actually was that four trivial lines got replace with 15
fairly complicated lines. The opposite of what it was supposed to
do.
Also it made it harder to come up with the fix in the previous commit;
simply grepping for the relevant symbols did not work because they get
constructed at run-time instead of appearing in the source file.
Jonas Bernoulli [Mon, 27 Jul 2020 15:25:01 +0000 (17:25 +0200)]
test: Deal with Emacs 27 switching to lexical scope by default
Starting with Emacs 27 undeclared variables in evaluated interactive
code uses lexical scope. This includes code passed with '--eval' as
we do in the Emacs tests, which also happen to assume dynamic scope.
- This can affect variables defined by libraries that we use. We
let-bind such variables to change the behavior of functions which we
then call with these bindings in effect. If these libraries are not
loaded beforehand, then the bindings are lexical and fail to have
the effect we intended.
At this time only 'smtpmail' has to be loaded explicitly (for the
variables let-bound in emacs_deliver_message and emacs_fcc_message).
'message' doesn't have to be loaded explicitly, because loading
'notmuch' (in 'run_emacs') already takes care of that, indirectly.
- Our own testing-only variables also have to be declared explicitly.
We should have done that anyway, but because of how and where these
variables are used it was very easy to overlook that (i.e. it isn't
something the byte-compiler ever looks at). Not so in Emacs 27
anymore; here this oversight caused four tests to fail.
The numeric values of these variables get incremented by functions
that we add to hooks that are run by many tests, not just the tests
where we actually inspect the value and therefore take care to let-
bind the values to 0 before we begin. The global values therefore
have to be numeric values as well. I have chosen -100 instead of 0
as the default in case someone writes a test that inspects the value
but forgets to let-bind the value. I hope that the unusual negative
value that one is going to see in such a case will help debugging
the issue.
David Bremner [Thu, 16 Jul 2020 22:48:19 +0000 (19:48 -0300)]
test: add regression test for n_d_{begin,end}_atomic
Xapian currently succeeds to begin/end a transaction on a closed database,
or at least does not throw an exception. Make the test robust against
this changing.
David Bremner [Tue, 14 Jul 2020 11:25:28 +0000 (08:25 -0300)]
lib: move deallocation of memory from n_d_close to n_d_destroy
In order to mimic the "best effort" API of Xapian to provide
information from a closed database when possible, do not
destroy the Xapian database object too early.
Because the pointer to a Xapian database is no longer nulled on close,
introduce a flag to track whether the notmuch database is open or not.
David Bremner [Wed, 22 Jul 2020 11:19:28 +0000 (08:19 -0300)]
lib: fix exception messages for n_m_message_*
The original generic handler had an extra '%s' in the format
string. Update tests that failed to catch this because the template to
print status strings checked 'stat', which was not set.
David Bremner [Thu, 9 Jul 2020 00:17:07 +0000 (21:17 -0300)]
test: regression for retrieving closed db from message
This is actually one of the few potentially useful things you can do
with a message belonging to a closed database, since in principle you
could re-open the database.