Commit graph

144 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
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
Jani Nikula
14c60cf168 cli/show: list all filenames of a message in the formatted output
Instead of just having the first filename for the message, list all
duplicate filenames of the message as a list in the formatted
outputs. This bumps the format version to 3.
2017-02-26 07:41:33 -04:00
Mark Walters
0c6cd0fb02 devel: Document emacs keybindings
This adds a file under devel listing all the keybindings sorted by key
in the main three modes (search, show and tree).

To reduce clutter it only lists the single key "unmodified"
keybindings: I think all our uses of prefixes and modifiers are
natural variants of the unmodified binding (eg M-n compared to n in
show mode)

This should make easier to see what keybindings are available when
adding new features.
2016-10-25 18:10:40 -03:00
W. Trevor King
f9189a062b nmbug: Add --no-renames to default log options
Git has supported this since b68ea12e (diff.c: respect diff.renames
config option, 2006-07-07, v1.4.2).  All of our information is in the
paths (the files are empty), so we don't want rename detection.  By
using --no-renames, we get entries like:

  $ nmbug log -- e473b453a2
  commit e473b453a25c072b5df67d834d822121373321f5
  Author: David Bremner <david@tethera.net>
  Date:   Sun Sep 25 07:54:11 2016 -0300

  D       tags/1474196252-31700-1-git-send-email-markwalters1009@gmail.com/0.23
  A       tags/1474196252-31700-1-git-send-email-markwalters1009@gmail.com/pushed

  ...

Instead of the old:

  $ nmbug log -- e473b453a2
  commit e473b453a25c072b5df67d834d822121373321f5
  Author: David Bremner <david@tethera.net>
  Date:   Sun Sep 25 07:54:11 2016 -0300

  R100    tags/1474196252-31700-1-git-send-email-markwalters1009@gmail.com/0.23   tags/1474196252-31700-1-git-send-email-markwalters1009@gmail.com/pushed
2016-10-04 07:51:22 -03:00
Tomi Ollila
1e96445cb5 devel/man-to-mdwn.pl: portable locale environment variable setting
Setting locale environment variables (LC_* and LANG) to e.g.
en_US.utf8 works fine on Linux, and that is what locale -a
returns (in Linux). However this does not work e.g. in some *BSD
systems.
In these systems, en_US.UTF-8 works. This also works in Linux
systems (which may look like a surprising thing on the first sight(*)).
But that *UTF-8 format seems to be widely used in the Linux system:
Grep it through the files in /etc/, for example.

Easy way to test: Run the following command lines. First should
complain about setting locale failed, and second should not.

$ LC_ALL=en_US.UTF-1 perl -e ''
$ LC_ALL=en_US.UTF-8 perl -e ''

(*) and who knows what the "standard" is...
2016-06-11 13:01:30 -03:00
Daniel Kahn Gillmor
6a833a6e83 Use https instead of http where possible
Many of the external links found in the notmuch source can be resolved
using https instead of http.  This changeset addresses as many as i
could find, without touching the e-mail corpus or expected outputs
found in tests.
2016-06-05 08:32:17 -03:00
Daniel Kahn Gillmor
554b90b58e nmbug: updated to modern URL for PEP 343 2016-06-05 08:27:13 -03:00
David Bremner
9bbc54bd40 nmbug: ignore # comments
Lines starting with # have always (for a long time, anyway) been ignored
by notmuch-restore, but have not been generated by notmuch-dump
previously.  In order to make nmbug robust against such output, ignore
comment lines.
2016-03-28 09:29:42 -03:00
W. Trevor King
d6cbb24fcf notmuch-report: Add notmuch-report(1) and notmuch-report.json(5) man pages
To describe the script and config file format, so folks don't have to
dig through NEWS or the script's source to get that information.

The Makefile and conf.py are excerpted from the main doc/ directory
with minor simplifications and adjustments.  The devel/nmbug/ scripts
are largely independent of notmuch, and separating the docs here
allows packagers to easily build the docs and install the scripts in a
separate package, without complicating notmuch's core build/install
process.
2016-03-24 07:41:24 -03:00
W. Trevor King
399c857eba notmuch-report.json: Rename from status-config.json
status-config.json wasn't obviously associated with the old
nmubg-status, now notmuch-report.  The new name is
${CONFIGURED_SCRIPT}.json, so the association should be clear.
2016-03-24 07:41:06 -03:00
W. Trevor King
074f45e305 notmuch-report: Rename from nmbug-status
This script generates reports based on notmuch queries, and doesn't
really have anything to do with nmbug, except for sharing the NMBGIT
environment variable.
2016-03-24 07:40:39 -03:00
W. Trevor King
88171f34ed status-config.json: Remove parens from query entry
These are now added by nmbug-status.
2016-03-24 07:39:57 -03:00
W. Trevor King
6c0b6c8e1c nmbug-status: Wrap query phrases in parentheses when and-ing together
For example:

  "query": ["tag:a", "tag:b or tag:c"]

is now converted to:

  ( tag:a ) and ( tag:b or tag:c )

instead of the old:

  tag:a and tag:b or tag:c

This helps us avoid confusion due to Xapian's higher-precedence AND
[1], where the old query would be interpreted as:

  ( tag:a and tag:b ) or tag:c

[1]: http://xapian.org/docs/queryparser.html
2016-03-24 07:39:42 -03:00
W. Trevor King
031ca3f1bd nmbug-status: Add meta.message-url config setting
So you can link to archives other than Gmane.  For example, I'm doing
this in [1].

[1]: https://github.com/wking/nmbug-oci
2016-03-24 07:39:25 -03:00
David Bremner
9f8b2091c8 STYLE: suggest long names
Hopefully the exceptions are common sense.
2016-03-04 20:45:06 -04:00
David Bremner
99a0a90f65 STYLE: document some rules about variable declarations
No-one seemed opposed to C99 style loop variable declarations. The
requirement to declare variables at the top of blocks is maybe a little
more contested, but I believe it reflects the status quo.
2016-03-04 20:44:57 -04:00
Tomi Ollila
3959d98535 devel/emacs: add devel/try-emacs-mua
devel/try-emacs-mua provides an easy way to try and experiment
with the notmuch emacs client distributed in emacs subdirectory of
the notmuch source tree.

try-emacs-mua starts a new emacs process and if initial checks pass
*scratch* buffer is filled with information of how to begin.

Normal emacs command line arguments can be used, like -q or -Q.
These arguments are appended verbatim to the starting emacs process.

If the emacs version in use is smaller than 24.4, special care is taken
to ensure that notmuch*.elc files older than corresponding .el files
are not loaded. Since emacs 24.4, setting `load-prefer-newer' variable
takes care of this.
2016-01-13 10:36:19 -04:00
W. Trevor King
d6204e8362 nmbug-status: Fix unbalanced <p> tags in default header/footer
These were broken by b70386a4 (Move the generated date from the top of
the page to the footer, 2014-05-31), which moved 'Generated ...' to
the footer with the opening tag, but didn't replace the blurb opening
tag or add a closing tag after 'Generated ...'.
2016-01-13 10:29:14 -04:00
W. Trevor King
8fc32dd42e nmbug-status: Style headers with smaller fonts
We only use h1 through h3, and David prefers smaller headers [1], so
shift over to the font sizes usually used for h2 through h4 [2,3,4].
I haven't bothered with the W3C's default margins, since a bit of
extra whitespace doesn't seem like a big deal.

[1]: id:87k2nl8r0k.fsf@zancas.localnet
     http://article.gmane.org/gmane.mail.notmuch.general/21595
[2]: http://www.w3.org/TR/html-markup/h2.html
[3]: http://www.w3.org/TR/html-markup/h3.html
[4]: http://www.w3.org/TR/html-markup/h4.html
2016-01-13 10:28:49 -04:00
W. Trevor King
e3d586d038 nmbug-status: Adjust headers to start with h1
We've been leading off with h2s since 3e5fb88f (contrib/nmbug: add
nmbug-status script, 2012-07-07), but the semantically-correct headers
are:

  <h1>{title}</h1>
  ...
  <h2>Views</h2>
  ...
  <h3>View 1</h3>
  ...
  <h3>View 2</h3>
  ...

We can always add additional CSS if the default h1 formatting is too
intense.
2016-01-13 10:28:38 -04:00
W. Trevor King
a07cafae00 nmbug-status: Avoid hard-coded filename in error message
We already have a 'filename' variable with the name, so stay DRY and
use that variable here.

Also fix a missing-whitespace error from bed8b674 (nmbug-status:
Clarify errors for illegible configs, 2014-05-10), wrapping on the
sentence to match similar error-generation earlier in this function.
2016-01-07 09:15:35 -04:00
Tomi Ollila
36ad271704 devel/release-checks: added checking of copyright year in documentation
Check that copyright year will be current year in generated documentation.

Checking is done my matching that copyright line contains current year
as a substring which is good enough "approximation" in this context.
2015-11-19 07:34:29 -04:00
Jani Nikula
018e69f558 nmbug-status: print config errors to stderr
Particularly scripted usage with stdout redirection can be confusing
if errors are printed to stdout instead of stderr.
2015-10-04 07:22:03 -03:00
Jani Nikula
8b35b8f71a nmbug-status: add support for specifying sort order for each view
Let each view have a "sort" key, typically used with values
"oldest-first" or "newest-first" (although all values in Query.SORT
are accepted), and sort the results accordingly. Oldest first remains
the default.

The dynamic approach of mapping sort values is as suggested by
W. Trevor King <wking@tremily.us>.
2015-09-29 08:25:25 -03:00
David Bremner
765556c1f1 build: extract library versions from notmuch.h
- Make lib/notmuch.h the canonical location for the library versioning
information.

- Since the release-check should never fail now, remove it to reduce
complexity.

- Make the version numbers in notmuch.h consistent with the (now
  deleted) ones in lib/Makefile.local
2015-08-10 13:53:55 +02:00
Tomi Ollila
02a2eeb427 test: make script exit (1) if it "fails" to source (.) a file
The files (test) scripts source (with builtin command `.`) provides
information which the scripts depend, and without the `source` to
succeed allowing script to continue may lead to dangerous situations
(e.g. rm -rf "${undefined_variable}"/*).

At the end of all source (.) lines construct ' || exit 1' was added;
In our case the script script will exit if it cannot find (or read) the
file to be sourced. Additionally script would also exits if the last
command of the sourced file exited nonzero.
2015-08-07 21:56:39 +02:00