Commit graph

175 commits

Author SHA1 Message Date
David Edmondson
c471c4eb04 emacs: Use the header line to show the subject of the thread. 2010-11-11 17:06:04 -08:00
David Edmondson
e845f4e27e emacs: Simplify subjects more aggressively.
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.
2010-11-11 17:04:35 -08:00
David Edmondson
e6d31a5435 emacs: Elide the display of repeated subjects in thread display mode.
Collapsed messages do not show a "Subject:" line if the subject is the
same as that of the previous message.
2010-11-11 17:03:45 -08:00
David Edmondson
1b2ea703e7 emacs: Correctly count the number of lines in a signature. 2010-11-11 16:50:22 -08:00
Jameson Rollins
7171e77d4d Don't use kill-this-buffer to kill notmuch emacs buffers
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)).
2010-11-08 09:02:54 -08:00
Michal Sojka
c7189ed607 emacs: Fix notmuch-show-pipe-message to use notmuch-command variable
Previously notmuch command name was hardcoded into this function,
which made remote use of pipe command impossible.
2010-11-06 17:17:40 -07:00
Carl Worth
81d3bd3670 Rename "notmuch cat" to "notmuch show --format=raw"
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).
2010-11-06 12:03:51 -07:00
Michal Sojka
fe9e163f19 emacs: Access raw messages via cat subcommand
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.
2010-11-05 17:51:18 -07:00
Dirk Hohndel
ee578338a6 Fix problem with notmuch-hello-nice-number
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".
2010-10-29 15:49:01 -07:00
David Edmondson
f99ad42da0 emacs: Re-work the implementation of highlighting in notmuch-search-mode.
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.
2010-10-29 15:30:43 -07:00
Carl Worth
b11ecf613a emacs: Fix the autoload comments
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.
2010-10-29 15:27:01 -07:00
David Benjamin
adbfff40ca Don't involve the shell in notmuch searches
The shell isn't needed to interpret any of the arguments, so don't
bother using it at all.

Signed-off-by: David Benjamin <davidben@mit.edu>
2010-10-29 14:13:51 -07:00
Carl Worth
294b6a67c1 emacs: Use copy-sequence instead of copy-seq.
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.
2010-10-28 11:35:58 -07:00
Carl Worth
6d93d2090d emacs: Eliminate duplicate From header in replies.
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.
2010-10-27 18:44:05 -07:00
Carl Worth
c9e0da3a1a emacs: Eliminate warning of calling function with excess arguments.
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.
2010-10-27 18:04:38 -07:00
Carl Worth
75f703e7c2 emacs: Remove non-interactive call of goto-line
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.
2010-10-27 17:58:19 -07:00
Carl Worth
4ddb5ab4dd emacs: Fix to eliminate warning in notmuch-query-map-aux
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.
2010-10-27 17:54:38 -07:00
David Edmondson
c506e1034b emacs: Avoid runtime use of `cl'.
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.
2010-10-27 17:41:50 -07:00
Rob Browning
b67c3ed609 Move notmuch-fcc-header-setup to message-header-setup-hook.
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>
2010-10-27 17:36:02 -07:00
Carl Worth
36dcbdeff6 emacs: Explicitly set the From address when composing a new message.
Previously, underlying emacs code was setting this header. Now, we do the
right thing and query the notmuch configuration for the default value here.
2010-10-27 17:04:48 -07:00
Carl Worth
a3883a7e17 emacs: Enable FCC (to a directory named "sent") by default.
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.
2010-10-27 17:02:44 -07:00
Carl Worth
8b6f3e3f45 emacs: Change FCC to be relative to notmuch mail store, not message-directory
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.
2010-10-27 16:27:43 -07:00
Carl Worth
4606ea60a7 emacs: Fix quoting of Message-Id to fix test case of Id containing ".."
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.
2010-10-22 17:41:40 -07:00
Carl Worth
ca956552bd emacs: Remove the joke from the first line of the notmuch-hello view.
Overuse just makes the joke unfunny.
2010-10-22 12:12:22 -07:00
Carl Worth
1a17faf48d emacs: Fix notmuch-hello to not break when given a very narrow window.
Simply ensure that some subtractions never result in a negative
number, (since emacs complains when asked to create a string with a
negative length).
2010-10-22 12:03:34 -07:00
Carl Worth
31a5e5a125 emacs: Fix bug when parsing a subject cotaining: \[[0-9/]\]
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.
2010-09-23 13:21:03 -07:00
Carl Worth
4e77148a4b emacs: Allow '|' to operate on multiple messages (by means of prefix argument).
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.
2010-09-16 15:52:12 -07:00
Carl Worth
c8da979352 emacs: Fix line-wrapping for help message of notmuch-show mode.
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.
2010-08-19 15:09:55 -07:00
Carl Worth
42e146a3a2 Add C-tab binding in notmuch-search mode as well.
We recently added this to notmuch-hello mode so we might as well
support it in this mode as well for consistency.
2010-06-04 17:16:53 -07:00
David Edmondson
0109f67e38 emacs: Tags should be shown with `notmuch-tag-face'.
Use the same face for tags in `notmuch-show' mode as that used in
`notmuch-search' mode.
2010-06-03 19:13:23 -07:00
David Edmondson
17b09af228 emacs: In search mode, truncate authors using invisible text.
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.
2010-06-03 19:12:23 -07:00
David Edmondson
f2525ed18f emacs: Adjust comment to avoid confusing font-lock.
Comments with an open bracket in the first column confuse `font-lock'
mode, so avoid them.
2010-06-03 19:11:15 -07:00
David Edmondson
fc37771a71 emacs: Allow the display of absolute dates in the header line.
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.
2010-06-03 19:09:18 -07:00
Nelson Elhage
35343710a2 emacs: Bind <backtab> (shift-TAB) to notmuch-show-previous-button
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>
2010-06-03 18:17:03 -07:00
David Edmondson
5ebf5efcb0 emacs: More functionality for `notmuch-wash-tidy-citations'.
Add:
- Insert a blank line before a citation if there isn't one,
- Insert a blank line after a citation if there isn't one.
2010-06-03 18:17:03 -07:00
David Edmondson
636925b40b emacs: Pretty print the numbers of matching messages.
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.
2010-06-03 18:17:03 -07:00
Nelson Elhage
9ccd978665 emacs: notmuch-hello: Make widget-keymap a parent of notmuch-hello-keymap
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.
2010-06-03 18:17:03 -07:00
Sebastian Spaeth
e229bfa5aa add missing docstring for functions
The '?' key bindings uses them for the help window and these are
currently empty.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2010-06-03 18:17:03 -07:00
Sebastian Spaeth
a56010ac8b Make notmuch-hello a mode.
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>
2010-06-03 18:17:03 -07:00
Sebastian Spaeth
5bc4ff4e1d emacs: Remove notmuch-hello-roundup function
as it does the same as (ceiling number divisor) which is already provided in elisp.
2010-06-03 18:17:03 -07:00
David Edmondson
0ffea4297f emacs: In hello mode, bind `C-tab' to move backwards through widgets.
`C-tab' is now the inverse operation to `tab'.
2010-06-03 17:08:27 -07:00
Sebastian Spaeth
c9eb047c6c emacs: Reuse rather than reinvent message header filtering
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>
2010-06-03 17:05:33 -07:00
David Edmondson
251d57f56b emacs: Allow tuning of the tag/saved search layout.
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'.
2010-06-03 17:04:11 -07:00
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