Commit graph

311 commits

Author SHA1 Message Date
Jani Nikula
e312705d20 emacs: Add new customization option to sort saved searches
Add new customization option notmuch-saved-search-sort-function to sort
saved searches in user-defined order. Provide a sort function to sort the
saved searches in alphabetical order. Setting the search function to nil
causes the saved searches not to be sorted, as before. This also remains
the default. The function only affects display of the saved searches, not
the order in which they are stored by custom.

Signed-off-by: Jani Nikula <jani@nikula.org>
2011-11-22 22:54:55 -04:00
Jameson Graef Rollins
53629b5506 emacs: breakout notmuch-show-advance functionality from notmuch-show-advance-and-archive
This patch breaks out much of the functionality of
notmuch-show-advance-and-archive into a new function:
notmuch-show-advance.  This new function does all the advancing
through a show buffer that notmuch-show-advance-and-archive did,
without all the invasive thread archiving.  The return value of
notmuch-show-advance is nil if the bottom of the thread is not
reached, and t if it is.

notmuch-show-advance-and-archive is modified to just call
notmuch-show-advance, and then call notmuch-show-archive-thread if the
return value is true.  In this way the previous functionality of
notmuch-show-advance-and-archive is preserved.

This provides a way for people to rebind the space bar to a more sane
function if they don't like the default behavior.
2011-11-20 22:45:17 -04:00
Jameson Graef Rollins
edd2f3f0a8 emacs: add notmuch-show-worker function for specifying crypto processing directly
The main reason to introduce this new unexposed function is to allow
the buffer redisplay crypto switch to behaving in a more expected way.
The prefix to notmuch-show-redisplay buffer now switches the crypto
processing of the current show buffer, as opposed to switching the
logic of the notmuch-crypto-process-mime customization variable.  This
behavior is more intuitive.
2011-11-13 15:22:16 -04:00
Jameson Graef Rollins
b00e27bd99 emacs: add documentation for notmuch-show crypto-switch option 2011-11-13 15:21:58 -04:00
Jameson Graef Rollins
9207f90f52 emacs: update notmuch-crypto-process-mime config variable documentation.
This mentions the fact that prefix arguments are now used to enable to
crypto switch.
2011-11-12 20:50:22 -04:00
Jameson Graef Rollins
07022714eb emacs: Unbind M-RET as display of thread with crypto switch.
Use prefix argument instead to set switch.
2011-11-12 20:42:25 -04:00
Pieter Praet
f9764bfacc emacs: add keybind and function to stash Message-ID without prefix
Add function `notmuch-show-stash-message-id-stripped'
which stashes a Message-ID after ripping off the prefix and quotes,
add bind it to "I" key in `notmuch-show-stash-map'.

Simplifying `notmuch-show-get-message-id' instead might seem better,
but that would require concat'ing in 9 places instead of 1.

Signed-off-by: Pieter Praet <pieter@praet.org>
2011-11-12 20:29:04 -04:00
Dmitry Kurochkin
e972d752c0 emacs: add invisible space after the search widget field in notmuch-hello
It is very convenient when C-e (bound to `widget-end-of-line') ignores
trailing spaces inside the search widget.  But it only does so if a
widget is not followed by a newline (that is why it works in the saved
search widgets).  The patch just adds an invisible space after the
search widget to get the desirable behavior of `widget-end-of-line'.
The extra space is also added to expected results of emacs tests.
2011-11-12 10:34:53 -05:00
Austin Clements
a2d78fba20 emacs: Use a single buffer invisibility spec to fix quadratic search cost.
Buffer redisplay requires traversing the buffer's invisibility spec
for every part of the display that has an 'invisible text or overlay
property.  Previously, the search buffer's invisibility spec list
contained roughly one entry for each search result.  As a result,
redisplay took O(NM) time where N is the number of visible lines and M
is the total number of results.  On a slow computer, this is enough to
make even buffer motion noticeably slow.  Worse, during a search
operation, redisplay is triggered for each search result (even if
there are no visible buffer changes), so search was quadratic
(O(NM^2)) in the number of search results.

This change switches to using a single element buffer invisibility
spec.  To un-hide authors, instead of removing an entry from the
invisibility spec, it simply removes the invisibility overlay from
those authors.

I tested using a query with 6633 results on a 9 year old machine.
Before this patch, Emacs took 70 seconds to fill the search buffer;
toward the end of the search, Emacs consumed 10-20x as much CPU as
notmuch; and moving point in the buffer took about a second.  With
this patch, the same query takes 40 seconds, Emacs consumes ~3x the
CPU of notmuch by the end, and there's no noticeable lag to moving
point.  (There's still some source of non-linearity, because Emacs and
notmuch consume roughly the same amount of CPU early in the search.)
2011-11-12 09:21:03 -05:00
Michal Sojka
0234a16b56 Do not query on notmuch-search exit
Emacs 23.2 queries by default about killing existing processes. This
is annoying when one wants to interrupt long search with 'q' key.
Disable this behavior for notmuch.
2011-11-08 14:25:07 -04:00
Dmitry Kurochkin
34aa8e8a9c emacs: remove unused `point-invisible-p' function
`point-invisible-p' does not work correctly when `invisible'
property is a list.  There are standard `invisible-p' and related
functions that should be used instead.
2011-11-07 20:38:37 -04:00
Dmitry Kurochkin
8809e09dcc emacs: remove no longer used functions from notmuch-show.el
Remove `notmuch-show-move-past-invisible-backward' and
`notmuch-show-move-past-invisible-forward' functions which are
unused.
2011-11-07 20:38:37 -04:00
Dmitry Kurochkin
6e6cb68b80 emacs: improve hidden signatures handling in notmuch-show-advance-and-archive
Use `previous-single-char-property-change' instead of going
through each character by hand and testing it's visibility.  This
fixes `notmuch-show-advance-and-archive' to work for the last
message in thread with hidden signature.
2011-11-07 20:38:37 -04:00
Daniel Schoepe
6a280088e6 emacs: Tab completion for notmuch-search and notmuch-search-filter
This patch adds completion with <tab> in the minibuffer for
notmuch-search and notmuch-search-filter.
2011-11-02 22:06:44 -03:00
Daniel Schoepe
4a4ada73b7 emacs: Turn id:"<message-id>" elements into buttons for notmuch searches
This fixes the minor annoyance that message ids were parsed as mail
addresses by goto-address-mode in notmuch-show buffers.
2011-10-28 14:12:19 -03:00
Amadeusz Żołnowski
e6d85fb97d Separate Emacs misc. files dir. from Emacs code dir.
New option --emacsetcdir was added, but it's set default to the same
value as --emacslispdir for backward compatibility.
2011-10-28 14:07:44 -03:00
Jameson Graef Rollins
76fdca8f77 emacs: add notmuch-show-refresh-view function
This function, like the equivalent for notmuch-search, just refreshes
the current show view.  Like in notmuch-search, this new function is
bound to "=".  If a prefix is given then the redisplay happens with the
crypto-switch set, which displays the thread with the opposite logic
of whatever is set in the notmuch-crypto-process-mime customization
variable.
2011-10-06 10:33:21 -03:00
Jameson Graef Rollins
d1519d256a emacs: Add callback functions to crypto sigstatus button.
This adds two callback functions to the sigstatus button.  If the sig
status is "good", then clicking the button displays the output of "gpg
--list-keys" on the key fingerprint.  If the sigstatus is "bad", then
clicking the button will retrieve the key from the keyserver, and
redisplay the current buffer.

Thanks to David Bremner <bremner@unb.ca> for help with this.
2011-10-06 10:30:25 -03:00
Jameson Graef Rollins
7d3aacbf14 emacs: Improve support for message/rfc822 parts.
The insert-part-message/rfc822 function is overhauled to properly
processes the new formatting of message/rfc822 parts.  The json output
for message parts now includes "headers" and "body" fields, which are
now parsed and output appropriately.
2011-09-05 22:58:52 -03:00
Tomi Ollila
8e2a14bbbb fix checking whether header is member of message-hidden-headers
Emacs lisp function 'member' takes element and list as an
argument. I.e. the second argument is list, not symbol
referencing the list.
On emacs 23.x the member call always returned nil (thus buggy),
on emacs 22.x the call failed, making it unusable.
2011-08-25 09:08:04 -03:00
Carl Worth
580de27177 emacs: Fix to unconditionally display subject changes in collapsed thread view
The feature to show subject changes in the collapsed thread view was
originally added (8ab433607) with an option
(notmuch-show-always-show-subject) to display the subject
for all messages, even when there was no change.

The subsequent commit (4f04d273) changed the sense of the test (or to
and) and the name of the controlling variable
(notmuch-show-elide-same-subject).

But this commit is broken in a few ways:

  1. The original definition of notmuch-show-always-show-subject was
     left around

     But the variable isn't actually used in the code at all, so it
     just adds clutter and confusion to the customization interface.

  2. The name and description of the controlling variable doesn't
     match the implementation

     The name suggests that setting the variable to t will cause
     repeated subjects to be elided, (suggesting that when it is nil
     all subjects will be shown).

     However, when the variable is nil, no subjects are shown. So a
     correct name for the variable in this sense would be
     notmuch-show-subject-changes.

Showing subject changes is a useful feature, and should be on by
default. (We don't want to bury generally useful features behind
customizations that users have to find).

Rather than fixing the name of the variable and changing its default
value, here we remove the condition entirely, such that the feature is
enabled unconditionally.

So both the currently-used variable and the stale definition of the
formerly-used are removed.

Also, the one relevant test-suite result is updated, (showing the
intial subject of a collapsed thread, and no subject display for later
messages that do not change the subject).
2011-07-01 02:00:25 -07:00
Carl Worth
e5dafc9051 Makefile: Make emacs compilation depend on global dependencies.
We call these "global_deps" for a reason, after all!

Without this, emacs compilation would proceed even if the configure script
failed, (such as for a missing dependency). That's undesirable as it can
cause the helpful error messages from the configure failure to scroll away.
2011-06-28 11:59:48 -07:00
Pieter Praet
607a73010a fix sum moar typos [error messages]
Various typo fixes in error messages within the source code.

Signed-off-by: Pieter Praet <pieter@praet.org>

Edited-by: Carl Worth <cworth@cworth.org> Restricted to just error messages.
2011-06-23 15:59:03 -07:00
Pieter Praet
432e091924 fix sum moar typos [user-visible documentation in code]
Various typo fixes in documentation within the code that can be made
available to the user, (emacs function help strings, "notmuch help"
output, notmuch man page, etc.).

Signed-off-by: Pieter Praet <pieter@praet.org>

Edited-by: Carl Worth <cworth@cworth.org> Restricted to just
documentation and fixed fix of "comman" to "common" rather than
"command".
2011-06-23 15:58:50 -07:00
Pieter Praet
8bb6f7869c fix sum moar typos [comments in source code]
Various typo fixes in comments within the source code.

Signed-off-by: Pieter Praet <pieter@praet.org>

Edited-by: Carl Worth <cworth@cworth.org> Restricted to just
source-code comments, (and fixed fix of "descriptios" to "descriptors"
rather than "descriptions").
2011-06-23 15:58:39 -07:00
Pieter Praet
730acd4764 fix sum moar typos [build scripts, Makefiles]
Various typo fixes in comments within the Makefile and other build scripts.

Signed-off-by: Pieter Praet <pieter@praet.org>

Edited-by: Carl Worth <cworth@cworth.org> Restricted to just build files.
2011-06-23 15:44:59 -07:00
Dmitry Kurochkin
ce08571428 Fix wrong-type-argument lisp error in `notmuch-fcc-header-setup'
This error occurs when `notmuch-fcc-dirs' is set to a list.  The error
was in the `notmuch-fcc-dirs' format check which was changed in an
incompatible way from 0.4 to 0.5.

The fix was extracted from a bigger patch series by David
Edmondson id:"1290682750-30283-2-git-send-email-dme@dme.org".

Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>
2011-06-23 15:19:06 -07:00
Jameson Graef Rollins
2ba880d59e emacs: Show all multipart/alternative parts by default.
This is patch is a temporary work-around for a slight regression that
popped up in the part handling reorganization.  Currently, text/plain
parts are always preferred, if present, over other non-text/plain
parts in multipart/alternative.  However, this means that if there is
a blank text/plain part, no content will be displayed.

One way to get around this is to set the
"notmuch-show-all-multipart/alternative-parts" customization variable
to True ('t'), which will cause all parts to always be displayed.

Since we want to move forward with the next release, we're going to
set this variable true by default, to make sure that no content is
unretrievably hidden from the user.  Once we come up with a better
solution for easy display of hidden parts we can set this back to a
default value of 'nil'.
2011-06-22 22:28:12 -03:00
Dmitry Kurochkin
52f751fb74 Simplify message and headers visibility code in notmuch-show view.
Before the change, headers and message visibility functions took
extra care to correctly set `buffer-invisibility-spec'.  This was
needed because headers overlay `invisible' property had only
headers' invisibility spec.  So visibility of headers was
determined only by the headers invisibility spec.  The patch sets
headers overlay `invisible' property a list with both the headers
and the message invisibility spec.  This makes headers invisible
if either of them is added to the `buffer-invisibility-spec' and
allows to simplify the code.
2011-06-15 07:07:32 -07:00
Dmitry Kurochkin
4a9d0ac147 Set higher priority for headers and hidden citation overlays.
Before the patch, message, headers and hidden citation overlays
had zero priority.  All these overlay have `invisible' property.
Emacs documentation says that we should not make assumptions
about which overlay will prevail when they have the same priority
[1].  It happens to work as we need, but we should not rely on
undocumented behavior.

[1] http://www.gnu.org/s/emacs/manual/html_node/elisp/Overlay-Properties.html
2011-06-15 07:07:32 -07:00
Dmitry Kurochkin
95ef8da294 Fix hiding a message while some citations are shown in notmuch-show view.
Before the change, message and citation invisibility overlays
conflicted: if some citation is made visible and then the whole
message is hidden, that citation remained visible.  This happened
because the citation's overlay has an invisible property which
takes priority over the message overlay.  The message
invisibility spec does not affect citation visibility, it is
determined solely by the citation overlay invisibility spec.
Hence, if citation is made visible, it is not hidden by message
invisibility spec.

The patch changes citation overlay invisibility property to be a
list which contains both the citation and the message
invisibility specs.  This makes the citation invisible if either
of them is added to the `buffer-invisibility-spec'.  Note that
all citation visibility states are "restored" when the message
hidden and shown again.
2011-06-15 07:07:32 -07:00
Dmitry Kurochkin
7524b0650e Set message invisibility spec properties before inserting the body.
This would allow body-inserting code (in particular, wash
button-inserting code) to use message invisibility specs.
2011-06-15 07:07:32 -07:00
Dmitry Kurochkin
f43f760887 Pass message to the `notmuch-show-insert-text/plain-hook' hook.
Before the change, the `notmuch-show-insert-text/plain-hook' was
given only the `depth' argument.  The patch adds another one -
the message.  Currently, the new message argument is not used by
any on the hooks.  But it will be used later to get access to
message invisibility specs when wash buttons are inserted.
2011-06-15 07:07:32 -07:00
Dmitry Kurochkin
974faa22b5 Workaround for Emacs bug #8721.
The emacs bug is that isearch cannot search through invisible text
when the 'invisible' property is a list.

The patch adds `notmuch-isearch-range-invisible' function which
is the same as `isearch-range-invisible' but with fixed Emacs bug
 #8721.  Advice added for `isearch-range-invisible' which calls
`notmuch-isearch-range-invisible' instead of the original
`isearch-range-invisible' when in `notmuch-show-mode'.
2011-06-15 07:07:32 -07:00
David Bremner
f56b86dffa notmuch.el: hide original message in top posted replies.
This code treats top posted copies essentially like signatures, except
that it doesn't sanity check their length, since neither do their
senders.

New user-visible variables:

	notmuch-wash-button-original-hidden-format
	notmuch-wash-button-original-visible-format

Rebased-by: Carl Worth <cworth@cworth.org>
2011-06-10 15:59:45 -07:00
Dmitry Kurochkin
d1cbd833a7 Make `notmuch-show-clean-address' parsing-error-proof.
Mail-header-parse-address may fail for an invalid address.
Before the change, this would result in empty notmuch-show buffer
with an error message like: Scan error: "Unbalanced parentheses".
The patch wraps the function in condition-case and returns
unchanged address in case of error.
2011-06-03 14:08:26 -07:00
Thomas Jost
dacaaf3a07 emacs: Cleaner interface when prompting for sender address
Most of the time, every entry in the list of identities has the same user name
part. It can then be filled in automatically, and the user can only be prompted
for the email address, which makes the interface much cleaner.
2011-06-03 12:42:04 -07:00
Thomas Jost
78138ec9aa emacs: Don't always prompt for the "From" address when replying
When replying, the From: address is already filled in by notmuch reply, so most
of the time there is no need to prompt the user for it.
2011-06-03 12:38:51 -07:00
Jameson Graef Rollins
da3e47e377 emacs: fix notmuch-show-part-button to not include newline
This makes the button cleaner, so that it doesn't include the entire
rest of the line that the button is on.
2011-06-03 12:37:55 -07:00
Dmitry Kurochkin
a0f09b4942 Use message-field-value instead of message-fetch-field in FCC header setup.
For message-fetch-field the buffer is expected to be narrowed to
just the header of the message.  That is not the case when
notmuch-fcc-header-setup is run, hence a wrong header value may be
returned.  E.g. when forwarding an
email, (message-fetch-field "From") returns the From header value
of the forwarded email.

Message-field-value is the same as message-fetch-field, only
narrows the buffer to the headers first.

Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>
2011-06-03 12:30:55 -07:00
Pieter Praet
e2afcd2594 emacs: Use "message-cited-text" instead of "message-cited-text-face"
(describe-face 'message-cited-text-face)
> message-cited-text-face is an alias for the face `message-cited-text'.
> This face is obsolete since 22.1; use `message-cited-text' instead.

Signed-off-by: Pieter Praet <pieter@praet.org>
Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>
2011-06-01 21:59:42 -07:00
Thomas Jost
09793b6132 emacs: Define several faces for the crypto-status button
Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>

jrollins modified this patch to conform to recent changes in the
crypto processing since this patch was originally sent in.
2011-06-01 21:41:24 -07:00
Dmitry Kurochkin
a87a6b99f9 Don't re-compress .gz & al. in notmuch-show-save-part.
Write-region handles some file names specially, see Emacs Lisp
manual section 25.11 Making Certain File Names "Magic" [1].  This
is a nice feature for normal text editing, but it is not
desirable if we need to save raw file content (e.g. attachment).
In particular, this affects archives and may result in corrupted
attachments saved with notmuch-show-save-part (attachment button
click handler).

Turns out, smart GNUS folks encountered the same problem and
implemented write-region wrapper which inhibits some file name
handlers.  In particular, this wrapper is used in mm-save-part,
which is why notmuch-save-attachments that uses it works fine
with archives.

The patch replaces write-region with mm-write-region in
notmuch-show-save-part.  Also it removes coding-system-for-write
and require-final-newline setting in notmuch-show-save-part.  The
former is set in mm-write-region.  The latter seems to be
unneeded because mm-save-part does not use it.

[1] http://www.gnu.org/s/emacs/manual/html_node/elisp/Magic-File-Names.html
2011-05-31 15:04:52 -07:00
Jameson Graef Rollins
cb8418784c emacs: Give mutlipart/{signed, encrypted} their own part handler.
This is the best way to make the displayed output for
decrypted/verified messages clearer.  The special sigstatus and
encstatus buttons are now displayed under the part header button.  The
part header button is also tweaked to provide information to user
about how to proces crypto.
2011-05-27 16:22:00 -07:00
Jameson Graef Rollins
933011ccaf emacs: Do not attempt to render arbitrary application parts.
We probably shouldn't have been doing this anyway, but we do it here
specifically because we don't want the content of the
application/pgp-encrypted parts to be displayed and cluttering the
message show.
2011-05-27 16:22:00 -07:00
Jameson Graef Rollins
45fe354745 emacs: Add support for PGP/MIME verification/decryption
A new emacs configuration variable "notmuch-crypto-process-mime"
controls the processing of PGP/MIME signatures and encrypted parts.
When this is set true, notmuch-query will use the notmuch show
--decrypt flag to decrypt encrypted messages and/or calculate the
sigstatus of signed messages.  If sigstatus is available, notmuch-show
will place a specially color-coded header at the begining of the
signed message.

Also included is the ability to switch decryption/verification on/off
on the fly, which is bound to M-RET in notmuch-search-mode.
2011-05-27 16:22:00 -07:00
Daniel Schoepe
eb4e0ea2ab emacs: Make the queries used in the all-tags section configurable
This patch adds a customization variable that controls what queries
are used to construct the all-tags section in notmuch-hello. It allows
the user to specify a function to construct the query given a tag or
a string that is used as a filter for each tag.
It also adds a variable to hide various tags from the all-tags section.

Signed-off-by: Daniel Schoepe <daniel.schoepe@googlemail.com>
2011-05-26 14:34:41 -07:00
Thomas Jost
b15cfd7ffa emacs: Add a customization allowing to always prompt for the "From" address when composing a new message 2011-05-26 10:38:39 -07:00
Thomas Jost
f7cc259c10 emacs: Allow the user to choose the "From" address when replying to a message
When pressing C-u r, the user will be prompted for the identity to use.
2011-05-26 10:38:16 -07:00
Thomas Jost
1a8aae6fa7 emacs: Allow the user to choose the "From" address when forwarding a message
When pressing C-u f, the user will be prompted for the identity to use.
2011-05-26 10:34:45 -07:00
Thomas Jost
784649561a emacs: Allow the user to choose the "From" address when composing a new message
When pressing C-u m, the user will be prompted for the identity to use.
2011-05-26 10:34:37 -07:00
Thomas Jost
fda6416745 emacs: Helpers needed for the user to be able to choose the "From" address when composing a new message
This adds functions and variables needed for this feature to be implemented.
Once it's done, the user will be able to use a prefix argument (e.g. pressing
C-u m instead of m) and be able to select a From address.

By default the list of names/addresses to be used during completion will be
automatically generated by the settings in the notmuch configuration file. The
user can customize the notmuch-identities variable to provide an alternate list.

This is based on a previous patch by Carl Worth
(id:"87wrhfvk6a.fsf@yoom.home.cworth.org" and follow-ups).
2011-05-26 10:34:21 -07:00
Dmitry Kurochkin
b6862c7eb9 Carefully manage save/restore of point in `notmuch-wash-toggle-invisible-action'.
Before the change, save-excursion was used to save the point.  But the
marker saved by save-excursion was inside a region that was deleted,
so that approach is unreliable, (leading to point jumping to a new
position past the button). This patch instead saves point in an
integer variable, and when restoring, carefully avoids moving point
past the button, (in case the new button label is shorter than the old
button label).
2011-05-24 16:33:09 -07:00
Dmitry Kurochkin
40de245862 Use different labels for wash buttons when text is visible or hidden.
Before the change, citation and signature wash buttons used the
same label in both visible and hidden states.  Sometimes it is
very convenient when you can determine if the text is hidden or
shown without reading the context and/or clicking the button.
The patch makes it easy to see if the text is shown or hidden by
explicitly saying what the button does (shows or hides the text).
2011-05-24 15:28:33 -07:00
Carl Worth
bc382902c1 emacs: Add an accessor function for emacs code to get at user.other_email
This is like the other notmuch-config accessor functions except that it
converts the newline-separated string into an actual lisp list.
2011-05-24 14:43:48 -07:00
Daniel Schoepe
d84e927091 emacs: add notmuch-before- and notmuch-after-tag-hook
This patch adds hooks that are run before/after messages are tagged
From the emacs interface.  In order to implement this and to avoid
having hooks parse all the arguments to the notmuch binary again, I
created a `notmuch-tag' function that other modules should use instead
of running (notmuch-call-notmuch-process "tag" ...) directly.
2011-05-24 13:28:41 -07:00
Jameson Graef Rollins
1650fd39ce emacs: update notmuch-show.el to use new part output
The command-line interface for extracting a single part from a message
recently changed from:

	notmuch part --part=X
to:
	notmuch show --format=raw --part=X
2011-05-24 12:19:18 -07:00
David Edmondson
0898cfad5e emacs: Show cleaner `From:' addresses in the summary line.
Remove double quotes and flatten "foo@bar.com <foo@bar.com>" to
"foo@bar.com".

Edited-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net> (clean up
expected output for emacs tests).

Signed-off-by: Jameson Rollins <jrollins@finestructure.net>
2011-05-18 16:11:53 -07:00
David Edmondson
4f04d2734f emacs: Add custom `notmuch-show-elide-same-subject'
This controls the appearance of collapsed messages in notmuch-show
mode, avoiding redundancy for repeated subject).

Remove `notmuch-show-always-show-subject'.

Signed-off-by: Jameson Rollins <jrollins@finestructure.net>
2011-05-18 16:11:53 -07:00
David Edmondson
8ab4336074 emacs: Add `notmuch-show-always-show-subject', allowing control over
the display of collapsed messages.

Signed-off-by: Jameson Rollins <jrollins@finestructure.net>
2011-05-18 16:11:52 -07:00
David Edmondson
f3384a322e emacs: Allow renderer of multipart/related parts access to non-primary parts.
Typically used to allow a `text/html' renderer access to images which
are sent along with the HTML.

This is not enabled by default, instead the user must execute
`notmuch-show-setup-w3m' for it to take effect.

Edited-by: Carl Worth <cworth@cworth.org> Add documentation string for
notmuch-show-setup-23m and clean up warning about reference/assignment
of free variable.

Signed-off-by: Jameson Rollins <jrollins@finestructure.net>
2011-05-18 16:10:15 -07:00
David Edmondson
31bd2872c3 emacs: Optionally show all parts in multipart/alternative.
Add a variable `notmuch-show-all-multipart/alternative-parts' that
allows the user to indicate that all candidate sub-parts of a
multipart/alternative part should be shown rather than just the
preferred part. The default is `nil', showing only the preferred part.

This is mostly a debugging aid.

Signed-off-by: Jameson Rollins <jrollins@finestructure.net>
2011-05-18 15:51:46 -07:00
David Edmondson
7ca4db2b46 emacs: Render text/x-vcalendar parts.
Use code from icalendar.el to convert text/x-vcalendar parts to
something suitable for use with the Emacs diary.

Signed-off-by: Jameson Rollins <jrollins@finestructure.net>
2011-05-17 16:34:26 -07:00
David Edmondson
f35813df38 emacs: Allow indentation of multipart children.
Signed-off-by: Jameson Rollins <jrollins@finestructure.net>
2011-05-17 16:34:26 -07:00
David Edmondson
0c68a5d847 emacs: Add `notmuch-show-multipart/alternative-discouraged'.
Also improved implementation of indication of which parts are
not shown.

Signed-off-by: Jameson Rollins <jrollins@finestructure.net>
2011-05-17 16:34:26 -07:00
David Edmondson
b741e4dd25 emacs: add more part handling functions
This adds new notmuch-show-insert-part functions to handle
multipart/alternative and message/rfc822 parts.
2011-05-17 16:34:26 -07:00
Carl Worth
362ab047c2 notmuch show: Properly nest MIME parts within mulipart parts
Previously, notmuch show flattened all output, losing information
about the nesting of the MIME hierarchy. Now, the output is properly
nested, (both in the --format=text and --format=json output), so that
clients can analyze the original MIME structure.

Internally, this required splitting the final closing delimiter out of
the various show_part functions and putting it into a new
show_part_end function instead. Also, the show_part function now
accepts a new "first" argument that is set not only for the first MIME
part of a message, but also for each first MIME part within a series
of multipart parts. This "first" argument controls the omission of a
preceding comma when printing a part (for json).

Many thanks to David Edmondson <dme@dme.org> for originally
identifying the lack of nesting in the json output and submitting an
early implementation of this feature. Thanks as well to Jameson Graef
Rollins <jrollins@finestructure.net> for carefully shepherding David's
patches through a remarkably long review process, patiently explaining
them, and providing a cleaned up series that led to this final
implementation. Jameson also provided the new emacs code here.
2011-05-17 15:58:57 -07:00
Carl Worth
7c58326d62 emacs: Only compile replacement functions for emacs < emacs-23
This avoids the emacs lisp compiler from emitting warnings on this
replacement code, (which warnings would be hard for us to eliminate
since we didn't write the code but copied it verbatim from emacs 23).
2011-05-11 13:27:14 -07:00
Jameson Graef Rollins
907cac7035 use custom-face-edit value-type in notmuch-search-line-faces
This enables the proper face customization UI for
notmuch-search-line-faces.
2011-04-25 14:26:20 -07:00
Carl Worth
eead238277 emacs: Define notmuch-search-process-filter-data before first use.
To avoid a wraning about a reference to a free variable when compiling.
2011-03-10 17:59:53 -08:00
Carl Worth
708c4f46ca emacs: Don't drop error messages from "notmuch search"
With the previous commit, unexpected output before or between search results
would be displayed. However, trailing junk from the "notmuch search" output
would still be silently swallowed.

The most common case for an error message from "notmuch search" would be
an invalid command-line, and in that case, there would be no search results
and the trailing error message would get swallowed.

We fix the process sentinel to check for leftover data and add it to the
final buffer. We also add a test case to ensure this works.
2011-03-10 16:53:46 -08:00
Carl Worth
8a534dc60d emacs: Fix notmuch-search-process-filter to handle incomplete lines
This fixes the recently-added emacs-large-search-buffer test. This is
as simple as saving any trailing input and then pre-prepending it on
the next call.

MAny thanks to Thomas Schwinge <thomas@schwinge.name> for tracking
down this problem and contributing a preliminary version of this fix.
2011-03-10 16:25:37 -08:00
Carl Worth
44d3c57e2a emacs: Display any unexpected output from notmuch search
Rather than silently swallowing unexpected output, the emacs interface will now
display it. This will allow error messages to actually arrive at the emacs
interface (though not in an especially pretty way). This also allows for easier
investigation of the inadvertent swallowing of search results that span page
boundaries (as demonstrated by the recent added emacs-large-search-buffer test).

The page-boundary bug has been present since a commit from 2009-11-24:
93af7b5745

Many thanks to Thomas Schwinge for tracking that bug down and
contributing the test for it.
2011-03-10 15:18:40 -08:00
Carl Worth
3e4a9d60a9 build: Add support for non-source-directory builds.
Such as:

     mkdir build
     cd build
     ../configure
     make

This is implemented by having the configure script set a srcdir
variable in Makefile.config, and then sprinkling $(srcdir) into
various make rules. We also use vpath directives to convince GNU make
to find the source files from the original source directory.
2011-03-09 15:10:03 -08:00
Jameson Rollins
15d8928f41 emacs: send notmuch-query stderr to /dev/null
The call-process to notmuch in notmuch-query.el was previously sending
stderr into the output buffer.  This means that if there is any stderr
the JSON parsing breaks.  Unfortunately call-process does not support
sending stderr to a separate buffer or to the minibuffer [0], but it
does support sending it to /dev/null.  So we do that here instead.

[0] a bug was filed against emacs (#7842)
2011-01-27 14:44:05 +10:00
Carl Worth
1a915d1b38 Makefile: Quote variables used as filenames in shell commands
This allows support for filenames with spaces in them.
2011-01-26 23:36:52 +10:00
Michal Sojka
74cb76a69d emacs: View the output of pipe command when it fails
Previously, the user didn't know whether the pipe command succeeded or
not. It was only possible to find it out by manually inspecting
the work done (or not done) by the command or by manually switching to
*notmuch-pipe* buffer and determine it from command output. For this
the user had to first find the text corresponding to the last run of
pipe command as the buffer accumulated the output from all pipe commands.

This patch changes the following. The *notmuch-pipe* buffer is erased
before every pipe command so it contains only the output from the last
command. Additionally, when the command failed, the *notmuch-pipe* buffer
is shown and an error message is displayed.
with the output of pipe command.
2011-01-26 22:39:36 +10:00
Cédric Cabessa
26b4cc4aad configure: add options to disable emacs/zsh/bash and choose install dir.
add --bashcompletiondir and --zshcompletiondir (like --emacslispdir) to choose
installation dir for bash/zsh completion files

Make some features optional:
  --without-emacs / --with-emacs=no do not install lisp file
  --without-bash-completion / --with-bash-completion=no  do not install bash
files
  --without-zsh-completion / --with-zsh-completion=no do not install zsh files
By default, everything is enabled. You can reenable something with
  --with-feature=yes
2011-01-26 22:30:32 +10:00
David Edmondson
b9d4af4641 emacs: Remove over-eager regular expressions from notmuch-wash-tidy-citations.
The removed expressions, which were used to ensure that citations were
both preceded and followed by a blank line, were poorly implemented
and caused a regexp stack overflow on messages more than a few
thousand lines long.
2010-12-07 14:10:43 -08:00
David Edmondson
5d05d5434d emacs: Improve the display of truncated authors.
Incremental search does not match strings that span a
visible/invisible boundary. This results in failure to correctly
isearch for authors in `notmuch-search' mode if the name of the author
is split between the visible and invisible components of the authors
string. To avoid this, attempt to truncate the visible component of
the authors string on a boundary between authors, such that the
entirety of an author's name is either visible or invisible.
2010-12-07 13:57:05 -08:00
David Edmondson
cafd46ca13 emacs: Use truenames for Fcc paths.
Appease the test suite by using the true name for the Fcc directory
path, otherwise a value for `notmuch-database-path' which includes
symbolic links causes test suite failures.
2010-12-07 13:47:59 -08:00
James Vasile
7ae149445a compatibility with emacs22
Emacs22 lacks apply-partially and mouse-event-p, so define them if emacs
version is less than 23.  With this change, I was able to begin using
notmuch in emacs22.

The definitions of apply-partially and mouse-event-p are copied from
the emacs 23 distribution, (which is distributed under the GPLv3+ just
as notmuch).
2010-11-16 15:04:22 -08:00
David Edmondson
75d616c6ca emacs: Use `view-mode' when examining raw messages.
Explained-by: Carl Worth: This gives convenient keybindings for
navigating the file and for quitting from the buffer, (since, with a
raw message file the user will generally want to just view the
message, not edit it).
2010-11-16 11:16:59 -08:00
Jameson Rollins
2b433736a5 emacs: add stash thread-id function to notmuch-search mode
This add a "stash-map" for search-mode, just like in show-mode, and
adds one function, bound to "i" to stash the thread-id of the current
selected thread.

Couldn't think of the correct way to stash other thread info, so I
didn't add any other stash functions for now.
2010-11-11 17:28:48 -08:00
Jameson Rollins
128b6259ee emacs: mv notmuch-{show,common}-do-stash
Here we move the notmuch-show/notmuch-show-do-stash function to
notmuch-lib/notmuch-common-do-stash.  Nothing in this function is
notmuch-show mode specific, so this move will make it cleaner to be
used by other modes (such as notmuch-search).
2010-11-11 17:28:32 -08:00
David Edmondson
ea1c2bb5c5 emacs: Improve the definition and use of `notmuch-fcc-dirs'.
Re-work the declaration and definition of `notmuch-fcc-dirs'. The
variable now allows three types of values:

- nil: no Fcc header is added,

- a string: the value of `notmuch-fcc-dirs' is the name of the
  folder to use,

- a list: the folder is chosen based on the From address of the
  current message using a list of regular expressions and
  corresponding folders:

     ((\"Sebastian@SSpaeth.de\" . \"privat\")
      (\"spaetz@sspaeth.de\" . \"OUTBOX.OSS\")
      (\".*\" . \"defaultinbox\"))

  If none of the regular expressions match the From address, no
  Fcc header will be added.
2010-11-11 17:16:28 -08:00
David Edmondson
c471c4eb04 emacs: Use the header line to show the subject of the thread. 2010-11-11 17:06:04 -08:00
David Edmondson
e845f4e27e emacs: Simplify subjects more aggressively.
Remove 're: ' or 'Re: ' from anywhere within a subject line rather
than just at the beginning. This is to accommodate threads where a
mailing list sometimes inserts a subject prefix.

For example, if a thread has the subjects:

    [Orgmode] org-indent, org-inlinetask: patches on github
    Re: [Orgmode] org-indent, org-inlinetask: patches on github
    [Orgmode] Re: org-indent, org-inlinetask: patches on github

the last of these would not have been considered the same and would
therefore have been shown.
2010-11-11 17:04:35 -08:00
David Edmondson
e6d31a5435 emacs: Elide the display of repeated subjects in thread display mode.
Collapsed messages do not show a "Subject:" line if the subject is the
same as that of the previous message.
2010-11-11 17:03:45 -08:00
David Edmondson
1b2ea703e7 emacs: Correctly count the number of lines in a signature. 2010-11-11 16:50:22 -08:00
Jameson Rollins
7171e77d4d Don't use kill-this-buffer to kill notmuch emacs buffers
kill-this-buffer appears to be a function intended specifically for
use in the menu bar, and causes problem killing notmuch buffers when
multiple frames have been used.  This patch replaces kill-this-buffer
with notmuch-kill-this-buffer, which in turn just simply calls
(kill-buffer (current-buffer)).
2010-11-08 09:02:54 -08:00
Michal Sojka
c7189ed607 emacs: Fix notmuch-show-pipe-message to use notmuch-command variable
Previously notmuch command name was hardcoded into this function,
which made remote use of pipe command impossible.
2010-11-06 17:17:40 -07:00
Carl Worth
81d3bd3670 Rename "notmuch cat" to "notmuch show --format=raw"
This is part of an effort to avoid proliferation of excessive
top-level notmuch commands. Also, "raw" better captures the
functionality here, (as opposed to "cat" which is a fairly oblique
reference to a bad Unix abbreviation whose metaphor doesn't work here
since "notmuch cat" operates only on a single message and hence cannot
"con'cat'enate" anything).
2010-11-06 12:03:51 -07:00
Michal Sojka
fe9e163f19 emacs: Access raw messages via cat subcommand
This patch modifies the following commands to access the messages via
cat subcommand:
- view/save attachments ('v', 'w'),
- view a raw message ('V') and
- pipe a message to a command ('|').

With this patch, it is straightforward to use notmuch emacs interface
with a remote database accessed over SSH. To do this, it is sufficient
to redefine notmuch-command variable to contain the name of a script
containing:

    ssh user@host notmuch "$@"

If the ssh client has enabled connection sharing (ControlMaster option
in OpenSSH), the emacs interface is almost as responsive as when
notmuch is invoked locally.
2010-11-05 17:51:18 -07:00
Dirk Hohndel
ee578338a6 Fix problem with notmuch-hello-nice-number
Without this little patch notmuch fails if asked to display a saved
search that has zero results

Edited-by: David Edmondson <dme@dme.org>: With code that is a little
more "emacsy".
2010-10-29 15:49:01 -07:00
David Edmondson
f99ad42da0 emacs: Re-work the implementation of highlighting in notmuch-search-mode.
Re-write `notmuch-search-color-line', with the following improvements:
 - create overlays only if they will be needed,
 - merge the properties specified for a tag on top of any matching a
   previous tag.
2010-10-29 15:30:43 -07:00
Carl Worth
b11ecf613a emacs: Fix the autoload comments
Remove them from non-top-level entry points, (such as the functions to
set notmuch modes and the deprecated notmuch-folder function). And add
one to the notmuch-hello function. Also, add missing documentation
string to notmuch-hello.
2010-10-29 15:27:01 -07:00
David Benjamin
adbfff40ca Don't involve the shell in notmuch searches
The shell isn't needed to interpret any of the arguments, so don't
bother using it at all.

Signed-off-by: David Benjamin <davidben@mit.edu>
2010-10-29 14:13:51 -07:00
Carl Worth
294b6a67c1 emacs: Use copy-sequence instead of copy-seq.
I don't see copy-seq documented within emacs at all, and some users
have encountered failures of the form:

notmuch-show-del-tags-worker: Symbol's function definition is void: copy-seq

This should eliminate that problem.
2010-10-28 11:35:58 -07:00
Carl Worth
6d93d2090d emacs: Eliminate duplicate From header in replies.
The original code was intended to work, but clearly wasn't tested. Use
mail-header (as in existing code) to extract a header from a header alist.

This fixes the duplicate-from-line bug that is exercised by the test
just added to the test suite.
2010-10-27 18:44:05 -07:00