Commit graph

7528 commits

Author SHA1 Message Date
Kevin Boulain
c810312e24 test: uncaught exception when editing properties of a removed message
These two functions don't fail gracefully when editing a removed
message:
 BROKEN edit property on removed message without uncaught exception
        --- T610-message-property.20.EXPECTED   2023-02-27 11:33:25.792764376 +0000
        +++ T610-message-property.20.OUTPUT     2023-02-27 11:33:25.793764381 +0000
        @@ -1,2 +1,3 @@
         == stdout ==
         == stderr ==
        +terminate called after throwing an instance of 'Xapian::DocNotFoundError'

The other functions appear to be safe.
2023-03-30 07:06:48 -03:00
Kevin Boulain
d86e03c786 lib/notmuch: update example
Likely missed in 86cbd215e, when notmuch_query_search_messages_st was
renamed to notmuch_query_search_messages.
2023-02-27 08:34:38 -04:00
David Bremner
48d774bbf4 emacs/tree: use two argument form of setq-local
Apparently the macro setq-local only takes two arguments in Emacs 26.1
2023-02-21 10:55:42 -04:00
David Bremner
09f2ad8e85 lib: add better diagnostics for over long filenames.
Previously we just crashed with an internal error. With this change,
the caller can handle it better. Update notmuch-new so that it doesn't
crash with "unknown error code" because of this change.
2023-02-20 09:22:32 -04:00
David Bremner
4e6c6c8aac test: add known broken test for diagnostics from over long filenames.
Previously we tested over long directory names, add similar testing
for over long filenames.
2023-02-20 09:22:07 -04:00
jao
f63d14a8c1 emacs: notmuch-tree-outline-mode
With this mode, one can fold trees in the notmuch-tree buffer as if
they were outlines, using all the commands provided by
outline-minor-mode.  We also define a couple of movement commands
that, optional, will ensure that only the thread around point is
unfolded.

The implementation is based on registering a :level property in the
messages p-list, that is then used by outline-minor-mode to to
recognise headers.

Amended by db: Copy docstring to manual and edit for presentation. Add
two tests. Fix typo "wether".
2023-02-20 08:58:32 -04:00
Daniel Kahn Gillmor
db4b48f6cc configure: use pkg-config for gpgme
GnuPG upstream has supported pkg-config since gpgme version 1.13 and
gpg-error 1.33, and now prefers the use of pkg-config by default,
instead of relying on gpg-error-config and gpgme-config.

As of libgpg-error 1.46, upstream deliberately does not ship
gpg-error-config by default.  As of gpgme 1.18.0, upstream does not
ship gpgme-config if gpg-error-config is also not present.

Both of these versions of upstream libraries are in debian unstable
now.  To the extent that notmuch is dependent on GnuPG, it should
follow GnuPG upstream's lead.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2023-01-10 08:29:23 -04:00
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