Commit graph

120 commits

Author SHA1 Message Date
David Edmondson
cd03f21447 emacs: Another special case for `notmuch-show-clean-address'.
Remove backslashes.
2012-01-27 07:59:40 -04:00
David Edmondson
cbc4876a33 emacs: Avoid mail-header-parse-address' in notmuch-show-clean-address'.
`mail-header-parse-address' expects un-decoded mailbox parts, which is
not what we have at this point. Replace it with simple string
deconstruction.

Mark the corresponding test as no longer broken.

Minor whitespace cleanup.
2012-01-27 07:58:58 -04:00
David Edmondson
3f003a3ae0 emacs: Re-enable line wrapping in `notmuch-show-mode'.
Turn on `visual-line-mode' via a hook, so that those who so choose can
avoid it.
2012-01-27 07:48:06 -04:00
David Edmondson
63342a3c06 emacs: Make the part content available to `mm-inlinable-p'.
The `mm-inlinable-p' function works better if it has access to the
data of the relevant part, so load that content before calling it.

Don't load the content for parts that the user has indicated no desire
to inline.

This fixes the display of attached image/jpeg parts, for example.
2012-01-26 08:10:55 -04:00
Tomi Ollila
37dec7d7b3 emacs/*.el: changed one-char comment prefix ';' to two; ';;'
In order for emacs (indent-region) to (re)indent emacs lisp
properly there needs to be at least 2 comment characters (;;).
2012-01-21 14:06:17 -04:00
Mark Walters
85665a2955 Make buttons for attachments allow viewing as well as saving
Define a keymap for attachment buttons to allow multiple actions.
Define 3 possible actions:
    save attachment: exactly as currently,
    view attachment: uses mailcap entry,
    view attachment with user chosen program

Keymap on a button is: s for save, v for view and o for view with
other program. Default (i.e. enter or mouse button) is save but this
is configurable in notmuch customize.

One implementation detail: the view attachment function forces all
attachments to be "displayed" using mailcap even if emacs could
display them itself. Thus, for example, text/html appears in a browser
and text/plain asks whether to save (on a standard debian setup)
2012-01-21 08:55:48 -04:00
David Edmondson
05f4904616 emacs: Improved printing support.
Add various functions to print notmuch messages and tie them together
with a simple frontend.

Add a binding ('#') in `notmuch-show-mode' to print the current
message.

one trailing space removed by db.
2012-01-21 08:38:38 -04:00
David Edmondson
d2a1140c44 emacs: Truncate lines and do not enable visual-line-mode in notmuch-show buffers.
Enable the truncation of lines in `notmuch-show-mode' to avoid visual
noise caused by the wrapping of the header lines.

Don't enable `visual-line-mode' because it disables line truncation.

The benefits of `visual-line-mode' were that it wrapped long lines
in received messages. With `notmuch-wash-wrap-long-lines' now default
behaviour, this is no longer required.
2012-01-21 08:22:27 -04:00
Pieter Praet
046f5dded2 emacs: globally replace non-branching "(if (not ..." with "(unless ..."
Less code, same results, without sacrificing readability.
2012-01-21 08:17:56 -04:00
Pieter Praet
643ce61c1b emacs: logically group def{custom,face}s
To allow for expansion whilst keeping everything tidy and organized,
move all defcustom/defface variables to the following subgroups,
defined in notmuch-lib.el:

- Hello
- Search
- Show
- Send
- Crypto
- Hooks
- External Commands
- Appearance

As an added benefit, defcustom keyword args are now consistently
ordered as they appear @ defcustom's docstring (OCD much?).

Proper defgroup docstrings and various other improvements
by courtesy of Austin Clements.
2012-01-19 09:27:02 -04:00
David Bremner
efa5d6cb32 Revert "emacs: Don't attempt to colour tags in `notmuch-show-mode'."
This reverts commit 4b256ff557.

According to id:"87aa5nlwwg.fsf@praet.org" and followup messages, the
assumptions of the patch seem not to hold in emacs 23.
2012-01-17 08:01:48 -04:00
David Edmondson
4b256ff557 emacs: Don't attempt to colour tags in `notmuch-show-mode'.
The tags were coloured using text properties. Unfortunately that text
(the header line) also has an overlay, which overrides the text
properties. There's not point in applying text properties that will
never be seen.
2012-01-15 22:31:00 -04:00
Jani Nikula
f02b475fa7 emacs: bind 'r' to reply-to-sender and 'R' to reply-to-all
Change the default reply key bindings, making 'r' reply-to-sender and 'R'
reply-to-all.

Signed-off-by: Jani Nikula <jani@nikula.org>
2012-01-14 11:11:06 -04:00
Jani Nikula
dc0919c912 emacs: add support for replying just to the sender
Provide reply to sender counterparts to the search and show reply
functions. Add key binding 'R' to reply to sender, while keeping 'r' as
reply to all, both in search and show views.

Signed-off-by: Jani Nikula <jani@nikula.org>
2012-01-14 11:10:41 -04:00
David Edmondson
647c250989 notmuch/emacs: Observe the charset of text/html parts, where known.
Add the charset of text/html parts to the JSON output of 'notmuch
-show' when it is known. Observe the encoding when rendering such
parts in emacs.
2012-01-13 21:45:21 -04:00
David Bremner
0bbfc5ce8b Merge branch 'release'
Conflicts:
	notmuch-reply.c
	notmuch.1
2012-01-13 20:52:01 -04:00
Jameson Graef Rollins
74bced62b4 emacs: fix notmuch-show-indent-messages-width customization variable name
The name was originally notmuch-indent-messages-width, which is
inconsistent with our variable naming convention.
2012-01-05 17:48:46 -04:00
David Edmondson
641399fa2c emacs: Enable more text/plain hook functions by default.
Users are missing out on various functions which usefully improve the
display of text/plain message parts because they are not enabled by
default. Enable a useful set.

`notmuch-wash-convert-inline-patch-to-part' is _not_ enabled by
default as it is based on a heuristic.
2011-12-28 13:28:54 -04:00
Jani Nikula
d5d39a92f1 emacs: add inline patch fake parts through a special handler
Add wash generated inline patch fake parts through a special
"inline-patch-fake-part" handler to distinguish them from real MIME
parts. The fake parts are described as "inline patch (as text/x-diff)".

Signed-off-by: Jani Nikula <jani@nikula.org>
2011-12-28 08:18:13 -04:00
Jameson Graef Rollins
c0d694035d emacs: call notmuch-show instead of notmuch-search in buttonised id: links
Since message-ids necessarily match just a single message, there's no
reason to do a search for the id before viewing the actual message;
the search just becomes an extra screen to click through.  Clicking on
an id: links now just jumps straight to the message itself.
2011-12-24 15:32:01 -04:00
Aaron Ecay
8392a7cc54 emacs: fix off-by-one bug in notmuch-show-archive
Text properties change between characters; prev-s-c-property-change
returns the position after the change.  Thus, it is still inside the
invisible region.
2011-12-23 08:29:04 -04:00
Aaron Ecay
e3260d0253 Don't quote lambda forms
This generates byte-compiler warnings on (at least) current trunk
versions of Emacs.  The quote is not necessary; lambda forms are
self-quoting.
2011-12-21 07:27:38 -04:00
Daniel Schoepe
3f02ba3406 emacs: Document notmuch-show-get-message-properties 2011-12-16 08:34:26 -04:00
Thomas Jost
430fb27b3e emacs: Add a face for crypto parts headers
Commit cb841878 introduced new parts handlers for crypto parts, but also
hardcoded values for their headers face. This replaces these hardcoded values
with a customizable face.
2011-12-15 22:51:24 -04:00
Dmitry Kurochkin
a647f43643 emacs: do not call notmuch show for non-inlinable parts
Before the change, there was a workaround to avoid notmuch show calls
for parts with application/* Content-Type.  But non-inlinable parts
are not limited to this Content-Type (e.g. mp3 files have audio/mpeg
Content-Type and are not inlinable).  For such parts
`notmuch-show-insert-part-*/*' handler is called which unconditionally
fetches contents for all parts.

The patch moves content fetching from `notmuch-show-insert-part-*/*'
to `notmuch-show-mm-display-part-inline' function after MIME inlinable
checks are done to avoid useless notmuch show calls.  The
application/* hack is no longer needed and removed.
2011-12-07 20:05:25 -04:00
Dmitry Kurochkin
2a349d739b emacs: remove unused variable in `notmuch-show-insert-part-message/rfc822'
An obvious cleanup.  I wonder why there was no warning about this
during compilation.
2011-12-07 20:00:24 -04:00
Dmitry Kurochkin
f1e75c724d emacs: remove some code duplication in notmuch-show
Add optional props argument to `notmuch-show-get-header'.  Use it to
get headers in `notmuch-show-insert-part-multipart/signed' and
`notmuch-show-insert-part-multipart/encrypted'.
2011-12-07 19:58:45 -04:00
Gregor Zattler
46eb1c116a emacs: make message indentation width customisable
Till now Emacs UI indents messages according to their respecive
depth of neting in the thread.  The actual width of indentation
per level is hardcoded to `1' space.
This patch makes message indentation customisable by introducing
a variable `notmuch-indent-messages-width' which defaults to `1',
which is the same as before.  Felix could set this variable to
`0' in order to disable indentation, I tested it with a value of
`4' for a clearer separation of messages in a thread.
2011-11-25 12:40:23 -05:00
Austin Clements
3a3f6f0ab5 emacs: Don't record undo information for search or show buffers.
There's no reason to record undo information for read-only,
programmatically-constructed buffers.  The undo list just chews up
memory keeping track of our calls to insert.
2011-11-24 08:31:44 -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
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
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
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
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
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
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
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
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
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
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
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
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