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).
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).
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.
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).
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.
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.
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".
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.
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 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.
Yet another case of "how could this have possibly worked before?!".
I guess we were just getting very lucky with the emacs lisp calling
conventions and what happens with extra arguments, but, ick! Much
better now.
As the emacs compiler warns, the goto-line function is only intended for
interactive use. Instead use the approach recommended in the goto-line
documentation to avoid this.
This is one of those cases where the warning looks absolutely correct,
(complaining about a free variable), but I'm left wondering how the
original code could have worked at all.
From what I can tell, this code wasn't actually being called by any
of the current code in notmuch.
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.
Call notmuch-fcc-header-setup from message-header-setup-hook rather
than message-send-hook. This allows you to see what's going to
happen, and to make manual adjustments if desired. Gnus does
something similar.
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Now that the FCC code is fixed to use the notmuch database path, we can
actually enable this by default, which should be highly useful for all
new users of notmuch.
Otherwise, FCC is too hard to use, (user must set it and also set message-
directory variable to match notmuch mail datbase path). As a rule, I'd like
for users of notmuch to not be required to muck around with non-notmuch
mail settings in emacs.
The above is only really possible now thanks to the recent addition of the
"notmuch config get" command which allows emacs to query the currently
configured notmuch database path.
This also now allows an absolute-path FCC to be set if desired.
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.
That is, a subject with a bracketed set of digits (and optionally a
slash), for example "[2010]" would cause the emacs code to misparse
the search results. Fix this by tweaking the regular expression.
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.
Rather than discarding authors when truncated to fit the defined
column width, mark the text beyond the end of the column as invisible
and allow `isearch' to be used over the text so hidden.
This allows us to retain the compact display whilst enabling a user to
find the elided text.
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>
Insert a separator every three digits when outputting numbers. Allow
the user to choose the separator by customizing
`notmuch-decimal-separator'. Widen the space allocated for message
counts accordingly.
This lets us pick up later changes to widget-keymap if the user
customizes it in some way. This is the recommended way to use
`widget-keymap', according to its help.
This enables the nifty '?' key binding to work in notmuch-hello
(although for some strange reasons I don't see any descriptions for
specific key bindings yet. Not sure how that is supposed to work
though.
But this starts, runs and behaves identical to the existing code.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
In notmuch-mua-reply we were filtering out the Subject and To headers
manually in a loop, but message mode offers a nice function for
exactly that. Simplify the code by using it. Also, as notmuch-mua-mail
already sorts and hides headers that we want sorted and hidden, we can
safely remove those 2 functions from here as well. Also remove the
(require 'cl), the only reason for its existence was the now removed
"loop" function.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Add `notmuch-column-control', which has three potential sets of
values:
- t: automatically calculate the number of columns per line based on
the tags to be shown and the window width,
- an integer: a lower bound on the number of characters that will be
used to display each column,
- a float: a fraction of the window width that is the lower bound on
the number of characters that should be used for each column.
So:
- if you would like two columns of tags, set this to 0.5.
- if you would like a single column of tags, set this to 1.0.
- if you would like tags to be 30 characters wide, set this to
30.
- if you don't want to worry about all of this nonsense, leave
this set to `t'.
Add face declarations for the date, count, matching author and subject
columns in search mode and apply those faces when building the search
mode display.
Approved-by: Jameson Rollins <jrollins@finestructure.net>