Commit graph

169 commits

Author SHA1 Message Date
Mohsin Kaleem
cd89065dc3 emacs: Add new option notmuch-search-hide-excluded
The new notmuch-search-hide-excluded option allows users to configure whether
to show or hide excluded messages (as determined by search.exclude_tags
in the local notmuch config file). It defaults to true for now to maintain
backwards-compatibility with how notmuch-{search,tree} already worked.

New commands notmuch-search-toggle-hide-excluded and
notmuch-tree-toggle-exclude have also been added. They toggle the value
of notmuch-search-hide-excluded for the search in the current search or
tree buffer. It's bound to "i" in the respective keymaps for these
modes.

Lastly I've amended some calls to notmuch-tree and notmuch-unthreaded
which didn't pass through the buffer local value of
notmuch-search-oldest-first (and now notmuch-search-exclude).
Examples of where I've done this include:
  + notmuch-jump-search
  + notmuch-tree-from-search-current-query
  + notmuch-unthreaded-from-search-current-query
  + notmuch-tree-from-search-thread

A new test file for Emacs has been added which covers the usage of the
new `notmuch-search-hide-excluded' option and interactively hiding or
showing mail with excluded tags. These test cover the basic usage of
the `notmuch-search-toggle-hide-excluded' command in notmuch-search,
notmuch-tree and notmuch-unthreaded searches. These tests also cover
the persistence of the current value of the hide-excluded mail option
as a user switches from between these different search commands.

[1]: id:87ilxlxsng.fsf@kisara.moe

Amended-by: db, fix indentation in T461-emacs-search-exclude.sh
2024-04-06 15:03:45 -03:00
David Bremner
d4e0aaa76b devel/nmweb: read mail files in binary mode.
"ju" reported on IRC that browsing

    https://nmbug.notmuchmail.org/nmweb/show/20160719094205.qmf5sjnja6crt5t3%40gotlib

crashed. The underlying issue is that python3 defaults to utf8
decoding files unless they are opened in binary mode. The file in
question (in the nmbug archive; it depends a bit on the routing the
message took) has

        Content-Type: text/plain; charset=iso-8859-1
        Content-Transfer-Encoding: 8bit

and some of it is not valid utf8.
2023-09-18 06:13:25 -03:00
Tim Culverhouse
e9ff896f84 schemata: document 'excluded' field in structured output
Include the 'excluded' field in the structured output schema.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2023-07-09 12:26:56 -03:00
Jakub Wilk
32bef33565 nmweb: Fix spacing around punctuation in headers 2022-10-11 08:15:25 -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
David Bremner
b3d466bf39 emacs/show: provide notmuch-show-choose-duplicate
This new command allows the user to interactively choose a different
duplicate (file) to display for a given message in
notmuch-show-mode. Since both tree and unthreaded view use
notmuch-show-mode, this provides the same facility there.
2022-07-30 08:42:12 -03:00
David Bremner
4612f3eb3d CLI/show: support --duplicate for structured output
This introduces a new mandatory key for message structures, namely
"duplicate". Per convention in devel/schemata this does _not_ increase
the format version. This means that clients are responsible for
checking that it exists, and not crashing if it does not.

The main functional change is teaching mime_node_open to understand a
'duplicate' argument.

Support for --duplicate in notmuch-reply would make sense, but we
defer it to a later commit.
2022-07-30 08:41:50 -03:00
David Bremner
803ac83c46 nmbug: promote to user tool "notmuch-git"
Initially just a rename, and drop the --version argument that clashes
with the global notmuch --version argument.
2022-06-17 08:40:19 -03:00
David Bremner
7167b7556c emacs: whitespace cleanup for keybindings
Changing the width of a column requires rewriting all the rows.
2022-02-26 08:00:43 -04:00
David Bremner
928c204240 emacs: Document undo binding.
This messes up whitespace, which will require a global change to fix.
2022-02-26 08:00:28 -04:00
David Bremner
3a311ed5ec devel/notmuch-web: single user web front end using python-cffi
Originally contributed by Brian Sniffen [1]. Quite a few unpublished
fixes from Daniel Kahn Gilmour. We've been running it a few years now
as the "official" archive of the notmuch mailing list. There also a
few fixes from myself and Austin Ray. Finally I converted it to the
new python bindings.

This commit squashes the several years of development history and
moves it under devel, in recognition of the now established role it
plays in the project infrastructure.

[1]: id:87tvyvp4f2.fsf@istari.evenmere.org
2022-02-25 08:20:31 -04:00
Tomi Ollila
08da7f25e5 removed use of 'echo -n' (and echo -n -e ...)
In most cases used printf %s ... instead.

echo -n > file  lines to create empty / truncate files were
changed to : > file lines, like done in in test-lib-emacs.sh

And one echo -n "  " replaced with use of sed "s/^/  /" in next line.
2022-02-21 09:36:39 -04:00
David Bremner
c5cf92aa35 CLI: print extra headers in structured output
This is based on a patch from Johan Parin [1], which is in turn
responding to a bug report / feature requiest from Jan Malkhovski.

The update to the structured output documented in schemata is intended
to be upward compatible, so the format version stays the same

[1]: id:20191116162723.18343-1-johan.parin@gmail.com
[2]: id:87h8sdemnr.fsf@oxij.org
2022-01-18 08:11:06 -04:00
David Bremner
a4b1c39331 devel: script for checking a commit (series)
'check-notmuch-commit' is an updated version of a script I have been
using (although not always as consistently as I should) before sending
patches to the list.

Although it requires a bit more tooling, encouraging people to use
check-notmuch-commit might reduce the number of round trips to the
list for style nitpicks.
2021-10-10 20:55:09 -03:00
David Bremner
731697d671 CLI: define and use format version 5
This is a bit of a cheat, since the format does not actually
change. On the other hand it is fairly common to do something like
this to shared libary SONAMEs when the ABI changes in some subtle way.
It does rely on the format-version argument being early enough on the
command line to generate a sensible error message.
2021-08-22 07:05:13 -07:00
jao
357dd488ca emacs: new command notmuch-tree-filter-by-tag
This new command for notmuch-tree-mode is analogous to
notmuch-search-filter-by-tag, bound to "t" in notmuch-search-mode; it
gets therefore the same "t" keybinding in notmuch-tree-mode (replacing
the current assignment to notmuch-search-by-tag).
2021-08-21 19:53:42 -07:00
jao
7857457833 emacs: new command notmuch-tree-filter
This command is analogous to notmuch-filter, but is defined on tree
mode buffers.
2021-08-21 19:48:13 -07:00
Matt Armstrong
5734d8bd32 Fix author-scan.sh on BSD systems.
BSD xargs does not have the -d option. Here we use tr to convert
newlines to NUL characters, then pass -0 to xargs (which BSD does
support).

I looked at passing -z to 'git ls-files', but I did not find a BSD
grep option to turn on NUL deliminted line processing.
2021-08-03 20:26:36 -03:00
jao
32f42581e3 doc: new notmuch show --sort and related emacs commands
New --sort CLI option documented in notmuch-show's man page, and
notmuch-search-toggle-order mentioned in doc/notmuch-emacs.rst and
devel/emacs-keybindings.org (in the latter, there's also some
whitespace changes in a table introduced by org-mode).
2021-07-03 20:38:34 -03:00
Daniel Kahn Gillmor
8c29a5da09 cli/show: produce "email" element in sigstatus
When the certificate that signs a message is known to be valid, GMime
is capable of reporting on the e-mail address embedded in the
certificate.

We pass this information along to the caller of "notmuch show", as
often only the e-mail address of the certificate has actually been
checked/verified.

Furthermore, signature verification should probably at some point
compare the e-mail address of the caller against the sender address of
the message itself.  Having to parse what gmime thinks is a "userid"
to extract an e-mail address seems clunky and unnecessary if gmime
already thinks it knows what the e-mail address is.

See id:878s41ax6t.fsf@fifthhorseman.net for more motivation and discussion.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2021-06-26 13:07:47 -03:00
David Bremner
324443f166 devel/uncrustify: add line length limits.
A generous limit of 102 is chosen to moderate the amount of resulting
reformatting.
2021-03-12 07:15:41 -04:00
Tomi Ollila
a12bf2a52a nmbug: notmuch-report: set both background and foreground colors
Whenever setting background color, set also corresponding
foreground color. Don't expect default foreground color to
be #000 (or something close); user may have changed it.
2021-01-09 11:29:07 -04:00
David Bremner
40b75f50be release: call python3 instead of python
Debian does not install /usr/bin/python by default any more.
2020-11-08 10:01:53 -04:00
David Bremner
8e721f12ba release: update release-checks.sh for s/version/version.txt/
Another place missed by the rename.
2020-11-08 10:00:57 -04:00
David Bremner
8776faf6d5 devel/release-checks.sh: use grep to find copyright year.
This is quite fragile, but it works for now, unlike the python
version.

In general it seems conf.py is not intended to be evaluated outside of
sphinx, as it assumes certain global names (in particular "tags") are
defined.
2020-08-16 11:34:03 -03:00
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
David Bremner
ee897cab8b test: drop upgrade from v1 tests
These are less crucial since we stopped generating new database
versions and relied primarily on features. They also rely on a
pre-generated v1 database which happens to be chert format. This
backend is not supported by Xapian 1.5.

Also drop the tool gen-testdb.sh, which is currently broken, due to
changes in the testing infrastructure.
2020-07-11 17:20:09 -03:00
David Bremner
55619625eb devel: script to calculate a list of authors.
As an initial heuristic, report anyone with at least 15 lines of code
in the current source tree. Test corpora are excluded, although
probabably this doesn't change much about the list of authors
produced.
2020-06-05 07:00:35 -03:00
Keegan Carruthers-Smith
f28e0a9337 emacs: introduce notmuch-search-by-tag
This is like notmuch-search-filter-by-tag, but creates a new search
rather than filtering the current search. We add this to
notmuch-common-keymap since this can be used by many contexts. We bind
to the key "t", which is the same key used by
notmuch-search-filter-by-tag in notmuch-search-mode-map. This is done
intentionally since the keybinding for notmuch-search-mode-map can be
seen as a specialization of creating a new search.

This change was motivated for use in "notmuch-hello". It is a more
convenient way to search a tag than expanding the list of all tags. I
also noticed many saved searches people use are simply tags.
2020-04-14 12:29:31 -03:00
Daniel Kahn Gillmor
144cf30e2c nmbug: explicitly prefer python3
nmbug and notmuch-report are developer tools.  It's 2018, and all
developers should have python3 available.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2020-04-03 09:33:44 -03:00
Daniel Kahn Gillmor
7eb9615b30 Drop devel/printmimestructure (it is in mailscripts 0.11)
mailscripts 0.11 now ships a derivative of devel/printmimestructure
called email-print-mime-structure.  Maintenance for that utility will
happen in mailscripts from now on, so we should not track an
independent copy of it in notmuch's source tree.

See https://bugs.debian.org/939993 for more details about the
adoption.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-10-13 09:31:50 -03:00
David Bremner
bcfd3e7542 uncrustify: indent classes
With previous settings member functions / variables are moved to
column 0.
2019-06-14 07:41:27 -03:00
David Bremner
87df05d181 STYLE: document rules for calls, block comments, ternary ops 2019-06-14 07:41:27 -03:00
Daniel Kahn Gillmor
56416a5470 cli/show: add information about which headers were protected
The header-mask member of the per-message crypto object allows a
clever UI frontend to mark whether a header was protected (or not).
And if it was protected, it contains enough information to show useful
detail to an interested user.  For example, an MUA could offer a "show
what this message's Subject looked like on the wire" feature in expert
mode.

As before, we only handle Subject for now, but we might be able to
handle other headers in the future.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>

Amended by db: tweaked schemata notation.
2019-05-29 08:11:50 -03:00
Daniel Kahn Gillmor
4cb789aa09 cli/show: emit new whole-message crypto status output
This allows MUAs that don't want to think about per-mime-part
cryptographic status to have a simple high-level overview of the
message's cryptographic state.

Sensibly structured encrypted and/or signed messages will work fine
with this.  The only requirement for the simplest encryption + signing
is that the message have all of its encryption and signing protection
(the "cryptographic envelope") in a contiguous set of MIME layers at
the very outside of the message itself.

This is because messages with some subparts signed or encrypted, but
with other subparts with no cryptographic protection is very difficult
to reason about, and even harder for the user to make sense of or work
with.

For further characterization of the Cryptographic Envelope and some of
the usability tradeoffs, see here:

   https://dkg.fifthhorseman.net/blog/e-mail-cryptography.html#cryptographic-envelope
2019-05-26 08:20:23 -03:00
Daniel Kahn Gillmor
0741e48c3d use #!/usr/bin/env python consistently 2018-06-14 20:38:20 -03:00
Jameson Graef Rollins
0a3dff7b8a minor cleanup to printmimestructure
make the source slightly easier to read.  no functional change.
2018-06-14 20:36:19 -03:00
Daniel Kahn Gillmor
8ca911d13b devel: make printmimestructure py3 compatible
Make printmimestructure work in python3 as well as python2.
2018-06-14 20:33:17 -03:00
Daniel Kahn Gillmor
c20a5eb805 move more http -> https
Correct URLs that have crept into the notmuch codebase with http://
when https:// is possible.

As part of this conversion, this changeset also indicates the current
preferred upstream URLs for both gmime and sup.  the new URLs are
https-enabled, the old ones are not.

This also fixes T310-emacs.sh, thanks to Bremner for catching it.
2018-05-03 20:59:20 -03:00
Daniel Kahn Gillmor
54982e520c fix typos 2018-01-04 20:35:58 -04:00
W. Trevor King
75477003e9 nmbug: Bump to version 0.3
Changes since 0.2:

* Accept failures to unset core.worktree in clone (0a155847,
  2017-10-10, unreleased).
* Use --no-renames in log (f9189a06, 2016-09-26, v0.24).
* Auto-checkout in clone if it wouldn't clobber (7ef3b653, 2017-10-10,
  unreleased).
* Add a 'help' command for folks who don't like --help
  (9d25c97d, 2014-10-03, v0.20).
* Setup a 'config' branch on clone to track origin/config (244f8739,
  2015-03-22, v0.20).  This branch may be consumed by
  notmuch-report(1).
* Only error for invalid diff lines in tags/ (57225988, 2017-10-16,
  unreleased).
* Ignore # comments in 'notmuch dump ...' output (9bbc54bd,
  2016-03-27, v0.22).
* Respect 'expect' in _spawn(..., wait=True) (e263c5b1, 2017-10-10,
  unreleased).
* Update URLs in documentation (554b90b5 and 6a833a6e8, 2016-06-02,
  v0.23).
2017-12-29 16:44:20 -04:00
W. Trevor King
572259885a nmbug: Only error for invalid diff lines in tags/
Avoid:

  Traceback (most recent call last):
    File "/home/nmbug/bin/nmbug", line 834, in <module>
      args.func(**kwargs)
    File "/home/nmbug/bin/nmbug", line 385, in checkout
      status = get_status()
    File "/home/nmbug/bin/nmbug", line 580, in get_status
      maybe_deleted = _diff_index(index=index, filter='D')
    File "/home/nmbug/bin/nmbug", line 658, in _diff_index
      for id, tag in _unpack_diff_lines(stream=p.stdout):
    File "/home/nmbug/bin/nmbug", line 678, in _unpack_diff_lines
      'Invalid line in diff: {!r}'.format(line.strip()))
  ValueError: Invalid line in diff: u'.mailmap'

With this commit, folks can commit READMEs, .mailmap, etc. to their
nmbug repositories, and 'nmbug diff' and 'status' won't choke on them.
If you want to check for this sort of thing, you can set --log-level
to info or greater.  nmbug will still error if the unrecognized path
is under tags/, since that's more likely to be a user error.
2017-12-16 08:20:13 -04:00
W. Trevor King
7ef3b65376 nmbug: Auto-checkout in clone if it wouldn't clobber
We currently auto-checkout after pull and merge to make those more
convenient.  They're guarded against data-loss with a leading
_insist_committed().  This commit adds the same convenience to clone,
since in most cases users will have no NMBPREFIX-prefixed tags in
their database when they clone.  Users that *do* have
NMBPREFIX-prefixed tags will get a warning (and I've bumped the
default log level to warning so folks who don't set --log-level will
see it) like:

  $ nmbug clone http://nmbug.notmuchmail.org/git/nmbug-tags.git
  Cloning into '/tmp/nmbug-clone.g9dvd0tv'...
  Checking connectivity: 16674, done.
  Branch config set up to track remote branch config from origin.
  Not checking out to avoid clobbering existing tags: notmuch::0.25, ...
2017-12-11 09:07:09 -04:00
W. Trevor King
0a1558471f nmbug: Accept failures to unset core.worktree in clone
Since 6311cfaf (init: do not set unnecessary core.worktree,
2016-09-25, 2.11.0 [1]), Git has no longer set core.worktree when
--separate-git-dir is used.  This broke clone with:

  $ nmbug clone http://nmbug.notmuchmail.org/git/nmbug-tags.git
  Cloning into '/tmp/nmbug-clone.33gg442e'...
  Checking connectivity: 16674, done.
  ['git', '--git-dir', '/home/wking/.nmbug', 'config', '--unset', 'core.worktree'] exited with 5
  $ echo $?
  1

The initial discussion that lead to the Git change is in [2], and
there is some more discussion around this specific change in [3].
There is some useful background on working trees in this 2009 message
[4].  There is also a git-worktree(1) since df0b6cfb (worktree: new
place for "git prune --worktrees", 2015-06-29, 2.5.0 [5]) which grew
the ability to add new worktrees in 799767cc (Merge branch
'es/worktree-add', 2015-07-13, 2.5.0 [6]).  Folks relying on
core.worktree in the --separate-git-dir case fall into the "former
case" in [4], and as Junio pointed out in that message, Git
operations like 'add' don't really work there.

In nmbug we don't want core.worktree, because our effective working
tree is the notmuch database.  By accepting failed core.worktree
unsets, clone will work with Gits older and younger than 2.11.0.

[1]: 6311cfaf93
[2]: https://public-inbox.org/git/CALqjkKZO_y0DNcRJjooyZ7Eso7yBMGhvZ6fE92oO4Su7JeCeng@mail.gmail.com/
[3]: https://public-inbox.org/git/87h94d8cwi.fsf@kyleam.com/
[4]: https://public-inbox.org/git/7viqbsw2vn.fsf@alter.siamese.dyndns.org/
[5]: df0b6cfbda
[6]: 799767cc98

Reported-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2017-12-11 09:06:47 -04:00
W. Trevor King
e263c5b1f9 nmbug: Respect 'expect' in _spawn(..., wait=True)
Fixing a bug from 7f2cb3be (nmbug: Translate to Python, 2014-10-03).
The bug had no direct impact though, because none of the wait=True
callers were setting expect.

Also add expected codes to the debug messages, to help log readers
understand why nonzero exits are occasionally accepted.
2017-12-11 09:06:30 -04:00
Tomi Ollila
54aef07159 devel/check-out-of-tree-build.sh: consistent naming, consistent quoting
Renamed from out-of-tree-build-check.sh to be consistent with
other files in this directory.

Fixed quoting in "$srcdir" usage for additional robustness, other
quoting changes for consistency.
2017-10-05 07:40:36 -03:00
Jani Nikula
379de73603 devel: add script to test out-of-tree builds
Something I used for 'git bisect run', but we should really add this
as part of our process.
2017-10-02 07:25:06 -03:00
Vladimir Panteleev
ca4688e103 Use rooted paths in .gitignore files
A leading / in paths in a .gitignore file matches the beginning of the
path, meaning that for patterns without slashes, git will match files
only in the current directory as opposed to in any subdirectory.

Prefix relevant paths with / in .gitignore files, to prevent
accidentally ignoring files in subdirectories and possibly slightly
improve the performance of "git status".
2017-08-18 19:42:35 -03:00
David Bremner
9eacd7d367 devel/schemata: describe version 4
Replace numeric errors with human readable flags.  Not all sig_error
keys will necessarily be generated with a given version of gmime.

Drop status "none" as it's currrently unused and I don't know what
it's for.
2017-07-04 08:32:37 -03:00
Jani Nikula
ea20a932f1 cli/show: add content-disposition to structured output message parts
Help the clients decide how to display parts.

Test updates by Mark Walters <markwalters1009@gmail.com>.
One more test fix by db
2017-02-28 08:03:00 -04:00