Previously, we would do only a single-level traverse of the keymap.
That meant that for a keybinding such as "M-TAB" we would just see
the prefix key ("ESC") and print that it was a keymap---never printing
the TAB nor the documentation for the command it is bound to.
Now, we do the full walk, constructing a proper description of the
full keybdinding with prefix characters, (and converting "ESC" to
"M-" for legibility).
Since notmuch-help now displays a single line of documentation from
each of these commands we ensure that the first line stands alone for
each command.
We also override some builtin commands with new commands that don't
behave any differently, but have our own notmuch-specific
documentation, (such as "select next thread" rather than "move point
to next line").
This broke when we switched to filter-based processing of search
results and added the "End of search results" line onto the end. Fix
to skip ignore that line when moving to the last thread.
When there's no more to scroll, we want to select the first thread.
This used to work, and I'm not sure when it broke, (perhaps when we
switched from post-process decorating of the search results to
filtering). Fix the calculation to work again.
The concept behind direct manipulation with mouse clicks is that
documentation shouldn't be necessary, (though my original motivation
here was simply that "<mouse-1>" was exceeding my TAB width.
This does cause a blank line to be added for the mouse binding. This
isn't directly desired, but as long as it's there we put it at a
natural place for a separator.
I had originally created this keymap in order from most important to
least important commands. But our new notmuch-help command is
presented with the list in the reverse order. So we reverse the input
so that the user sees the most important commands first.
This gives somewhat friendlier output for the '?' binding than we had
previously with `describe-mode'. First, we no longer have the various
minor modes cluttering up the output. Second the display of the
binding table uses the first line of documentation for the bound
function rather than the function name.
This silences a warning when compiling notmuch.el. The documentation
of beginning-of-buffer does say (rather emphatically) that it's not
to be used from lisp programs.
The previous location of autoload comments didn't seem to correspond
with the functions most likely to be the entry points for using
notmuch. This change adjusts them to match those likely entry points.
This patch use notmuch-tag-face showing tags in the notmuch-search-mode.
We can selectively highlight each tag by setting notmuch-tag-face-alist as below
(defface notmuch-tag-unread-face
'((((class color)) (:foreground "goldenrod")))
"Notmuch search mode face used to highligh tags.")
(defface notmuch-tag-inbox-face
'((((class color)) (:foreground "red")))
"Notmuch search mode face used to highligh tags.")
(setq notmuch-tag-face-alist '(("unread" . 'notmuch-tag-unread-face)
("inbox" . 'notmuch-tag-inbox-face)))
(require 'notmuch)
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
The most obvious bindings for save attachments are already taken. The
existing 'w' binding was bound to view the raw message. This commit
moves it to 'V' which still seems somewhat mnemonic and uses 'w' for
save (write) attachments.
Sometimes forwarding a message is preferable to replying and modifying
the set of recipients. This commit provides that ability using the
message-forward function.
The ability to temporarily create a buffer containing only the
contents of the currently selected message in notmuch show mode is
generally useful. This commit factors the majority of the code
required to do so out of notmuch-show-view-all-mime-parts into a macro
called with-current-notmuch-show-message and rewrites the original
function in terms of the macro.
A future set of commits will provide additional functionality using
the macro as well.
If there is an html mime-part in the message and it's the first part,
it gets inlined using `mm-display-part' to convert it to plain text.
The HTML content is still available as a non-text part as well.
Rather than tagging the everything in the thread. This is arguably more
desirable behavior and is consistent with clearly desirably behavior of
notmuch-search-operate-all.
Note that this change applies indirectly to
notmuch-search-archive-thread (which is actually equivalent behavior
since this function is primarily used when browsing an inbox).
Signed-off-by: Jed Brown <jed@59A2.org>
It is often convenient to change tags on several messages at once. This
function applies any number of tag whitespace-delimited tag
modifications to all messages matching the current query.
I have bound this to `*'.
Signed-off-by: Jed Brown <jed@59A2.org>
Make sure we use notmuch-search-oldest-first to decide the how
the search result should be displayed. This helps to set the
value to nil and have latest mail shown first
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
When removing a tag from a message or thread, build a completion buffer
which contains only tags that the message or thread has really set.
Signed-off-by: Jan Janak <jan@ryngle.com>
Several commands ask the user for a tag name. With this feature the
user can just press tab and Emacs automatically retrieves the list of
all existing tags from notmuch database with 'notmuch search-tags' and
presents a completion buffer to the user.
This feature is very useful for users who have a large number of tags
because it saves typing and minimizes the risk of typos.
Signed-off-by: Jan Janak <jan@ryngle.com>
We want to allow the user to be able to use search expressions with
parentheses and semi-colons, etc. and we definitely don't want the
shell interpreting those!
Previously, our emacs interface was waiting for the "notmuch search"
to complete before it would display anything. Now, we execute the
process asyncrhonously and filter results as they come in.
This takes advantage of the recent work to make "notmuch search"
results stream out steadily. The result is that some search results
will be available nearly instantly and the user can navigate and view
those while additional results continue loading.
Having actually implemented this, I realized that my
initial approach of providing a function to configure
a button was wrong. Instead I've replaced that with
button types. This then makes it possible to provide
the fully expanded view when all threads in a message
are unread.
It also has the potential to allow global-expansion functions
if that is desireable
This is the same as with citations and signatures.
I used an ellipsis here for the invisible region, which
I think make it more obvious that there are extra headers.
MH-e used this for extra long To/CC headers.
Folder mode takes a (user-configurable) list of search patterns and
produces a list of those patterns and the count of messages that they
match. When an entry in this list is selected, a search window with
the defined search is opened. The set of folders is defined as a
list, each element contains the name of the folder and the query string
to count.
Signed-off-by: Keith Packard <keithp@keithp.com>
Selecting text in the search view isn't all that useful, so instead,
make mouse-1 clicks actually show the thread you click on. It's almost
like direct manipulation or something.
Signed-off-by: Keith Packard <keithp@keithp.com>
When you compose a new message, message mode carefully inserts your
mail signature at the bottom of the message; as notmuch constructs the
reply all by itself, this doesn't happen then. Use the message mode
function 'message-insert-signature' to add that to reply buffers.
Signed-off-by: Keith Packard <keithp@keithp.com>
Avoding these is nicer to users, text editors, and our poor little
notmuch.el code itself that would get confused when seeing a copy of
itself in email. (Of course, we should still fix that bug, but this
workaround is good nonetheless.)
This patch add notmuch-search-hook that gets run when we
after displaying search results
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Cc:Keith Packard <keithp@keithp.com>
I created the notmuch-show-hook precisely so I could add these two
options, but I suspect most people will want them, so I just made them
the default. If you don't want them, you can use remove-hook to get
rid of this.
Signed-off-by: Keith Packard <keithp@keithp.com>
I wanted to enable got-address-mode and visual-line-mode in my show
windows to make messages easier to read and URLs easier to
follow. This hook allows the user to run arbitrary code each time a
message is shown.
Signed-off-by: Keith Packard <keithp@keithp.com>
This is what most people want for a _search_ command. It's often
different for actually reading mail in an inbox, (where it makes more
sense to have results displayed in chronological order), but in such a
case, ther user is likely using an interface that can simply pass the
--sort=oldest-first option to "notmuch search".
Here we're also change the sort enum from NOTMUCH_SORT_DATE and
NOTMUCH_SORT_DATE_REVERSE to NOTMUCH_SORT_OLDEST_FIRST and
NOTMUCH_SORT_NEWEST_FIRST. Similarly we replace the --reverse option
to "notmuch search" with two options: --sort=oldest-first and
--sort=newest-first.
Finally, these changes are all tracked in the emacs interface, (which
has no change in its behavior).
The documentation for 'next-line' suggests that 'forward-line' is a
better choice for non-interactive usage. That appears to be the case
here; using next-line caused emacs to spin forever for me.
Signed-off-by: Keith Packard <keithp@keithp.com>
This is the default separator used by mailman, so there's a lot of
clutter in thread displays without this. Also, we not provide a nice
variable to the user (notmuch-show-signature-regexp) for configuring
this.
I think there's a GMime bug that we're getting parts decoded without a
final newline (the encoded parts seem to have them just fine). We can
workaround the bug easily enough by finding a part-closing delimiter
that is not at the beginning of a line, and if so, just insert a
newline.
Without this, the one-line-summary of the next message would continue
on the same line as the last line of the previous message, (and this
would often happen for mailing-list messages where mailman would add
an extra part for its signature block).
This makes it much easier to actually read the subject lines.
The user can set notmuch-search-authors-width to control the width of
the column.
Two possible ideas for improving this support further:
1. Make the excess authors invisible instead of removing them from
the buffer, (which means that isearch could still find them).
2. Have the user variable control a percentage of the window width
rather than being a fixed number of columns.
Now that we're actually adding text to the buffer for the indentation,
our old aproach of using positions to record regions to manipulate is
now longer correct. Fortunately, it's easy to switch from positions to
markers which are robust, (just call point-marker instead of point and
all relevant functions accept markers as well as points).
I also finally fixed the bug where the text "[6 line signature]" we
display was causing the one-line-summary of the next message to be on
its same line rather than at the beginning of the next line where it
belongs.
Currently just supports viewing all MIME parts in the message. There's
not yet support for selecting and viewing individual parts, but that
should be easy to add from here, (now that we've found
mm-display-parts to do all the heavy lifting).
This gives us two different default search orders: The inbox view that
comes up from "M-x notmuch" is sorted in chronological order (oldest
threads first). A new global search "M-x notmuch-search" will instead
be in reverse chronological order (newest threads first).
Any filtered searches retain the sort order of the search being
filtered.
There's not yet any interface for changing the sort order of a search
after it is constructed.
I wrote these originally jsut for debugging. They've never been hooked
up to any keybinding and the existing "M-x visible-mode" does what's
needed anyway.
This way we get to take advantage of the configuration of the user's
email addresses in notmuch, (rather than expecting the user to
configure all of their email addresses in message mode as well).
We were just starting to get "notmuch reply" into shape in order to
provide the needed functionality here, but then I realized that the
message-reply function built into emacs is already more functional,
(at least for the case of replying to a single message).
Previously, when selecting a thread to view from the search buffer, we
would advance the point by one line before showing the thread, (so
that it would be ready to show the next thread once the user was done
with the current thread). This was annoying when the user temporarily
exited the thread view, (because the "wrong" thread was then selected
in the search view).
We get a more consistent experience by waiting to advance until the
user has finished viewing one thread and is ready to view the next.
The recent change of the hidden thread-ID syntax caused this message
to instead be replaced with a cryptic "search failed" error and an
internal regular expression. Put our nice message back.
This is in place now citations and signatures. We'll still need to
add something else for hidden messages (those that are already
read and hidden away).
The more general command is more consistent, and more useful.
We also fix "notmuch search" to output copy-and-pasteable search terms
for the thread with "thread:" prepended already. Similarly, the
message-ID in the output of "notmuch show" is also now printed as a
valid search term, ("id:<message-id>" rather than "ID: <message-id>").
Naturally, the emacs code is also changed to track these changes.
The magic space bar is nice, but sometimes there's a message with a
long attachment that I just want to skip, but still consider the
message marked as read.
I had implemented this intentionally originally, thinking that it
would be important to see the last message scroll all the way off
screen before the next press of the magic space bar would go and
archive away the whole thread.
But in practice, that just turns out to be annoying, (especially for a
long sequence of single-message threads where the space bar has to be
pressed twice for every one). It's actually quite easy to know if it's
"safe" to press the space bar expecting just a scroll instead of an
archive by simply looking down and seeing if the current window is
full.
And as for the total lack of undo with all of this, I'm getting by by
simply using x to get back to the search view, and then going back
into the thread of interest.
More magic for the magic space bar: If a thread is entirely open,
(such as when viewing an old thread where every message is read), the
space bar now visits each message in turn (rather than skipping all of
the unread messages).
Otherwise known as "Backspace" on keyboards in the real, (rather than
emacs), world. This will go by screenfuls for long messages, and
message by message for short messages. So it does the reverse of the
magic space bar, (but without reversing any tag-changing magic that
the magic space bar might have done).
Chances are, a signature above a certain threshold isn't just a
signature, (for example, it could be an encrypted messages tacked onto
the end of the file, or could be any sort of PS.)
We add a new variable, notmuch-show-signature-lines-max that can be
used to configure the threshold, (set to 6 by default for now).
I noticed that these functions would sometimes leave point on an
invisible character[*]. The problem would be that point would appear
to be on a particular message, but adding or removing a tag would
actually add/remove a tag from the *previous* message.
Fix the C-n and C-p keybindings at least to call the underlying
command and then advance to a visible character. We set this-command
in our overrides so that the temporary-goal-column feature still
works.
[*] The documentation says that command loop is supposed to move point
outside of any invisible region when a command exits. But apparently
not.
Clearly some recent code was very fragile, which I noticed in that the
space bar would no longer scroll a long message if it was the only
message in a thread.
This resulted in a lot of churn, but hopefully things are more robust
now, (for example by using new predicates like
notmuch-show-last-message-p rather than doing heuristics based on
(eobp) or (window-end)).
As usual, the presence of invisible characters complicates the task of
making this stuff robust.
With the recent change of showing the first unread message, we would
scroll down to the end of the buffer if all messages were already
read. This would confusingly show nothing visible in the window.
Instead, detect this case and move to the beginning of the buffer.
The magic of the space bar is all about unread messages, so there's no
reason for it to advance to messages that have already been read.
Similarly, we now remove any magic from (n)ext so that it simply
advances to the next message without marking anything read, (which
makes it symmetrical with (p)revious).