Commit graph

574 commits

Author SHA1 Message Date
Austin Clements
e1d5e88156 emacs: Improve error handling for notmuch-call-notmuch-json
This checks for non-zero exit status from JSON CLI calls and pops up
an error buffer with stderr and stdout.  A consequence of this is that
show and reply now handle errors, rather than ignoring them.
2012-12-16 17:04:08 -04:00
Austin Clements
66c935cff3 emacs: Factor out synchronous notmuch JSON invocations
Previously this code was duplicated between show and reply.  This
factors out synchronously invoking notmuch and parsing the output as
JSON.
2012-12-16 17:00:22 -04:00
Austin Clements
0844af35eb emacs: Use unified error handling in notmuch-call-notmuch-process
This makes notmuch-call-notmuch-process use the unified CLI error
handling, which basically refines the error handling this function
already did.
2012-12-16 17:00:00 -04:00
Austin Clements
693cf03cee emacs: Centralize notmuch command error handling
This provides library functions for unified handling of errors from
the notmuch CLI.  Follow-up patches will convert some scattered error
handling to use this and add error handling where we currently ignore
errors.
2012-12-16 16:58:14 -04:00
Austin Clements
d0ebd6cb53 emacs: Fix bug in resynchronizing after a JSON parse error
Previously, if the input stream consisted only of an error message,
notmuch-json-begin-compound would signal a (wrong-type-argument
number-or-marker-p nil) error when reaching the end of the error
message.  This happened because notmuch-json-scan-to-value would think
that it reached a value and put the parser into the 'value state.
Even after notmuch-json-begin-compound signaled the syntax error, the
parser would remain in this state and when the resynchronization logic
reached the end of the buffer, the parser would fail because the
'value state indicates that characters are available.

This fixes this problem by restoring the parser's previous state if it
encounters a syntax error.
2012-12-15 13:47:49 -04:00
Jani Nikula
11a220a3c1 emacs: add support for stashing the thread id in show view
Add a prefix argument to notmuch-show-stash-message-id to stash thread
id instead of message id.
2012-12-09 19:09:46 -04:00
Mark Walters
776e21d953 emacs: show: refresh buffer did not remove overlays
Previously refreshing the notmuch show buffer did not remove overlays
which meant that if the user refreshed a message with images the
images would remain and then the new text was added after.

One might have guessed that erase-buffer would have removed them but
it seems not.  Thus force the removal of overlays with remove-overlays.
2012-12-06 17:13:23 -04:00
Mark Walters
5382eebcdc emacs: stash bugfix
Currently an attempt to stash a non-existent field (eg cc when not
present) throws an error. Catch this case and give the user a warning
message.
2012-12-06 17:12:47 -04:00
Jani Nikula
fb6edb0800 emacs: drop support for deprecated notmuch-folders
Remove notmuch-folders which has been deprecated since

commit a466921760
Author: Carl Worth <cworth@cworth.org>
Date:   Mon Apr 26 22:42:07 2010 -0700

    emacs: Rip out all of the notmuch-folder code.

This lets us simplify the notmuch-saved-searches code slightly.
2012-12-04 09:08:02 -04:00
Mark Walters
e504b56f24 emacs: Split the function notmuch-show-clean-address
This function is also used by pick so split it out in preperation for
moving to lib. In fact, pick and show want a slightly different
combination of name and email on return so make the separated function
return them as a pair, and let show or pick extract the combination
they want from that.
2012-12-01 08:15:28 -04:00
Tomi Ollila
59c994e770 emacs: less guessing of character set in messages
The macro with-current-notmuch-show-message executes command
`notmuch show --format=raw id:...` which just outputs the contents
of the mail file verbatim (into temporary buffer). In case e.g. utf-8
locale is used the temporary buffer has buffer-file-coding-system as
utf-8. In this case Emacs converts the data to multibyte format, guessing
that input is in utf-8.
However, the "raw" (MIME) message may contain octet data in any other
8bit format, and as no (MIME-)content spesific handling to the message
is done at this point, conversion to other formats may lose information.
By setting coding-system-for-read 'no-conversion drops the conversion part
and makes this handle input as notmuch-get-bodypart-internal() does.
This marks the broken test in previous change fixed.
2012-11-26 22:06:41 -04:00
Tomi Ollila
0a21fb98b2 notmuch-show.el: handle the case where icalendar-import-buffer returns nil
icalendar-import-buffer can fail by an error signal (which have been
witnessed) but according to its docstring it can also return nil
when failing (it returns t when succeeding).

Now that the error is caught by the caller of notmuch-show-inset-part-*
functions in case icalendar-import-buffer returns nil an explicit
error is signaled and unwind-protect takes care of deleting the
temporary file (just in case, it is usually not written to the fs yet).
2012-11-25 11:06:23 -04:00
Tomi Ollila
60b5bff53d notmuch-show.el: import calendar data with public function after CR removal
notmuch-get-bodypart-content provides raw data to its caller so
that it can be stored verbatim whenever needed. icalendar functions
expect Emacs to do EOL conversion for the data given to these. Therefore
it the CRLF -> LF conversion is now done explicitly.

The calls to private functions icalendar--convert-ical-to-diary and
icalendar--read-element are replaced with call to public function
icalendar-import-buffer.
2012-11-25 11:06:12 -04:00
Austin Clements
87a05adba3 emacs: Buttonize mid: links
This adds support for RFC 2392 mid: message ID links.
2012-11-15 18:13:27 -04:00
Austin Clements
580997252f emacs: Improve the regexp used to match id:'s in messages
This regexp agrees with Xapian query syntax much more closely, though
we specifically disallow various cases that would be confusing in the
context of an email body (e.g., punctuation at the end of an id: link
is not considered part of the id: link because it's probably part of
the surrounding text).

In particular, this handles id: links that are not surrounded by
quotes much better, which stash is much more likely to generate now
that we don't quote id's that don't need to be quoted.  It also
handles quoted id: links better.

We update the buttonization test to reflect the new pattern.
2012-11-15 18:11:07 -04:00
Tomi Ollila
7c6ac9fbae emacs/notmuch-show.el: handle bodypart insert error
When inserting of email bodypart failes, insert a failure message
to the buffer (and continue) instead of halting the insertion of
the rest of that email thread in question.
2012-11-07 08:04:12 -04:00
Mark Walters
42391b4056 emacs: Move the incremental JSON parser to notmuch-lib.el
This just moves the newly split out incremental json parser (together
with its state variables) to lib.

There should be no functional change.
2012-10-28 09:42:18 -03:00
Mark Walters
294667871a emacs: Rename incremental JSON internal variables
This patch just renames the internal variables for the JSON parser now
it is no longer specific to search mode. It also fixes up the white
space after the previous patch. There should be no functional changes.
2012-10-28 09:42:09 -03:00
Mark Walters
1dd76ab9b6 emacs: Split out the incremental json parser into its own function
This patch splits out the incremental json parser into its own
function.

It moves the main logic of the parser to happen inside the parse
buffer rather than inside the results buffer, but makes sure all
results and all errors are displayed in the results buffer.

It also changes the local parser variables from being buffer
local to the results buffer to being buffer local to the parse buffer,
and sets them up automatically so the caller does not need to.

Finally to keep the diff small this patch does not fix the whitespace,
nor complete the code movement (these are done in subsequent patches)
but it should contain all the functional changes.
2012-10-28 09:41:54 -03:00
Austin Clements
0a4663ff43 emacs: Escape tag queries suggested by tab completion 2012-10-27 09:34:34 -03:00
Austin Clements
b235850f9b emacs: Escape tag queries performed by hello 2012-10-27 09:34:14 -03:00
Austin Clements
1a4cb8fd29 emacs: Introduce generic boolean term escaping function
Currently, we only properly escape stashed id queries, but there are
other places where the Emacs UI constructs queries for boolean terms.
Since this escaping function is meant to be used in other places, it
avoids escaping strings that don't need escaping.
2012-10-27 09:33:55 -03:00
Pieter Praet
0db6c7b8be emacs: rename notmuch-show-toggle-headers' to notmuch-show-toggle-visibility-headers'
* emacs/notmuch-show.el

  (notmuch-show-toggle-headers):
    Rename to `notmuch-show-toggle-visibility-headers'.

  (notmuch-show-mode-map):
    Update "h" binding wrt renamed `notmuch-show-toggle-headers'.

  (notmuch-message-headers):
    Update docstring wrt renamed `notmuch-show-toggle-headers'.

  (notmuch-message-headers-visible):
    Update docstring wrt renamed `notmuch-show-toggle-headers'.
    Also fixed a small typo.

* test/emacs:

  Update subtest wrt renamed `notmuch-show-toggle-headers':
  - "notmuch-show: hide message headers (w/ notmuch-show-toggle-headers)"
2012-10-20 12:10:41 -03:00
Austin Clements
f227d63b27 emacs: Work around gnus-inhibit-images bug in mm-shr
Emacs 24's mm-shr HTML email renderer fails to load gnus-art before
referencing gnus-inhibit-images, resulting in a void-variable error
when notmuch attempts to render an HTML email with inline images.
This works around this bug by advising mm-shr to load gnus-art.

mm-shr is the only function outside of gnus-art itself that references
gnus-inhibit-images, so this workaround should be correct.  If this
ever changes, hopefully they will have fixed this bug upstream first.

This fixes the "Rendering HTML mail with images" test for Emacs 24.
2012-09-30 11:40:31 -03:00
Jani Nikula
1ecacab28f emacs: simplify point placement in notmuch-hello refresh
notmuch-hello (called also through notmuch-hello-update, bound to '='
by default) tries to find the widget under or following point before
refresh, and put the point back to the widget afterwards. The code has
grown quite complicated, and has at least the following issues:

1) All the individual section functions have to include code to
   support point placement. If there is no such support, point is
   dropped to the search box. Only saved searches and all tags
   sections support point placement.

2) Point placement is based on widget-value. If there are two widgets
   with the same widget-value (for example a saved search with the
   same name as a tag) the point is moved to the earlier one, even if
   point was on the later one.

3) When first entering notmuch-hello notmuch-hello-target is nil, and
   point is dropped to the search box.

Moving the point to the search box is annoying because the user is
required to move the point before being able to enter key bindings.

Simplify the code by removing all point placement based on widgets, as
it does not work properly, and trying to fix that would unnecessarily
complicate the code.

Save current line and column before refresh, and restore them
afterwards. Sometimes, if notmuch-show-empty-saved-searches is nil,
and the refresh adds or removes saved searches from the list, this has
the appearance of moving the point relative to the nearest
widgets. This is a much smaller and less frequent problem than the
ones listed above.
2012-09-30 11:20:08 -03:00
Damien Cassou
f164784d56 Run notmuch-show-hook' after setting header-line-format'
This patch makes it possible for notmuch-show hooks to change the
header line.

Signed-off-by: Damien Cassou <damien.cassou@gmail.com>
2012-09-27 12:48:43 -03:00
Jani Nikula
8a22e28750 emacs: add support for reversing notmuch-show-mark-read tag changes
Since marking a message as read can now be a user customized set of
tag changes, make reversing this easier. Allow a prefix argument to
notmuch-show-mark-read to reverse the marking as read, similar to the
unarchiving in notmuch-show-archive-message.

While at it, update the relevant documentation to match that of other
automatic tagging (i.e. archive and reply).
2012-09-19 08:06:12 -03:00
Jani Nikula
1548751041 emacs: add support for reversing notmuch-search-archive-thread tag changes
Since archiving a thread can now be a user customized set of tag
changes, make reversing this easier. Allow a prefix argument to
notmuch-search-archive-thread to reverse the archiving, similar to the
unarchiving in notmuch-show-archive-message.
2012-09-19 08:05:59 -03:00
Jani Nikula
d5dcfc714e emacs: add support for custom tag changes on message/thread archive
Add support for customization of the tag changes that are applied when
a message or a thread is archived. Instead of hard-coded removal of
the "inbox" tag, the user can now specify a list of tag changes to
perform.
2012-09-19 08:04:10 -03:00
Jani Nikula
2590d94bf0 emacs: use new tag change helper to mark messages as replied
Clarify documentation while at it.
2012-09-19 08:03:35 -03:00
Jani Nikula
5a48340bf1 emacs: fix notmuch-message-replied-tags defcustom type 2012-09-19 08:02:48 -03:00
Jani Nikula
1dc7e66ee7 emacs: add helper for tag change list manipulation
Add a helper to create (and optionally reverse) a list of tag changes.
2012-09-19 08:01:59 -03:00
Pieter Praet
c62126238b emacs: correct notmuch-search-mode's docstring wrt notmuch-search-tag-all'
* emacs/notmuch.el (notmuch-search-mode):
  `notmuch-search-tag-all' currently uses the current query string
  instead of `notmuch-search-find-thread-id-region-search', which
  might cause a race condition.
2012-09-01 23:08:52 -03:00
Mark Walters
7cd3cd3003 emacs: make notmuch-show return its buffer
notmuch-pick uses the returned buffer to try and make sure it does not
close the wrong buffer.
2012-09-01 22:59:54 -03:00
Michal Nazarewicz
1f30f7d290 notmuch-show: add notmuch-show-mark-read-tags option
The `notmuch-show-mark-read-tags' lists tags that are to be applied when
message is read.  By default, the only value is "-unread" which will remove
the unread tag.  Among other uses, this variable can be used to stop
notmuch-show from modifying tags when message is shown (by setting the
variable to an empty list).
2012-08-29 19:01:10 -03:00
Austin Clements
c3119c45e1 emacs: Make moving to the previous message move to the previous boundary
Previously, notmuch-show-previous-message would move to the beginning
of the message before the message containing point.  This patch makes
it instead move to the previous message *boundary*.  That is, if point
isn't already at the beginning of the message, it moves to the
beginning of the current message.  This is consistent with
notmuch-show-next-message, which can be thought of as moving to the
next message boundary.  Several people have expressed a preference for
this.
2012-08-12 21:30:10 +02:00
Mark Walters
5811550cdd emacs: notmuch search bugfix
The recent change to use json for notmuch-search.el introduced a bug
in the code for keeping position on refresh. The problem is a
comparison between (plist-get result :thread) and a thread-id returned
by notmuch-search-find-thread-id: the latter is prefixed with
"thread:"

We fix this by adding an option to notmuch-search-find-thread-id to
return the bare thread-id. It appears that notmuch-search-refresh-view
is the only caller of notmuch-search that supplies a thread-id so this
change should be safe (but could theoretically break users .emacs
functions).
2012-08-12 21:27:45 +02:00
Austin Clements
07b5f97202 emacs: Fix "not defined at runtime" warning
Previously, the Emacs byte compiler produced the warning

    the function `remove-if-not' might not be defined at runtime.

because we only required cl at compile-time (not runtime).  This fixes
this warning by requiring cl at runtime, ensuring that the definition
of remove-if-not is available.
2012-08-12 21:05:08 +02:00
Mark Walters
1efb6e7ae1 emacs: show: exclude bug fix
The pipe message function (when used with a prefix) uses a search of
the form "id:<id1> or id:<id2>" etc. Since the user says precisely
which messages are wanted by opening them it should not use excludes.
2012-08-02 21:13:19 -03:00
Mark Walters
3fa00020ea emacs: fix a bug introduced by the recent search cleanups.
In commit 5d0883e the function notmuch-search-next-thread was changed.
In particular it only goes to the next message if there is a next
message. This breaks notmuch-show-archive-thread-then-next. Fix this
by going to the "next" message whenever we are on a current message.
2012-08-02 21:11:53 -03:00
Austin Clements
5d0883ea1b emacs: Fix navigation of multi-line search result formats
At this point, the only remaining functions that don't support
multi-line search result formats are the thread navigation functions.
This patch fixes that by rewriting them in terms of
notmuch-search-result-{beginning,end}.

This changes the behavior of notmuch-search-previous-thread slightly
so that if point isn't at the beginning of a result, it first moves
point to the beginning of the result.
2012-07-24 09:23:53 -03:00
Austin Clements
90e741ef81 emacs: Allow custom tags formatting
Previously we ignored any notmuch-search-result-format customizations
for tag formatting because we needed to be able to parse back in the
result line and update the tags in place.  We no longer do either of
these things, so we can allow customization of this format.

(Coincidentally, previously we still allowed too much customization of
the tags format, since moving it earlier on the line or removing it
from the line would interfere with the tagging mechanism.  There is
now no problem with doing such things.)
2012-07-24 09:23:13 -03:00
Austin Clements
e94b45112e emacs: Replace other search text properties with result property
Since the result object contains everything that the other text
properties recorded, we can remove the other text properties and
simply look in the plist of the appropriate result object.
2012-07-24 09:21:48 -03:00
Austin Clements
7ba5c86399 emacs: Use result text properties for search result iteration
This simplifies the traversal of regions of results and eliminates the
need for save-excursions (which tend to get in the way of maintaining
point when we make changes to the buffer).  It also fixes some strange
corner cases in the old line-based code where results that bordered
the region but were not included in it could be affected by region
commands.  Coincidentally, this also essentially enables multi-line
search result formats; the only remaining non-multi-line-capable
functions are notmuch-search-{next,previous}-thread, which are only
used for interactive navigation.
2012-07-24 09:21:38 -03:00
Austin Clements
2a91f636d8 emacs: Update tags by rewriting the search result line in place
Now that we keep the full thread result object, we can refresh a
result after any changes by simply deleting and reconstructing the
result line from scratch.

A convenient side-effect of this wholesale replacement is that search
now re-applies notmuch-search-line-faces when tags change.
2012-07-24 09:04:50 -03:00
Austin Clements
60ebc84945 emacs: Use text properties instead of overlays for tag coloring
Previously, tag-based search result highlighting was done by creating
an overlay over each search result.  However, overlays have annoying
front- and rear-advancement semantics that make it difficult to
manipulate text at their boundaries, which the next patch will do.
They also have performance problems (creating an overlay is linear in
the number of overlays between point and the new overlay, making
highlighting a search buffer quadratic in the number of results).

Text properties have neither problem.  However, text properties make
it more difficult to apply multiple faces since, unlike with overlays,
a given character can only have a single 'face text property.  Hence,
we introduce a utility function that combines faces into any existing
'face text properties.

Using this utility function, it's straightforward to apply all of the
appropriate tag faces in notmuch-search-color-line.
2012-07-24 09:04:38 -03:00
Austin Clements
ae30f33093 emacs: Record thread search result object in a text property
This also provides utility functions for working with this text
property that get its value, find its start, and find its end.
2012-07-24 09:04:27 -03:00
Ingo Lohmar
bcdfff4f3a emacs: Fix notmuch-message-mark-replied.
notmuch-message-mark-replied used "apply" to change message tags
according to notmuch-message-replied-tags after sending a reply.  This
works if the latter is a single-element list.  But with the recently
changed format of tag changes, it breaks for multiple-element lists.
Use "funcall" to properly pass the list of tag changes as a single
argument.
2012-07-24 09:01:26 -03:00
Austin Clements
9c5ea07cc6 emacs: Switch from text to JSON format for search results
The JSON format eliminates the complex escaping issues that have
plagued the text search format.  This uses the incremental JSON parser
so that, like the text parser, it can output search results
incrementally.

This slows down the parser by about ~4X, but puts us in a good
position to optimize either by improving the JSON parser (evidence
suggests this can reduce the overhead to ~40% over the text format) or
by switching to S-expressions (evidence suggests this will more than
double performance over the text parser).  [1]

This also fixes the incremental search parsing test.

This has one minor side-effect on search result formatting.
Previously, the date field was always padded to a fixed width of 12
characters because of how the text parser's regexp was written.  The
JSON format doesn't do this.  We could pad it out in Emacs before
formatting it, but, since all of the other fields are variable width,
we instead fix notmuch-search-result-format to take the variable-width
field and pad it out.  For users who have customized this variable,
we'll mention in the NEWS how to fix this slight format change.

[1] id:"20110720205007.GB21316@mit.edu"
2012-07-12 17:39:36 -06:00
Austin Clements
889dda3731 emacs: Implement an incremental JSON parser
This parser is designed to read streaming JSON whose structure is
known to the caller.  Like a typical JSON parsing interface, it
provides a function to read a complete JSON value from the input.
However, it extends this with an additional function that
requires the next value in the input to be a compound value and
descends into it, allowing its elements to be read one at a time
or further descended into.  Both functions can return 'retry to
indicate that not enough input is available.

The parser supports efficient partial parsing, so there's no need to
frame the input for correctness or performance.

The bulk of the parsing is still done by Emacs' json.el, so any
improvements or optimizations to that will benefit the incremental
parser as well.

Currently only descending into JSON lists is supported because that's
all we need, but support for descending into JSON objects can be added
in the future.
2012-07-12 17:39:28 -06:00
Austin Clements
1a5bcdf6c1 emacs: Pass plist to `notmuch-search-show-result'
Rather than passing lots of arguments and then further passing those
to `notmuch-search-insert-field', pass a plist containing all of the
search result information.  This plist is compatible with the JSON
format search results.
2012-07-12 17:39:12 -06:00
Austin Clements
17525340a2 emacs: Move search-target logic to `notmuch-search-show-result'
This is a simpler place to do this, since we can avoid any point
motion and hence any save-excursions in
`notmuch-search-process-filter', which in turn lets us put all of the
search-target logic outside of any save-excursions.

`notmuch-search-show-{result,error}' are now responsible for their own
point motion.

`notmuch-search-process-filter' could use some reindentation after
this, but we're about to rewrite it entirely, so we won't bother.
2012-07-12 17:39:04 -06:00
Austin Clements
9b4361d0fe emacs: Helper for reporting search parsing errors
This removes the last bit of direct output from the parsing function.
With the parser now responsible solely for parsing, we can swap it out
for another parser.
2012-07-12 17:38:54 -06:00
Austin Clements
e4818cc9c5 emacs: Separate search line parsing and display
Previously, much of the display of search lines was done in the same
function that parsed the CLI's output.  Now the parsing function only
parses, and notmuch-search-show-result fully inserts the search result
in the search buffer.
2012-07-12 17:38:43 -06:00
Austin Clements
bbc74d98f5 emacs: Clean up notmuch-search-show-result
This simplifies the code and makes it no longer cubic in the number of
result fields.
2012-07-12 17:38:34 -06:00
Daniel Schoepe
88b922afdc emacs: Add configurable wrapping width for notmuch-wash-wrap-long-lines
This introduces a variable to control after how many characters a line
is wrapped by notmuch-wash-wrap-long-lines (still wrapping at the
window width if it is lower).
2012-06-29 22:38:52 -03:00
Mark Walters
e12645c869 emacs: make elide messages use notmuch-show for omitting messages.
Previously the elide messages code got the entire-thread from
notmuch-show.c and then threw away all non-matching messages. This
version calls notmuch-show.c without the --entire-thread flag so
it never receives the non-matching messages in the first place.

This makes it substantially faster.
2012-06-29 22:33:31 -03:00
Mark Walters
ae1940cedc emacs: add pipe attachment command
Allow the user to pipe the attachment somewhere. Bound to '|' on the
attachment button.

Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>
2012-06-22 07:40:49 -03:00
Jesse Rosenthal
d094153a26 emacs: derive correct timestamp in FCC unique name
Previously, the timestamp at the beginning of the FCC unique maildir
name was derived incorrectly, thanks to an integer overflow. This
changes the derivation of timestamp to use a float, and so will get
the number correct at least until 2038. (It is still formatted with
"%d" so it will show up as an integer.) Should we need to change it in
the next 26 years to take the unix millenium into account, it will be
invisible to users.

This change is mostly a question of consistency, since the unique name
is arbitrary anyway. But since most people use timestamps, and that was
the original intention here as well, we might as well.

Signed-off-by: Jesse Rosenthal <jrosenthal@jhu.edu>
2012-06-22 07:39:21 -03:00
Jani Nikula
0ff57e75cf emacs: only strip "re:" in the beginning of subject
Fix notmuch-show-strip-re by matching "re:" only in the beginning of
the input string.
2012-06-07 23:28:17 -03:00
Austin Clements
44224b6259 emacs: Suppress warnings about using cl at runtime
It was decided in the thread starting at [0] that it is okay for
notmuch to use 'cl runtime functions.  However, by default, these
produce byte compiler warnings.  This suppresses those using
file-local variables.

[0] id:"m262g864dz.fsf@wal122.wireless-pennnet.upenn.edu"
2012-06-03 13:27:07 -03:00
Tomi Ollila
70ca3444c7 emacs: use 'gnus-decoded in notmuch-mm-display-part-inline ()
When mail message is read from emacs, the message structure
obtained may contain parts which have content included
(`text/plain` for example) and other parts where content is not
included (`text/html` for example).

In case content is included, the string is already available in
emacs' internal format and therefore mm-... functions should not
attempt to do further decoding for the data in temp buffer
provided for it.

Currently when reply buffer is created,
notmuch-mm-display-part-inline () is used to provided quoted reply
content. This change makes the mm-... functions called by it use
'gnus-decoded as charset whenever the content is already available.

File .../emacs-23.3/lisp/gnus/mm-uu.el mentions:
"`gnus-decoded' is a fake charset, which means no further decoding."
2012-05-23 22:29:32 -03:00
Dmitry Kurochkin
4997ec9571 emacs: fix custom queries section customization widget in notmuch-hello
The customization widget referred to a non-existing function
`notmuch-hello-insert-query-list'.  The patch changes it to the
correct one - `notmuch-hello-insert-searches'.  The relevant test is
fixed now.
2012-05-06 19:44:55 -03:00
Michal Sojka
e02c179c8f emacs: Do not pass stderr of notmuch reply to JSON parser
Sometimes, notmuch reply outputs something to stderr, for example:
"Failed to verify signed part: Cannot verify multipart/signed part:
unsupported signature protocol". When this happens, replying in emacs
fails, because emacs cannot parse the error message as JSON.

This patch causes emacs to ignore stderr when reading reply from
notmuch.
2012-05-06 08:49:38 -03:00
Thomas Jost
832fd1a7a6 emacs: Let the user choose where to compose new mails
Introduce a new defcustom notmuch-mua-compose-in that allows users to
specify where new mails are composed, either in the current window or
in a new window or frame.

Signed-off-by: Jameson Rollins <jrollins@finestructure.net>
2012-05-06 08:49:05 -03:00
Adam Wolfe Gordon
f6c170fabc emacs: Correctly quote non-text/plain parts in reply
Quote non-text parts nicely by displaying them with mm-display-part
before calling message-cite-original to quote them. HTML-only emails
can now be quoted correctly. We re-use some code from notmuch-show
(notmuch-show-mm-display-part-inline), which has been moved to
notmuch-lib.el.

Mark the test for this feature as not broken.
2012-05-06 08:48:11 -03:00
Jameson Graef Rollins
904a807088 emacs: eliminate search-tag-thread in favor of just search-tag
notmuch-search-tag-thread is now completely redundant with
notmuch-search-tag so we eliminate it to simplify the interface.
2012-04-29 17:43:03 -03:00
Jameson Graef Rollins
c1bcf5f8c0 emacs: modify show tag functions to use new notmuch-tag interface
The main change here is to modify argument parsing so as to not force
tag-changes to be a list, and to let notmuch-tag handle prompting the
user when required.  doc strings are also updated and cleaned up.
2012-04-29 17:42:43 -03:00
Jameson Graef Rollins
dba0e53ea8 emacs: modify search tag functions to use new notmuch-tag interface
The main change here is to modify argument parsing so as to not force
tag-changes to be a list, and to let notmuch-tag handle prompting the
user when required.  doc strings are also updated and cleaned up.
2012-04-29 17:41:57 -03:00
Jameson Graef Rollins
97aa3c0659 emacs: allow notmuch-tag to accept string inputs and prompt for tags
notmuch-tag is extended to accept various formats of the tag changes.
In particular, user prompting for tag changes is now incorporated
here, so it is common for modes.

The tag binary and the notmuch-{before,after}-tag-hooks are only
called if tag changes is non-nil.

In all cases tag-changes is returned as a list.
2012-04-29 17:41:35 -03:00
Jameson Graef Rollins
eb8feb1666 emacs: create notmuch-tag.el, and move appropriate functions from notmuch.el
Tagging functions are used in notmuch.el, notmuch-show.el, and
notmuch-message.el.  There are enough common functions for tagging
that it makes sense to put them all in their own library.

No code is modified, just moved around.
2012-04-29 17:39:37 -03:00
Jameson Graef Rollins
f5102f71ea emacs: fix archive thread/message function documentation.
This removes an inaccuracy in the thread archiving function, and adds
a clarification to the message archiving function.
2012-04-29 15:54:13 -03:00
David Edmondson
af59d61a4c emacs: Don't move to the next thread unless the cursor is at the end of the buffer.
When using the spacebar to scroll through a thread, hitting 'space'
when the bottom of the last message is visible should take the cursor
to the end of the buffer rather than immediately archiving the thread
and moving to the next thread.
2012-04-29 15:54:13 -03:00
Mark Walters
94250ac2c5 emacs-show: open excluded matches if no other matches
Currently emacs show does not open matching but excluded
messages. This is normally the desired behaviour but is probably not
ideal if only excluded messages match. This patch opens all the
matching (necessarily excluded) messages in this case and goes to the
first one.
2012-04-29 15:54:13 -03:00
Jameson Graef Rollins
cbba1d1ba9 emacs: do not modify subject in search or show
A previous patch [0] replaced blank subject lines with '[No Subject]'
in search and show mode.  Apparently this was needed to circumvent
some bug in the printing code, but there was no need for it search or
show, and it is definitely not desirable, so we undo it here (a revert
is no longer feasible).  We should not be modifying strings in the
original message without good reason, or without a clear indication
that we are doing so, neither of which apply in this case.  For
further discussion see [0].

[0] id:"1327918561-16245-3-git-send-email-dme@dme.org"
2012-04-28 23:30:59 -03:00
Austin Clements
9429141bb1 emacs: Put notmuch-hello-sections in custom group notmuch-hello 2012-04-24 23:39:19 -03:00
Austin Clements
ff53fb468e emacs: Put notmuch-print-mechanism in custom group notmuch-show 2012-04-24 23:25:51 -03:00
Jameson Graef Rollins
5073de34b4 emacs: modify help message for notmuch-search-line-faces to reflect preferred "deleted" tag name.
No functional change here.  The help message previously referred to
the "delete" tag, but "deleted" is now preferred, so hopefully this
will reduce any potential confusion.
2012-04-24 23:25:51 -03:00
Jameson Graef Rollins
6c84116091 emacs: have tag-completion return all tags for nil input
Previously the function would fail if the initial input was nil.  Now
it will return a list of all tags, which obviously makes much more
sense.
2012-04-12 15:34:49 -03:00
Jameson Graef Rollins
8225ff21ec emacs: include tags from excluded messages in tag tab completion
The new message exclude functionality will hide tags that only exist
on excluded messages.  However, one might very well want to manually
modify excluded tags.  This makes sure tags from excluded messages are
always available in tab completion.
2012-04-12 08:43:22 -03:00
Jameson Graef Rollins
1d4758e21f emacs: update call in tag-completion function
"search-tags" is deprecated, so use the more modern and supported
"search --output=tags".
2012-04-12 08:42:55 -03:00
Dmitry Kurochkin
6409a27b2c emacs: get rid of trailing spaces in notmuch-hello view
This patch removes trailing spaces in notmuch-hello view.

A side effect of this change is that tag/query buttons no longer
include a space at the end.  This means that pressing RET when the
point is at the first character after the tag/query button no longer
works (note that this is the standard behavior for buttons).  We may
change this behavior in the future (without adding trailing spaces
back) if people would find this change inconvenient.
2012-04-12 08:40:33 -03:00
Mark Walters
075d7df01e emacs: make show set --exclude=false
Show has to set --exclude=false to deal with cases where it is asked
to show a single excluded message. It uses JSON so it can easily pass
the exclude information to the user.
2012-04-07 23:06:31 -03:00
Jani Nikula
052000f85a emacs: do not modify the alist passed to notmuch-sort-saved-searches
Sort modifies its input as a side effect. Pass it a copy in
notmuch-sort-saved-searches to not modify the notmuch-saved-searches
alist.
2012-04-06 12:34:16 -03:00
Dmitry Kurochkin
1361dd37bc emacs: fix off-by-one error in notmuch-hello column alignment
Expected results for few tests are fixed, the relevant test is
unmarked broken.
2012-04-05 07:40:12 -03:00
Adam Wolfe Gordon
e4844fafec emacs: Fix the References header in reply
In the new reply code, the References header gets inserted by
message.el using a function called message-shorten-references. Unlike
all the other header-inserting functions, it doesn't put a newline
after the header, causing the next header to end up on the same
line. In our case, this header happened to be User-Agent, so it's hard
to notice. This is probably a bug in message.el, but we need to work
around it.

This fixes the problem by wrapping message-shorten-references in a
function that inserts a newline after if necessary. This should
protect against the message.el bug being fixed in the future.
2012-04-02 17:47:04 -03:00
Adam Wolfe Gordon
3737ca6e26 emacs: Fix two bugs in reply
Bug 1: Replying from alternate addresses
----------------------------------------

The reply code was inconsistent in its use of symbols and strings for
header names being passed to message.el functions. This caused the
From header to be lookup up incorrectly, causing an additional From
header to be added with the user's primary address instead of the
correct alternate address.

This is fixed by using symbols everywhere, i.e. never using strings
for header names when interacting with message.el.

This change also removes our use of `mail-header`, since we don't use
it anywhere else, and using assq makes it clear how the header lists
are expected to work.

Bug 2: Duplicate headers in emacs 23.2
--------------------------------------

The message.el code in emacs 23.2 assumes that header names will
always be passed as symbols, so our use of strings caused
problems. The symptom was that on 23.2 (and presumably on earlier
versions) the reply message would end up with two of some headers.

Converting everything to symbols also fixes this issue.
2012-04-02 17:45:27 -03:00
Austin Clements
839a80513a emacs: Fix mis-named argument to notmuch-get-bodypart-internal
Previously, this function took an argument called "message-id", even
though it was a general query, rather than a message ID.  This changes
it to "query".
2012-03-31 08:27:15 -03:00
Austin Clements
ee1180018e emacs: Escape all message ID queries
This adds a lib function to turn a message ID into a properly escaped
message ID query and uses this function wherever we previously
hand-constructed ID queries.  Wherever this new function is used,
documentation has been clarified to refer to "id: queries" instead of
"message IDs".

This fixes the broken test introduced by the previous patch.
2012-03-30 21:27:03 -03:00
Mark Walters
f57ef64302 emacs: content-type comparison should be case insensitive.
The function notmuch-match-content-type was comparing content types
case sensitively. Fix it so it tests case insensitively.

This fixes a bug where emacs would not include any body when replying
to a message with content-type TEXT/PLAIN.
2012-03-30 21:19:50 -03:00
Adam Wolfe Gordon
650123510c emacs: Use the new JSON reply format and message-cite-original
Use the new JSON reply format to create replies in emacs. Quote HTML
parts nicely by using mm-display-part to turn them into displayable
text, then quoting them with message-cite-original. This is very
useful for users who regularly receive HTML-only email.

Use message-mode's message-cite-original function to create the
quoted body for reply messages. In order to make this act like the
existing notmuch defaults, you will need to set the following in
your emacs configuration:

message-citation-line-format "On %a, %d %b %Y, %f wrote:"
message-citation-line-function 'message-insert-formatted-citation-line

The tests have been updated to reflect the (ugly) emacs default.
2012-03-19 22:03:23 -03:00
Adam Wolfe Gordon
950789f3c3 emacs: Factor out useful functions into notmuch-lib
Move a few functions related to handling multipart/alternative parts
into notmuch-lib.el, so they can be used by future reply code.
2012-03-19 21:59:24 -03:00
Austin Clements
0eaf4a21dd emacs: Fix search tab completion in terminals
In X, Emacs distinguishes the tab key, which produces a 'tab event;
from C-i, which produces a ?\t event.  However, in a terminal, these
are indistinguishable and only produce a ?\t event.  In order to
simplify things, Emacs automatically translates from 'tab to ?\t (see
"Function key translations" in M-x describe-bindings), so functions
only need to be bound to ?\t to work in all situations.

Previously, the search tab completion code usedq (kbd "<tab>"), which
produced the event sequence [tab], which only matched the 'tab event
and hence only worked in X.  This patch changes it to (kbd "TAB"),
which matches the general ?\t event and works in all situations.
2012-03-18 09:14:23 -03:00
David Bremner
c46764030d Merge branch 'release' 2012-03-10 21:46:26 -04:00
Jani Nikula
90f310b4fb emacs: fix MML quoting in replies
The reply MML quoting added in commit ae438cc unintentionally MML
quotes also the signature/encryption MML tags added via
message-setup-hook, causing the reply not to be signed/encrypted.

MML quote just the original message in the temp buffer before
inserting it to the message buffer, to not interfere with message mode
hooks or message construction in general.

See [1] and [2] for bug reports.

Thanks to Tim Bielawa <tbielawa@redhat.com> for testing.

[1] id:"87hay78x6l.fsf@wyzanski.jamesvasile.com"
[2] id:"1330812262-28272-1-git-send-email-tbielawa@redhat.com".

Signed-off-by: Jani Nikula <jani@nikula.org>
2012-03-10 21:24:14 -04:00
Michal Sojka
4a0740920d emacs-hello: Do not calculate the count of the messages in hidden sections
The result is that hello screen shows much faster when some sections are
hidden.
2012-03-10 10:10:27 -04:00
David Bremner
ad6a6edb38 Merge branch 'release' 2012-03-03 11:56:36 -04:00
Mark Walters
1aa4abe7a1 emacs: notmuch.el ignore excluded matches
This is a small change to make notmuch.el ignore excluded matches.  In
the future it could do something better like add a button for
rerunning the search with the excludes (particularly if nothing
matches with the excludes) or having them invisible and allowing the
visibility to be toggled.
2012-03-02 08:38:27 -04:00
Mark Walters
119a42571e emacs: show: recognize the exclude flag.
Show mode will recognize the exclude flag by not opening excluding
messages by default, and will start at the first matching non-excluded
message. If there are no matching non-excluded messages it will go to
the first matching (necessarily excluded) message.
2012-03-02 08:37:50 -04:00
Tomi Ollila
2c077b1e4a Spelling fix
Retreive is spelled as r e t r i e v e .
2012-03-01 19:04:21 -04:00
Tomi Ollila
1fb5c77818 emacs: retain show buffer state after retrieving gpg key
After retrieving gpg key retain show buffer state like in
all other operations (i.e. no other calls to notmuch-show-refresh-view
provides optional reset-state argument).
Emacs MUA keeps current message under cursor instead of going first
open message(possibly marking it read).
2012-03-01 19:04:02 -04:00
Daniel Schoepe
3557acab64 emacs: User-defined sections in notmuch-hello
This patch makes the notmuch-hello screen fully customizable
by allowing the user to add and remove arbitrary sections. It
also provides some convenience functions for constructing sections,
e.g. showing the unread message count for each tag.

This is done by specifying a list of functions that will be run
when notmuch-hello is invoked.
2012-03-01 08:16:29 -04:00
Michal Sojka
8c095acb6c emacs: Clarify description of thread manipulating functions
It is not clear whether the term "thread" refers to the thread in the
database or to the thread currently shown in a buffer. Those two
meanings may refer to different sets of messages, e.g. when a new email
is added to the database while the buffer shows the state before the new
email arrived.

This patch replaces the term thread with the term current buffer, which
is hopefully less ambiguous.
2012-02-29 22:47:57 -04:00
Austin Clements
f89f3709d6 emacs: Fix out of date comment
The behavior of the header line in show-mode changed from showing the
subject of the first open message to showing the subject of the first
message in 4d77f18b.  Update a comment to reflect this.
2012-02-27 22:36:34 -04:00
Austin Clements
17a06ab990 emacs: Reverse the meaning of notmuch-show-refresh-view's argument
Consensus seems to be that people prefer that refreshing show buffers
retains state by default, rather than resetting it by default.  This
turns out to be the case in the code, as well.  In fact, there's even
a test for this that's been marked broken for several months, which
this patch finally gets to mark as fixed.
2012-02-25 10:35:22 -04:00
Austin Clements
4d77f18b1d emacs: When refreshing a show buffer, only mark read when resetting state
If we retain state while refreshing a show buffer, it should not mark
any messages read since it's not a navigation operation (it especially
shouldn't mark the first message matching the query read, which is
what it did previously).  If the user or caller requests that refresh
reset the state of the buffer, then we consider that a navigation
operation, so we do mark the message under point after the refresh
read.

This is implemented by moving responsibility for initial positioning
and read-marking out of notmuch-show-worker and into its caller.
Since notmuch-show-worker is now exclusively about building the show
buffer, we rename it to notmuch-show-build-buffer.
2012-02-25 10:35:08 -04:00
Pieter Praet
2f86290aaf emacs: add `notmuch-show-stash-mlarchive-link{, -and-go}'
* emacs/notmuch-show.el

  (notmuch-show-stash-mlarchive-link-alist):
    New defcustom of type `alist' (key = name, value = URI),
    containing Mailing List Archive URI's for searching by Message-Id.

  (notmuch-show-stash-mlarchive-link-default):
    New defcustom, default MLA to use when `notmuch-show-stash-mlarchive-link'
    received no user input whatsoever.  Available choices are generated using
    the contents of `notmuch-show-stash-mlarchive-link-alist'.

  (notmuch-show-stash-map):
    Added keybinds "l" and "L" for `notmuch-show-stash-mlarchive-link'
    respectively `notmuch-show-stash-mlarchive-link-and-go'.

  (notmuch-show-stash-mlarchive-link):
    New function, stashes a URI pointing to the current message at one
    of the MLAs configured in `notmuch-show-stash-mlarchive-link-alist'.
    Prompts user with `completing-read' if not provided with an MLA key.

  (notmuch-show-stash-mlarchive-link-and-go):
    New function, uses `notmuch-show-stash-mlarchive-link' to
    stash a URI, and then visits it using the browser configured
    in `browse-url-browser-function'.

Based on original work [1] by David Edmondson <dme@dme.org>.

[1] id:"1327397873-20596-1-git-send-email-dme@dme.org"
2012-02-25 10:34:27 -04:00
Pieter Praet
16ba777fd2 emacs: `notmuch-show-get-message-id': optionally return Message-Id sans prefix
* emacs/notmuch-show.el

  (notmuch-show-get-message-id):
    Add optional arg BARE.  When non-nil, return a Message-Id without
    quotes and prefix, thus obviating the need to strip them off again
    in various places.

  (notmuch-show-stash-message-id-stripped):
    Update wrt changes in `notmuch-show-get-message-id'.
2012-02-25 10:33:18 -04:00
Jani Nikula
cfdc9a472d emacs: support text/calendar mime type
Replace text/x-vcalendar with text/calendar, while maintaining support
and backwards compatibility for text/x-vcalendar.

Code by David Edmondson <dme@dme.org>
2012-02-25 08:55:47 -04:00
Austin Clements
311e8f6c45 emacs: Fix out-of-date declare-function
The names of the arguments to notmuch-show-refresh-view had gotten out
of sync between the declare-function and the real thing.
2012-02-20 23:05:17 -04:00
Michal Sojka
e4ceb19cc7 emacs: Fix display of highlighted line in notmuch-search
When notmuch-search-line-faces is used to set background color in search
results, the highlight of the current line is not always displayed
correctly. This patch fixes that by increasing the priority property of
the highlight overlay.
2012-02-17 08:03:26 -04:00
Dmitry Kurochkin
d8bff4b3af emacs: allow to set RETAIN-STATE for `notmuch-show-refresh-view' interactively
The notmuch-show view refresh function (`notmuch-show-refresh-view',
bound to "=") accepts an optional RETAIN-STATE argument.  The patch
allows to set this argument interactively by using "C-u =".
2012-02-14 23:42:28 -04:00
Dmitry Kurochkin
a5674c2158 emacs: cleanup and simplify `notmuch-show-archive-thread' and related functions
Recent changes in notmuch-show tagging introduced some code
duplication.  The patch cleanups and simplifies
`notmuch-show-archive-thread' function by using
`notmuch-show-tag-all', no longer used function are removed.  After
the change, `notmuch-show-archive-thread' function becomes symmetric
with `notmuch-show-archive-message'.

A side effect of these changes is that `notmuch-show-archive-thread'
no longer calls "notmuch tag" for each message in the thread.
2012-02-12 14:01:28 -04:00
David Edmondson
668b66ec85 emacs: A prefix argument to `notmuch-show' should invert the matching message behaviour.
Allow the user to open a thread with inverted
`notmuch-show-only-matching-messages' behaviour using a prefix
argument.
2012-02-12 11:58:21 -05:00
David Edmondson
866ce8b132 emacs: Add `notmuch-show-only-matching-messages'.
Allow the user to choose that only matching messages are shown by
default.
2012-02-12 11:58:21 -05:00
David Edmondson
d268422884 emacs: Check that the parent buffer is alive before using it. 2012-02-12 11:58:21 -05:00
David Edmondson
48766fca71 emacs: Optionally retain the state of the buffer during `notmuch-show-refresh-view'.
With an argument, record and reply the state of the buffer during
`notmuch-show-refresh-view'.

In this context, "state" is defined as:
 - the open/closed state of each message,
 - the current message.

Traditional use of refresh with the = key does not retain the
state. The recently introduced toggle commands ($, !, < and >) do
retain the state.
2012-02-12 11:58:21 -05:00
David Edmondson
7bcab5d645 emacs: Add a binding (t) to toggle the truncation of long lines. 2012-02-12 11:58:21 -05:00
David Edmondson
c205e8ffae emacs: Allow the indentation of content to be toggled.
Very deeply indented content is sometimes difficult to
read (particular for something like patches). Allow the indentation of
the content to be toggled with '<'.

Indentation of the header lines is not affected, so it remains
possible to see the structure of the thread.
2012-02-12 11:58:21 -05:00
David Edmondson
44a544ede0 emacs: Allow `notmuch-show-mode' to display only matching messages.
The current behaviour (all messages shown, non-matching collapsed)
is retained as the default. Type '!' to switch to showing only
the matching messages - non-matching messages are not available.
'!' will switch back to showing everything.
2012-02-12 11:58:21 -05:00
David Edmondson
19ec74c50e emacs: Rework crypto switch toggle.
Re-work the existing crypto switch toggle to be based on a persistant
buffer-local variable.

To allow this, modify `notmuch-show-refresh-view' to erase and re-draw
in the current buffer rather than killing the current buffer and
creating a new one. (This will also allow more per-buffer behaviour in
future patches.)

Add a binding ('$') to toggle crypto processing of the current buffer
and remove the prefix argument approach that achieves a similar
result.
2012-02-12 11:58:21 -05:00
David Edmondson
5d021e52e2 emacs: Ensure that gnupg output goes at the end of the buffer.
When showing the user some details of gnupg output, ensure that those
details are shown at the end of the gnupg status buffer
("*notmuch-crypto-gpg-out*"), otherwise it can end up mixed up with
earlier output.
2012-02-12 11:58:20 -05:00
Jani Nikula
e06943f85e emacs: add default value to notmuch-search-line-faces
Add default value to notmuch-search-line-faces to show "unread"
messages in bold, and "flagged" messages in blue, to have some visual
indication of important messages in search results. This should be
helpful for new users.

"unread" tag is quite obvious, and handled specially both in the lib
and emacs ui. "flagged" is synced to maildir F flag in the lib. If one
syncs the maildir to IMAP, this also translates to corresponding IMAP
flag. (This is "starred" in GMail and Android.)

Signed-off-by: Jani Nikula <jani@nikula.org>
2012-02-12 11:58:20 -05:00
Jani Nikula
d2ef4edc54 emacs: make show view a/A/x/X key bindings more consistent
Modify the show view key bindings as follows to make them more
consistent:

'a' = Archive current message, then move to next message, or show next
thread from search if at the last message in thread.

'A' = Archive each message in thread, then show next thread from
search.

'x' = Archive current message, then move to next message, or exit back
to search results if at the last message in thread.

'X' = Archive each message in thread, then exit back to search
results.

The changes make the key bindings more consistent in two ways:
1) 'a'/'A' both advance to the next thread like 'a' used to.
2) 'x' operates on messages and 'X' on threads like 'a'/'A'.
2012-02-08 13:22:00 -04:00
Dmitry Kurochkin
6e59a5630f emacs: s/tags/tag-changes/ for arguments of tagging functions
This makes the argument names more consistent and clear.  The
following functions changed: `notmuch-tag',
`notmuch-search-tag-thread', `notmuch-search-tag-region' and
`notmuch-search-tag-all'.
2012-02-08 11:22:44 -04:00
Dmitry Kurochkin
9d8fa2acac emacs: accept empty tag list in `notmuch-tag'
Since `notmuch-tag' is a non-interactive function and hence is meant
to be invoked programmatically, it should accept zero tags.  Also, the
tagging operations (bound to "*", "+", "-") would accept empty input
without an error.
2012-02-08 11:21:52 -04:00
Dmitry Kurochkin
26fce4ae60 emacs: relax tag syntax check in `notmuch-tag' function
The tag syntax check in `notmuch-tag' function was too strict and did
not allow nmbug tags with "::".  Since the check is done for all
tagging operations in Emacs UI, this basically means that no nmbug
tags can be changed.  The patch relaxes the tag syntax check to allow
any tag names that do not include whitespace characters.
2012-02-08 11:19:23 -04:00
Dmitry Kurochkin
904eafaefc emacs: separate history for operations which accept single and multiple tags
Some tag-related operations accept a single tag without prefix
(`notmuch-select-tag-with-completion'), others accept multiple tags
prefixed with '+' or '-' (`notmuch-read-tag-changes').  Before the
change, both functions used a single default minibuffer history.  This
is inconvenient because you have to skip options with incompatible
format when going through the history.  The patch adds separate
history lists for the two functions.  Note that functions that accept
the same input format (e.g. "+", "-", "*") share the history list as
before.
2012-02-08 11:18:37 -04:00
Dmitry Kurochkin
26d5b0efe4 emacs: add "*" binding for notmuch-show view
The patch adds `notmuch-show-tag-all' function bound to "*" in
notmuch-show view.  The function is similar to the
`notmuch-search-tag-all' function for the notmuch-search view: it
changes tags for all messages in the current thread.
2012-02-08 11:17:45 -04:00
Dmitry Kurochkin
f643f1bac0 emacs: rename notmuch-search-operate-all' to notmuch-search-tag-all'
`Notmuch-search-tag-all' is more clear and consistent with other
tagging function names.
2012-02-08 11:16:04 -04:00
Dmitry Kurochkin
389ddf0f12 emacs: make "+" and "-" tagging operations in notmuch-show more flexible
Before the change, "+" and "-" tagging operations in notmuch-show view
accepted only a single tag.  The patch makes them use the recently
added `notmuch-read-tag-changes' function, which allows to enter
multiple tags with "+" and "-" prefixes.  So after the change, "+" and
"-" bindings in notmuch-show view allow to both add and remove
multiple tags.  The only difference between "+" and "-" is the
minibuffer initial input ("+" and "-" respectively).
2012-02-08 11:13:53 -04:00
Dmitry Kurochkin
2beaefa2ec emacs: make "+" and "-" tagging operations in notmuch-search more flexible
Before the change, "+" and "-" tagging operations in notmuch-search
view accepted only a single tag.  The patch makes them use the
recently added `notmuch-read-tag-changes' function (renamed
`notmuch-select-tags-with-completion'), which allows to enter multiple
tags with "+" and "-" prefixes.  So after the change, "+" and "-"
bindings in notmuch-search view allow to both add and remove multiple
tags.  The only difference between "+" and "-" is the minibuffer
initial input ("+" and "-" respectively).
2012-02-08 11:08:43 -04:00
Dmitry Kurochkin
b3eafaf725 emacs: remove text properties from `notmuch-search-get-tags' result 2012-02-08 11:08:22 -04:00
Dmitry Kurochkin
0adf05f578 emacs: move tag format validation to `notmuch-tag' function
Before the change, tag format validation was done in
`notmuch-search-operate-all' function only.  The patch moves it down
to `notmuch-tag', so that all users of that function get input
validation.
2012-02-08 11:08:09 -04:00
David Bremner
2c6710e3ba emacs: use mark instead of point-max in MML quoting.
As Aaron explains in id:"m2vco72tf3.fsf@wal122.wireless-pennnet.upenn.edu"

  Using point-max would include the signature in the quoting as well.
  It would probably be fairly odd to want to put an MML tag in one’s
  signature, but that doesn’t mean that we should break that usage.

We had to use point-max in the 0.11.1 bug-fix release, because the
mark functionality was added post 0.11.
2012-02-04 13:40:24 -05:00
David Bremner
d43f6c00b3 Merge commit '0.11.1'
Conflicts:
	NEWS
	bindings/python/notmuch/database.py
	bindings/python/notmuch/message.py
	notmuch.1

NEWS merged by hand, others taken from master.
2012-02-04 12:01:46 -05:00
Dmitry Kurochkin
8281430558 emacs: fix `notmuch-wash-region-to-button' to work at beginning of buffer
`Notmuch-wash-region-to-button' is the function that creates hidden
regions with buttons for signatures, citations and original messages.
Before the change, it did not work correctly if the to-be-hidden
region started at the beginning of a message: the visibility toggle
button was hidden as well.  The patch fixes this.  There are two parts
in the fix:

* Use `insert-before-markers' instead of `insert' for creating the
  button, so that it does not get added to the hidden overlay.

* Stop using PREFIX argument for adding a newline before the button.
  The newline should not be added before a button at the beginning of
  buffer.

The corresponding test is fixed now.
2012-02-04 07:33:18 -05:00
David Edmondson
d8d7387881 emacs: Move the blank line from the bottom of the headers to the top of the body.
The blank line doesn't really change position, but is now considered
to be part of the body rather than part of the headers. This means
that it is visible when the body is visible rather than when the
headers are visible.
2012-02-03 21:28:45 -04:00
David Edmondson
32d7b3aabd emacs: More address cleaning.
Remove outer single-quotes from the mailbox part. Allow for multiple
sets of nested single and double quotes.

Add more tests.
2012-02-03 21:24:48 -04:00
David Edmondson
6bd3d8af54 emacs: Prefer '[No Subject]' to blank subjects. 2012-02-03 21:20:15 -04:00
David Edmondson
e516a712bb emacs: Stop the `truncate-string-to-width' madness.
There's no need to call `truncate-string-to-width' twice in this code
path.
2012-02-03 21:19:00 -04:00
Aaron Ecay
ae438ccd8c emacs: quote MML tags in replies
Emacs message-mode uses certain text strings to indicate how to attach
files to outgoing mail.  If these are present in the text of an email,
and a user is tricked into replying to the message, the user’s files
could be exposed.

Edited-by: Pieter Praet <pieter@praet.org>:  Rebased to release branch.
2012-02-03 08:26:41 -04:00
Pieter Praet
2dcd1e7234 emacs: globally replace non-branching "(if COND (progn ..." with "(when ..."
Less code, same results, without sacrificing readability.
2012-02-01 21:29:17 -04:00
Jameson Graef Rollins
7cd907b69c emacs: fix show-previous-message doc string 2012-01-30 23:25:01 -04:00
Jameson Graef Rollins
4a5281b888 emacs: modify the default show-mode key bindings for archiving
This changes the default key bindings for the 'a' key in notmuch-show
mode.  Instead of archiving the entire thread, it now just archives
the current message, and then advance to the next open message
(archive-message-then-next).  'A' is now bound to the previous
archive-thread-then-next function.
2012-01-30 23:24:36 -04:00
Jameson Graef Rollins
0417c22d11 emacs: use pop-at-end functionality in show-archive-message-then-next function
This provides a smoother message processing flow by reducing the
number of key presses needed for these common operations.
2012-01-30 23:24:02 -04:00
Jameson Graef Rollins
cdb51decdd emacs: add option to show-next-{, open-}message functions to pop out to parent buffer if at end
This will allow for keybindings that achieve a smoother message
processing flow by reducing the number of key presses needed for most
common operations.
2012-01-30 23:23:49 -04:00
Jameson Graef Rollins
436c98a973 emacs: add message archiving functions
This adds two new message archiving functions that parallel the thread
archiving functions: notmuch-show-archive-message{,-then-next}.  The
former also takes a prefix argument to unarchive the message (ie. put
back in inbox).
2012-01-30 23:21:16 -04:00
Jameson Graef Rollins
be05158b69 emacs: break out thread navigation from notmuch-show-archive-thread
This function is now just for archiving the current thread.  A new
function is created to archive-then-next.  The 'a' key binding is
updated accordingly.

This will allow people to bind to the simple thread archiving function
without the extra navigation.  The archive-thread function now also
takes a prefix to unarchive the current thread (ie. put the whole
thread back in the inbox).
2012-01-30 23:21:01 -04:00
Jameson Graef Rollins
047792102c emacs: break up notmuch-show-archive-thread-internal into two more generally useful functions
Break up notmuch-show-archive-thread-internal into two new functions:

notmuch-show-tag-thread-internal: applies a tag to all messages in
thread.  If option remove flag is t, tags will be removed instead of
added.

notmuch-show-next-thread: moves to the next thread in the search
result.  If given a prefix, will show the next result, otherwise will
just move to it in the search view.

Two new interactive functions, notmuch-show-{add,remove}-tag-thread,
are also added.  Together, these provide a better suit of thread
tagging and navigation tools.

The higher level thread archiving functions are modified to use these
new function.
2012-01-30 23:19:10 -04:00