The complete-string matching of commit
f2ebe3ac44
defeats the substitution of partial search
strings when the user manually types a
long search string that just happens to
partially match a saved search.
For example, typing "tag:inbox and not tag:foo"
should result in "[inbox] and not tag:foo" but
this has been broken since that commit.
As a compromise between this feature and what the
commit was trying to achieve, we now reverse the
saved-searches list before looking for a match.
This happens to work for me, but won't necessarily
work in general.
What we really want is the longest match, but rassoc-if
just gives us the first match. All of this is just about
creating slightly nice search-buffer names. So if anyone
really cares about making the names *even* nicer, then
they could improve this further.
I happen to have a lot of saved searches that are variants of the
tag:inbox search, (such as "tag:inbox and tag:notmuch"). The logic for
these was always matching inbox first, resulting in "[ inbox ] and
tag:notmuch" rather than "notmuch" as desired.
Anchor the regular expression on both ends to make it look harder for
the better match.
We are asserting that the new notmuch-hello implementation, (available
by just calling `notmuch') is just as easy to use as the old
notmuch-folder. So let's remove what's now a largely redundant
implementation.
To make this transition easier, we are still supporting the
notmuch-folders variable name, and we still provide `notmuch-folder'
as an alias which can be invoked to get the new notmuch-hello
functionality.
Previously, this was calling into a notmuch-folder-count
function. Only, everything related to notmuch-folder is about to go
away, so lets have notmuch-hello define its own function
(notmuch-saved-search-count) for this purpose.
We use this function to abstract away the common 3-step process for
looking for a value for the saved-searches variable:
1. Look at the notmuch-saved-searches variable itself
2. Look at the notmuch-folders vaiable
3. Use a default value
We were already using this logic (open-coded) in notmuch-hello, but
notmuch.el was accessing notmuch-folders directly for the clever name
selection of search buffers.
I'm planning to rip out the notmuch-folder-mode completely. So as a
token kindness to existing users of notmuch-folders, I'm at least
making notmuch-hello support the notmuch-folders variable name as an
alternate for the new name of notmuch-saved-searches.
We've recently changed things so that the notmuch-hello screen is the
default view one gets by executing `notmuch'. So hide the "hello" name
from everything exposed in the customize interface, (leaving "hello"
as just an internal name within the implementation).
After the previous commit, toggling the visibility of tags could
result in notmuch-hello aborting with:
Wrong type argument: wholenump, -1
At least, the error only occurred for me when making tags visible. But
that may be because my longest tag name is longer than my longest
saved-search name.
After isearching for an entire saved-search name, the point will be
immediately after that name in the buffer. Before commit
c9ba61bebe the space right after the
name was part of the widget so the user could press RET right after
the isearch to activate the saved search.
The above commit broke that functionality. Restore it by including a
single space after each name as part of the widget.
And off by default. There's a notmuch-hello-show-tags option in
customize to toggle the default setting, as well as buttons to
persistently toggle the visibility for the current session.
I have enough tags in my database that it's quite a bit faster for
notmuch-hello to come up without showing the tags.
Previously, we preserved the current position only when returning to
the notmuch-hello buffer or when refreshing it. Fix to also preserve
the position when directly invoking notmuch-hello, (such as from a
global keybinding).
This give us a useful active widget by default, ("inbox"), and
otherwise gives the first saved search in the user's customized
list. Not having point on the search bar means that the various
keybindings are all available.
This command was previously written under the fragile assumption that
the search bar was always the third widget. That's no longer true with
the saved searches now appearing before the search bar, so we save the
position of the search bar and go directly to it now.
Once users start using saved searches regularly, it's expected that
these will become the primary access points to mail. So give them a
priority position in the buffer.
When we go into a search, and then later quit and return to the
notmuch-hello buffer, we want the point to remain in the same position
it was in when we left. So we have to call the position-remembering
notmuch-hello-update rather than notmuch-hello from the continuation.
Before refreshing, we check which widget we are currently on, (or look
for the next widget), and then we watch for that same widget to go by
when constructing the buffer contents. Finally, we jump to the
position we saw when the widget went by.
Previously, trailing spaces after each saved-search name were included
as part of the widget. This is going to be problematic for a future
change that will extract the widget's value and compare it to the
configured names of saved searches.
Instead, just include the name itself in the widget, and then insert
the spaces for separation afterwards.
The existing code inserts the signature before inserting the message
body (which it puts at the very end of the buffer - therefore AFTER
the signature). This little snippet makes us search backwards and
insert the message body before a signature, if it exists.
This also fixes a small indentation issue in David's code.
Signed-off-by: Dirk Hohndel <hohndel@infradead.org>
Previously this was just a message that was almost impossible for the
user to see. Now, the user gets to see the error message, and is
presented with a buffer that actually contains the Fcc header of
interest.
I have gone wild and added a defcustom "notmuch-fcc-dirs".
Depending on the value of that variable we will not do any
maildir fcc at all (nil, the default), or it is of the format
(("defaultsentbox")
("full name <email@address>" . "Work/sentbox")
("full name2 <email2@address2>" . "Work2/sentbox"))
The outbox name will be concatenated with the message mode
variable "message-directory" which is "~/Mail/" by default.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
1)use insert-buffer-substring
Rather than the insert-buffer. Emacs complains that it is for interactive use
and not for use within elisp. So use insert-buffer-substring which does the
same thing when not handed any 'begin' 'end' parameters.
2)replace caddr with (car (cdr (cdr)))
The former requires 'cl to be loaded and during make install emacs complained
about not knowing it.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Require notmuch-maildir-fcc and also install it.
Rename all jkr/* functions to notmuch-maildir-fcc-*
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
When completing an address, tell the user how many addresses in the
database matched the query.
Edited-by: Carl Worth <cworth@cworth.org>: Removed a stray numeric
literal that was causing a compiler warning.
Reviewed-by: Carl Worth <cworth@cworth.org>
This variable was moved from notmuch.el to notmuch-lib.el some time
ago, but the declaration in notmuch.el was left around. Clean that up.
Reviewed-by: Carl Worth <cworth@cworth.org>
The notmuch-hello functionality is now sufficiently useful that we
want to make it the default view of notmuch for new users. This also
effectively hides the "hello" name from the user, so we'll be free to
change that in the implementation if necessary.
This change also shuffles the requires between notmuch.el and
notmuch-hello.el. This fixes things so that our documented (require
'notmuch) is sufficient for getting the notmuch-hello functionality.
Finally, the shuffling caused the notmuch-search-oldest-first variable
from one file to the other. While doing that, give this variable the
defcustom treatment for easier customization.
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.
For composing new messages and forwarding, leave the cursor on the
'To:' field. For replies, leave the cursor at the start of the
body. In all cases, mark the buffer as not modified so that the user
is not prompted if she decides to immediately kill the buffer.
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.
"notmuch-address.el" tries to be careful to insinuate itself into
message mode only if it will do something useful, so it's safe to load
it all of the time.
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'.
Avoiding adding the same search string to the 'recent searches' list
more than once by testing whether the string was already used with
`member' rather than `memq'.
The notmuch logo uses transparency. That can display poorly when
inserting the image into an emacs buffer (black logo on a black
background), so force the background colour of the image. We use a
face (`notmuch-hello-logo-background') to represent the colour so that
`defface' can be used to declare the different possible colours, which
depend on whether the frame has a light or dark background.
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.
Add an `isearch-open-invisible' property to the overlays used to hide
citations and signatures, together with an appropriate function to
leave the invisible text visible should that be required.
This isn't ideal for me personally, since I usually want to inovke a
saved search rather than entering a new search textually. But it's at
least better than just putting point in the upper-left corner where it
doesn't do anything.
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.
A tool `notmuch-addresses' is required to produce addresses which
match a query string. An example of a suitable script can be found in
the git repository at
http://jkr.acm.jhu.edu/git/notmuch_addresses.git
There are no doubt others.
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.
Define a new `mail-user-agent' (`notmuch-user-agent') and use it by
default. Re-arrange various routines that send mail to use this
(compose, reply, forward). Insert a `User-Agent:' header by default.
This is the real commit for this functionality this time. The
previous attempt to merge this code:
commit 57926bc7b0
was botched (by Carl Worth, not David) to include only the Makefile
change. So the build was broken until this commit that actually adds
the new file.
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.
Define a new `mail-user-agent' (`notmuch-user-agent') and use it by
default. Re-arrange various routines that send mail to use this
(compose, reply, forward). Insert a `User-Agent:' header by default.
Fix missing argumen in declaration of notmuch-search function and add
a definition of notmuch-search-continuation to avoid warning about
assignment to a free variable.
This is based on the prototype that Carl Worth described in the TODO
file. It provides a search bar as well as support for recent searches,
saved searches, and a list of all tags in the database (as well as the
number of messages with each tag).
The width of the authors field in search output was previously
specified in two places:
- `notmuch-search-authors-width': the limit beyond which the authors
names are truncated,
- `notmuch-search-result-format': the layout of the search results.
Changing the configuration of one of these may have required the user
to know about and adapt the other accordingly. This led to confusion.
Instead, remove `notmuch-search-authors-width' and perform truncation
based on the relevant field in `notmuch-search-result-format'.
Approved-By: Jameson Rollins <jrollins@finestructure.net>
With defcustom the user can easily find this variable (and its
documentation) within "M-x customize-group" "notmuch" (though finding
*that* is still tricky).
The new name of notmuch-poll-script is also easier to remember, (for
me at least).
Emacs scoping rules strongly encourage us to have fully-namespaced
function names. A prefix like "notmuch-search" is a pretty ugly
namespace name, but it's what we have for now.
The new functions first check if an external poll script has been defined in
the variable 'notmuch-external-refresh-script and if yes, runs that script
before executing the existing refresh function (which is bound to '=')
This can be used to have 'G' mimic the mutt behavior of polling an external
mail server - or if the mail polling is already automatic, it can trigger
the call to notmuch new and any necessary automatic tagging of new email.
Signed-off-by: Dirk Hohndel <hohndel@infradead.org>
As the user has already defined aliases for certain searches in
notmuch-folders, search buffer names that use these aliases will
be easier to identify.
This patch helps in customizing search result display similar to
mutt's index_format. The customization is done by defining an alist as
below:
(setq notmuch-search-result-format '(("date" . "%s ")
("authors" . "%-40s ")
("subject" . "%s ")))
The supported keywords are date, count, authors, subject and tags.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Signed-off-by: David Edmondson <dme@dme.org>
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).
This reverts commit fbec989fe3.
I only pushed this accidentally. See message
id:871ver6u9r.fsf@yoom.home.cworth.org for the various reasons I
didn't like this patch, (mostly I think the association of 'F' is
wrong).
With the recent addition of "*" being a special case for a search
matching all messages, we have to take care when doing a filter
operation. In this case it's not legal to simply append and get:
* and <some-new-search-terms>
Instead we carefully construct a new search string of only:
<some-new-search-terms>
This could all be avoided if we had a parser that could understand
"*" with the meaning we want.
Clean up code duplication, as per Carl's suggestion, by making
notmuch-search-{add/remove}-tag-thread a special case of the -region
commands, where the region in question is between (point) and (point).
There was a bug in notmuch-search-{add,remove}-tag-region, which would
not behave correctly if the region went beyond the last message. Now,
instead of simply iterating to the last line of the region, these
functions will iterate to the minimum of the last line of the region
and the last possible line, i.e.
(- (line-number-at-pos (point-max)) 2)
Tested-by: Carl Worth <cworth@cworth.org> Note that the old, buggy
behavior included infinite loops of emacs lisp code, so the new
behavior is significantly better than that.
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 $@
These commands act on all messages in the thread, not simply those
that match the search. (There are use case for both behaviors, but the
documentation must match the behavior that's actually implemented).
This patch adds `-region' versions of the `notmuch-search-' commands to find
properties. It also splits up `notmuch-add/remove-tags' into both a
`-thread' and a `-region' version. (This makes us modify
`notmuch-search-archive-thread' to use the
`notmuch-search-remove-tag-thread' function, instead of
`notmuch-search-remove-tag', for consistency.) The add/remove-tag command
called by pressing `+' or `-' will then choose accordingly, based on whether
region is active.
This version fixes a couple of errors in the first version, which led to
incorrect marking of some tags in the search view (though the actual
tagging was still correct). It's also based on current master.
I'm not sure any more if region selection is actually the correct way to
do this, or if a mutt-style message-marking method would be better. But
I didn't want a buggy incorrect version out there.
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>
Arbitrary font faces can be specified for given thread tags. By
default, no coloring is applied. To specify coloring, place something
like this in your .emacs:
(setq notmuch-search-line-faces '(("delete" . '(:foreground "red"))
("unread" . '(:foreground "green"))))
Order matters: line faces listed first will take precedence (in the
example above, a thread tagged both "delete" and "unread" will be
colored red, since the "delete" face is listed before the "unread").
notmuch.el | 33 ++++++++++++++++++++++++++++++++-
1 files changed, 32 insertions(+), 1 deletions(-)
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>
The date was unfairly left out of getting pretty colors in the
notmuch-show header display. This fixes that grave injustice.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Instead, simply byte-compile the emacs source files as part of "make"
and install them as part of "make install". The byte compilation is
made conditional on the configure script finding the emacs binary.
That way, "make; make install" will still work for someone that doesn't
have emacs installed, (which was the only reason we had made a separate
"make install-emacs" target in the first place).
With the original quiet function, there's an actual purpose (hiding
excessively long compiler command lines so that warnings and errors
from the compiler can be seen).
But with things like quiet_symlink there's nothing quieter. In fact
"SYMLINK" is longer than "ln -sf". So all this is doing is hiding the
actual command from the user for no real benefit.
The only actual reason we implemented the quiet_* functions was to be
able to neatly right-align the command name and left-align the arguments.
Let's give up on that, and just left-align everything, simplifying the
Makefiles considerably. Now, the only instances of a captialized command
name in the output is if there's some actually shortening of the command
itself.