[PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch

2010-04-26 Thread David Edmondson
On Mon, 26 Apr 2010 13:38:37 -0400, Jameson Rollins  wrote:
> What about advanced users?  I really want my notmuch front page to just
> be a particular saved search.  The notmuch-hello looks neat, but I don't
> really see myself ever using it, since I can access all the
> functionality I need already.  All I really want from a front page is
> the main search that I look at all the time ("tag:inbox and not
> tag:deleted"), have it *not* close if I accidentally hit 'q', and a way
> to pop back to it from wherever I am.  Could we make it configurable so
> that the front page is either the hello page, or the special search page
> I describe?

Isn't something like:

(global-set-key "\C-ci" '(lambda () (interactive) (notmuch-search "tag:inbox 
and not tag:deleted" notmuch-search-oldest-first)))

all you need?

dme.
-- 
David Edmondson, http://dme.org
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 



[PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch

2010-04-26 Thread David Edmondson
On Fri, 23 Apr 2010 13:13:01 -0700, Carl Worth  wrote:
> Finally, I'm quite inclined to make `notmuch' invoke this mode, so think
> about that.

See id:1272294424-17363-1-git-send-email-dme at dme.org.

dme.
-- 
David Edmondson, http://dme.org
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 



[PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch

2010-04-26 Thread Carl Worth

-- 
carl.d.worth at intel.com
On Mon, 26 Apr 2010 19:03:35 +0100, David Edmondson  wrote:
> > What about advanced users?  I really want my notmuch front page to just
> > be a particular saved search.  The notmuch-hello looks neat, but I don't
> > really see myself ever using it, since I can access all the
> > functionality I need already.  All I really want from a front page is
> > the main search that I look at all the time ("tag:inbox and not
> > tag:deleted"), have it *not* close if I accidentally hit 'q', and a way
> > to pop back to it from wherever I am.  Could we make it configurable so
> > that the front page is either the hello page, or the special search page
> > I describe?
> 
> (global-set-key "\C-ci" '(lambda () (interactive) (notmuch-search "tag:inbox 
> and not tag:deleted" notmuch-search-oldest-first)))

It's really close, I think.

It doesn't add the "not close if I hit 'q'" feature, though.

And I agree that that feature is really important for using a default
search as the "primary landing page" of notmuch. I really wanted that
feature when I was using the original `notmuch' command as my primary
landing page.

The idea is to allow the user to basically just keep hitting 'q' to
quickly pop back up to the primary search.

As far as "could we make it configurable?": Of course! This is emacs
after all. ;-)

-Carl

-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 



[PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch

2010-04-26 Thread David Edmondson
On Fri, 23 Apr 2010 13:13:01 -0700, Carl Worth  wrote:
>   * This should be integrated such that (require 'notmuch) provides the
> notmuch-hello functionality. That's our documented access point for
> getting at notmuch functionality.

I'll do this, but I wonder if it is actually good advice. It causes
notmuch.el (and anything that requires) to be loaded immediately. This
will typically happen before any of a users' customisation settings are
loaded (as `custom-set-variables', etc. generally happens right at the
bottom of .emacs).

A result of this is that notmuch can't use any of the customisation
settings to adapt its' behaviour at load time. A example is (about which
more lower down):

>   * I would *love* a simple way to import my existing notmuch-folder
> configuration into notmuch-hello. Bonus points if this happens
> automatically.

notmuch-hello.el has:

(defcustom notmuch-hello-saved-searches notmuch-folders
  "A list of saved searches to display."
  :type '(alist :key-type string :value-type string)
  :group 'notmuch)

So if `notmuch-folders' is set before notmuch-hello.el is loaded, you
get some saved-searches copied from your folders (but this won't
override any specific settings you made for
`notmuch-hello-saved-searches').

Relying on the order in general is bad
(cf. `notmuch-search-authors-width'), but it can allow us to provide
some useful functionality.

If we don't want users to "(require 'notmuch)" we'd probably have to
suggest one or more autoloads - perhaps even provide a file with a bunch
of autoloads in it. Oh, or "(require 'notmuch)" should just load
something that has the autoloads (d'oh!) and some
`define-mail-user-agent' goop so that `compose-mail' does the right
thing.

I'll try to produce a patch for this last thing.

>   * The logo background is gray on my white-background emacs. That
> looks odd.

Patch sent.

>   * It would be great if point were in the search bar right when this
> mode started.

This is customisable, and I see that you changed the default ;-)

>   * I'd like the saved searches to appear before the recent searches I
> think.

Did you come to any conclusion about this?

>   * I'm not sure how useful the numbered shortcuts are for the recent
> searches. We want to encourage people to move to saved searches
> instead, (and the recent searches are quite transient anyway). So do
> we really need these? [I mistook them for message counts at
> first.]

Patch sent which removes them.

>   * Repeating a recent search by pressing RET on it creates a new
> identical search which doesn't seem all that useful.

Patch sent.

>   * I would *love* a simple way to import my existing notmuch-folder
> configuration into notmuch-hello. Bonus points if this happens
> automatically.

We could have `notmuch-hello' use `notmuch-folders' if
`notmuch-hello-saved-searches' is `nil'. Would that help?

> Finally, I'm quite inclined to make `notmuch' invoke this mode, so
> think about that.

It seems straightforward, I'll produce a patch.

dme.
-- 
David Edmondson, http://dme.org


[PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch

2010-04-26 Thread Carl Worth
> On Mon, 26 Apr 2010 10:36:28 +0100, David Edmondson  wrote:
> > >   * It would be great if point were in the search bar right when this
> > > mode started.
> > 
> > This is customisable, and I see that you changed the default ;-)
> 
> Yes. I'm still on the fence about this change, (as we are talking in the
> other thread).
> 
> > >   * I'd like the saved searches to appear before the recent searches I
> > > think.
> > 
> > Did you come to any conclusion about this?

I thought about these this morning and here are my latest thoughts on
what I would like to see:

  1. Change the "notmuch" and message count in the welcome sentence to
 not be buttons.

  2. Put the saved searches (if any) before the search bar.

  3. When `notmuch-hello' (or even `notmuch' when it gets its new name)
 is invoked directly, move to the first button, (go to point-min and
 then call widget-forward). That is, if the user has any saved
 searches, then point will be on the first one. If the user has no
 saved searches, then point will be on the search bar.

  4. Fix refresh of notmuch-hello to leave point in the same logical
 place, (the same saved-search widget at least).

What do you think? This will give new users the ability to just type a
search string as their first interaction. Users with a little more
experience, (enough to have saved a search), will have easier access to
those, and will not have the search bar interfering with keybindings.

-Carl

-- 
carl.d.worth at intel.com
On Mon, 26 Apr 2010 07:59:07 -0700, Carl Worth  wrote:
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 



Re: [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch

2010-04-26 Thread David Edmondson
On Fri, 23 Apr 2010 13:13:01 -0700, Carl Worth cwo...@cworth.org wrote:
   * This should be integrated such that (require 'notmuch) provides the
 notmuch-hello functionality. That's our documented access point for
 getting at notmuch functionality.

I'll do this, but I wonder if it is actually good advice. It causes
notmuch.el (and anything that requires) to be loaded immediately. This
will typically happen before any of a users' customisation settings are
loaded (as `custom-set-variables', etc. generally happens right at the
bottom of .emacs).

A result of this is that notmuch can't use any of the customisation
settings to adapt its' behaviour at load time. A example is (about which
more lower down):

   * I would *love* a simple way to import my existing notmuch-folder
 configuration into notmuch-hello. Bonus points if this happens
 automatically.

notmuch-hello.el has:

(defcustom notmuch-hello-saved-searches notmuch-folders
  A list of saved searches to display.
  :type '(alist :key-type string :value-type string)
  :group 'notmuch)

So if `notmuch-folders' is set before notmuch-hello.el is loaded, you
get some saved-searches copied from your folders (but this won't
override any specific settings you made for
`notmuch-hello-saved-searches').

Relying on the order in general is bad
(cf. `notmuch-search-authors-width'), but it can allow us to provide
some useful functionality.

If we don't want users to (require 'notmuch) we'd probably have to
suggest one or more autoloads - perhaps even provide a file with a bunch
of autoloads in it. Oh, or (require 'notmuch) should just load
something that has the autoloads (d'oh!) and some
`define-mail-user-agent' goop so that `compose-mail' does the right
thing.

I'll try to produce a patch for this last thing.

   * The logo background is gray on my white-background emacs. That
 looks odd.

Patch sent.

   * It would be great if point were in the search bar right when this
 mode started.

This is customisable, and I see that you changed the default ;-)

   * I'd like the saved searches to appear before the recent searches I
 think.

Did you come to any conclusion about this?

   * I'm not sure how useful the numbered shortcuts are for the recent
 searches. We want to encourage people to move to saved searches
 instead, (and the recent searches are quite transient anyway). So do
 we really need these? [I mistook them for message counts at
 first.]

Patch sent which removes them.

   * Repeating a recent search by pressing RET on it creates a new
 identical search which doesn't seem all that useful.

Patch sent.

   * I would *love* a simple way to import my existing notmuch-folder
 configuration into notmuch-hello. Bonus points if this happens
 automatically.

We could have `notmuch-hello' use `notmuch-folders' if
`notmuch-hello-saved-searches' is `nil'. Would that help?

 Finally, I'm quite inclined to make `notmuch' invoke this mode, so
 think about that.

It seems straightforward, I'll produce a patch.

dme.
-- 
David Edmondson, http://dme.org
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch

2010-04-26 Thread Carl Worth

-- 
carl.d.wo...@intel.com
On Mon, 26 Apr 2010 10:36:28 +0100, David Edmondson d...@dme.org wrote:
 I'll do this, but I wonder if it is actually good advice.

My primary point is that all of the implemented functionality,
(including notmuch-hello and notmuch-addresses), needs to be made
available with our documented approach for loading notmuch in
emacs. Currently that's (require 'notmuch).

We can certainly come up with another approach if there's a better one.

 So if `notmuch-folders' is set before notmuch-hello.el is loaded, you
 get some saved-searches copied from your folders (but this won't
 override any specific settings you made for
 `notmuch-hello-saved-searches').

OK. That is nice. But also a trick order dependency, yes.

 of autoloads in it. Oh, or (require 'notmuch) should just load
 something that has the autoloads (d'oh!) and some
 `define-mail-user-agent' goop so that `compose-mail' does the right
 thing.
 
 I'll try to produce a patch for this last thing.

Yes, that sounds perfect. I'll look forward to that.

* The logo background is gray on my white-background emacs. That
  looks odd.
 
 Patch sent.

Thanks. Pushed.

* It would be great if point were in the search bar right when this
  mode started.
 
 This is customisable, and I see that you changed the default ;-)

Yes. I'm still on the fence about this change, (as we are talking in the
other thread).

* I'd like the saved searches to appear before the recent searches I
  think.
 
 Did you come to any conclusion about this?

The thing I most want is for my saved searches to be extremely easy to
select. With notmuch-folder, the view wasn't fancy at all, but it was
extremely functional in that the first saved search was under point
right away and just C-n/C-p (or arrow keys) could be used to select
others.

I haven't gotten that same convenience with notmuch-hello yet.

* I'm not sure how useful the numbered shortcuts are for the recent
  searches
 
 Patch sent which removes them.

Pushed.

* Repeating a recent search by pressing RET on it creates a new
  identical search which doesn't seem all that useful.
 
 Patch sent.

And pushed.

 We could have `notmuch-hello' use `notmuch-folders' if
 `notmuch-hello-saved-searches' is `nil'. Would that help?

Yes, that's what I had in mind here.

  Finally, I'm quite inclined to make `notmuch' invoke this mode, so
  think about that.
 
 It seems straightforward, I'll produce a patch.

Excellent. A lot of these would have been easy for me to do of course,
but it seems to be working well for you to own the coding of our emacs
code for now. I really appreciate it!

-Carl


pgpWH4nv4YRbD.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch

2010-04-23 Thread Carl Worth
On Fri, 23 Apr 2010 13:13:01 -0700, Carl Worth  wrote:
>   * I'd like the saved searches to appear before the recent searches I
> think.

Actually, this might be OK since the recent searches go away when
restarting emacs.

>   * I would *love* a simple way to import my existing notmuch-folder
> configuration into notmuch-hello. Bonus points if this happens
> automatically.

This is as simple as editing my .emacs file to set the
notmuch-hello-saved-searches variable instead of notmuch-folders. So
that's nice.

Though we might want to remove the "-hello" from the name there. It
doesn't really add anything.

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 



[PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch

2010-04-23 Thread Carl Worth
On Thu, 22 Apr 2010 09:27:33 +0100, David Edmondson  wrote:
[no commit message paragraph]

Hi David,

This is really great stuff. I just merged this, and restricted mysefl to
following up with only a very tiny patch to clean up some warnings from
the emacs compilation.

Here is some quick feedback;

  * This should be integrated such that (require 'notmuch) provides the
notmuch-hello functionality. That's our documented access point for
getting at notmuch functionality.

  * The logo background is gray on my white-background emacs. That looks odd.

  * It would be great if point were in the search bar right when this
mode started.

  * I'd like the saved searches to appear before the recent searches I
think.

  * I'm not sure how useful the numbered shortcuts are for the recent
searches. We want to encourage people to move to saved searches
instead, (and the recent searches are quite transient anyway). So do
we really need these? [I mistook them for message counts at first.]

  * Repeating a recent search by pressing RET on it creates a new
identical search which doesn't seem all that useful.

  * I would *love* a simple way to import my existing notmuch-folder
configuration into notmuch-hello. Bonus points if this happens
automatically.

Finally, I'm quite inclined to make `notmuch' invoke this mode, so think
about that.

That's the feedback I have from a very quick, first look. I'm sure I'll
have more later.

Thanks again! This is really slick.

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 



Re: [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch

2010-04-23 Thread Carl Worth
On Fri, 23 Apr 2010 13:13:01 -0700, Carl Worth cwo...@cworth.org wrote:
   * I'd like the saved searches to appear before the recent searches I
 think.

Actually, this might be OK since the recent searches go away when
restarting emacs.

   * I would *love* a simple way to import my existing notmuch-folder
 configuration into notmuch-hello. Bonus points if this happens
 automatically.

This is as simple as editing my .emacs file to set the
notmuch-hello-saved-searches variable instead of notmuch-folders. So
that's nice.

Though we might want to remove the -hello from the name there. It
doesn't really add anything.

-Carl


pgpQsdCccPj1K.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch

2010-04-22 Thread David Edmondson
---
 emacs/Makefile.local   |5 +
 emacs/notmuch-hello.el |  359 
 emacs/notmuch-lib.el   |9 ++
 emacs/notmuch-logo.png |  Bin 0 -> 1671 bytes
 emacs/notmuch.el   |   28 +++--
 5 files changed, 390 insertions(+), 11 deletions(-)
 create mode 100644 emacs/notmuch-hello.el
 create mode 100644 emacs/notmuch-logo.png

diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index f759c0d..6486d90 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -7,6 +7,10 @@ emacs_sources := \
$(dir)/notmuch-query.el \
$(dir)/notmuch-show.el \
$(dir)/notmuch-wash.el
+   $(dir)/notmuch-hello.el
+
+emacs_images := \
+   $(dir)/notmuch-logo.png

 emacs_bytecode := $(subst .el,.elc,$(emacs_sources))

@@ -26,5 +30,6 @@ install-emacs:
 ifeq ($(HAVE_EMACS),1)
install -m0644 $(emacs_bytecode) $(DESTDIR)$(emacslispdir)
 endif
+   install -m0644 $(emacs_images) $(DESTDIR)$(emacslispdir)

 CLEAN := $(CLEAN) $(emacs_bytecode)
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
new file mode 100644
index 000..13de6f8
--- /dev/null
+++ b/emacs/notmuch-hello.el
@@ -0,0 +1,359 @@
+;; notmuch-hello.el --- welcome to notmuch, a frontend
+;;
+;; Copyright ?? David Edmondson
+;;
+;; This file is part of Notmuch.
+;;
+;; Notmuch is free software: you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; Notmuch is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with Notmuch.  If not, see .
+;;
+;; Authors: David Edmondson 
+
+(require 'widget)
+(require 'wid-edit) ; For `widget-forward'.
+(require 'cl)
+
+(require 'notmuch-lib)
+(require 'notmuch)
+
+(declare-function notmuch-search "notmuch" (query  oldest-first 
target-thread target-line))
+(declare-function notmuch-folder-count "notmuch" (search))
+
+(defcustom notmuch-hello-recent-searches-max 10
+  "The number of recent searches to store and display."
+  :type 'integer
+  :group 'notmuch)
+
+(defcustom notmuch-hello-show-empty-saved-searches nil
+  "Should saved searches with no messages be listed?"
+  :type 'boolean
+  :group 'notmuch)
+
+(defcustom notmuch-hello-indent 4
+  "How much to indent non-headers."
+  :type 'integer
+  :group 'notmuch)
+
+(defcustom notmuch-hello-saved-searches notmuch-folders
+  "A list of saved searches to display."
+  :type '(alist :key-type string :value-type string)
+  :group 'notmuch)
+
+(defcustom notmuch-hello-show-logo t
+  "Should the notmuch logo be shown?"
+  :type 'boolean
+  :group 'notmuch)
+
+(defcustom notmuch-hello-logo-background "#5f5f5f"
+  "Background colour for the notmuch logo."
+  :type 'color
+  :group 'notmuch)
+
+(defcustom notmuch-hello-jump-to-search nil
+  "Whether `notmuch-hello' should always jump to the search
+field."
+  :type 'boolean
+  :group 'notmuch)
+
+(defvar notmuch-hello-url "http://notmuchmail.org;
+  "The `notmuch' web site.")
+
+(defvar notmuch-hello-recent-searches nil)
+
+(defun notmuch-hello-remember-search (search)
+  (if (not (memq search notmuch-hello-recent-searches))
+  (push search notmuch-hello-recent-searches))
+  (if (> (length notmuch-hello-recent-searches)
+notmuch-hello-recent-searches-max)
+  (setq notmuch-hello-recent-searches (butlast 
notmuch-hello-recent-searches
+
+(defun notmuch-hello-trim (search)
+  "Trim whitespace."
+  (if (string-match "^[[:space:]]*\\(.*[^[:space:]]\\)[[:space:]]*$" search)
+  (match-string 1 search)
+search))
+
+(defun notmuch-hello-search (search)
+  (let ((search (notmuch-hello-trim search)))
+(notmuch-hello-remember-search search)
+(notmuch-search search notmuch-search-oldest-first nil nil 
#'notmuch-hello-search-continuation)))
+
+(defun notmuch-hello-add-saved-search (widget)
+  (interactive)
+  (let ((search (widget-value
+(symbol-value
+ (widget-get widget :notmuch-saved-search-widget
+   (name (completing-read "Name for saved search: "
+  notmuch-hello-saved-searches)))
+;; If an existing saved search with this name exists, remove it.
+(setq notmuch-hello-saved-searches
+ (loop for elem in notmuch-hello-saved-searches
+   if (not (equal name
+  (car elem)))
+   collect elem))
+;; Add the new one.
+(customize-save-variable 'notmuch-hello-saved-searches
+(push (cons name search)
+  notmuch-hello-saved-searches))
+(message "Saved '%s' as 

[PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch

2010-04-13 Thread Michal Sojka
On Mon, 12 Apr 2010, David Edmondson wrote:
> commit e55dc251b9e8001fe16873fadac565563e606d69
> Author: David Edmondson 
> Date:   Mon Apr 12 11:12:23 2010 +0100
> 
> emacs: Add notmuch-hello.el, a friendly frontend to notmuch

Hi dme,

thanks for the great patch. For next time, could you plese use 'git
format-patch' for generating patches for sending in email? If I pipe
your message to 'git am', all the above text becomes a part of commit
message.

-Michal


[PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch

2010-04-13 Thread David Edmondson
On Tue, 13 Apr 2010 12:25:43 +0200, Michal Sojka  wrote:
> For next time, could you plese use 'git format-patch' for generating
> patches for sending in email? If I pipe your message to 'git am', all
> the above text becomes a part of commit message.

Will do.

dme.
-- 
David Edmondson, http://dme.org


[PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch

2010-04-13 Thread David Edmondson
On Tue, 13 Apr 2010 06:58:46 +0200, Xavier Maillard  wrote:
> On Mon, 12 Apr 2010 11:13:30 +0100, David Edmondson  wrote:
> > commit e55dc251b9e8001fe16873fadac565563e606d69
> > Author: David Edmondson 
> > Date:   Mon Apr 12 11:12:23 2010 +0100
> > 
> > emacs: Add notmuch-hello.el, a friendly frontend to notmuch
> 
> I like it !

There's an updated version in the `dme-play' branch of
git://github.com/dme/notmuch.git.

dme.
-- 
David Edmondson, http://dme.org


[PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch

2010-04-13 Thread Xavier Maillard
On Mon, 12 Apr 2010 11:13:30 +0100, David Edmondson  wrote:
> commit e55dc251b9e8001fe16873fadac565563e606d69
> Author: David Edmondson 
> Date:   Mon Apr 12 11:12:23 2010 +0100
> 
> emacs: Add notmuch-hello.el, a friendly frontend to notmuch

I like it !

Xavier


Re: [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch

2010-04-13 Thread Michal Sojka
On Mon, 12 Apr 2010, David Edmondson wrote:
 commit e55dc251b9e8001fe16873fadac565563e606d69
 Author: David Edmondson d...@dme.org
 Date:   Mon Apr 12 11:12:23 2010 +0100
 
 emacs: Add notmuch-hello.el, a friendly frontend to notmuch

Hi dme,

thanks for the great patch. For next time, could you plese use 'git
format-patch' for generating patches for sending in email? If I pipe
your message to 'git am', all the above text becomes a part of commit
message.

-Michal
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch

2010-04-13 Thread David Edmondson
On Tue, 13 Apr 2010 12:25:43 +0200, Michal Sojka sojk...@fel.cvut.cz wrote:
 For next time, could you plese use 'git format-patch' for generating
 patches for sending in email? If I pipe your message to 'git am', all
 the above text becomes a part of commit message.

Will do.

dme.
-- 
David Edmondson, http://dme.org
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch

2010-04-12 Thread David Edmondson
commit e55dc251b9e8001fe16873fadac565563e606d69
Author: David Edmondson 
Date:   Mon Apr 12 11:12:23 2010 +0100

emacs: Add notmuch-hello.el, a friendly frontend to notmuch

New  emacs/notmuch-hello.el
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
new file mode 100644
index 000..279c424
--- /dev/null
+++ b/emacs/notmuch-hello.el
@@ -0,0 +1,122 @@
+;; notmuch-hello.el --- welcome to notmuch, a frontend
+;;
+;; Copyright ? David Edmondson
+;;
+;; This file is part of Notmuch.
+;;
+;; Notmuch is free software: you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; Notmuch is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with Notmuch.  If not, see .
+;;
+;; Authors: David Edmondson 
+
+(require 'widget)
+
+(require 'notmuch-lib)
+
+(defvar notmuch-hello-searches-to-save 10)
+(defvar notmuch-hello-search-width 60)
+
+(defvar notmuch-hello-recent-searches nil)
+
+(defun notmuch-hello-save-search (search)
+  (if (not (memq search notmuch-hello-recent-searches))
+  (push search notmuch-hello-recent-searches))
+  (if (> (length notmuch-hello-recent-searches)
+notmuch-hello-searches-to-save)
+  (setq notmuch-hello-recent-searches (butlast 
notmuch-hello-recent-searches
+
+(defun notmuch-hello-trim (search)
+  "Trim whitespace."
+  (if (string-match "^[[:space:]]*\\(.*[^[:space:]]\\)[[:space:]]*$" search)
+  (match-string 1 search)
+search))
+
+(defun notmuch-hello-search (search)
+  (let ((search (notmuch-hello-trim search)))
+(notmuch-hello-save-search search)
+(notmuch-search search)))
+
+(defun notmuch-hello ()
+  (interactive)
+
+  (switch-to-buffer "*notmuch-hello*")
+  (kill-all-local-variables)
+  (let ((inhibit-read-only t))
+(erase-buffer))
+
+  (let ((all (overlay-lists)))
+;; Delete all the overlays.
+(mapcar 'delete-overlay (car all))
+(mapcar 'delete-overlay (cdr all)))
+
+  (widget-insert "\nWelcome to notmuch.\n\n")
+  (let ((start (point)))
+(widget-insert "Search: ")
+(widget-create 'editable-field
+  :size notmuch-hello-search-width
+  :action (lambda (widget  ignore)
+(let ((search (widget-value widget)))
+  (notmuch-hello-search search
+(widget-insert "\n")
+(indent-rigidly start (point) 4))
+
+  (when notmuch-hello-recent-searches
+(widget-insert "\nRecent searches:\n\n")
+(let ((start (point)))
+  (mapcar '(lambda (search)
+(widget-create 'editable-field
+   :size notmuch-hello-search-width
+   :action (lambda (widget  ignore)
+ (let ((search (widget-value widget)))
+   (notmuch-hello-search search)))
+   search)
+(widget-insert "\n"))
+ notmuch-hello-recent-searches)
+  (indent-rigidly start (point) 4)))
+
+  (widget-insert "\nFolders:\n\n")
+  (let ((start (point)))
+(mapcar '(lambda (folder)
+  (let ((w (widget-create 'push-button
+  :notify (lambda (widget  ignore)
+(notmuch-search (widget-get 
widget :notmuch-search-terms)))
+  "open")))
+(widget-put w :notmuch-search-terms (cdr folder)))
+  (widget-insert (format " %6s %s\n" (notmuch-folder-count (cdr 
folder)) (car folder
+   notmuch-folders)
+(indent-rigidly start (point) 4))
+
+  (widget-insert "\nAll tags:\n\n")
+  (let ((start (point)))
+(mapcar '(lambda (tag)
+  (let ((w (widget-create 'push-button
+  :notify (lambda (widget  ignore)
+(notmuch-search (widget-get 
widget :notmuch-search-terms)))
+  "open")))
+(widget-put w :notmuch-search-terms (concat "tag:" tag)))
+  (widget-insert (format " %6s %s\n" (notmuch-folder-count
+  (concat "tag:" tag))
+ tag)))
+   (process-lines notmuch-command "search-tags"))
+(indent-rigidly start (point) 4))
+
+  (use-local-map widget-keymap)
+  (local-set-key "=" 'notmuch-hello)
+  (local-set-key "q" '(lambda () (interactive) (kill-buffer (current-buffer
+
+  (widget-setup)
+
+  ;; Always