Commit graph

882 commits

Author SHA1 Message Date
David Edmondson
55cef18f95 emacs: Allow control over faces for search mode columns.
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>
2010-06-03 16:55:27 -07:00
David Edmondson
965b3e6a8b emacs: Set the face' property rather than font-lock-face'.
Avoid using face properties reserved for the font-lock package.
2010-06-03 16:53:36 -07:00
David Edmondson
106f9862d1 emacs: Display non-matching authors with a different face.
In search mode some messages don't match the search criteria. Show
their authors names with a different face - generally darker than
those that do match.
2010-06-03 16:53:32 -07:00
Sebastian Spaeth
fc73737ff5 Easier way to define a fcc directory
In the common case that a user only has one FCC (save outgoing mail in
the Mail directory, it is now possible to simply configure a string
such as "Sent" in the notmuch-fcc-dirs variable. More complex options,
depending on a users email address, are possible and described in the
variable customization help text.

The whole function notmuch-fcc-header-setup has been cleaned up a
little while working on that.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2010-06-03 16:50:46 -07:00
David Edmondson
6039864ed5 emacs: Usability improvements for `notmuch-hello'.
- If no saved searches exist or are displayed, don't signal an error,
- If no saved searches exist or are displayed, leave the cursor in the
  search bar,
- Minor layout improvements.
2010-06-03 16:49:03 -07:00
Jesse Rosenthal
b749bd5390 Add notmuch-message.el to emacs/Makefile.local
When notmuch-message.el was added to the emacs directory, I neglected to
add it to the makefile as one of the emacs_sources. This patch adds it.
2010-04-27 10:19:09 -07:00
Jesse Rosenthal
80a9078716 emacs: Remove conditional from notmuch-fcc-initialization.
The fcc code would only initialize if notmuch-fcc-dirs was set. This was
a problem if you reset the variable, or added the variable later during
initialization. Now we always add the fcc hook, but it doesn't do
anything unless notmuch-fcc-dirs are set.
2010-04-27 09:42:40 -07:00
Jesse Rosenthal
a43ceef205 emacs: require notmuch-message.el from notmuch.el
Add a (require 'notmuch-message) to notmuch.el. This is for functions that
specifically target message mode (and, in the future, notmuch-message
mode).
2010-04-27 09:16:44 -07:00
Jesse Rosenthal
0adcabc7cf emacs: Add auto-tagging for replied messages.
Add `notmuch-message-mark-replied', a function for automatically tagging
replied messages with user-defined tags. The tags (which can be either
added or removed) can be customized with the customization variable
`notmuch-message-replied-tags'. This is a simple list of strings. Any
string prefaced with a "-" will be removed; any string prefaced with a "+"
(or neither "+" nor "-") will be added.

This adds a new file notmuch-message.el, for functions which target
message mode (and in the future, notmuch-message mode). Based on some
conversation, notmuch-message.el will probably end up subsuming
notmuch-mua.el, but until we figure out exactly how we want to do that,
they will remain separate files.

Edited-by: Carl Worth <cworth@cworth.org>: Remove trailing whitespace
and add newline at end of file.
2010-04-27 09:16:10 -07:00
Carl Worth
7d440c56c1 emacs: Add missing parenthesis that was breaking the build.
Someday I'll stop pushing patches without at least compile-testing them.
*sigh*
2010-04-27 08:42:11 -07:00
David Edmondson
43423e9c88 emacs/notmuch-wash.el: Add `notmuch-wash-convert-inline-patch-to-part'.
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'.
2010-04-27 08:22:40 -07:00
David Edmondson
08561d8ae1 emacs: Fix `notmuch-hello-insert-tags' to correctly draw the tags.
The fix in 1e18711543 broke end-of-row
wrapping when drawing the table of tags/saved searches. Fix that and
improve the readability of the matrix reflection code to hasten future
debugging.
2010-04-27 08:20:24 -07:00
David Edmondson
18d41192d2 emacs: If 'all tags' is not shown, don't use it when calculating widths.
If the 'all tags' section of the hello buffer will not be shown, don't
consider those tags when determining the number of saved searches that
can be displayed on a single line.
2010-04-27 08:19:39 -07:00
David Edmondson
1e18711543 emacs: Fix column alignment in `notmuch-hello-insert-tags'
Re-working the saved search/tag insertion to buttonize only the name
of the saved search/tag plus one space broke the calculation of how
much filler is required to complete the column, resulting in lines
wider than the window.
2010-04-27 01:56:13 -07:00
Carl Worth
3dac7305c2 emacs: Use message-signature-separator rather than hard-coded string.
It's possible that the user has instructed message-mode to use some
other separator. If so, then that's what we should look for when
looking for the signature.

Thanks to David Edmondson <dme@dme.org> for pointing this out.
2010-04-26 23:12:58 -07:00
Carl Worth
173a195da9 emacs: Delete some trailing whitespace.
That managed to sneak in with some recent improvements to the Fcc code.
2010-04-26 23:09:08 -07:00
Jesse Rosenthal
24a7a10af2 emacs: Ensure that message-directory for Fcc has a trailing slash
Use `file-name-as-directory' to ensure that message-directory has a
trailing slash so it can be combined with the notmuch-fcc-dirs
correctly.
2010-04-26 23:06:54 -07:00
Jesse Rosenthal
07c8eb1db6 emacs: add prompt to create maildir for fcc if it does not exist.
If the user specifies a maildir that does not exist, prompt the user to
see whether a maildir should be created. This will fail, with the
relevant explanation, if the location is not writable, or if a file
already exists in that location. If the location is a dir, but not a
maildir, this will add /tmp/cur/new to it.
2010-04-26 23:06:50 -07:00
Jesse Rosenthal
9b85872ed4 emacs: fcc should fail at the right time if it doesn't point to a maildir
Throw an error after the maildir is generated but before the message
is sent. This change allows the user to edit the maildir if it fails,
so that it will point to a correct place.

Note that this changes the previous behavior which always overwrote
the existing Fcc line. Now, an Fcc line is only auto-generated if
there isn't one already there.

The ideal change would be to prompt to create a maildir. This should
enable a place for doing that in a future patch.
2010-04-26 23:06:36 -07:00
Carl Worth
0d8e26d0e3 emacs: Tweak search-buffer naming to search list in reverse order
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.
2010-04-26 23:00:20 -07:00
Carl Worth
6731ab1037 emacs: Rename search buffers with "saved-search" not "folder"
Since we recently renamed everything from notmuch-folders to
notmuch-saved-searches, fix up the generated names in the search
buffers to match.
2010-04-26 22:58:46 -07:00
Carl Worth
f2ebe3ac44 emacs: Match entire saved-search when computing search-view buffer name
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.
2010-04-26 22:49:45 -07:00
Carl Worth
a466921760 emacs: Rip out all of the notmuch-folder code.
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.
2010-04-26 22:42:07 -07:00
Carl Worth
fa5279113b emacs: Fix notmuch-hello to use its own function for counting search results.
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.
2010-04-26 22:40:31 -07:00
Carl Worth
f1f7e71e03 emacs: Add a notmuch-saved-searches function.
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.
2010-04-26 22:37:11 -07:00
Carl Worth
4727eacb36 emacs: Move declare-function from notmuch-lib.el to notmuch-hello.el.
Apparently the declare-function macro doesn't work in a required file
as I might like it too. Put it where it needs to go to avoid the
warning.
2010-04-26 22:33:09 -07:00
Carl Worth
f8e372ebec notmuch-hello: Add a 'G' keybinding.
Just like the G keybinding we've had in notmuch-folder-mode and
notmuch-search-mode, (to call `notmuch-poll' to 'G'et new mail).
2010-04-26 22:05:47 -07:00
Carl Worth
2a6a0e2481 notmuch-hello: Make this work with a notmuch-folders variable set in ~/.emacs
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.
2010-04-26 21:55:51 -07:00
Carl Worth
51e5eaac17 emacs: Remove "hello" from all variables exported through customize.
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).
2010-04-26 21:45:19 -07:00
Carl Worth
404c6121e5 notmuch-hello: Fix a sign error when computing number of padding spaces.
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.
2010-04-26 20:51:31 -07:00
Carl Worth
ca5ae54cb1 notmuch-hello: Fix ability to isearch to a saved-search and press RET
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.
2010-04-26 20:15:45 -07:00
Carl Worth
7df0e611df emacs: notmuch-hello: Make viewing of all tags conditional.
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.
2010-04-26 20:08:30 -07:00
Carl Worth
7fa6306cae notmuch-hello: Preserve current position when invoking notmuch-hello
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).
2010-04-26 19:43:21 -07:00
Carl Worth
3ac2727dae emacs: notmuch-hello: Move to first saved search item.
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.
2010-04-26 18:54:08 -07:00
Carl Worth
f2f6da9af0 emacs: Fix 's' keybinding to go to search bar in notmuch-hello.
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.
2010-04-26 18:54:08 -07:00
Carl Worth
b5c71adc8f emacs: Move saved searches before search bar in notmuch-hello.
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.
2010-04-26 18:54:08 -07:00
Carl Worth
1c17dda5d5 emacs: Remove the notmuch-hellow-jump-to-search variable.
Instead, make notmuch-hello unconditionally jump to the first widget
in the buffer. By default this will be the search bar anyway.
2010-04-26 18:40:55 -07:00
Carl Worth
652e92c6cc emacs: Take advantage of position-remembering when returning to notmuch-hello
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.
2010-04-26 18:00:37 -07:00
Carl Worth
ddce8438a0 emacs: Make update of notmuch-hello leave point on the same widget.
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.
2010-04-26 17:59:01 -07:00
Carl Worth
c9ba61bebe emacs: notmuch-hello: Don't include extra spaces in widget values.
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.
2010-04-26 17:55:55 -07:00
Carl Worth
8a6a00bf4c emacs: Disable automatic jump to search bar for notmuch-hello.
We're about to get support for maintaining point on the current
saved-search, so we don't want this jump-to-search defeating that.
2010-04-26 17:51:27 -07:00
Dirk Hohndel
56cbff2988 Put signatures at the very end of the message
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>
2010-04-26 16:37:47 -07:00
Carl Worth
2b49f4631c emacs: Fix to generate error if fcc directory is not a maildir
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.
2010-04-26 14:56:46 -07:00
Sebastian Spaeth
4b34effca5 Integrate notmuch-fcc mechansim
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>
2010-04-26 12:00:13 -07:00
Sebastian Spaeth
c000c4b394 notmuch-maildir-fcc: elisp syntax fixes
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>
2010-04-26 11:58:43 -07:00
Sebastian Spaeth
36245db69d Integrate notmuch-maildir-fcc into notmuch
Require notmuch-maildir-fcc and also install it.
Rename all jkr/* functions to notmuch-maildir-fcc-*

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2010-04-26 11:58:34 -07:00
Jesse Rosenthal
1775893720 Add elisp file for FCC to maildir solution
File grabbed from http://jkr.acm.jhu.edu/jkr-maildir.el
but not integrated yet.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2010-04-26 11:54:15 -07:00
David Edmondson
b66ff567f6 emacs: Tell the user how many addresses matched when completing
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.
2010-04-26 10:58:42 -07:00
David Edmondson
975307c945 emacs: Remove duplicate declaration of `notmuch-folders'
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.
2010-04-26 10:45:05 -07:00
David Edmondson
98cf886120 emacs: notmuch' should display the notmuch-hello' interface
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.
2010-04-26 10:37:35 -07:00
David Edmondson
159b05fcaa emacs: Fix `notmuch-show-rewind' in the presence of invisible text
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.
2010-04-26 10:33:38 -07:00
David Edmondson
e247ae47c1 emacs: More DWIM when editing messages
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.
2010-04-26 10:24:36 -07:00
David Edmondson
01ec4d3bcb emacs: Add more functions to clean up text/plain parts
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.
2010-04-26 10:05:46 -07:00
Carl Worth
6408270512 Revert "emacs: Add more functions to clean up text/plain parts"
This reverts commit 97570954cb.
2010-04-26 10:05:29 -07:00
David Edmondson
6afa0b16a3 emacs: Fix `notmuch-search-insert-field'
Compare the formatted version of the authors with the formatted sample
string rather than the un-formatted authors with the formatted sample
string.
2010-04-26 08:23:48 -07:00
David Edmondson
e2516a343b emacs: Hide the "User-Agent:" when composing messages
Add a list of headers to those hidden by `message-mode' when
composing. By default the list includes only "User-Agent:".
2010-04-26 08:23:05 -07:00
David Edmondson
87d9df50e5 emacs: Automatically load "notmuch-address"
"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.
2010-04-26 08:10:47 -07:00
David Edmondson
75b9b028ea emacs: Correct message/header/citation/signature hiding
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'.
2010-04-26 08:07:17 -07:00
David Edmondson
a9bf967e71 emacs: Add a search to the 'recent searches' list once only
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'.
2010-04-26 07:31:26 -07:00
David Edmondson
d6dea89588 emacs: Remove the accelerator keys from the hello buffer
Carl though that the recent search accelerator keys are not useful, so
remove them.
2010-04-26 07:31:15 -07:00
David Edmondson
7b31a11f20 emacs: Adapt the logo background colour to that of the frame
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.
2010-04-26 07:30:33 -07:00
David Edmondson
38c35f8123 emacs: Sort headers when composing
Always sort the headers in the message composition window.
2010-04-26 07:15:50 -07:00
David Edmondson
47f5871aff emacs: Suppress window creation when replying
The buffer used to edit a reply should overlay the original
message. Encourage this by setting `same-window-regexps' locally.
2010-04-26 07:15:42 -07:00
David Edmondson
97570954cb emacs: Add more functions to clean up text/plain parts
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.
2010-04-24 07:52:37 -07:00
David Edmondson
7c5f017a30 emacs: Fix i-search to open up invisible citations as necessary
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.
2010-04-24 07:38:28 -07:00
Carl Worth
c87d17f28e emacs: Make notmuch-hello jumpt to search bar by default.
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.
2010-04-24 06:15:09 -07:00
Carl Worth
a88d1d277b emacs: Rename notmuch-show-headers to notmuch-message-headers
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.
2010-04-24 06:11:57 -07:00
Carl Worth
54ec603bb4 emacs: Don't display From header by default.
This header is redundant with the summary-line of each message which
contains the same information.
2010-04-24 06:06:12 -07:00
Carl Worth
4d2acc3eca emacs: Allow user to customize which headers are visible.
Continuing our tradition of making more and more of the notmuch
functionality configurable fromt eh customize interface.
2010-04-24 06:04:59 -07:00
Carl Worth
ed93a5a19f emacs: Change message headers (To, CC, From, and Date) to be visible by default
Users can still toggle these to be hidden by default, and can still
toggle visibility of headers for a single message with the 'h'
command.
2010-04-24 05:48:04 -07:00
David Edmondson
63b8a2b9af emacs: Allow headers to be shown by default in show mode
Add `notmuch-show-headers-visible' which, when set `t', causes headers
to be shown by default.
2010-04-24 05:47:06 -07:00
David Edmondson
bae184f5fc emacs: Add notmuch-address.el for address completion using notmuch
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.
2010-04-23 17:31:46 -07:00
Carl Worth
1291d1dcb1 emacs: Rename notmuch-show-toggle-all to notmuch-show-open-or-close-all
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.)
2010-04-23 17:27:14 -07:00
David Edmondson
e6bc99f31f emacs/notmuch-show.el: Add `notmuch-show-toggle-all' bound to M-RET
`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.
2010-04-23 17:24:01 -07:00
Carl Worth
b57d9635f5 emacs: Use single-quote not double-quote when constructing search
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.
2010-04-23 16:39:18 -07:00
David Edmondson
45ad21fba1 emacs: Re-arrange message sending code
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.
2010-04-23 15:41:33 -07:00
David Edmondson
7135a8bcbf emacs: Push the cursor to point-max on n' or N' at the end of a thread
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.
2010-04-23 13:26:32 -07:00
David Edmondson
57926bc7b0 emacs: Re-arrange message sending code
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.
2010-04-23 13:18:13 -07:00
Carl Worth
4b0994dd25 emacs: Fix some compilation warnings.
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.
2010-04-23 12:57:22 -07:00
David Edmondson
e9394932f7 emacs: Add notmuch-hello.el, a friendly frontend to notmuch
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).
2010-04-23 12:50:18 -07:00
David Edmondson
b65bcb5f8f emacs: Remove notmuch-search-authors-width' and fix the use of notmuch-search-result-format' accordingly
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>
2010-04-23 12:14:17 -07:00
Jesse Rosenthal
44982ab332 Reintroduce patch to quote args in notmuch-show to facilitate remote use
This reintroduces the patch committed in 9193455fa1, which was
reverted during the upgrade to the JSON emacs UI.
2010-04-23 11:59:47 -07:00
Carl Worth
0b2cf3527e emacs: Add customize treatment and rename refresh-script to notmuch-poll-script
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).
2010-04-22 14:46:15 -07:00
Carl Worth
577a6906ce emacs: Use consistent naming for the two new poll functions.
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.
2010-04-22 14:24:37 -07:00
Dirk Hohndel
f373ed0792 Add 'G' keybinding to folder and search view that triggers external poll
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>
2010-04-22 14:22:09 -07:00
Carl Worth
38c595738f emacs: Move definition of notmuch-folders to earlier in the file.
To avoid a warning about a free variable from the emacs compiler.
2010-04-21 17:04:36 -07:00
Servilio Afre Puentes
3bf27d6c58 emacs: Try to name search buffers using info in notmuch-folders
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.
2010-04-21 16:58:46 -07:00
Carl Worth
8981842ff6 emacs: Fix notmuch-search-authors-width declaration.
Our defcustom call was missing the 'notmuch group, which emacs was
nice enough to warn about during compilation.
2010-04-21 14:17:14 -07:00
David Edmondson
8cee113819 emacs: Support for customizing search result display
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>
2010-04-21 13:37:14 -07:00
Carl Worth
6157fe0bfd emacs/notmuch-show.el: Part headers are real buttons that save the part
Convert the part headers into buttons that save the part when
activated.
2010-04-21 13:19:19 -07:00
David Edmondson
c579c8201f emacs: Display all body parts using `notmuch part --part=<n>'
Use the `notmuch part' command to access body parts not currently
included in the JSON output and display those body parts
appropriately.
2010-04-21 13:14:46 -07:00
David Edmondson
6c0621962a emacs: Use mailcap.el to guess the type of application/octet-stream parts
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.
2010-04-21 13:14:39 -07:00
David Edmondson
4488cf30f6 emacs: Use `mm-display-part' when possible
For parts that the mm-decode/mm-view functions can inline and we have
the content, use `mm-display-part' to insert the part in the
buffer.
2010-04-21 13:10:51 -07:00
David Edmondson
b93c5749fd emacs/notmuch-show.el: Improved part labelling
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.
2010-04-21 13:05:39 -07:00
David Edmondson
3b3da097d8 emacs: Move body markup to a separate file
Move the citation and signature markup for text/plain parts to a new
file (notmuch-wash.el) and call it using a hook mechanism rather than
directly.
2010-04-21 12:55:46 -07:00
Carl Worth
aab9fa307b emacs: Rename body-invis-spec to message-invis-spec
This is more consistent with the related names (toggle-message,
:message-visible, etc.)
2010-04-21 12:52:38 -07:00
Carl Worth
b825204f0d emacs: Remove the notmuch-show-toggle-body command (with "b" binding)
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).
2010-04-21 12:52:38 -07:00
David Edmondson
e26d767897 emacs: JSON based implementation
Re-implement notmuch-show.el using the JSON output format of the
notmuch command. Most functionality is retained - HTML display is
noticeably missing.
2010-04-21 12:12:02 -07:00
David Edmondson
cdd64727f1 emacs/notmuch.el: Enable hl-line-mode' in notmuch-search-mode' 2010-04-19 11:20:02 -07:00
David Edmondson
f920ff59b9 emacs/notmuch-show.el: Avoid passing unintended format strings to `message'
If the text being stashed included %, `message' was unhappy and
complained.
2010-04-19 10:15:09 -07:00
Carl Worth
9792d3553e Revert "notmuch.el: 'F' in search mode takes us to a list of folders."
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).
2010-04-16 07:53:10 -07:00
Carl Worth
b4459b8a4d emacs: Fix search filtering of a global search ("*")
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.
2010-04-15 21:25:45 -07:00
Jesse Rosenthal
db96d67ba2 Clean up code duplication in adding or removing tag by region.
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).
2010-04-14 10:10:55 -07:00
Jesse Rosenthal
2fbb6d05a9 Fix bug in adding or removing tag by region.
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.
2010-04-14 10:09:53 -07:00
Jesse Rosenthal
9193455fa1 notmuch.el: quote args in notmuch-show to facilitate remote use
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 $@
2010-04-13 09:14:03 -07:00
Carl Worth
fec5622add emacs: Correct the documentation for notmuch-search-add-tag (and -remove-tag)
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).
2010-04-07 13:15:27 -07:00
Jesse Rosenthal
4c9585933e notmuch.el: add functionality in notmuch search mode to add or remove tags by region
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.
2010-04-07 13:10:36 -07:00
Carl Worth
d5f5b38339 Display the last few lines of a citation by default.
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.
2010-04-07 12:15:08 -07:00
David Edmondson
c44ce805de notmuch.el: Allow citation suffixes to be shown as well as prefixes.
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>
2010-04-07 12:10:36 -07:00
David Edmondson
e95dac86f5 notmuch.el: Colour cited regions and signatures with message-cited-text-face
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de> (with fixup to
               avoid over-eager coloring of signatures).
2010-04-07 12:02:35 -07:00
Jameson Rollins
84767fd582 notmuch.el: colorize lines in notmuch-search based on thread tags.
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(-)
2010-04-07 11:09:20 -07:00
Carl Worth
8364c2f36e emacs: Fix typo in line-wrapping in documentation of notmuch-show.
Just trying to keep things neat.
2010-04-07 10:40:29 -07:00
Jesse Rosenthal
9bee20aed3 notmuch.el: Make notmuch-show buffer name first subject, instead of thread-id (supersedes V1--3)
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>
2010-04-07 10:40:06 -07:00
David Edmondson
fbec989fe3 notmuch.el: 'F' in search mode takes us to a list of folders. 2010-04-07 10:25:35 -07:00
Jameson Rollins
aa531a92ae notmuch.el: fontify date in header
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>
2010-04-07 10:22:13 -07:00
Carl Worth
dfbec15b23 Install emacs lisp files into a notmuch sub-directory of site-lisp.
Now that we have multiple emacs-lisp source files, it's just more
polite this way.
2010-04-06 18:30:43 -07:00
Carl Worth
a5ed8c68f6 Makefile: Eliminate the "make install-emacs" target.
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).
2010-04-06 14:36:31 -07:00
Carl Worth
f89b3d16db Makefiles: Eliminate the useless quiet_* functions.
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.
2010-04-06 14:36:31 -07:00
Carl Worth
4235ef5109 Makfiles: Make the top-level targets PHONY
Just to avoid any clash with files of the same names.
2010-04-05 12:59:06 -07:00
David Bremner
c2f3710a78 notmuch-query.el: new file to support access to the notmuch database.
Initially this file provides one main function
notmuch-query-get-threads, which takes a set of search terms, and
returns a parsed set of matching threads as a lisp data structure.

A set of notmuch-query-map-* functions are provided to help map
functions over the data structure.

The function notmuch-query-get-message-ids uses this machinery to get
the set of message-ids matching a query.

Edited-by: Carl Worth <cworth@cworth.org>: Change comment syntax,
(";;" rather than ";" to make emacs-lisp mode happy), and eliminate
some excess whitespace, as suggested by David Edmonson.
2010-04-05 11:08:45 -07:00
David Edmondson
e8414a72d4 emacs: Move notmuch-show functionality to notmuch-show.el
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.
2010-04-05 09:25:56 -07:00
Carl Worth
03588ee710 emacs: Fix "free variable" warning for notmuch-folder-show-empty.
Emacs really wants us to defvar each variable before assigning to it,
(which gives us a place to document the variable as well).
2010-04-03 12:31:49 -07:00
David Edmondson
e33b73819a emacs/notmuch.el: Improve tag highlighting in search mode
Assume that tags never include an opening bracket, and hence improve
the regular expression used to highlight them. This avoids false
matches where the 'from' address of a thread participant includes an
opening bracket.
2010-04-03 12:31:49 -07:00
David Edmondson
d3884a5984 Makefile.local: Automatically use makefile mode
We add a magic line to the beginning of each Makefile.local file to
help the editor know that it should use makefile mode for editing the
file, (even though the filename isn't exactly "Makefile").

Edited-by: Carl Worth <cworth@cworth.org>: Expand treatment from
emacs/Makefile.local to each instance of Makefile.local.
2010-04-03 12:31:49 -07:00
Carl Worth
33d5cc415e Makefiles: Make the install rules quiet like the compilation rules.
The output from make is looking better all the time, (though the
columns still aren't lined up).
2010-03-31 23:54:21 -07:00
Carl Worth
8c671a17c0 Makefiles: Eliminate shell for loops in rule definitions.
These just made the output look so ugly, and weren't actually making
the rule definitions any simpler. Good riddance.
2010-03-31 22:59:30 -07:00
Carl Worth
b957a1b029 emacs: Fix the notmuch-search-authors-width variable.
This variable existed previously, but wasn't actually used for anything.
2010-03-31 13:32:00 -07:00
Carl Worth
bb61755afe emacs: Fix search refresh when on the last line of a search buffer.
We currently allow the cursor to be positioned on the "End of search
results" line after the last thread in a search buffer. When
refreshing on this line, there's no thread ID to be used as the
target.

Previously, a refresh from this case would result in a nil thread
target, but we were also using nil to indicate that the target thread
had been found. This caused the position to be lost during refresh,
(the cursor would move from the last line in the buffer to the first).

We fix this by using a magic string of "found" rather than nil to
clearly indicate whether the target thread has actually been found.
2010-03-10 11:07:58 -08:00
Carl Worth
70ef8de798 emacs: Adjust search refresh to use a target line not a target position.
It doesn't make sense to move the cursor to some random point in the
middle of a line. We always want the refresh to leave the cursor at
the beginning of some line instead.
2010-03-10 11:07:51 -08:00
Carl Worth
86232e62ab Makefile: Fix Makefiles to depend on all child Makefile fragments.
We were previously maintaining two lists of the child Makefile
fragments---one for the includes and another for the dependencies. So,
of course, they drifted and the dependency list wasn't up to date.

We fix this by adding a single subdirs variable, and then using GNU
Makefile substitution to generate both the include and the dependency
lists.

Some side effect of this change caused the '=' assignment of the dir
variable to not work anymore. I'm not sure why that is, but using ':='
makes sense here and fixes the problem.
2010-03-10 10:59:57 -08:00
Carl Worth
ce6cfd6408 Makefile: Add a message after "make install-emacs"
More help to guide the new user here. Tell the user how to actually
invoke the emacs client now that it's installed.
2010-03-10 10:50:20 -08:00
David Bremner
bbda0a0156 emacs: Move emacs UI (currently just one file) to subdirectory.
Add emacs/Makefile.local and emacs/Makefile. Move emacs targets into
emacs/Makefile.local, but leave the byte compilation rule in the top
level Makefile.
2010-03-09 12:13:33 -08:00