Re: [PATCH] Add 'G' keybinding to folder and search view that triggers external poll

2010-04-23 Thread Dirk Hohndel
On Fri, 23 Apr 2010 10:09:03 +0200, "Sebastian Spaeth"  
wrote:
> On 2010-04-22, Dirk Hohndel wrote:
> > I appreciate how nicely you can say "I liked the idea and then
> > completely rewrote the crap elisp that you submitted" :-)
> 
> Hehe. Very useful indeed. There is one more thing: Would it be possible to 
> provide user
> feedback while this is running (synchronously, I guess)? Like having
> some message in the minibuffer saying "Calling all stations" and
> "Polling finished, please move along..." ?

Right now all you get is the busy cursor. The problem with the updates
is that notmuch/emacs calls just one script. I don't know how to display
(progress-) output from that script in the mininuffer...

/D

-- 
Dirk Hohndel
Intel Open Source Technology Center
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] Add 'G' keybinding to folder and search view that triggers external poll

2010-04-23 Thread Dirk Hohndel
On Fri, 23 Apr 2010 08:20:40 -0700, Carl Worth  wrote:
> On Fri, 23 Apr 2010 10:09:03 +0200, "Sebastian Spaeth"  
> wrote:
> > Hehe. Very useful indeed. There is one more thing: Would it be possible to 
> > provide user
> > feedback while this is running (synchronously, I guess)? Like having
> > some message in the minibuffer saying "Calling all stations" and
> > "Polling finished, please move along..." ?
> 
> Anything is possible, of course. It just always seems to mean someone
> learning a bit more elisp. ;-)

I'm working on that. Check back in a few months :-)
 
> In the meantime, I've found it handy to put my mouse pointer over the
> emacs window when I run this command. Then I get a nice "busy" mouse
> cursor during this operation instead of the standard text-edit bar.

That's what I'm doing as well.

/D

-- 
Dirk Hohndel
Intel Open Source Technology Center
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] Add 'G' keybinding to folder and search view that triggers external poll

2010-04-23 Thread Dirk Hohndel
On Fri, 23 Apr 2010 08:20:40 -0700, Carl Worth  wrote:
> On Fri, 23 Apr 2010 10:09:03 +0200, "Sebastian Spaeth"  SSpaeth.de> wrote:
> > Hehe. Very useful indeed. There is one more thing: Would it be possible to 
> > provide user
> > feedback while this is running (synchronously, I guess)? Like having
> > some message in the minibuffer saying "Calling all stations" and
> > "Polling finished, please move along..." ?
> 
> Anything is possible, of course. It just always seems to mean someone
> learning a bit more elisp. ;-)

I'm working on that. Check back in a few months :-)

> In the meantime, I've found it handy to put my mouse pointer over the
> emacs window when I run this command. Then I get a nice "busy" mouse
> cursor during this operation instead of the standard text-edit bar.

That's what I'm doing as well.

/D

-- 
Dirk Hohndel
Intel Open Source Technology Center


[PATCH] Add 'G' keybinding to folder and search view that triggers external poll

2010-04-23 Thread Sebastian Spaeth
On 2010-04-22, Dirk Hohndel wrote:
> I appreciate how nicely you can say "I liked the idea and then
> completely rewrote the crap elisp that you submitted" :-)

Hehe. Very useful indeed. There is one more thing: Would it be possible to 
provide user
feedback while this is running (synchronously, I guess)? Like having
some message in the minibuffer saying "Calling all stations" and
"Polling finished, please move along..." ?


Re: [PATCH] Add 'G' keybinding to folder and search view that triggers external poll

2010-04-23 Thread Carl Worth
On Fri, 23 Apr 2010 10:09:03 +0200, "Sebastian Spaeth"  
wrote:
> Hehe. Very useful indeed. There is one more thing: Would it be possible to 
> provide user
> feedback while this is running (synchronously, I guess)? Like having
> some message in the minibuffer saying "Calling all stations" and
> "Polling finished, please move along..." ?

Anything is possible, of course. It just always seems to mean someone
learning a bit more elisp. ;-)

In the meantime, I've found it handy to put my mouse pointer over the
emacs window when I run this command. Then I get a nice "busy" mouse
cursor during this operation instead of the standard text-edit bar.

-Carl


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


[PATCH] Add 'G' keybinding to folder and search view that triggers external poll

2010-04-23 Thread Carl Worth
On Fri, 23 Apr 2010 10:09:03 +0200, "Sebastian Spaeth"  wrote:
> Hehe. Very useful indeed. There is one more thing: Would it be possible to 
> provide user
> feedback while this is running (synchronously, I guess)? Like having
> some message in the minibuffer saying "Calling all stations" and
> "Polling finished, please move along..." ?

Anything is possible, of course. It just always seems to mean someone
learning a bit more elisp. ;-)

In the meantime, I've found it handy to put my mouse pointer over the
emacs window when I run this command. Then I get a nice "busy" mouse
cursor during this operation instead of the standard text-edit bar.

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



[PATCH] Add 'G' keybinding to folder and search view that triggers external poll

2010-04-23 Thread Dirk Hohndel
On Fri, 23 Apr 2010 10:09:03 +0200, "Sebastian Spaeth"  wrote:
> On 2010-04-22, Dirk Hohndel wrote:
> > I appreciate how nicely you can say "I liked the idea and then
> > completely rewrote the crap elisp that you submitted" :-)
> 
> Hehe. Very useful indeed. There is one more thing: Would it be possible to 
> provide user
> feedback while this is running (synchronously, I guess)? Like having
> some message in the minibuffer saying "Calling all stations" and
> "Polling finished, please move along..." ?

Right now all you get is the busy cursor. The problem with the updates
is that notmuch/emacs calls just one script. I don't know how to display
(progress-) output from that script in the mininuffer...

/D

-- 
Dirk Hohndel
Intel Open Source Technology Center


Re: [PATCH] Add 'G' keybinding to folder and search view that triggers external poll

2010-04-23 Thread Sebastian Spaeth
On 2010-04-22, Dirk Hohndel wrote:
> I appreciate how nicely you can say "I liked the idea and then
> completely rewrote the crap elisp that you submitted" :-)

Hehe. Very useful indeed. There is one more thing: Would it be possible to 
provide user
feedback while this is running (synchronously, I guess)? Like having
some message in the minibuffer saying "Calling all stations" and
"Polling finished, please move along..." ?
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] Add 'G' keybinding to folder and search view that triggers external poll

2010-04-22 Thread Dirk Hohndel
On Thu, 22 Apr 2010 14:50:33 -0700, Carl Worth  wrote:
> On Fri, 09 Apr 2010 12:53:26 -0700, Dirk Hohndel  
> wrote:
> > 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 '=')
> 
> Thanks Dirk,
> 
> This is even handier than I expected.
> 
> I've pushed this now, but followed up immediately with a (totally
> trivial) change to reduce code duplication, and then a (slightly more
> major) change to define the controlling variable with defcustom so that
> the user can find the variable in the customize screen for notmuch.
> 
> I also renamed it to notmuch-poll-script so you'll need to update your
> setting for this feature to work.

I appreciate how nicely you can say "I liked the idea and then
completely rewrote the crap elisp that you submitted" :-)

/D

-- 
Dirk Hohndel
Intel Open Source Technology Center
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] Add 'G' keybinding to folder and search view that triggers external poll

2010-04-22 Thread Dirk Hohndel
On Thu, 22 Apr 2010 14:50:33 -0700, Carl Worth  wrote:
> On Fri, 09 Apr 2010 12:53:26 -0700, Dirk Hohndel  
> wrote:
> > 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 '=')
> 
> Thanks Dirk,
> 
> This is even handier than I expected.
> 
> I've pushed this now, but followed up immediately with a (totally
> trivial) change to reduce code duplication, and then a (slightly more
> major) change to define the controlling variable with defcustom so that
> the user can find the variable in the customize screen for notmuch.
> 
> I also renamed it to notmuch-poll-script so you'll need to update your
> setting for this feature to work.

I appreciate how nicely you can say "I liked the idea and then
completely rewrote the crap elisp that you submitted" :-)

/D

-- 
Dirk Hohndel
Intel Open Source Technology Center


Re: [PATCH] Add 'G' keybinding to folder and search view that triggers external poll

2010-04-22 Thread Carl Worth
On Fri, 09 Apr 2010 12:53:26 -0700, Dirk Hohndel  wrote:
> 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 '=')

Thanks Dirk,

This is even handier than I expected.

I've pushed this now, but followed up immediately with a (totally
trivial) change to reduce code duplication, and then a (slightly more
major) change to define the controlling variable with defcustom so that
the user can find the variable in the customize screen for notmuch.

I also renamed it to notmuch-poll-script so you'll need to update your
setting for this feature to work.

-Carl


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


[PATCH] Add 'G' keybinding to folder and search view that triggers external poll

2010-04-22 Thread Carl Worth
On Fri, 09 Apr 2010 12:53:26 -0700, Dirk Hohndel  
wrote:
> 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 '=')

Thanks Dirk,

This is even handier than I expected.

I've pushed this now, but followed up immediately with a (totally
trivial) change to reduce code duplication, and then a (slightly more
major) change to define the controlling variable with defcustom so that
the user can find the variable in the customize screen for notmuch.

I also renamed it to notmuch-poll-script so you'll need to update your
setting for this feature to work.

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



[PATCH] Add 'G' keybinding to folder and search view that triggers external poll

2010-04-09 Thread Dirk Hohndel

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 
---
 emacs/notmuch.el |   24 
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 517c53a..a56b949 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -260,6 +260,7 @@ For a mouse binding, return nil."
 (define-key map "s" 'notmuch-search)
 (define-key map "o" 'notmuch-search-toggle-order)
 (define-key map "=" 'notmuch-search-refresh-view)
+(define-key map "G" 'notmuch-poll-and-search-refresh-view)
 (define-key map "t" 'notmuch-search-filter-by-tag)
 (define-key map "f" 'notmuch-search-filter)
 (define-key map [mouse-1] 'notmuch-search-show-thread)
@@ -747,6 +748,17 @@ same relative position within the new buffer."
 (goto-char (point-min))
 ))
 
+(defun notmuch-poll-and-search-refresh-view ()
+  "Run external script to import mail and refresh the current view.
+
+Checks if the variable 'notmuch-external-refresh-script is defined
+and runs the external program defined it provides. Then calls
+notmuch-search-refresh-view to refresh the current view."
+  (interactive)
+  (if (boundp 'notmuch-external-refresh-script)
+  (call-process notmuch-external-refresh-script nil nil))
+  (notmuch-search-refresh-view))
+
 (defun notmuch-search-toggle-order ()
   "Toggle the current search order.
 
@@ -801,6 +813,7 @@ current search results AND that are tagged with the given 
tag."
 (define-key map ">" 'notmuch-folder-last)
 (define-key map "<" 'notmuch-folder-first)
 (define-key map "=" 'notmuch-folder)
+(define-key map "G" 'notmuch-poll-and-folder)
 (define-key map "s" 'notmuch-search)
 (define-key map [mouse-1] 'notmuch-folder-show-search)
 (define-key map (kbd "RET") 'notmuch-folder-show-search)
@@ -919,6 +932,17 @@ Currently available key bindings:
 (if search
(notmuch-search (cdr search) notmuch-search-oldest-first
 
+(defun notmuch-poll-and-folder ()
+  "Run external script to import mail and refresh the folder view.
+
+Checks if the variable 'notmuch-external-refresh-script is defined
+and runs the external program defined it provides. Then calls
+notmuch-folder to refresh the current view."
+  (interactive)
+  (if (boundp 'notmuch-external-refresh-script)
+  (call-process notmuch-external-refresh-script nil nil))
+  (notmuch-folder))
+
 ;;;###autoload
 (defun notmuch-folder ()
   "Show the notmuch folder view and update the displayed counts."
-- 
1.6.6.1


-- 
Dirk Hohndel
Intel Open Source Technology Center
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] Add 'G' keybinding to folder and search view that triggers external poll

2010-04-09 Thread Dirk Hohndel

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 
---
 emacs/notmuch.el |   24 
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 517c53a..a56b949 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -260,6 +260,7 @@ For a mouse binding, return nil."
 (define-key map "s" 'notmuch-search)
 (define-key map "o" 'notmuch-search-toggle-order)
 (define-key map "=" 'notmuch-search-refresh-view)
+(define-key map "G" 'notmuch-poll-and-search-refresh-view)
 (define-key map "t" 'notmuch-search-filter-by-tag)
 (define-key map "f" 'notmuch-search-filter)
 (define-key map [mouse-1] 'notmuch-search-show-thread)
@@ -747,6 +748,17 @@ same relative position within the new buffer."
 (goto-char (point-min))
 ))

+(defun notmuch-poll-and-search-refresh-view ()
+  "Run external script to import mail and refresh the current view.
+
+Checks if the variable 'notmuch-external-refresh-script is defined
+and runs the external program defined it provides. Then calls
+notmuch-search-refresh-view to refresh the current view."
+  (interactive)
+  (if (boundp 'notmuch-external-refresh-script)
+  (call-process notmuch-external-refresh-script nil nil))
+  (notmuch-search-refresh-view))
+
 (defun notmuch-search-toggle-order ()
   "Toggle the current search order.

@@ -801,6 +813,7 @@ current search results AND that are tagged with the given 
tag."
 (define-key map ">" 'notmuch-folder-last)
 (define-key map "<" 'notmuch-folder-first)
 (define-key map "=" 'notmuch-folder)
+(define-key map "G" 'notmuch-poll-and-folder)
 (define-key map "s" 'notmuch-search)
 (define-key map [mouse-1] 'notmuch-folder-show-search)
 (define-key map (kbd "RET") 'notmuch-folder-show-search)
@@ -919,6 +932,17 @@ Currently available key bindings:
 (if search
(notmuch-search (cdr search) notmuch-search-oldest-first

+(defun notmuch-poll-and-folder ()
+  "Run external script to import mail and refresh the folder view.
+
+Checks if the variable 'notmuch-external-refresh-script is defined
+and runs the external program defined it provides. Then calls
+notmuch-folder to refresh the current view."
+  (interactive)
+  (if (boundp 'notmuch-external-refresh-script)
+  (call-process notmuch-external-refresh-script nil nil))
+  (notmuch-folder))
+
 ;;;###autoload
 (defun notmuch-folder ()
   "Show the notmuch folder view and update the displayed counts."
-- 
1.6.6.1


-- 
Dirk Hohndel
Intel Open Source Technology Center