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).
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".
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").
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'.
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.
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
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.
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.
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
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.
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.
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.
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.
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
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>
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>
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>
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>
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>
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.
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.
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).
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).
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.
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)).
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).
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.
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.
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.
The GNU Emacs Lisp Reference Manual section D.1 says:
> * Please don't require the cl package of Common Lisp extensions at
> run time. Use of this package is optional, and it is not part of
> the standard Emacs namespace. If your package loads cl at run time,
> that could cause name clashes for users who don't use that package.
>
> However, there is no problem with using the cl package at compile
> time, with (eval-when-compile (require 'cl)). That's sufficient for
> using the macros in the cl package, because the compiler expands
> them before generating the byte-code.
Follow this advice, requiring the following changes where `cl' was
used at runtime:
- replace `rassoc-if' in `notmuch-search-buffer-title' with the `loop'
macro and inline code. At the same time find the longest prefix
which matches the query rather than simply the last,
- replace `union', `intersection' and `set-difference' in
`notmuch-show-add-tag' and `notmuch-show-remove-tag' with local code
to calculate the result of adding and removing a list of tags from
another list of tags.
If Xapian sees unquoted ".." as in id:123..456 then it thinks that's a
range specification. We avoid this problem by instead passing
id:"123..456" to Xapian.
We extend the '|' command so that passing a prefix argument, (for
example, "C-u |"), causes it to pipe all open messages in the current
thread rather than just the single, current message.
This was previously wrapped for unsubtituted command names. It looks
much better in the notmuch-help (available with '?') if wrapped
according to the length of the substituted command names.
Add `notmuch-show-relative-dates' to control whether the summary line
in `notmuch-show' mode displays relative dates (e.g. '26 mins. ago') or
the full date string from the message. Default to `t' for
compatibility with the previous behaviour.
Shift-TAB is standard "opposite" of TAB -- in GUI interfaces they
typically cycle through input elements in opposite orders -- so it
makes sense to behave the same way.
Signed-off-by: Nelson Elhage <nelhage@ksplice.com>
Detect inline patches and convert them to fake attachments, in order
that `diff-mode' highlighting can be applied to the patch. This can be
enabled by customising `notmuch-show-insert-text/plain-hook'.
When determining whether or not to re-align the head of the current
message with the top of the window, use `count-screen-lines' rather
than `count-lines' to allow for invisible text in the preceding
message. When comparing that number of lines against
`next-screen-context-lines', realign if the number of lines of the
previous message visible is 'smaller than or equal to' rather than
just 'smaller than' to improve usability.
Add:
- notmuch-wash-wrap-long-lines: Wrap lines longer than the width of
the current window whilst maintaining any citation prefix.
- notmuch-wash-tidy-citations: Tidy up citations by:
- compress repeated otherwise blank citation lines,
- remove otherwise blank citation lines at the head and tail of a
citation,
- notmuch-wash-elide-blank-lines: Compress repeated blank lines and
remove leading and trailing blank lines.
None of these is enabled by default - add them to
`notmuch-show-insert-text/plain-hook' to use.
Reviewed-by: Carl Worth <cworth@cworth.org>: I previously committed a
stale version of this patch.
Set `buffer-invisibility-spec' to `nil' (a list) if it is just `t'
before inserting any body parts, otherwise removing items from
`buffer-invisibility-spec' (which is what
`notmuch-show-headers-visible' and `notmuch-show-message-visible' do)
is a no-op and has no effect. This caused threads with only matching
messages to have those messages hidden initially because
`buffer-invisibility-spec' stayed `t'.
Add:
- notmuch-wash-wrap-long-lines: Wrap lines longer than the width of
the current window whilst maintaining any citation prefix.
- notmuch-wash-tidy-citations: Tidy up citations by:
- compress repeated otherwise blank citation lines,
- remove otherwise blank citation lines at the head and tail of a
citation and remove blank lines between attribution statements and
the citation,
- notmuch-wash-compress-blanks: Compress repeated blank lines and
remove leading and trailing blank lines.
Enable `notmuch-wash-tidy-citations' and
`notmuch-wash-compress-blanks' by default by adding them to
`notmuch-show-insert-text/plain-hook'. `notmuch-wash-wrap-long-lines'
is not enabled by default.
If `notmuch-wash-wrap-long-lines' is enabled, word wrapping of the
buffer leads to an unappealing display of text, so provide a function
to disable it and add it to the list of `notmuch-show-mode' hook
functions.
And similarly for notmuch-show-headers-visible to
notmuch-message-headers-visible.
I've never liked notmuch-show as a namespace prefix, but it looks
especially bad when it appears as "Notmuch Show Headers Visible" in
the customize buffer. Give nicer names to these variables which are
exported for user manipulation.
The function was named and documented incorrectly before, saying that
it would "change the visibility of all messages". Instead it only
opens the messages that are closed---it doesn't simultanesously close
the messages that are open. (Granted, nobody would *want* that
behavior I don't think, but the naming was confusing before.)
`notmuch-show-toggle-all' changes the visibility all of the messages
in the current thread. By default it makes all of the messages
visible. With a prefix argument, it makes them all not visible.
Commit 44982ab332 added some extra
quoting when constructing a search. A previous version of this patch
had used single-quotation marks (') while this version used
double-quotation marks (").
The intent of the extra quoting was to allow notmuch-command to be set
to a script invoking ssh.
What actually happens, however is that the extra quotation marks make
it all the way into the query string seen by Xapian. And the double
quotes trigger phrase searching, (which isn't desired here). The
side-effect of that is that the emacs code would fallback to an
unqalified query and display all threads with all messages open.
We fix that side-effect now by using single-quote characters, but
we'll want a better fix in the future to avoid Xapian seeing these
characters at all I think.
Sebastian pointed out that the pre-JSON UI would move the cursor to
the end of the buffer if `n' or `N' is hit when on the last (unread)
message. Mimic that behaviour in the new UI.
Use the mailcap functionality to guess a MIME type for attachments of
type application/octet-stream and, presuming successful, feed the
attachment back into the display code with the determine type.
This is mostly useless at the moment, as the JSON output from notmuch
does not include the content of application/octet-stream parts, so
they cannot be displayed even if the guess is a good one.
If a text/plain part is not the first part in a message, add a label
in order that a user can see that multiple parts are present.
If a part has a 'filename' attribute, include it in any label
describing the part.
In the recent switch to a JSON-based emacs interface, RET now toggles
message visibility anywhere in the message, (rather than only on the
summary line). So we no longer need this separate "b" binding for this.
Additionally, the body toggle was implemented independently from RET,
so after hiding a message with "b" one could not make it visible with
RET. This confusing state is now no longer possible, (since the
:body-visible property is removed entirely).
Put single-quotes around the argument of the `show --entire-thread' command
in notmuch-show. This change should have no effect on normal usage.
However, it allows us to use the notmuch.el client with a remote notmuch
binary and database over ssh (by, e.g., setting `notmuch-command' to a
simple shell script). Without the quotes, ssh will not send the command
properly.
One very simple example script is as follows. (Note that it requires
keypair login to the ssh server.)
#!/bin/sh
SSH_BIN="/path/to/local/ssh"
NOTMUCH_HOST="my.remote.server"
NOTMUCH_REMOTE_PATH="/path/to/remote/notmuch"
$SSH_BIN $NOTMUCH_HOST $NOTMUCH_REMOTE_PATH $@
As put forth in the commit that enabled this functionality, the last
few lines of a citation are often much more important. In that case,
let's actually do the useful thing by default.
In many conversations the last few lines of a citation are more
interesting than the first few lines, hence allow those to be shown if
desired.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Change the buffer name to a uniquified subject of the thread (i.e. the
subject of the first message in the thread) instead of the thread-id. This
is more meaningful to the user, and will make it easier to scroll through
numerous open buffers.
Note that this patch adds an optional `buffer-name' argument to notmuch
show.
Signed-off-by: Jesse Rosenthal <jrosenthal@jhu.edu>
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
To ease the transition to a JSON based implementation of
`notmuch-show', move the current implementation into a separate file.
Create `notmuch-lib.el' to hold common variables.