Commit graph

152 commits

Author SHA1 Message Date
Paul Wise
239fdbbbf0 notmuch-mutt: check that the search cache Maildir is not a real Maildir
This prevents data loss when users configure the search cache Maildir to be a
real Maildir containing their real mail data, since the search cache Maildir
is expected to contain only symlinks to the real mail data.

Prevents: <ZCsQBNmbzwkvbpHA@localhost.localdomain>
2023-05-28 15:34:42 -03:00
Paul Wise
18e35950da notmuch-mutt: do not clear search cache Maildir when nothing is found
The previous results might be useful to the user but
an empty directory definitely isn't useful.
2023-05-28 15:33:11 -03:00
Paul Wise
85916d8a96 notmuch-mutt: clarify the empty Maildir function operates on search caches
Rename the function and adjust the documentation comment.
2023-05-28 15:32:11 -03:00
Paul Wise
93d936c5ae notmuch-mutt: replace extra command with notmuch thread search feature
This should be be slightly faster since it avoids forking a shell
and is less code in and less dependencies for the script.

Since String::ShellQuote isn't used elsewhere, drop mention of it.
2023-05-27 14:26:43 -03:00
Paul Wise
6d383d4049 notmuch-mutt: fix Xapian query construction
Spaces need to be stripped when querying the Message-Id,
because notmuch stores them in Xapian with spaces stripped.

All double-quote characters need to be doubled to escape them,
otherwise they will be added as extra query terms outside the id.
2023-05-27 14:24:40 -03:00
Paul Wise
d155f29eca notmuch-mutt: convert ISO-8859-15 copyright statement to UTF-8
Suggested-by: isutf8 & check-all-the-things
2023-05-25 08:43:14 -03:00
Tomi Ollila
0d4a3c7185 notmuch-mutt: replace shell pipeline with internal pipe processing
The shell pipeline used to symlink files based in search results
to "cache" directory for mutt(1) to use was prone to portability
problems (due to /bin/sh differences).

The replacement executes `notmuch search` without intermediate shell
(so shell_quote was removed in this case), reads the filenames from
piped output and symlinks files internally.
2020-08-12 20:40:46 -03:00
Greg Anders
1fcf068e33 Make notmuch-mutt script more portable
The -D flag to install (used in the Makefile) is GNU-specific and does
not work on BSD distributions (i.e. macOS). Likewise with the xargs -r
flag. These changes use portable alternatives to these flags while
preserving the exact behavior.
2020-03-22 22:57:25 -03:00
David Bremner
84efbda925 contrib/notmuch-mutt: add install target
The main goal here is to be able to install the notmuch-mutt script
with an absolute shebang. I have tried to make the notmuch-mutt
Makefile use configure information from notmuch if available, but make
suitable guesses if not.
2018-09-18 07:54:33 -03:00
Georg Faerber
c117306f2d Fix typos as found by codespell
Signed-off-by: Georg Faerber <georg@riseup.net>
2018-03-24 20:09:54 -03:00
Daniel Kahn Gillmor
54982e520c fix typos 2018-01-04 20:35:58 -04:00
Daniel Kahn Gillmor
b10ce6bc23 database: add n_d_index_file (deprecates n_d_add_message)
We need a way to pass parameters to the indexing functionality on the
first index, not just on reindexing.  The obvious place is in
notmuch_database_add_message.  But since modifying the argument list
would break both API and ABI, we needed a new name.

I considered notmuch_database_add_message_with_params(), but the
functionality we're talking about doesn't always add a message.  It
tries to index a specific file, possibly adding a message, but
possibly doing other things, like adding terms to an existing message,
or failing to deal with message objects entirely (e.g. because the
file didn't contain a message).

So i chose the function name notmuch_database_index_file.

I confess i'm a little concerned about confusing future notmuch
developers with the new name, since we already have a private
_notmuch_message_index_file function, and the two do rather different
things.  But i think the added clarity for people linking against the
future libnotmuch and the capacity for using index parameters makes
this a worthwhile tradeoff.  (that said, if anyone has another name
that they strongly prefer, i'd be happy to go with it)

This changeset also adjusts the tests so that we test whether the new,
preferred function returns bad values (since the deprecated function
just calls the new one).

We can keep the deprecated n_d_add_message function around as long as
we like, but at the next place where we're forced to break API or ABI
we can probably choose to drop the name relatively safely.

NOTE: there is probably more cleanup to do in the ruby and go bindings
to complete the deprecation directly.  I don't know those languages
well enough to attempt a fix; i don't know how to test them; and i
don't know the culture around those languages about API additions or
deprecations.
2017-08-23 07:38:37 -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
laochailan
a26b06f09d fixed wrong constant values
before, they were both zero, so getting a read-writeable handle was
impossible.
2016-09-03 20:15:46 -03:00
laochailan
263a690ac4 Added thread bindings to go bindings 2016-09-03 20:15:16 -03:00
David Bremner
b0d03fc5ba bindings: move go bindings to contrib
This signals two things, an intent to be more liberal about accepting
patches, and an intent to stop distributing the bindings if maintenance
doesn't pick up.
2016-09-03 20:13:08 -03:00
David Bremner
2f2df00d43 contrib: remove old copy of vim front end
Having two in the tree is just confusing. And the viml one is even more
out of date than the ruby one.
2016-09-03 20:10:01 -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
Stefano Zacchiroli
e3e03fb718 notmuch-mutt: use env to locate perl for increased portability
Note: this patch drops -w from the shebang line, but we still have
"use warnings" in the script, which is superior anyhow.

Thanks Andreas Tolfsen for the suggestion.
2016-04-30 07:34:00 -03:00
Jack Peirce
1ad02d06b5 notmuch-mutt: fix xargs/ln usage for OpenBSD compatibility
- xargs: use -r flag instead of --no-run-if-empty
- ln: use -I flag/3rd form of ln command instead of -t flag/4th form

Signed-off-by: Stefano Zacchiroli <zack@upsilon.cc>
2015-05-04 08:04:38 +02:00
Stefano Zacchiroli
1722ea2c95 notmuch-mutt: support for messages that lack Message-ID headers
For those messages, compute a synthetic Message-ID based on the SHA1
of the whole message, in the same way that notmuch would do. See:
http://git.notmuchmail.org/git/notmuch/blob/HEAD:/lib/sha1.c

To do the above, rewrite get_message_id() to accumulate header lines,
parse them to check for Message-ID, and fallback to SHA1 computation
if it is not present.

Thanks to:
- Jan N. Klug for preliminary versions of this patch
- Tomi Ollila for suggesting an elegant implementation
2015-02-16 08:58:13 -04:00
Stefano Zacchiroli
02b554c896 notmuch-mutt README: use metacpn.org/* as deps homepages 2015-02-16 08:57:49 -04:00
Stefano Zacchiroli
f755fd1bda notmuch-mutt: bump copyright year 2015-02-16 08:57:42 -04:00
David Bremner
9060a1f617 contrib: remove notmuch deliver
contrib/notmuch-deliver is presumed obsoleted by notmuch-insert.
2015-01-14 15:25:30 +01:00
Mark Walters
919ca31581 remove notmuch-pick 2013-11-13 21:24:05 -04:00
Mark Walters
81b2ad57f0 test: move emacs-tree test into mainline
We move the emacs-tree test and associated files into the main test
directory and add the test to the list in notmuch-test.
2013-11-07 07:40:28 -04:00
Mark Walters
bb5fb8ea25 emacs: move notmuch-tree from contrib to mainline 2013-11-07 07:31:55 -04:00
Mark Walters
e2a16b6a6b emacs: tree: remove unneeded declarations
There are some crufty declare-functions and requires in notmuch-tree:
since it requires notmuch.el itself this all works but in preparation
for the move to mainline tidy this up.
2013-11-07 07:31:24 -04:00
Mark Walters
2a26f61421 pick: rename test emacs-pick to emacs-tree
Also fixup run-tests.sh
2013-10-29 08:15:07 -03:00
Mark Walters
dae09c690b pick: rename test outputs from pick to tree
Rename all the test output files to tree rather than pick, move the
containing directory to a tree.expected-output and fix up the
references in the test.
2013-10-29 08:14:22 -03:00
Mark Walters
e265a67c55 pick: Change the test names and print out for pick tests
Change from the pick name to the tree name
2013-10-29 08:13:32 -03:00
Mark Walters
5ad17f1fb7 contrib: pick: move lisp names from pick to tree
This changes all the lisp names from pick to tree (variables,
functions etc). It also changes the lisp in the emacs-pick test files
to match the new names.
2013-10-29 08:13:01 -03:00
Austin Clements
438c224787 pick: Use interactive specifications for tag changes 2013-10-25 21:31:11 -03:00
Austin Clements
3c3304131d pick: Use list form of tag-changes in test
Currently we support both string and list forms of tag-changes for
historical reasons.  This is about to change, so fix pick's tests that
use the legacy string form of tag-changes.
2013-10-25 21:31:00 -03:00
Austin Clements
14971fe57c pick: Fix incorrect use of `notmuch-pick-tag'
`notmuch-pick-tag' takes a list of tag changes, but
`notmuch-pick-archive-message' passes it a &rest argument.  This
happens to work if `notmuch-archive-tags' contains a single tag (which
it usually does), but will break if it does not.
2013-10-25 21:30:49 -03:00
Mark Walters
10596a5cce contrib: pick: update notmuch-show calls
Remove some unneeded nil arguments in notmuch-show calls.
2013-10-14 08:26:37 -03:00
Mark Walters
cc8c407dfc contrib: pick: remove temporary keybinding
We would like to bind prefix-arg RET in search view to "pick show this
thread" (i.e. notmuch-pick-from-search-thread). It is not easy to do
this cleanly from contrib so I have been using M-RET instead.

Temporarily remove this functionality in preparation for entering
mainline and binding to prefix-arg RET.
2013-10-02 08:47:39 -03:00
Mark Walters
d1a5f5c659 contrib: pick: move M-RET to prefix-arg RET
In pick the user has the option of showing the selected message in a
subpane (the message pane) or in the full frame. This is customisable
using the variable notmuch-pick-show-out. At the moment RET is bound
to the default option and M-RET the other option. This is
messy and involves tricks to make sure the keymap is setup at the
right time.

This changes this to prefix-arg RET for the other option which
simplifies the code and makes things cleaner.
2013-10-02 08:47:18 -03:00
Mark Walters
cbbf53e4df contrib: pick: tidy up pick-format-field
Previously this function used a temporary variable to store the return
value but we can just use the return value of the cond statement
directly.

The only tiny subtlety is that in one case (subject) we need to
slightly reorder the logic to make sure the formatted-field is the
last thing computed.
2013-09-23 07:30:57 -03:00
Mark Walters
c8f7b6e0c4 contrib: pick: remove unused notmuch-pick-from-hello
This function was used for pick entry from hello but isn't needed
anymore. It was modelled on notmuch-hello-search which is now only
used non-interactively (and notmuch-pick does now add to the
recent-search history correctly).
2013-09-23 07:30:20 -03:00
Mark Walters
4672cf0fe6 contrib: pick: use the new notmuch-common-keymap for pick entry
Austin recently added a global keymap: use this for pick
entry.
2013-09-23 07:29:56 -03:00
Mark Walters
393788487d contrib: pick: remove some superfluous quotes
Pick adds some keybindings to keymaps for other modes (for entry to
pick). These quoted the keymaps which appears to be unnecessary and to
rely on the fact that these keymaps have the same entry in the
function cell as the value cell (perhaps for historical reasons?)

Remove these quotes.
2013-09-23 07:29:45 -03:00
Mark Walters
81ee7855b5 contrib: pick: make the tree graphics a proper part of the format
Previously the box graphics in the pick view were always attached to
the subject. Make them a field in their own right. We use the
recursive insert to change the default notmuch-pick-result-format so
that the user view does not change. (The subject touches the tree box
graphics but the next column (tags) is still vertically aligned.)
2013-09-15 08:58:36 -03:00
Mark Walters
6ae591911c contrib: pick: allow recursive message field formats
Previously, the message format was fixed: each part had to be a
certain width and either left or right justified. This allows the user
to specify that two parts can be variable width but that combined they
should be some fixed width. We do this by allowing the user to set as
a "field" a list of the normal result-format form which is formatted
and then itself inserted according to the format string specified.

This means all existing formats work but allows more general things
too. This will be used in the next patch to allow the user to specify
where the tree box graphics are drawn but allow, e.g., the total width
of the tree box graphics and subject to be specified.
2013-09-15 08:58:03 -03:00
Mark Walters
6c8116c05b contrib: pick: move the insertion of fields up a level
This moves the actual insertion of message fields up from the field
formatting function into the message insertion function. This will be
useful in the next patch as we can apply further formatting to the
insertion string before inserting.
2013-09-15 08:57:32 -03:00
Mark Walters
44bfad08f1 contrib: pick: print () for a message with no tags
Dating back to the earliest notmuch-pick we have not printed anything
for the tag field for a message with no tags. This is inconsistent
with search and show both of which print "()". Change pick to be
consistent.
2013-09-15 08:57:21 -03:00
Mark Walters
2ae45c3392 contrib: pick: use global keymap
Austin recently introduced a new global keymap. This makes pick use
this global map.

In most cases pick needs to override this global map because
it wants to close the message pane before doing the action. However,
this documents the over-rides and makes it less likely that the pick
bindings will get out of sync with the main bindings.
2013-09-15 08:56:57 -03:00
Mark Walters
b8faf2b543 contrib: pick: bugfix use of mini-buffer history
pick was meant to use the same mini-buffer history but this failed
because the interactive definition took place before the use search
mini-buffer history part. Remove the interactive prompt to ensure the
correct history is used.
2013-09-15 08:56:13 -03:00
Kevin J. McCarthy
f3dc5be6f2 notmuch-mutt: Fix tagging issues
This patch fixes three issues with "notmuch-mutt tag":

1. The message_id was not shell quoted.
   Thanks to Jason Miller for the bug report and patch.

2. The tags passed into tag_action() were not being properly quoted.
   The "join before shell_quote" was combining multiple tags into a
   single argument to notmuch tag: '+one -two -three' instead of
   '+one' '-two' '-three'.

3. A "--" was added between the tags and search-term as shown in the
   current notmuch-tag man page.

Thanks to Tomi Ollila for suggesting the simple fix of using
the list form of system(), which bypasses the shell.
2013-09-08 22:47:51 -03:00
Kevin McCarthy
f354b90d5e notmuch-mutt: use notmuch --duplicate flag
Change notmuch-mutt to use the new --duplicate=1 flag for duplicate
removal.  This will remove duplicates based on message-id at the
notmuch level.  Previously we were using fdupes or generating sha sums
after the search.

This version will be faster, but will enable the possibility of hiding
search results due to accidental/malicious duplicate message-ids.
2013-09-08 22:41:38 -03:00