Commit graph

68 commits

Author SHA1 Message Date
Daniel Schoepe
3557acab64 emacs: User-defined sections in notmuch-hello
This patch makes the notmuch-hello screen fully customizable
by allowing the user to add and remove arbitrary sections. It
also provides some convenience functions for constructing sections,
e.g. showing the unread message count for each tag.

This is done by specifying a list of functions that will be run
when notmuch-hello is invoked.
2012-03-01 08:16:29 -04:00
Dmitry Kurochkin
d0a048f856 emacs: polish notmuch-hello help text
Make `=' binding description consistent with others.
2012-01-26 08:20:40 -04:00
Dmitry Kurochkin
e6e10b82c9 emacs: bind "s" to `notmuch-hello-search' in notmuch-hello buffer
`notmuch-hello-search' uses `notmuch-search' function but refreshes
notmuch-hello buffer when the search buffer is closed.
2012-01-25 08:33:48 -04:00
Dmitry Kurochkin
bc267b70b0 emacs: use a single history for all searches
There are two ways to do search in Emacs UI: search widget in
notmuch-hello buffer and `notmuch-search' function bound to "s".
Before the change, these search mechanisms used different history
lists.  The patch makes notmuch-hello search use the same history list
as `notmuch-search' function.
2012-01-25 08:33:39 -04:00
Dmitry Kurochkin
02d8815922 emacs: bind "s" to `notmuch-search' in notmuch-hello buffer
Before the change, "s" in notmuch-hello buffer would jump to the
search box.  The patch changes the binding to `notmuch-search' which
is consistent with all other notmuch buffers.
2012-01-25 08:33:27 -04:00
Tomi Ollila
37dec7d7b3 emacs/*.el: changed one-char comment prefix ';' to two; ';;'
In order for emacs (indent-region) to (re)indent emacs lisp
properly there needs to be at least 2 comment characters (;;).
2012-01-21 14:06:17 -04:00
Dmitry Kurochkin
d3aa6848da emacs: add invisible dot instead of space at the end of notmuch-hello search box
This makes `show-trailing-whitespace' happy, i.e. it does not mark the
whole search box line as trailing spaces.

Since the dot is invisible, this change makes no visible difference
for `notmuch-hello'.

Edited-by: Pieter Praet <pieter@praet.org> to fix the tests.
2012-01-21 08:50:48 -04:00
Pieter Praet
046f5dded2 emacs: globally replace non-branching "(if (not ..." with "(unless ..."
Less code, same results, without sacrificing readability.
2012-01-21 08:17:56 -04:00
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