Commit graph

109 commits

Author SHA1 Message Date
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
Mark Walters
75ddd1eb46 contrib: pick: test: buffer movement 2013-09-04 06:33:41 -03:00
Mark Walters
0d8a3cc7fd contrib: pick: test: stash message id
This is important to test as lots of subsequent tests will fail if this fails.
2013-09-04 06:33:31 -03:00
Mark Walters
e8affaec06 contrib: pick: test: tag/untag whole thread 2013-09-04 06:33:17 -03:00
Mark Walters
d96863e54d contrib: pick: test: tag/untag single message 2013-09-04 06:32:58 -03:00
Mark Walters
e1e7b6fd2e contrib: pick: test: refresh view
A recent proposed patch was buggy when refreshing the view. Add a test
for refresh so that this does not reoccur.
2013-09-03 06:14:40 -03:00
Mark Walters
95ee9ed643 contrib: pick: add docstring for notmuch-pick-worker 2013-09-03 06:14:03 -03:00
Mark Walters
7febf701e7 contrib: pick: remove unneeded variable notmuch-pick-buffer-name
This variable is essentially unused: it was only used for making sure
it itself got reset after a refresh of the buffer.

It did this by passing an unnecessary argument to notmuch-pick-worker
so remove that too.
2013-09-03 06:13:50 -03:00
Mark Walters
9d2ac59a80 contrib: pick: bind M-p and M-n to prev/next thread
This adds functions to go to the previous or next thread to
pick. Prev-thread behaves similarly to prev-message in show: if you
are on the top line of a thread it will go to the top of the previous
thread, otherwise it will go to the top of the current thread. Next
thread will always go to the top of the next thread (or the end of
buffer). These are bound to "M-p" and "M-n" by default (matching the
bindings in show).
2013-09-03 06:12:36 -03:00
Mark Walters
3edd9f127b contrib: pick: thread tagging (including archiving) implemented
Previously pick had no actions based on the entire thread: this adds
some. Note in this version '*' is bound to `tag thread' which is not
consistent with search or show. However it still might be the most
natural thing (as it is similar to running * in the show pane).
2013-09-03 06:11:18 -03:00
Mark Walters
f8a8afe5c2 contrib: pick: add thread based utility functions
Previously notmuch-pick had no thread based functionality. This adds a
macro to iterate through all messages in a thread. To simplify this it
adds a text-property marker to the first message of each thread.
2013-09-03 06:10:25 -03:00
Mark Walters
9701e9c7d5 contrib: pick: remove sync tests
Since the previous commit removed the sync parser we may as well
remove its tests too.
2013-08-27 08:01:32 -03:00
Mark Walters
a56449c24c contrib: pick: remove sync parser
Previously pick had the option of using an async parser like search or
a sync parser like show. The async parser has always been the default
and it seems fine so we can remove the sync one and the corresponding
defcustom.
2013-08-27 08:01:15 -03:00
Mark Walters
e3c2be3e25 contrib: pick: use close-message-pane for reply etc
We can save some code duplication by using the new close-message-pane
functionality for reply, forward, and new mail.
2013-08-24 11:27:22 +02:00
Mark Walters
863d9aa674 contrib: pick: add in binding to view raw message
Note this does rely on the fact that we have over-ridden notmuch-show-get-properties
2013-08-24 11:19:14 +02:00
Mark Walters
8349173e96 contrib: pick: make help close the message pane first
Previously pressing "?" for help when the message pane was open meant
the help window was very small. Close the message pane before
displaying help.
2013-08-24 11:18:48 +02:00
Mark Walters
d3ef0f74cf contrib: pick: close window function 2013-08-24 11:18:01 +02:00
Mark Walters
d3924d5798 contrib: pick: pass tab through to the message pane
This makes tab move to next button in the message pane and binds
button activate (in message pane) to "e". This means that is easy to
toggle hidden parts or hidden citations etc in the message pane.
2013-08-24 11:17:44 +02:00
Mark Walters
415d5da7dd contrib: pick: add button press helper
We will want to be able to activate buttons not in the current
buffer (ie in the message pane) so it is helpful to have a way of
activating a button without signalling error if there is no button.
2013-08-24 11:17:16 +02:00
Mark Walters
1c591115d6 contrib: pick: add in to-message-window function 2013-08-24 11:16:58 +02:00
Mark Walters
5728d178f7 contrib: pick: Link in stash map straight from notmuch-show
These functions all now work straight from their notmuch-show
implementation so link them in.

Stash functionality was one of the key missing things in notmuch-pick.
2013-08-24 11:16:45 +02:00
Mark Walters
84e30ea789 contrib: pick: Link in attachment functions straight from notmuch-show
We can use the attachment functions straight from
notmuch-show. notmuch-show-view-all-mime-parts might be deprecated so
we either want to undeprecate it or not have this binding.
2013-08-24 11:16:03 +02:00
Mark Walters
a79396999c contrib: pick: Link in notmuch-show-pipe-message
Since we can now use show functions directly in pick we can drop pick-pipe-message.
2013-08-24 11:15:44 +02:00
Mark Walters
1716edff9d contrib: pick: override notmuch-show-get-prop
We override notmuch-show-get-prop so that many of the show functions
can be used in notmuch-pick without modification. The main use is that
it means notmuch-show-get-message-id `works' in pick. Thus we get all
the stash functions and several other `for free' in pick.
2013-08-24 11:15:23 +02:00
Mark Walters
1fd1e57d93 contrib: pick: use notmuch-start-notmuch
This uses the new notmuch-start-notmuch function which should give
better handling of stderr and errors generally.
2013-07-20 14:20:17 -03:00
Mark Walters
b60fb3309c contrib: pick: document several of the tree/forest insertion functions. 2013-07-04 00:41:45 -03:00
Mark Walters
4c09e67adf pick: contrib: document notmuch-pick-message-window-kill-hook 2013-07-04 00:41:32 -03:00
Mark Walters
a8ade6b144 pick: contrib: document notmuch-pick-refresh-result 2013-07-04 00:41:15 -03:00
Mark Walters
bb03a26c25 pick: contrib: document notmuch-pick-show-out 2013-07-04 00:40:44 -03:00
Mark Walters
1ed9db6c30 contrib: pick: remove unused function
The function notmuch-pick-show-error was used before Austin's improved
error handling. It is now redundant so remove.
2013-07-04 00:37:47 -03:00
Mark Walters
3d772a0a85 contrib: pick: remove unused variable
This variable was needed at one point for the async parser but is not
needed anymore.
2013-07-04 00:37:37 -03:00
Mark Walters
8c33fde83e contrib: pick: bugfix: make the right variable buffer-local
The variable notmuch-pick-message-buffer should be buffer local but
instead notmuch-pick-message-buffer-name (a non-existent variable) was
made buffer local.
2013-07-04 00:37:30 -03:00
Mark Walters
3a8163e17f contrib: pick: add docstrings to all defvars 2013-07-04 00:37:21 -03:00
Mark Walters
91777f8dc9 contrib: pick: add a docstring for the main notmuch-pick function 2013-07-04 00:37:13 -03:00
Mark Walters
eb26cd1fba contrib: pick: fix refresh result
The function notmuch-pick-refresh-result (used to update tag changes)
was not quite correct: sometimes it got the choice between the subject
and " ..." wrong. This was always true but the new code often calls
this (when opening a message in the message pane to remove the unread
tag) while the async pick process is still running and this caused
mistakes which made the tests fail.

Thus we store the previous subject with the message.
2013-07-04 00:36:38 -03:00
Mark Walters
a9dbcbb00c contrib: pick: remove hack notmuch-pick-show-match-message-with-wait
This function was a horrible hack (sleeping while waiting for the
correct message). The new target code can just open the message in the
message window when it arrives.
2013-07-04 00:36:26 -03:00
Mark Walters
f9aad24f02 contrib: pick: if no target specified go to first matching message 2013-07-04 00:36:19 -03:00
Mark Walters
b7df509fb5 contrib: pick: remove reference to inbox in docstring
Copy the recent changes in show to use just notmuch-archive-tags (as a
link) rather than saying '(defaults to "inbox")'.
2013-06-25 08:45:43 -07:00
Mark Walters
57a88397ca contrib: pick: remove unnecessary funcall
Remove unnecessary funcall. This keeps the pick function inline with
the recently tweaked show function.
2013-06-04 09:02:59 -03:00
Mark Walters
dbc3a247ca contrib: pick: bugfix: use notmuch-show-mark-read-tags instead of unread
Previously pick removed the unread tag from its tag display: since the
tag change is now customisable use the customised variable.

This only affected the tags displayed, not the tags in the database as
notmuch-show (in the view pane) did the actual tag changes.
2013-06-02 20:53:49 -03:00
Mark Walters
cec063736a contrib: pick: bugfix. use notmuch-show-only-matching-messages rather than prefix
Previously pick set a prefix argument prior to calling show in the
message pane to tell show to only show matching messages. This sets
notmuch-show-only-matching-messages instead which is much cleaner and
will work even if the user has configured show to default to showing
only matching messages.
2013-06-02 20:52:41 -03:00
Mark Walters
5461c31d64 contrib: pick: use the sexp parser
This just converts notmuch-pick to use the sexp parser.
2013-06-02 08:11:27 -03:00
Mark Walters
47a419ad16 contrib: pick: add a target message for pick
This adds a target message for pick which it will jump to when (if) it
appears. It adds the target to notmuch-pick-from-show-current-query so
that pick goes straight to the message that was current in the show
view and it adds target to notmuch-pick-refresh-view so that the
current message is preserved.
2013-05-20 15:38:40 -03:00
Mark Walters
740f0cda55 contrib: pick: move save-excursion closer to message insertion
Pick keeps point roughly at the top of the buffer while inserting
messages at the end as they come in (from the async
parser). Previously the save-excursion to do this was done once for
each thread inserted: now it is done for each individual message.

The advantage is that the message insertion code can decide where to
leave point. In the next patch point will be left on the target message.

Note notmuch-pick-insert-msg is unchanged as that is used by the tag
display update code.
2013-05-20 15:37:52 -03:00