Commit graph

110 commits

Author SHA1 Message Date
Pieter Praet
643ce61c1b emacs: logically group def{custom,face}s
To allow for expansion whilst keeping everything tidy and organized,
move all defcustom/defface variables to the following subgroups,
defined in notmuch-lib.el:

- Hello
- Search
- Show
- Send
- Crypto
- Hooks
- External Commands
- Appearance

As an added benefit, defcustom keyword args are now consistently
ordered as they appear @ defcustom's docstring (OCD much?).

Proper defgroup docstrings and various other improvements
by courtesy of Austin Clements.
2012-01-19 09:27:02 -04:00
David Edmondson
38546e4acb emacs: Improve `notmuch-hello' display on ttys.
Inserting spaces to pad out columns is good, except when the padding
makes the line wider than the window. This looks particularly bad on a
tty where there is no fringe.

Hence, avoid padding the last column on each row.
2012-01-12 22:33:29 -04:00
Dmitry Kurochkin
49af79cd2a emacs: put the last search on top of recent searches in notmuch-hello
Notmuch-hello stores a list of recent searches.  Before the change, if
a search from this list is repeated, the recent search list is not
changed.  The patch makes repeated recent searches move to the head of
the list.  I.e. the last search is always on top of the recent search
list, which is what one would expect from a history list.
2011-12-22 07:41:02 -04:00
Thomas Jost
7edf9e2765 emacs: Change the default thousands separator to a space
This had been discussed and decided on IRC.

Rationale:
  Therefore the space is recommended in the SI/ISO 31-0 standard, and the
  International Bureau of Weights and Measures states that "for numbers with
  many digits the digits may be divided into groups of three by a thin space, in
  order to facilitate reading. Neither dots nor commas are inserted in the
  spaces between groups of three".

(http://en.wikipedia.org/wiki/Decimal_separator#Digit_grouping)
2011-12-22 06:56:41 -04:00
Thomas Jost
6dd482a16d emacs: rename notmuch-decimal-separator to notmuch-hello-thousands-separator
In 123,456.78, "." is the decimal separator, but "," is the thousands separator.
2011-12-22 06:56:26 -04:00
Jani Nikula
2f7f259d62 emacs: Fix notmuch-hello-tag-list-make-query defcustom
It was not possible to define custom filters or filter functions because
the types were const. Remove const to allow editing.

Signed-off-by: Jani Nikula <jani@nikula.org>
2011-12-22 06:54:10 -04:00
Thomas Jost
4e2fe89520 emacs: add notmuch-hello-refresh-hook
This hook is called every time a notmuch-hello buffer is updated.
2011-12-21 07:52:10 -04:00
Aaron Ecay
e3260d0253 Don't quote lambda forms
This generates byte-compiler warnings on (at least) current trunk
versions of Emacs.  The quote is not necessary; lambda forms are
self-quoting.
2011-12-21 07:27:38 -04:00
Dmitry Kurochkin
59adb2da19 emacs: do not call `notmuch-hello-mode' on update
`notmuch-hello' should call `notmuch-hello-mode' function only when
run for the first time.  But before the change, `notmuch-hello' used
`kill-all-local-variables' to remove editable widgets fields.  This
caused the major mode to be reset, and `notmuch-hello-mode' to be
called every time.

The patch manually deletes all editable widget fields and removes
`kill-all-local-variables' call.
2011-12-20 07:42:31 -04:00
Ivy Foster
db352df09e emacs: Add notmuch-hello-mode-hook
Functions called after entering `notmuch-hello-mode'
2011-12-16 17:17:30 -04:00
Jani Nikula
a467c5f071 emacs: Make saving new saved searches append, not prepend
Append new saved searches at the end of saved searches rather than insert
in front.

Signed-off-by: Jani Nikula <jani@nikula.org>
2011-11-22 22:55:15 -04:00
Jani Nikula
e312705d20 emacs: Add new customization option to sort saved searches
Add new customization option notmuch-saved-search-sort-function to sort
saved searches in user-defined order. Provide a sort function to sort the
saved searches in alphabetical order. Setting the search function to nil
causes the saved searches not to be sorted, as before. This also remains
the default. The function only affects display of the saved searches, not
the order in which they are stored by custom.

Signed-off-by: Jani Nikula <jani@nikula.org>
2011-11-22 22:54:55 -04:00
Dmitry Kurochkin
e972d752c0 emacs: add invisible space after the search widget field in notmuch-hello
It is very convenient when C-e (bound to `widget-end-of-line') ignores
trailing spaces inside the search widget.  But it only does so if a
widget is not followed by a newline (that is why it works in the saved
search widgets).  The patch just adds an invisible space after the
search widget to get the desirable behavior of `widget-end-of-line'.
The extra space is also added to expected results of emacs tests.
2011-11-12 10:34:53 -05:00
Pieter Praet
8bb6f7869c fix sum moar typos [comments in source code]
Various typo fixes in comments within the source code.

Signed-off-by: Pieter Praet <pieter@praet.org>

Edited-by: Carl Worth <cworth@cworth.org> Restricted to just
source-code comments, (and fixed fix of "descriptios" to "descriptors"
rather than "descriptions").
2011-06-23 15:58:39 -07:00
Daniel Schoepe
eb4e0ea2ab emacs: Make the queries used in the all-tags section configurable
This patch adds a customization variable that controls what queries
are used to construct the all-tags section in notmuch-hello. It allows
the user to specify a function to construct the query given a tag or
a string that is used as a filter for each tag.
It also adds a variable to hide various tags from the all-tags section.

Signed-off-by: Daniel Schoepe <daniel.schoepe@googlemail.com>
2011-05-26 14:34:41 -07:00
Thomas Jost
784649561a emacs: Allow the user to choose the "From" address when composing a new message
When pressing C-u m, the user will be prompted for the identity to use.
2011-05-26 10:34:37 -07: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
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
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 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
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
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
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
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
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
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
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
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
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
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
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