Commit graph

7421 commits

Author SHA1 Message Date
David Bremner
f4dc32e71b test: mark some tests as broken when run as root.
File permission errors e.g., are hard to trigger as root.
2023-01-05 20:14:37 -04:00
David Bremner
1d5d0ae686 lib/message: move xapian call inside try/catch block in _n_m_delete
The call to delete_document can throw exceptions (and can happen in
practice [1]), so catch the exception and extract the error
message. As a side effect, also move the call to _n_m_has_term inside
the try/catch. This should not change anything as that function
already traps any Xapian exceptions.

[1]: id:wwuk039sk2p.fsf@chaotikum.eu
2022-12-27 11:59:46 -04:00
David Bremner
966f40086f test: add known broken test for exception handling in _n_m_delete
In [1], Thomas Schneider reported an uncaught Xapian exception when
running out of disk space. We generate the same exception via database
corruption.

[1]: id:wwuk039sk2p.fsf@chaotikum.eu
2022-12-27 11:59:38 -04:00
David Bremner
16d92abf9f lib/database: propagate status code from _notmuch_message_delete
_notmuch_message_delete can return (at least)
NOTMUCH_STATUS_XAPIAN_EXCEPTION, which we should not ignore.
2022-12-27 11:59:29 -04:00
David Bremner
891af1d457 CLI/git: use --exclude=false when calling notmuch-search
We use notmuch search in two places in notmuch-git.py: to find which
tags have a given prefix, and to see if message with given id exists
locally. In both cases we do not want the presence of exclude tags
(e.g. deleted) to change the results.
2022-12-27 11:54:57 -04:00
Michael J Gruber
a5f7efd722 doc: mark --output=summary as default
`notmuch search` behaves differently depending on the output option: It
either outputs information pertaining to all threads with matching
messages (summary, threads) or to all matching messages (messages,
files, tags). The man page refres solely to the former in the main
description.

Help the user by clearly marking `summary` as the default output option.

Signed-off-by: Michael J Gruber <git@grubix.eu>
2022-12-03 09:32:48 -04:00
David Bremner
5ba7684445 emacs/show: use n-s-i-headerline to update tags
Although this has more steps than the previous regular expression
search and replace, it should be more robust against changes in the
headerline format, such as the inclusion of duplicate numbers (which
broke the previous version).
2022-11-15 07:34:25 -04:00
David Bremner
056249627a emacs/show: add optional orig-tags argument to n-s-i-headerline
This will support use of this function in notmuch-show-update-tags.
2022-11-15 07:28:29 -04:00
David Bremner
2b842a1d8c emacs/show: use plist to pass message info to n-s-insert-headerline
This should allow calling notmuch-show-insert-headerline from other
places without duplicating the set of plist accesses.
2022-11-15 07:28:02 -04:00
Russell Sim
82aa1acc0c emacs: move From header addition to after header intern
OTHER-HEADERS are expected to be passed as strings, to match the
implementation of `compose-mail'.  But the "From" header is currently
expected to be passed as a symbol.  Instead the "From" header can be
safely added after converting all the headers to symbols.
2022-11-05 13:30:50 -04:00
Robin Jarry
793f298091 cli: add options --offset and --limit to notmuch show
notmuch search does not output header values. However, when browsing
through a large email corpus, it can be time saving to be able to
paginate without running notmuch show for each message/thread.

Add --offset and --limit options to notmuch show. This is inspired from
commit 796b629c3b ("cli: add options --offset and --limit to notmuch
search").

Update man page, shell completion and add a test case to ensure it works
as expected.

Cc: Tim Culverhouse <tim@timculverhouse.com>
Cc: Tomi Ollila <tomi.ollila@iki.fi>
Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-11-05 13:18:15 -04:00
Matt Armstrong
b6565c1c54 emacs: fix dangling overlays in notmuch-search
notmuch-search-insert-authors now sets the evaporate property on the
ellipsis overlays.  Emacs will delete them when the buffer contents
are zeroed out, which happens with `notmuch-refresh-buffer`.  This
prevents them from being collapsed to zero-width overlays in position
1.  See Emacs bug#58479.  An upcoming change in Emacs will make these
dangling overlays visible to the user.
2022-11-05 13:13:43 -04:00
Jakub Wilk
32bef33565 nmweb: Fix spacing around punctuation in headers 2022-10-11 08:15:25 -03:00
Tomi Ollila
3db892f43b emacs: add notmuch-search-edit-search and notmuch-tree-edit-search
...and bind these to "E" in their respective keymaps.

Expected to be called interactively, then using read-from-minibuffer
with current search string as initial contents for editing.
(Noninteractive use makes little sense, but is supported.)

With this one can expand (as an opposite to limit) their
query and have e.g. (some of their) saved searches as search
"templates".

While at it, removed `(defvar notmuch-search-query-string)` from
notmuch-tree.el; it is unused (`notmuch-tree-basic-query` is used
instead).

Thanks to Jose Antonio Ortega Ruiz for his example for notmuch-tree
code, and better interactive use.
2022-09-23 20:23:58 -03:00
David Bremner
48d6b31485 nmweb: escape subject in search view
Fix a bug reported by Jakub Wilk [1].

[1]: id:20220822064717.qftn4tr7cs4r2ian@jwilk.net
2022-09-23 20:19:56 -03:00
Justus Winter
bf8aa34324 test: replace aging OpenPGP key used in the test suite
This replaces the old OpenPGPv4 key that is used in the test suite
with a more modern OpenPGPv4 key.  All cryptographic artifacts in the
test suite are updated accordingly.

Having old cryptographic artifacts in the test suite presents a
problem once the old algorithms are rejected by contemporary
implementations.

For reference, this is the old key.

  sec   rsa1024 2011-02-05 [SC]
        5AEAB11F5E33DCE875DDB75B6D92612D94E46381
  uid           [ unknown] Notmuch Test Suite <test_suite@notmuchmail.org> (INSECURE!)
  ssb   rsa1024 2011-02-05 [E]

And this is the new key.  Note that is has the same shape, but uses
Ed25519 and Cv25519 instead of 1024-bit RSA.

  sec   ed25519 2022-09-07 [SC]
        9A3AFE6C60065A148FD4B58A7E6ABE924645CC60
  uid           [ultimate] Notmuch Test Suite (INSECURE!) <test_suite@notmuchmail.org>
  ssb   cv25519 2022-09-07 [E]
2022-09-23 20:16:00 -03:00
Justus Winter
acb31939bb test: compute expected keyid from fingerprint 2022-09-19 22:19:35 -03:00
David Bremner
8eabd6388e test: add known broken test for indexing text/* attachments
The general problem of indexing attachments requires some help to turn
things into text, but (most?) text/* should be doable internally,
possibly with optimizations as for the text/html case.
2022-09-03 09:06:08 -03:00
David Bremner
a832f940e1 test: rename indexing corpus
The corpus is not really suitable for general indexing test since the
sole message is ignored (and will most likely continue to be ignored)
by notmuch-new.
2022-09-03 09:05:44 -03:00
David Bremner
2e5ef69fbf lib: add field processor for lastmod: prefix
By sharing the existing logic used by the sexp query parser, this
allows negative lastmod revisions to be interpreted as relative to the
most recent revision.
2022-09-03 08:43:33 -03:00
David Bremner
93c602a82f lib: factor out lastmod range handling from sexp parser.
This will permit the re-use of the same logic in the infix query
parser. The location of the shared code in the infix side is for
consistency with the other shared parsing logic. It will make more
sense when a Xapian field processor is added for the lastmod prefix.
2022-09-03 08:36:53 -03:00
David Bremner
606d9b02e4 lib/sexp: provide relative lastmod queries
Test the relatively trivial logic changes for the sexp query parser
first before refactoring that logic to share with the infix query
parser.
2022-09-03 08:36:53 -03:00
David Bremner
84e4e130e2 lib/open: create database path in some cases
There is some duplication of code here, but not all of the locations
valid to find a database make sense to create. Furthermore we nead two
passes, so the control flow in _choose_database_path would get a bit
convoluted.
2022-09-03 08:24:43 -03:00
David Bremner
8ba3057d01 lib/open: return non-SUCCESS on missing database path
This simplifies the logic of creating the directory path when it doesn't
exist.
2022-09-03 08:24:43 -03:00
David Bremner
25e2790e30 lib/open: refactor call to mkdir into function
This makes the error handling available for re-use. Using
g_mkdir_with_parents also handles the case of a pre-existing
directory. This introduces new functionality, namely creating the
parent directories, which will be useful for creating directories like
'.local/share/notmuch/default'.
2022-09-03 08:24:43 -03:00
David Bremner
44c9338061 test/path-config: set database.mail_root but not database.path
The failing "create database" test replicates a bug reported by Sean
Whitton [1]. The other two failures also look related to the database
being (re)created in the wrong place.

[1]: id:87y1wqkw13.fsf@athena.silentflame.com.
2022-09-03 08:24:43 -03:00
David Bremner
687866111a test: add test for creating database in various configurations.
The existing database creation (via add_email_corpus) was always done
in the traditional configuration. The use of xapian-metadata is just
to portably ensure that there is a database created where we expect
there to be.
2022-09-03 08:24:43 -03:00
Antoine Beaupré
a3b46fa8bb emacs/show: use read-shell-command instead of read-string
This enables auto-completion of commands, something which plain
read-string does not do. It's otherwise a drop-in
replacement. According to `C-h f`, read-shell-command was introduced
in Emacs 23.1 or earlier.
2022-09-03 08:12:16 -03:00
jao
684eeb65c7 emacs: new notmuch-tree-process-exit-functions
Hook run when the tree insertion process finishes its job.

--
This patch supersedes <id:20220816214023.1523322-1-jao@gnu.org>, but
changing the new variable name.

Right now, it can be used for silly things like removing or changing
the the "End of search." hardcoded message in the tree buffer.  But
also for more sophisticated things like folding all threads in add-ons
like my outline mode for tree buffers (to be submitted).

Signed-off-by: jao <jao@gnu.org>
2022-09-03 08:11:37 -03:00
David Bremner
76c3147613 debian: update changelog for new build-depends 2022-08-24 09:12:57 -07:00
David Bremner
5e44b74446 debian: build-depend on emacs-el
This is hopefully temporary, to work around some bugs related to emacs
28 in Debian.
2022-08-24 09:10:02 -07:00
David Bremner
c864b59942 NEWS: set release date for 0.37 2022-08-21 13:21:40 -07:00
David Bremner
88ea8619f4 debian: changelog for 0.37-1 2022-08-21 13:21:40 -07:00
David Bremner
6d53ee99b3 version: update to 0.37 2022-08-21 13:21:40 -07:00
David Bremner
4efe50b492 NEWS: minimal entries for two emacs changes. 2022-08-21 13:21:40 -07:00
Michael J Gruber
760431c0a3 test: increase cffi timeout
By default, the test suite uses 2min for other tests and 5s for cffi
tests. Sporadically, this leads to test failures caused by the timeout
on slower or loaded test infrastructure (as seen on ppc64le in Fedora's
infrastructure during branch time).

Increase the cffi timeout to the same 2m=120s.

Signed-off-by: Michael J Gruber <git@grubix.eu>
2022-08-16 04:29:39 -03:00
David Bremner
cf21ad2e79 changelog for 0.37~rc0-3 2022-08-14 11:49:54 -03:00
David Bremner
f563f5ab66 debian: changelog for 0.37~rc0-2 2022-08-14 10:56:15 -03:00
David Bremner
5ea2b25e33 debian: upload release candidate to experimental, not unstable
Oops, tagged "upstream" version is incorrect, but it's a minor issue.
2022-08-14 07:28:40 -03:00
David Bremner
b3243d1ac6 debian: changelog stanza for 0.37~rc0-1 2022-08-14 06:55:40 -03:00
David Bremner
676a470821 version: update to 0.37~rc0 2022-08-14 06:53:41 -03:00
David Bremner
b76f73efe3 doc/emacs: use define-key instead of hard-coding markup
Add keys to index. Allow indexing of both keys and commands. Use
standard typesetting for multiple keybindings.
2022-08-11 07:48:54 -03:00
David Bremner
aebf5b6d84 doc/emacs: replace use of emacsvar with el:defcustom
Mainly this allows dropping the ad-hoc directive emacsvar
2022-08-11 07:48:54 -03:00
David Bremner
0f3b196144 doc/emacs: replace emacscmd with el:define-key
This allows us to eliminate the ad-hoc emacscmd directive / role, and
improve indexing.

doc/emacs: convert remaining uses of emacscmd to define-key

This allows us to remove the no-longer used object type.
2022-08-11 07:48:54 -03:00
David Bremner
174221b179 doc/emacs: split index category from label
A more verbose category is needed for the index, but not the
description in the manual.
2022-08-11 07:43:17 -03:00
David Bremner
fe3db23684 doc/emacs: drop domain label
This makes the generate info files somewhat less verbose, so that they
say e.g. "Key Binding" instead of "Emacs Key Binding"
2022-08-11 07:43:17 -03:00
David Bremner
b2d0720971 doc/elisp: replace label for Emacs commands and key bindings.
In the notmuch doc index it is important to be clear which parts are
Emacs related.
2022-08-11 07:43:17 -03:00
David Bremner
4d367ac0b4 doc: copy elisp.py from flycheck, make available
This corresponds to flycheck commit
1702d2db3d8ba9bcb9b2bf810e791e907fcc3adc, which is apparently the last
time this file was modified (2018).

Embedding seems defensible since the file is evidently not changing
that much, and we need to change some labels to make it fit with the
not-just-emacs nature of notmuch docs.
2022-08-11 07:43:17 -03:00
David Bremner
bf64c48855 doc: add some documentation about duplicate files.
This is mainly motivated by the new emacs-UI features to select
duplicates, but hopefully it will help demystify things for users of
the CLI as well.
2022-08-11 07:32:04 -03:00
David Bremner
5a47b5a884 emacs: add docstring for notmuch-show-choose-duplicate
It should have one in any case, but in particular it is needed for the
manual.
2022-08-11 07:25:28 -03:00