notmuch-search-toggle-order and notmuch-tree

2016-08-11 Thread Aneesh Kumar K.V

Hi,

I was expecting notmuch-tree to also follow the search
order(oldest-first or not). But with latest notmuch
even after i change the search order using notmuch-serach-toggle-order a
tree view always list with the default search order. Is that expected ?

-aneesh

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


notmuch-tree display

2015-07-13 Thread Aneesh Kumar K.V
Mark Walters  writes:

> On Sun, 12 Jul 2015, "Aneesh Kumar K.V"  
> wrote:
>> "Aneesh Kumar K.V"  writes:
>>
>>> Mark Walters  writes:
>>>
>>>> It could be a font issue (for the tree graphical characters). Which font
>>>> are you using? and is emacs running in a terminal or in its own window?
>>>>
>>>> Best wishes
>>>>
>>>> Mark
>>>>
>>>
>>> I tried changing the font, but that did help. I am running emacs in its
>>> own window.
>>>
>>
>> Ok switching to ubuntu mono regular fixed the issue. So it is really
>> related to font. I don't know what changed. I always used inconsolata
>> and it worked before.
>
> My guess is that incosolata does not have all the graphics characters,
> so emacs drops to a different font when displaying them. For some reason
> it is now dropping to some other different font and the display is
> getting messed up.
>
> I think what-cursor-position called with a prefix argument (so C-u M-x
> what-cursor-position) tells you (amongst other things) the font under
> the cursor.  For me, when using incosalata as default font,  the quarter
> circles and arrow heads are in some different font.
>
> I don't know what the fix would be if this is the problem but lets see
> if it the problem first!
>
> Best wishes
>

Yes that seems to be issue. For non working I have

 position: 158 of 780 (20%), column: 36

character: ├ (displayed as ├) (codepoint 9500, #o22434, #x251c)
preferred charset: unicode (Unicode (ISO10646))
code point in charset: 0x251C
   script: symbol
   syntax: _which means: symbol
 category: .:Base, c:Chinese, h:Korean, j:Japanese
 to input: type "C-x 8 RET HEX-CODEPOINT" or "C-x 8 RET NAME"
  buffer code: #xE2 #x94 #x9C
file code: #xE2 #x94 #x9C (encoded by coding system utf-8)
  display: by this font (glyph code)
xft:-unknown-TeX Gyre Termes 
Math-normal-normal-normal-*-17-*-*-*-*-0-iso1064


For working font i have

 position: 158 of 780 (20%), column: 36
character: ├ (displayed as ├) (codepoint 9500, #o22434, #x251c)
preferred charset: unicode (Unicode (ISO10646))
code point in charset: 0x251C
   script: symbol
   syntax: _which means: symbol
 category: .:Base, c:Chinese, h:Korean, j:Japanese
 to input: type "C-x 8 RET HEX-CODEPOINT" or "C-x 8 RET NAME"
  buffer code: #xE2 #x94 #x9C
file code: #xE2 #x94 #x9C (encoded by coding system utf-8)
  display: by this font (glyph code)
xft:-unknown-Ubuntu Mono-normal-normal-normal-*-17-*-*-*-m-0-iso10646-1 
(#x4E

-aneesh



Re: notmuch-tree display

2015-07-13 Thread Aneesh Kumar K.V
Mark Walters markwalters1...@gmail.com writes:

 On Sun, 12 Jul 2015, Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com 
 wrote:
 Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com writes:

 Mark Walters markwalters1...@gmail.com writes:

 It could be a font issue (for the tree graphical characters). Which font
 are you using? and is emacs running in a terminal or in its own window?

 Best wishes

 Mark


 I tried changing the font, but that did help. I am running emacs in its
 own window.


 Ok switching to ubuntu mono regular fixed the issue. So it is really
 related to font. I don't know what changed. I always used inconsolata
 and it worked before.

 My guess is that incosolata does not have all the graphics characters,
 so emacs drops to a different font when displaying them. For some reason
 it is now dropping to some other different font and the display is
 getting messed up.

 I think what-cursor-position called with a prefix argument (so C-u M-x
 what-cursor-position) tells you (amongst other things) the font under
 the cursor.  For me, when using incosalata as default font,  the quarter
 circles and arrow heads are in some different font.

 I don't know what the fix would be if this is the problem but lets see
 if it the problem first!

 Best wishes


Yes that seems to be issue. For non working I have

 position: 158 of 780 (20%), column: 36
 
character: ├ (displayed as ├) (codepoint 9500, #o22434, #x251c)
preferred charset: unicode (Unicode (ISO10646))
code point in charset: 0x251C
   script: symbol
   syntax: _which means: symbol
 category: .:Base, c:Chinese, h:Korean, j:Japanese
 to input: type C-x 8 RET HEX-CODEPOINT or C-x 8 RET NAME
  buffer code: #xE2 #x94 #x9C
file code: #xE2 #x94 #x9C (encoded by coding system utf-8)
  display: by this font (glyph code)
xft:-unknown-TeX Gyre Termes 
Math-normal-normal-normal-*-17-*-*-*-*-0-iso1064


For working font i have

 position: 158 of 780 (20%), column: 36
character: ├ (displayed as ├) (codepoint 9500, #o22434, #x251c)
preferred charset: unicode (Unicode (ISO10646))
code point in charset: 0x251C
   script: symbol
   syntax: _which means: symbol
 category: .:Base, c:Chinese, h:Korean, j:Japanese
 to input: type C-x 8 RET HEX-CODEPOINT or C-x 8 RET NAME
  buffer code: #xE2 #x94 #x9C
file code: #xE2 #x94 #x9C (encoded by coding system utf-8)
  display: by this font (glyph code)
xft:-unknown-Ubuntu Mono-normal-normal-normal-*-17-*-*-*-m-0-iso10646-1 
(#x4E

-aneesh

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


notmuch-tree display

2015-07-12 Thread Aneesh Kumar K.V
"Aneesh Kumar K.V"  writes:

> Mark Walters  writes:
>
>> It could be a font issue (for the tree graphical characters). Which font
>> are you using? and is emacs running in a terminal or in its own window?
>>
>> Best wishes
>>
>> Mark
>>
>
> I tried changing the font, but that did help. I am running emacs in its
> own window.
>

Ok switching to ubuntu mono regular fixed the issue. So it is really
related to font. I don't know what changed. I always used inconsolata
and it worked before.

-aneesh



notmuch-tree display

2015-07-12 Thread Aneesh Kumar K.V
Mark Walters  writes:

> It could be a font issue (for the tree graphical characters). Which font
> are you using? and is emacs running in a terminal or in its own window?
>
> Best wishes
>
> Mark
>

I tried changing the font, but that did help. I am running emacs in its
own window.

-aneesh



Re: notmuch-tree display

2015-07-12 Thread Aneesh Kumar K.V
Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com writes:

 Mark Walters markwalters1...@gmail.com writes:

 It could be a font issue (for the tree graphical characters). Which font
 are you using? and is emacs running in a terminal or in its own window?

 Best wishes

 Mark


 I tried changing the font, but that did help. I am running emacs in its
 own window.


Ok switching to ubuntu mono regular fixed the issue. So it is really
related to font. I don't know what changed. I always used inconsolata
and it worked before.

-aneesh

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


Re: notmuch-tree display

2015-07-12 Thread Aneesh Kumar K.V
Mark Walters markwalters1...@gmail.com writes:

 It could be a font issue (for the tree graphical characters). Which font
 are you using? and is emacs running in a terminal or in its own window?

 Best wishes

 Mark


I tried changing the font, but that did help. I am running emacs in its
own window.

-aneesh

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


notmuch-tree display

2015-07-11 Thread Aneesh Kumar K.V

Hi,

Any suggestion on what might be causing this

https://github.com/syl20bnr/spacemacs/issues/2309

-aneesh



notmuch-tree display

2015-07-11 Thread Aneesh Kumar K.V

Hi,

Any suggestion on what might be causing this

https://github.com/syl20bnr/spacemacs/issues/2309

-aneesh

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


Error when viewing mails.

2013-06-04 Thread Aneesh Kumar K.V

I started seeing this with latest notmuch update.

Debugger entered--Lisp error: (wrong-type-argument listp t)
  memql(:notmuch-part t)
  #[(v) "\301\302\"\203\207\302B\211\207" [v memql :notmuch-part] 
3](t)
  notmuch-map-text-property(3037 2 rear-nonsticky #[(v) "\301\302\"\203
\207\302B\211\207" [v memql :notmuch-part] 3])
  notmuch-show-insert-bodypart((:body ((:content ((:content "This is great 
news! I'm glad to hear about both of these projects. Please\ndo send updates to 
the mailing lists as they progress!\n\nThanks,\nNoah\n\n\nOn Tue, May 28, 2013 
at 8:10 AM, Ludovic Court?s  wrote:\n\n> Hello Guilers & 
Emacsers!\n>\n> I?m pleased to announce that there will be two Guile-related 
projects\n> going on as part of GSoC this year:\n>\n>   ? Guile-Emacs, by BT 
Templeton\n>\n> 
http://www.google-melange.com/gsoc/proposal/review/google/gsoc2013/bpt/35002\n>\n>
 BT will continue the excellent work that has been done on Guile and\n> 
Emacs integration.  Previous GSoCs focused on providing a\n> full-fledged 
Emacs Lisp front-end to Guile?s compiler and VM.  This\n> project focuses 
on the missing piece: replacing the Emacs Lisp\n> interpreter in Emacs by 
Guile.\n>\n>   ? Emacsy, by Shane Celis\n>\n> 
https://google-melange.appspot.com/gsoc/proposal/review/google/gsoc2013/shanecelis/1\n>\n>
 This is another approach to the Emacs/Guile vision: Shane will work\n> 
on a framework, Emacsy, that will allow application developers to\n> easily 
?emacsify? them?i.e., by providing the mechanisms for a\n> 
?key-lookup-execute-command loop? similar to that of Emacs, with\n> Guile 
inside.\n>\n> (Shane and BT: feel free to introduce yourself and your 
project.)\n>\n> I?m the mentor for these two projects, but I really hope they 
will\n> develop with good interaction with the Guile and Emacs folk.  In\n> 
particular, I would like development issues and road maps to be\n> discussed 
primarily on the relevant project mailing lists.\n>\n> I?m very excited about 
these two projects.  I think they will help\n> promote a vision where users are 
in control and can readily exert their\n> freedom to study and adapt the 
software to their needs.\n>\n> Thanks a lot to Jos? and Giuseppe who have 
wonderfully handled GNU?s\n> participation in GSoC, and happy hacking!\n>\n> 
Ludo?.\n>\n" :content-type "text/plain" :id 2) (:content-length 2663 
:content-transfer-encoding "quoted-printable" :content-charset "windows-1252" 
:content-type "text/html" :id 3)) :content-type "multipart/alternative" :id 1)) 
:headers (:Date "Mon, 03 Jun 2013 23:15:45 -0400" :Cc "shane.celis at uvm.edu, 
Guile Mailing List , BT Templeton , 
Emacs development discussions " :To "Ludovic Court?s 
" :From "Noah Lavine " :Subject 
"Re: GSoC: Guile-Emacs + Emacsy") :tags ("emacs" "unread") :date_relative 
"Today 08:45" :timestamp 1370315745 :filename 
"/home/kvaneesh/Maildir/Inbox/cur/1370321733.30971_0.skywalker:2," :excluded 
nil :match t :id "CA+U71=MUFmnnw9_d1-W94hAs5mZnUD4B9jCQWOVsh55=tsHSXw at 
mail.gmail.com") (:content ((:content "This is great news! I'm glad to hear 
about both of these projects. Please\ndo send updates to the mailing lists as 
they progress!\n\nThanks,\nNoah\n\n\nOn Tue, May 28, 2013 at 8:10 AM, Ludovic 
Court?s  wrote:\n\n> Hello Guilers & Emacsers!\n>\n> I?m 
pleased to announce that there will be two Guile-related projects\n> going on 
as part of GSoC this year:\n>\n>   ? Guile-Emacs, by BT Templeton\n>\n> 
http://www.google-melange.com/gsoc/proposal/review/google/gsoc2013/bpt/35002\n>\n>
 BT will continue the excellent work that has been done on Guile and\n> 
Emacs integration.  Previous GSoCs focused on providing a\n> full-fledged 
Emacs Lisp front-end to Guile?s compiler and VM.  This\n> project focuses 
on the missing piece: replacing the Emacs Lisp\n> interpreter in Emacs by 
Guile.\n>\n>   ? Emacsy, by Shane Celis\n>\n> 
https://google-melange.appspot.com/gsoc/proposal/review/google/gsoc2013/shanecelis/1\n>\n>
 This is another approach to the Emacs/Guile vision: Shane will work\n> 
on a framework, Emacsy, that will allow application developers to\n> easily 
?emacsify? them?i.e., by providing the mechanisms for a\n> 
?key-lookup-execute-command loop? similar to that of Emacs, with\n> Guile 
inside.\n>\n> (Shane and BT: feel free to introduce yourself and your 
project.)\n>\n> I?m the mentor for these two projects, but I really hope they 
will\n> develop with good interaction with the Guile and Emacs folk.  In\n> 
particular, I would like development issues and road maps to be\n> discussed 
primarily on the relevant project mailing lists.\n>\n> I?m very excited about 
these two projects.  I think they will help\n> promote a vision where users are 
in control and can readily exert their\n> freedom to study and adapt the 
software to their needs.\n>\n> Thanks a lot to Jos? and Giuseppe who have 
wonderfully handled GNU?s\n> 

notmuch search and tags

2012-11-05 Thread Aneesh Kumar K.V
Mark Walters  writes:

> Hi
>
> Do you have some customisation of the notmuch search line
> (notmuch-search-result-format) in your .emacs file?
>
> Previously the user specified format for tags was ignored (and
> automatically enclosed the tags in brackets). Over the summer Austin
> fixed this and many other bugs (with the move to json for the search results).
>
> If you do have a customised search line then just replacing the ("tags"
> . "%s) by ("tag" . "(%s)") should fix it.
>

That was it. Updating notmch-search-result-format fixed it.

Thanks for the help
-aneesh



notmuch search and tags

2012-11-05 Thread Aneesh Kumar K.V


We have the mails appearing as below now. Earlier the tags towards the
end used be enclosed in "(" ")"

[21/21]   Today 10:57Blake Jones, Jani Nikula, Tomi Ollila[PATCH 05/10] 
install: check for non-SysV version (Solaris support) notmuch unread
[5/5] Today 09:58Eirik Byrkjeflot Anonsen, David Bremner, Jani Nikula, 
Austin Clements Automatic suppression of non-duplicate 
messagesnotmuch unread


-aneesh



Re: notmuch search and tags

2012-11-05 Thread Aneesh Kumar K.V
Mark Walters markwalters1...@gmail.com writes:

 Hi

 Do you have some customisation of the notmuch search line
 (notmuch-search-result-format) in your .emacs file?

 Previously the user specified format for tags was ignored (and
 automatically enclosed the tags in brackets). Over the summer Austin
 fixed this and many other bugs (with the move to json for the search results).

 If you do have a customised search line then just replacing the (tags
 . %s) by (tag . (%s)) should fix it.


That was it. Updating notmch-search-result-format fixed it.

Thanks for the help
-aneesh

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


notmuch search and tags

2012-11-04 Thread Aneesh Kumar K.V


We have the mails appearing as below now. Earlier the tags towards the
end used be enclosed in ( )

[21/21]   Today 10:57Blake Jones, Jani Nikula, Tomi Ollila[PATCH 05/10] 
install: check for non-SysV version (Solaris support) notmuch unread
[5/5] Today 09:58Eirik Byrkjeflot Anonsen, David Bremner, Jani Nikula, 
Austin Clements Automatic suppression of non-duplicate 
messagesnotmuch unread


-aneesh

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


Error with contrib/notmuch-pick

2012-10-30 Thread Aneesh Kumar K.V
"Aneesh Kumar K.V"  writes:

> I get the below error with notmuch-pick in upstream/contrib
>
> error in process filter: notmuch-pick-clean-address: Symbol's function 
> definition is void: notmuch-clean-address
> error in process filter: Symbol's function definition is void: 
> notmuch-clean-address

Ignore that. A previous stale .elc file left by an earlier make install

-aneesh



Error with contrib/notmuch-pick

2012-10-30 Thread Aneesh Kumar K.V

I get the below error with notmuch-pick in upstream/contrib

error in process filter: notmuch-pick-clean-address: Symbol's function 
definition is void: notmuch-clean-address
error in process filter: Symbol's function definition is void: 
notmuch-clean-address

-aneesh



Error with contrib/notmuch-pick

2012-10-30 Thread Aneesh Kumar K.V

I get the below error with notmuch-pick in upstream/contrib

error in process filter: notmuch-pick-clean-address: Symbol's function 
definition is void: notmuch-clean-address
error in process filter: Symbol's function definition is void: 
notmuch-clean-address

-aneesh

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


Re: Error with contrib/notmuch-pick

2012-10-30 Thread Aneesh Kumar K.V
Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com writes:

 I get the below error with notmuch-pick in upstream/contrib

 error in process filter: notmuch-pick-clean-address: Symbol's function 
 definition is void: notmuch-clean-address
 error in process filter: Symbol's function definition is void: 
 notmuch-clean-address

Ignore that. A previous stale .elc file left by an earlier make install

-aneesh

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


[PATCH 0/5] Notmuch Pick (WIP or contrib)

2012-07-25 Thread Aneesh Kumar K.V
Mark Walters  writes:

> Hello
>
> Notmuch pick is an emacs view which displays a threaded view of
> messages: each message has its own line and the thread structure is
> shown with UTF-8 graphics characters (so it looks vaguely similar to
> mutt's threaded view): see http://kanelephant.com/screen.png for a screenshot.
>
> Pick was originally written by David Edmondon and posted on irc and I
> have been developing it on and off since.  Now that almost all the
> backend changes it uses are in I would like to see about getting it
> into mainline.
>
> The code is not of the same standard as mainline code: in particular a
> lot of the code is written by me and is working but unidiomatic
> lisp. It has also not had widespread testing so I would expect it to
> have several bugs.
>
> We could try getting it into mainline using the normal review type
> approach, but the patch is necessarily large (it implements a new view
> similar in size to show or search) with the main pick.el file being
> nearly 900 lines.
>
> An alternative approach would be to accept it into contrib and then
> reviewers/users could submit fixes for the problems directly.
>
> This patch series implements the latter approach, but I am definitely
> happy to try for the former or some other approach.
>


I have been using this series for a long time and have not found any
issues. How about adding pick as a part of proper emacs file and have a
config value that disables pick by default. ? So only when
notmuch-enable-pick is set we will load notmuch-pick.el ?

> In its current form the user needs to copy (or link) the
> notmuch-pick.el from contrib into the emacs directory and then build
> notmuch as usual. 

With that users won't require to do the above.

>There are two very small patches to "mainline" code:
> one to compile and load the pick file if present and one small tweak
> to notmuch-show.el. Then in contrib/notmuch-pick there are three
> files: the notmuch-pick.el file itself, a README describing
> documenting install and use, and a TODO which contains the main things
> I think need doing (and I will try to update this in light of comments
> received).
>



-aneesh



Re: [PATCH 0/5] Notmuch Pick (WIP or contrib)

2012-07-24 Thread Aneesh Kumar K.V
Mark Walters markwalters1...@gmail.com writes:

 Hello

 Notmuch pick is an emacs view which displays a threaded view of
 messages: each message has its own line and the thread structure is
 shown with UTF-8 graphics characters (so it looks vaguely similar to
 mutt's threaded view): see http://kanelephant.com/screen.png for a screenshot.

 Pick was originally written by David Edmondon and posted on irc and I
 have been developing it on and off since.  Now that almost all the
 backend changes it uses are in I would like to see about getting it
 into mainline.

 The code is not of the same standard as mainline code: in particular a
 lot of the code is written by me and is working but unidiomatic
 lisp. It has also not had widespread testing so I would expect it to
 have several bugs.

 We could try getting it into mainline using the normal review type
 approach, but the patch is necessarily large (it implements a new view
 similar in size to show or search) with the main pick.el file being
 nearly 900 lines.

 An alternative approach would be to accept it into contrib and then
 reviewers/users could submit fixes for the problems directly.

 This patch series implements the latter approach, but I am definitely
 happy to try for the former or some other approach.



I have been using this series for a long time and have not found any
issues. How about adding pick as a part of proper emacs file and have a
config value that disables pick by default. ? So only when
notmuch-enable-pick is set we will load notmuch-pick.el ?

 In its current form the user needs to copy (or link) the
 notmuch-pick.el from contrib into the emacs directory and then build
 notmuch as usual. 

With that users won't require to do the above.

There are two very small patches to mainline code:
 one to compile and load the pick file if present and one small tweak
 to notmuch-show.el. Then in contrib/notmuch-pick there are three
 files: the notmuch-pick.el file itself, a README describing
 documenting install and use, and a TODO which contains the main things
 I think need doing (and I will try to update this in light of comments
 received).




-aneesh

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


[RFC PATCH v2 0/3] notmuch-pick: an emacs threaded message view with split-pane

2012-02-13 Thread Aneesh Kumar K.V
On Sun, 12 Feb 2012 18:49:36 +, Mark Walters  
wrote:
> Here is a rebased version of the notmuch-pick patch set
> id:"87d39k1gvi.fsf at qmul.ac.uk". It now applies directly 
> to master since Jani's notmuch-show command line parsing 
> has been pushed.
> 
> It includes the significant bug fix (at least for anyone working 
> with a dark background) from Daniel making matched messages 
> highlight color both configurable and have a sensible default.
> These are in the notmuch-pick subgroup of the customize menus.
> 

Really nice patchset. It would be really nice if we can get the serach
limit patchset before this. That way the pick result will be limitted.
I also noticied that mails are not marked as read when i select them in
the notmuch-pick mode. Also for me the tree structures appears as
below. 

 Today 00:19  Mark Walters  ???[RFC PATCH v2 1/3] cli: notmuch-show 
changes to support pick (notmuch)
 Today 02:38  Daniel Schoepe ...
  (notmuch, signed)
 Today 03:38  Mark Walters   ...
  (notmuch)
 Today 00:19  Mark Walters  ???[RFC PATCH v2 2/3] emacs: changes to 
other files to support notmuch-pick (notmuch)
 Today 03:57  Mark Walters   ...
  (notmuch)
 Today 00:19  Mark Walters  ???[RFC PATCH v2 3/3] emacs: add 
notmuch-pick itself  (notmuch)




Re: [RFC PATCH v2 0/3] notmuch-pick: an emacs threaded message view with split-pane

2012-02-13 Thread Aneesh Kumar K.V
On Sun, 12 Feb 2012 18:49:36 +, Mark Walters markwalters1...@gmail.com 
wrote:
 Here is a rebased version of the notmuch-pick patch set
 id:87d39k1gvi@qmul.ac.uk. It now applies directly 
 to master since Jani's notmuch-show command line parsing 
 has been pushed.
 
 It includes the significant bug fix (at least for anyone working 
 with a dark background) from Daniel making matched messages 
 highlight color both configurable and have a sensible default.
 These are in the notmuch-pick subgroup of the customize menus.
 

Really nice patchset. It would be really nice if we can get the serach
limit patchset before this. That way the pick result will be limitted.
I also noticied that mails are not marked as read when i select them in
the notmuch-pick mode. Also for me the tree structures appears as
below. 

 Today 00:19  Mark Walters  ├┬►[RFC PATCH v2 1/3] cli: notmuch-show 
changes to support pick (notmuch)
 Today 02:38  Daniel Schoepe│├─► ...
  (notmuch, signed)
 Today 03:38  Mark Walters  │╰─► ...
  (notmuch)
 Today 00:19  Mark Walters  ├┬►[RFC PATCH v2 2/3] emacs: changes to 
other files to support notmuch-pick (notmuch)
 Today 03:57  Mark Walters  │╰─► ...
  (notmuch)
 Today 00:19  Mark Walters  ├─►[RFC PATCH v2 3/3] emacs: add 
notmuch-pick itself  (notmuch)


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


[DRAFT PATCH] emacs: support limiting the number of results shown in search results

2011-12-04 Thread Aneesh Kumar K.V
On Thu, 17 Nov 2011 22:07:38 +0200, Jani Nikula  wrote:
> Add support for limiting the maximum number of results initially displayed
> in search results. When enabled, the search results will contain push
> buttons to double the number of results displayed or to show unlimited
> results.
> 
> The approach is inspired by vc-print-log in Emacs vc.el.
> 
> Signed-off-by: Jani Nikula 
> 

This break notmuch-search-operate-all, I guess the change should also
make sure notmuch-search-operate-all also limit its operation to
notmuch-search-limit ?

-aneesh



Re: [DRAFT PATCH] emacs: support limiting the number of results shown in search results

2011-12-03 Thread Aneesh Kumar K.V
On Thu, 17 Nov 2011 22:07:38 +0200, Jani Nikula j...@nikula.org wrote:
 Add support for limiting the maximum number of results initially displayed
 in search results. When enabled, the search results will contain push
 buttons to double the number of results displayed or to show unlimited
 results.
 
 The approach is inspired by vc-print-log in Emacs vc.el.
 
 Signed-off-by: Jani Nikula j...@nikula.org
 

This break notmuch-search-operate-all, I guess the change should also
make sure notmuch-search-operate-all also limit its operation to
notmuch-search-limit ?

-aneesh

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


Re: priorities for 0.7

2011-07-06 Thread Aneesh Kumar K.V
On Wed, 06 Jul 2011 09:55:00 -0700, Jameson Graef Rollins 
jroll...@finestructure.net wrote:
Non-text part: multipart/mixed
Non-text part: multipart/signed
 Hey, folks.  Now that 0.6 is *finally* out the door, it's time to start
 working on 0.7.  As Interim Distinguished co-Chief Vice Tyrant I have
 been tasked with starting the discussion on 0.7 release priorities.
 
 Below is just the beginning of list of things that have been discussed
 on the list that we should consider merging or working on for 0.7.  It's
 weighted towards stuff that I've worked on only because I'm more
 familiar with the state of those patches.  Please send follow-ups to
 this list to elaborate on certain things, or bring up other patches that
 should be considered [0].  We can then push on Carl to merge these ahead
 of the 0.7 freeze.
 
 - notmuch-new atomicity:
 
   id:1307822683-848-1-git-send-email-amdra...@mit.edu
 
   I believe that the above is that latest version of this series; Austin
   can point us to the right one if it's not.  This is an important
   series that is long overdue to be merged.  It should definitely be a
   top priority.
 
 - message/rfc822 part support:
 
   id:1307120466-4980-1-git-send-email-jroll...@finestructure.net
   id:1307320169-29905-1-git-send-email-jroll...@finestructure.net
 
   rfc822 part handling is a bit broken now after the notmuch-show
   rework.  The above patch series should have been included in 0.6 to
   fix a couple of regressions.  In the meantime Austin and I have
   started looking at further rework of notmuch-show to try to clean it
   up even more.  This rework might supersedes these patches, but it
   depends on how far we get.
 
 - emacs: Add notmuch-show-refresh-view function
 
   id:1306627784-3401-1-git-send-email-jroll...@finestructure.net
 
 - emacs: Add callback functions to crypto sigstatus button.
 
   id:1306861633-3873-1-git-send-email-jroll...@finestructure.net
 
 - emacs: notmuch-hello improvements (Daniel Schoepe, Michal Sojka,
   Dmitry Kurochkin, Pieter Praet)
 
   These guys have been working on various improvements to the
   notmuch-hello page.  I'll let them comment on where they're at with
   that, and what should be merged.
 
 - emacs: tagging race conditions (Austin Clements, Pieter Praet)
 
   Austin and Pieter have been looking at home to eliminate some race
   conditions when tagging from the emacs interface.  I'll let them
   comment on where that's at.
 
 - emacs: default key bindings
 
   There's been a lot of discussion about default key bindings for the
   emacs UI.  This issue frankly terrifies me since I worry that it is
   basically impossible to converge on anything.  I think we'll need to
   see a specific full proposal before we can really consider what to do
   here.
 
 - I know there are other old patches that are sinking in to the abyss.
   Hopefully any of those that are still relevant can be excavated.


Don't overload same-window-regex

id:1288200417-6584-1-git-send-email-aneesh.ku...@linux.vnet.ibm.com

Add reply-to header
id:1288200417-6584-2-git-send-email-aneesh.ku...@linux.vnet.ibm.com
I guess we want a generic form for this. I guess we want enable the
user to select what fields in the mail-header they would like to index

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


[PATCH 3/3] emacs: Test for thread-outlining

2011-06-14 Thread Aneesh Kumar K.V
On Mon, 13 Jun 2011 01:31:20 +0200, Daniel Schoepe  wrote:
> --- /dev/null
> +++ b/test/emacs.expected-output/notmuch-show-thread-outline
> @@ -0,0 +1,7 @@
> +Lars Kellogg-Stedman  - 2009-11-17
> + Mikhail Gusarov  - 2009-11-17
> +  Lars Kellogg-Stedman  - 2009-11-17
> +   "Mikhail Gusarov"  - 2009-11-17
> +   "Keith Packard"  - 2009-11-17
> +Lars Kellogg-Stedman  - 2009-11-18
> + "Carl Worth"  - 2009-11-18
> -- 

It would be nice to have the above as . I guess GNUs does the below

Lars Kellogg-Stedman  - 2009-11-17
|-> Mikhail Gusarov  - 2009-11-17
|-> Lars Kellogg-Stedman  - 2009-11-17
|->"Mikhail Gusarov"  - 2009-11-17
|->"Keith Packard"  - 2009-11-17

-aneesh


Re: [PATCH 3/3] emacs: Test for thread-outlining

2011-06-14 Thread Aneesh Kumar K.V
On Mon, 13 Jun 2011 01:31:20 +0200, Daniel Schoepe 
daniel.scho...@googlemail.com wrote:
 --- /dev/null
 +++ b/test/emacs.expected-output/notmuch-show-thread-outline
 @@ -0,0 +1,7 @@
 +Lars Kellogg-Stedman l...@seas.harvard.edu - 2009-11-17
 + Mikhail Gusarov dotted...@dottedmag.net - 2009-11-17
 +  Lars Kellogg-Stedman l...@seas.harvard.edu - 2009-11-17
 +   Mikhail Gusarov dotted...@dottedmag.net - 2009-11-17
 +   Keith Packard kei...@keithp.com - 2009-11-17
 +Lars Kellogg-Stedman l...@seas.harvard.edu - 2009-11-18
 + Carl Worth cwo...@cworth.org - 2009-11-18
 -- 

It would be nice to have the above as . I guess GNUs does the below

Lars Kellogg-Stedman l...@seas.harvard.edu - 2009-11-17
|- Mikhail Gusarov dotted...@dottedmag.net - 2009-11-17
|- Lars Kellogg-Stedman l...@seas.harvard.edu - 2009-11-17
|-Mikhail Gusarov dotted...@dottedmag.net - 2009-11-17
|-Keith Packard kei...@keithp.com - 2009-11-17

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


[PATCH] emacs: Accommodate message-mode updates.

2010-11-19 Thread Aneesh Kumar K. V
On Fri, 19 Nov 2010 16:06:40 +, David Edmondson  wrote:
> On Fri, 19 Nov 2010 21:31:36 +0530, "Aneesh Kumar K. V"  linux.vnet.ibm.com> wrote:
> > On Tue, 16 Nov 2010 17:51:38 +, David Edmondson  wrote:
> > > Message mode uses a different name for composition buffers in newer
> > > versions of emacs. Allow for this when causing the composition window
> > > to overlay the viewing window.
> > > ---
> > > 
> > > I don't understand why Aneesh chose to use `add-hook' and `purecopy'.
> > 
> > So what when i have unset mail added via .emacs even the older version
> > will work. making sure if the name change again i can fix it by a .emacs
> > update rather than notmuch code update.
> 
> What would you add to .emacs?
> 

In custom-set-variable i have the below

 '(same-window-buffer-names (quote ("*unsent mail*" "*shell*" "*mail*" 
"*inferior-lisp*" "*ielm*" "*scheme*")))
 '(same-window-regexps (quote ("\\*rsh-[^-]*\\*\\(\\|<[0-9]*>\\)" 
"\\*telnet-.*\\*\\(\\|<[0-9]+>\\)" "^\\*rlogin-.*\\*\\(\\|<[0-9]+>\\)" 
"\\*info\\*\\(\\|<[0-9]+>\\)" "\\*gud-.*\\*\\(\\|<[0-9]+>\\)" 
"\\`\\*Customiz.*\\*\\'" "\\*unsent mail .*")))


-aneesh


[PATCH] emacs: Accommodate message-mode updates.

2010-11-19 Thread Aneesh Kumar K. V
On Tue, 16 Nov 2010 17:51:38 +, David Edmondson  wrote:
> Message mode uses a different name for composition buffers in newer
> versions of emacs. Allow for this when causing the composition window
> to overlay the viewing window.
> ---
> 
> I don't understand why Aneesh chose to use `add-hook' and `purecopy'.

So what when i have unset mail added via .emacs even the older version
will work. making sure if the name change again i can fix it by a .emacs
update rather than notmuch code update.



> 
>  emacs/notmuch-mua.el |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
> index dc7b386..70c8dff 100644
> --- a/emacs/notmuch-mua.el
> +++ b/emacs/notmuch-mua.el
> @@ -88,7 +88,7 @@ list."
>  (let
>   ;; Overlay the composition window on that being used to read
>   ;; the original message.
> - ((same-window-regexps '("\\*mail .*")))
> + ((same-window-regexps '("\\*mail .*" "\\*unsent mail .*")))
>(notmuch-mua-mail (mail-header 'to headers)
>   (mail-header 'subject headers)
>   (message-headers-to-generate headers t '(to subject


-aneesh


Re: [PATCH] emacs: Accommodate message-mode updates.

2010-11-19 Thread Aneesh Kumar K. V
On Tue, 16 Nov 2010 17:51:38 +, David Edmondson d...@dme.org wrote:
 Message mode uses a different name for composition buffers in newer
 versions of emacs. Allow for this when causing the composition window
 to overlay the viewing window.
 ---
 
 I don't understand why Aneesh chose to use `add-hook' and `purecopy'.

So what when i have unset mail added via .emacs even the older version
will work. making sure if the name change again i can fix it by a .emacs
update rather than notmuch code update.



 
  emacs/notmuch-mua.el |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
 index dc7b386..70c8dff 100644
 --- a/emacs/notmuch-mua.el
 +++ b/emacs/notmuch-mua.el
 @@ -88,7 +88,7 @@ list.
  (let
   ;; Overlay the composition window on that being used to read
   ;; the original message.
 - ((same-window-regexps '(\\*mail .*)))
 + ((same-window-regexps '(\\*mail .* \\*unsent mail .*)))
(notmuch-mua-mail (mail-header 'to headers)
   (mail-header 'subject headers)
   (message-headers-to-generate headers t '(to subject


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


Re: [PATCH] emacs: Accommodate message-mode updates.

2010-11-19 Thread Aneesh Kumar K. V
On Fri, 19 Nov 2010 16:06:40 +, David Edmondson d...@dme.org wrote:
 On Fri, 19 Nov 2010 21:31:36 +0530, Aneesh Kumar K. V 
 aneesh.ku...@linux.vnet.ibm.com wrote:
  On Tue, 16 Nov 2010 17:51:38 +, David Edmondson d...@dme.org wrote:
   Message mode uses a different name for composition buffers in newer
   versions of emacs. Allow for this when causing the composition window
   to overlay the viewing window.
   ---
   
   I don't understand why Aneesh chose to use `add-hook' and `purecopy'.
  
  So what when i have unset mail added via .emacs even the older version
  will work. making sure if the name change again i can fix it by a .emacs
  update rather than notmuch code update.
 
 What would you add to .emacs?
 

In custom-set-variable i have the below

 '(same-window-buffer-names (quote (*unsent mail* *shell* *mail* 
*inferior-lisp* *ielm* *scheme*)))
 '(same-window-regexps (quote (\\*rsh-[^-]*\\*\\(\\|[0-9]*\\) 
\\*telnet-.*\\*\\(\\|[0-9]+\\) ^\\*rlogin-.*\\*\\(\\|[0-9]+\\) 
\\*info\\*\\(\\|[0-9]+\\) \\*gud-.*\\*\\(\\|[0-9]+\\) 
\\`\\*Customiz.*\\*\\' \\*unsent mail .*)))


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


[PATCH 3/3] notmuch: Add support for listing the parent message

2010-11-04 Thread Aneesh Kumar K. V
On Thu, 04 Nov 2010 09:28:40 +, David Edmondson  wrote:
> On Wed, 27 Oct 2010 22:56:57 +0530, "Aneesh Kumar K.V"  linux.vnet.ibm.com> wrote:
> > From: Aneesh Kumar K.V 
> > 
> > When you have long thread, it would be nice to be able to
> > show the message to which the current message is a reply
> 
> The patch fires up a new search, destroying my context. Shouldn't the
> parent message be visible in the current thread and, if so, perhaps just
> searching in the current buffer for it (and jumping back there) be
> possible? (Maybe even with a key to pop back to the child easily.)
> 

It should actually stack up. That is, it fires up a new search but then a
'q' should bring back the old context. One of the thing i really
wanted to keep was the ability to go back to the old context with a key
binding which in this case is achieved by 'q'

-aneesh


Re: [PATCH 3/3] notmuch: Add support for listing the parent message

2010-11-04 Thread Aneesh Kumar K. V
On Thu, 04 Nov 2010 09:28:40 +, David Edmondson d...@dme.org wrote:
 On Wed, 27 Oct 2010 22:56:57 +0530, Aneesh Kumar K.V 
 aneesh.ku...@linux.vnet.ibm.com wrote:
  From: Aneesh Kumar K.V aneesh.ku...@gmail.com
  
  When you have long thread, it would be nice to be able to
  show the message to which the current message is a reply
 
 The patch fires up a new search, destroying my context. Shouldn't the
 parent message be visible in the current thread and, if so, perhaps just
 searching in the current buffer for it (and jumping back there) be
 possible? (Maybe even with a key to pop back to the child easily.)
 

It should actually stack up. That is, it fires up a new search but then a
'q' should bring back the old context. One of the thing i really
wanted to keep was the ability to go back to the old context with a key
binding which in this case is achieved by 'q'

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


[PATCH 3/3] notmuch: Add support for listing the parent message

2010-10-27 Thread Aneesh Kumar K.V
From: Aneesh Kumar K.V <aneesh.ku...@gmail.com>

When you have long thread, it would be nice to be able to
show the message to which the current message is a reply

Signed-off-by: Aneesh Kumar K.V 
---
 emacs/notmuch-show.el |   12 
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 3fc3787..139c44d 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -582,6 +582,7 @@ function is used. "
(define-key map " " 'notmuch-show-advance-and-archive)
(define-key map (kbd "M-RET") 'notmuch-show-open-or-close-all)
(define-key map (kbd "RET") 'notmuch-show-toggle-message)
+   (define-key map "A" 'notmuch-show-search-parent)
map)
   "Keymap for \"notmuch show\" buffers.")
 (fset 'notmuch-show-mode-map notmuch-show-mode-map)
@@ -1095,4 +1096,15 @@ buffer."

 ;;

+(defun notmuch-show-get-parent ()
+  (let ((id (notmuch-show-get-header :In-Reply-To)))
+(if (string-match "^<\\(.*\\)>$" id)
+   (match-string 1 id)
+  id)))
+
+(defun notmuch-show-search-parent ()
+  "Search parent message"
+  (interactive)
+  (notmuch-search (concat "id:\"" (notmuch-show-get-parent) "\"")))
+
 (provide 'notmuch-show)
-- 
1.7.1



[PATCH 2/3] notmuch: Add support for In-Reply-To in header

2010-10-27 Thread Aneesh Kumar K.V
This will later used to implment switching to the replied to mail
from emacs

Signed-off-by: Aneesh Kumar K.V 
---
 notmuch-show.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/notmuch-show.c b/notmuch-show.c
index ea465de..dbb4672 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -287,7 +287,7 @@ static void
 format_headers_text (const void *ctx, notmuch_message_t *message)
 {
 const char *headers[] = {
-   "Subject", "From", "To", "Cc", "Bcc", "Date"
+   "Subject", "From", "To", "Cc", "Bcc", "Date", "In-Reply-To"
 };
 const char *name, *value;
 unsigned int i;
@@ -306,7 +306,7 @@ static void
 format_headers_json (const void *ctx, notmuch_message_t *message)
 {
 const char *headers[] = {
-   "Subject", "From", "To", "Cc", "Bcc", "Date"
+   "Subject", "From", "To", "Cc", "Bcc", "Date", "In-Reply-To"
 };
 const char *name, *value;
 unsigned int i;
-- 
1.7.1



[PATCH 1/3] emacs: Don't overload same-window-regexps

2010-10-27 Thread Aneesh Kumar K.V
From: Aneesh Kumar K.V <aneesh.ku...@gmail.com>

Also add unset mail to the regexps. Recent emacs changes change the buffer name

Signed-off-by: Aneesh Kumar K.V 
---
 emacs/notmuch-mua.el |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 0ad079f..23ffd96 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -85,10 +85,13 @@ list."
  (setq headers (mail-header-extract)
   (forward-line 1)
   (setq body (buffer-substring (point) (point-max
-(let
+(progn
;; Overlay the composition window on that being used to read
;; the original message.
-   ((same-window-regexps '("\\*mail .*")))
+  (add-hook 'same-window-regexps
+   (purecopy "\\*unsent mail.*"))
+  (add-hook 'same-window-regexps
+   (purecopy "\\*mail .*"))
   (notmuch-mua-mail (mail-header 'to headers)
(mail-header 'subject headers)
(message-headers-to-generate headers t '(to subject
-- 
1.7.1



Wrapping up the 0.3 release

2010-04-26 Thread Aneesh Kumar K. V
On Sat, 24 Apr 2010 08:37:11 -0700, Carl Worth  wrote:
> I pushed hard to get most everything we wanted for 0.3 done yesterday,
> (which was one week since 0.2). I think we're still within the tolerance
> of my published "about a week" schedule, but I would like to wrap things
> up soon.
> 
> Here are the features that I still have left in my queue at this point:
> 
>   * improve from-header guessing
> 
> Dirk is looking into fixing a segfault found by the test suite here
> 
>   * Fcc, Maildir, and Emacs message-mode -- a bit of code
> 
> This is next on my list to apply. Thanks for the extra testing!
> 
> There are a few other features that people had proposed but that didn't
> pass review yet. If people follow-up with those quickly, they can still
> go in. Otherwise, there's another new merge window coming up soon!
> 
> Meanwhile, I'm aware of two regressions I'd like to see fixed before
> 0.3:
> 
>   * Reply is now splitting the window
> 
> We're copying the original message into the new reply buffer, so
> what's the advantage of splitting here?

This actually have a disadvantage that after sending the mail i have to
explicitly kill the buffer


> 
>   * Composing a new message with 'm' brings up headers in a scrambled
> order.
> 
> A minor point, but it would be nice to fix this.
> 
> Finally, any of the tweaks I suggested to notmuch-hello mode would be
> quite welcome. I might take a whack at some of these.
> 
> Then, there's the task of writing up NEWS. Dirk started helping with
> that, which I appreciate. If anyone else wants to write up descriptions
> of their favorite features that have been merged, that would be great.

Another issue i found was


* A thread with only one message doesn't show the message body by
  default. I need to use 'h' key binding to show the message
  body. Multiple message thread seems to work fine.


-aneesh


[notmuch] JSON based emacs UI

2010-03-29 Thread Aneesh Kumar K. V
On Mon, 29 Mar 2010 10:17:01 +0100, David Edmondson  wrote:
> On Sun, 28 Mar 2010 14:03:44 -0300, Fernando Carrijo  yahoo.com.br> wrote:
> > David Edmondson  wrote:
> > > 'RET' anywhere in the message is supposed to toggle visibility of the
> > > message. That was not working perfectly - a little forced redisplay
> > > helped (just pushed).
> > > 
> > > Toggling the visibility of headers is done with 'h'. There's currently
> > > no way to do that by pressing 'RET' somewhere. (You can also toggle the
> > > body with 'b'.)
> > 
> > I fear this is not correct. I cloned notmuch from Carl's git repository,
> > and whenever I press 'RET' while the point is over the subject line, the
> > result is the same as pressing 'h': the subject information gets toggled.
> 
> Is this considered a feature that blocks people from switching to the
> JSON based UI?
> 

For me it is not an issue and i already switched to jason based ui. The
diff-mode for inline patch itself is a big motivation for me to switch.

-aneesh


Re: [notmuch] JSON based emacs UI

2010-03-29 Thread Aneesh Kumar K. V
On Mon, 29 Mar 2010 10:17:01 +0100, David Edmondson d...@dme.org wrote:
 On Sun, 28 Mar 2010 14:03:44 -0300, Fernando Carrijo fcarr...@yahoo.com.br 
 wrote:
  David Edmondson d...@dme.org wrote:
   'RET' anywhere in the message is supposed to toggle visibility of the
   message. That was not working perfectly - a little forced redisplay
   helped (just pushed).
   
   Toggling the visibility of headers is done with 'h'. There's currently
   no way to do that by pressing 'RET' somewhere. (You can also toggle the
   body with 'b'.)
  
  I fear this is not correct. I cloned notmuch from Carl's git repository,
  and whenever I press 'RET' while the point is over the subject line, the
  result is the same as pressing 'h': the subject information gets toggled.
 
 Is this considered a feature that blocks people from switching to the
 JSON based UI?
 

For me it is not an issue and i already switched to jason based ui. The
diff-mode for inline patch itself is a big motivation for me to switch.

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


[notmuch] JSON based emacs UI

2010-03-26 Thread Aneesh Kumar K. V
On Mon, 22 Mar 2010 14:47:39 +, David Edmondson  wrote:

I found another issue. In the notmuch-show-mode "RET" key on from and
subject doesn't seem to work.

For ex: for the last message "RET" key on from doesn't fold the message.
For all the message "RET" key on subject doesn't show the message
header(from cc and to list)

-aneesh


[notmuch] JSON based emacs UI

2010-03-26 Thread Aneesh Kumar K. V
On Thu, 25 Mar 2010 09:14:09 +, David Edmondson  wrote:
> On Thu, 25 Mar 2010 10:11:38 +0530, "Aneesh Kumar K. V"  linux.vnet.ibm.com> wrote:
> > Is there a way to get the inline patches shown similar to
> > diff-mode not just the attached patches ?
> 
> A new hook function for text/plain parts called
> `notmuch-wash-inline-patch' is added that attempts to do this by
> converting the inline patch into a fake attachment.
> 
> It guesses whether a buffer includes a patch and also the extent of that
> patch, so it's a bit risky and hence not enabled by default. It is only
> lightly tested. You can try it out by setting:
> 
>(setq notmuch-show-insert-text/plain-hook
>  '(notmuch-wash-wrap-long-lines
>notmuch-wash-tidy-citations
>notmuch-wash-compress-blanks
>notmuch-wash-inline-patch
>notmuch-wash-markup-citations))
> 
> The order is important!
> 

That worked. Thanks. BTW is there a way to get '=' to reload the thread
details. Something similar to notmuch-search-refresh-view. for the show
window. That would make sure i can get the tag updated tag details by
using = key. right now it is difficult to find out whether i "unread"
tag is removed from a message or not. The best fix would be to show the
updated tag dynamically 

-aneesh


Re: [notmuch] JSON based emacs UI

2010-03-26 Thread Aneesh Kumar K. V
On Mon, 22 Mar 2010 14:47:39 +, David Edmondson d...@dme.org wrote:

I found another issue. In the notmuch-show-mode RET key on from and
subject doesn't seem to work.

For ex: for the last message RET key on from doesn't fold the message.
For all the message RET key on subject doesn't show the message
header(from cc and to list)

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


[notmuch] JSON based emacs UI

2010-03-25 Thread Aneesh Kumar K. V
On Wed, 24 Mar 2010 07:32:41 +, David Edmondson  wrote:
> On Mon, 22 Mar 2010 14:47:39 +, David Edmondson  wrote:
> > I've pushed the first stage of a JSON based emacs UI to the repository
> > at http://github.com/dme/notmuch (it's in the "master" branch).
> > 
> > This is intended to be functionally equivalent to the current UI, though
> > HTML display is not present (see below).
> > 
> > This is lightly tested, but if anyone else wants to give it a try I
> > would be interested in feedback. There were a couple of places in the
> > current code where I wasn't completely sure of the intention, so I may
> > have inadvertently diverged (notmuch-show-rewind is a good example).
> > 
> > For HTML display and other improved MIME support my intention is to
> > enhance notmuch to allow single parts to be output (something like:
> > "notmuch show --part=2 id:k74hf87df.fsf at fish.org") and use that from the
> > UI code. No idea when I'll get to it, though.
> 
> "notmuch part --part=2 id:k74hf87df.fsf at fish.org" support is pushed now
> and notmuch-show.el updated to use it.
> 
> An attempt is made to inline all parts, including guessing the type of
> application/octet-stream parts using mailcap (so a file called
> "foo.patch" sent as type application/octet-stream will be displayed
> using diff-mode formatting).
> 

Is there a way to get the inline patches shown similar to
diff-mode not just the attached patches ?

-aneesh


Re: [notmuch] JSON based emacs UI

2010-03-25 Thread Aneesh Kumar K. V
On Thu, 25 Mar 2010 09:14:09 +, David Edmondson d...@dme.org wrote:
 On Thu, 25 Mar 2010 10:11:38 +0530, Aneesh Kumar K. V 
 aneesh.ku...@linux.vnet.ibm.com wrote:
  Is there a way to get the inline patches shown similar to
  diff-mode not just the attached patches ?
 
 A new hook function for text/plain parts called
 `notmuch-wash-inline-patch' is added that attempts to do this by
 converting the inline patch into a fake attachment.
 
 It guesses whether a buffer includes a patch and also the extent of that
 patch, so it's a bit risky and hence not enabled by default. It is only
 lightly tested. You can try it out by setting:
 
(setq notmuch-show-insert-text/plain-hook
  '(notmuch-wash-wrap-long-lines
notmuch-wash-tidy-citations
notmuch-wash-compress-blanks
notmuch-wash-inline-patch
notmuch-wash-markup-citations))
 
 The order is important!
 

That worked. Thanks. BTW is there a way to get '=' to reload the thread
details. Something similar to notmuch-search-refresh-view. for the show
window. That would make sure i can get the tag updated tag details by
using = key. right now it is difficult to find out whether i unread
tag is removed from a message or not. The best fix would be to show the
updated tag dynamically 

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


Re: [notmuch] JSON based emacs UI

2010-03-24 Thread Aneesh Kumar K. V
On Wed, 24 Mar 2010 07:32:41 +, David Edmondson d...@dme.org wrote:
 On Mon, 22 Mar 2010 14:47:39 +, David Edmondson d...@dme.org wrote:
  I've pushed the first stage of a JSON based emacs UI to the repository
  at http://github.com/dme/notmuch (it's in the master branch).
  
  This is intended to be functionally equivalent to the current UI, though
  HTML display is not present (see below).
  
  This is lightly tested, but if anyone else wants to give it a try I
  would be interested in feedback. There were a couple of places in the
  current code where I wasn't completely sure of the intention, so I may
  have inadvertently diverged (notmuch-show-rewind is a good example).
  
  For HTML display and other improved MIME support my intention is to
  enhance notmuch to allow single parts to be output (something like:
  notmuch show --part=2 id:k74hf87df@fish.org) and use that from the
  UI code. No idea when I'll get to it, though.
 
 notmuch part --part=2 id:k74hf87df@fish.org support is pushed now
 and notmuch-show.el updated to use it.
 
 An attempt is made to inline all parts, including guessing the type of
 application/octet-stream parts using mailcap (so a file called
 foo.patch sent as type application/octet-stream will be displayed
 using diff-mode formatting).
 

Is there a way to get the inline patches shown similar to
diff-mode not just the attached patches ?

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


[notmuch] Notmuch performance (literally, in my case)

2010-03-16 Thread Aneesh Kumar K. V
On Tue, 16 Mar 2010 08:37:54 -0700 (PDT), Ben Gamari  wrote:
> On Tue, 16 Mar 2010 11:08:47 +, Olly Betts  wrote:
> > For the issue of a background task interfering with interactive use, the 
> > feel
> > arguably matters more than the throughput.
> > 
> > I'll probably put that patch in 1.0.19, and look at moving all the 
> > fdatasync()
> > calls together.  This is http://trac.xapian.org/ticket/426 BTW.
> > 
> > The kernel should be able to handle this workload better though, so I would
> > say it was worthwhile to bring up on LKML if you have the energy.  It 
> > certainly
> > isn't just you, as apt-xapian-index seems to trigger it for some Ubuntu 
> > users,
> > and madduck mentioned it on #notmuch a week or so ago.
> 
> Alright. This issue has been bothering me for a very long time and it's 
> frankly
> pretty pathetic how badly the kernel falls apart under this sort of workload.
> I just wrote up a message (4b9fa440.12135e0a.7fc8.e745 at mx.google.com), 
> so
> we'll see what happens. In the past kernel developers have been very eager to
> write this issue off as not reproducible enough (perhaps wisely), so if anyone
> has anything to say, please contribute it to the thread.
> 

Ext3 fsync related issue is a know problem due to the way journalling is
handled in ext3. The solution for that would be data=writeback ( with
its loss of data integrity ) or not yet upstreamed data=guarded. Another
option would be to try ext4 which should not be impacted that badly by
the data=ordered journalled mode

-aneesh


Re: [notmuch] Notmuch performance (literally, in my case)

2010-03-16 Thread Aneesh Kumar K. V
On Tue, 16 Mar 2010 08:37:54 -0700 (PDT), Ben Gamari bgamari.f...@gmail.com 
wrote:
 On Tue, 16 Mar 2010 11:08:47 +, Olly Betts o...@survex.com wrote:
  For the issue of a background task interfering with interactive use, the 
  feel
  arguably matters more than the throughput.
  
  I'll probably put that patch in 1.0.19, and look at moving all the 
  fdatasync()
  calls together.  This is http://trac.xapian.org/ticket/426 BTW.
  
  The kernel should be able to handle this workload better though, so I would
  say it was worthwhile to bring up on LKML if you have the energy.  It 
  certainly
  isn't just you, as apt-xapian-index seems to trigger it for some Ubuntu 
  users,
  and madduck mentioned it on #notmuch a week or so ago.
 
 Alright. This issue has been bothering me for a very long time and it's 
 frankly
 pretty pathetic how badly the kernel falls apart under this sort of workload.
 I just wrote up a message (4b9fa440.12135e0a.7fc8.e...@mx.google.com), so
 we'll see what happens. In the past kernel developers have been very eager to
 write this issue off as not reproducible enough (perhaps wisely), so if anyone
 has anything to say, please contribute it to the thread.
 

Ext3 fsync related issue is a know problem due to the way journalling is
handled in ext3. The solution for that would be data=writeback ( with
its loss of data integrity ) or not yet upstreamed data=guarded. Another
option would be to try ext4 which should not be impacted that badly by
the data=ordered journalled mode

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


[notmuch] [PATCH -V3] notmuch.el: Support for customizing search result display

2010-03-10 Thread Aneesh Kumar K.V
From: Aneesh Kumar K.V <aneesh.ku...@gmail.com>

This patch helps in customizing search result display
similar to mutt's index_format. The customization is done
by defining an alist as below

(setq notmuch-search-result-format '(("date" . "%s ")
 ("authors" . "%-40s ")
 ("subject" . "%s ")))

The supported keywords are date, count, authors, subject.

Signed-off-by: Aneesh Kumar K.V 
---
 emacs/notmuch.el |   55 +
 1 files changed, 38 insertions(+), 17 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 5b553bb..cc5167f 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -157,6 +157,18 @@ remaining lines into a button.")
 (defvar notmuch-show-body-read-visible nil)
 (defvar notmuch-show-citations-visible nil)
 (defvar notmuch-show-signatures-visible nil)
+(defcustom notmuch-search-result-format
+  '(("date" . "%s")
+("count" . "%-7s")
+("authors" . "%-40s")
+("subject" . "%s"))
+  "Search result formating. Supported fields are
+   date, count, authors, subject
+ex: (setq notmuch-search-result-format \(\(\"authors\" . \"%-40s\"\)
+   \(\"subject\" . \"%s\"\)\)\)"
+:type '(alist :key-type (string) :value-type (string))
+:group 'notmuch)
+
 (defvar notmuch-show-headers-visible nil)

 ; XXX: This should be a generic function in emacs somewhere, not here
@@ -1314,11 +1326,6 @@ matching this search term are shown if non-nil. "
   "Notmuch search mode face used to highligh tags."
   :group 'notmuch)

-(defvar notmuch-tag-face-alist nil
-  "List containing the tag list that need to be highlighed")
-
-(defvar notmuch-search-font-lock-keywords  nil)
-
 ;;;###autoload
 (defun notmuch-search-mode ()
   "Major mode displaying results of a notmuch search.
@@ -1356,17 +1363,7 @@ Complete list of currently available key bindings:
   (setq truncate-lines t)
   (setq major-mode 'notmuch-search-mode
mode-name "notmuch-search")
-  (setq buffer-read-only t)
-  (if (not notmuch-tag-face-alist)
-  (add-to-list 'notmuch-search-font-lock-keywords (list
-   "(\\([^)]*\\))$" '(1  'notmuch-tag-face)))
-(let ((notmuch-search-tags (mapcar 'car notmuch-tag-face-alist)))
-  (loop for notmuch-search-tag  in notmuch-search-tags
-   do (add-to-list 'notmuch-search-font-lock-keywords (list
-   (concat "([^)]*\\(" notmuch-search-tag "\\)[^)]*)$")
-   `(1  ,(cdr (assoc notmuch-search-tag 
notmuch-tag-face-alist
-  (set (make-local-variable 'font-lock-defaults)
- '(notmuch-search-font-lock-keywords t)))
+  (setq buffer-read-only t))

 (defun notmuch-search-find-thread-id ()
   "Return the thread for the current thread"
@@ -1487,6 +1484,30 @@ This function advances the next thread when finished."
  (if never-found-target-thread
  (goto-char notmuch-search-target-position)))

+(defun insert-tags (tags)
+  (insert (concat "(" (propertize tags
+'font-lock-face 'notmuch-tag-face) ")")))
+
+(defun insert-field (field date count authors subject tags)
+(if (string-equal field "date")
+(insert (format (cdr (assoc field notmuch-search-result-format)) date))
+  (if (string-equal field "count")
+(insert (format (cdr (assoc field notmuch-search-result-format)) count))
+  (if (string-equal field "authors")
+(insert (format (cdr (assoc field notmuch-search-result-format)) authors))
+  (if (string-equal field "subject")
+  (insert (format (cdr (assoc field notmuch-search-result-format)) 
subject))
+  (if (string-equal field "tags")
+  (insert-tags (format "%s" tags)))
+)
+
+(defun notmuch-search-show-result (date count authors subject tags)
+(let ((fields) (field))
+  (setq fields (mapcar 'car notmuch-search-result-format))
+  (loop for field in  fields
+   do (insert-field field date count authors subject tags)))
+(insert "\n"))
+
 (defun notmuch-search-process-filter (proc string)
   "Process and filter the output of \"notmuch search\""
   (let ((buffer (process-buffer proc))
@@ -1510,7 +1531,7 @@ This function advances the next thread when finished."
  (set 'authors (concat (substring authors 0 (- 40 3)) 
"...")))
  (goto-char (point-max))
  (let ((beg (point-marker)))
-   (insert (format "%s %-7s %-40s %s (%s)\n" date count 
authors subject tags))
+   (notmuch-search-show-result date count authors subject 
tags)
(put-text-property beg (point-marker) 
'notmuch-search-thread-id thread-id)
(put-text-property beg (point-marker) 
'notmuch-search-authors authors)
(put-text-property beg (point-marker) 
'notmuch-search-subject subject)
-- 
1.7.0.2.157.gb7e7f



[notmuch] [PATCH -V3 2/2] notmuch.el: Add support for reply-to sender

2010-03-10 Thread Aneesh Kumar K.V
From: Aneesh Kumar K.V <aneesh.ku...@gmail.com>

Add key binding to do a reply-to sender. This is mapped to 'R'

Signed-off-by: Aneesh Kumar K.V 
---
 emacs/notmuch.el |   24 ++--
 1 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 5b553bb..9ba1ec1 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -78,7 +78,8 @@
 (define-key map "s" 'notmuch-search)
 (define-key map "m" 'message-mail)
 (define-key map "f" 'notmuch-show-forward-current)
-(define-key map "r" 'notmuch-show-reply)
+(define-key map "r" 'notmuch-show-reply-all)
+(define-key map "R" 'notmuch-show-reply)
 (define-key map "|" 'notmuch-show-pipe-message)
 (define-key map "w" 'notmuch-show-save-attachments)
 (define-key map "V" 'notmuch-show-view-raw-message)
@@ -446,12 +447,31 @@ buffer."
(forward-line)))
   (message-mode))

-(defun notmuch-show-reply ()
+(defun notmuch-show-reply-all ()
   "Begin composing a reply to the current message in a new buffer."
   (interactive)
   (let ((message-id (notmuch-show-get-message-id)))
 (notmuch-reply message-id)))

+
+(defun notmuch-recipient-reply (recipient query-string)
+  (switch-to-buffer (generate-new-buffer "notmuch-draft"))
+  (call-process notmuch-command nil t nil "reply"
+   (concat "--recipient=" recipient) query-string)
+  (message-insert-signature)
+  (goto-char (point-min))
+  (if (re-search-forward "^$" nil t)
+  (progn
+   (insert "--text follows this line--")
+   (forward-line)))
+  (message-mode))
+
+(defun notmuch-show-reply ()
+  "Begin composing a reply to the current message in a new buffer."
+  (interactive)
+  (let ((message-id (notmuch-show-get-message-id)))
+(notmuch-recipient-reply "sender" message-id)))
+
 (defun notmuch-show-forward-current ()
   "Forward the current message."
   (interactive)
-- 
1.7.0.2.157.gb7e7f



[notmuch] [PATCH -V3 1/2] notmuch-reply: Add support for replying only to sender

2010-03-10 Thread Aneesh Kumar K.V
From: Aneesh Kumar K.V <aneesh.ku...@gmail.com>

This patch add --recipient=all|sender option

Signed-off-by: Aneesh Kumar K.V 
---
 notmuch-client.h |2 +
 notmuch-reply.c  |   55 -
 2 files changed, 43 insertions(+), 14 deletions(-)

diff --git a/notmuch-client.h b/notmuch-client.h
index c80b39c..26fdb4a 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -70,6 +70,8 @@
 #define STRNCMP_LITERAL(var, literal) \
 strncmp ((var), (literal), sizeof (literal) - 1)

+#define NOTMUCH_REPLY_ALL   0x1
+#define NOTMUCH_REPLY_SENDER_ONLY 0x2
 static inline void
 chomp_newline (char *str)
 {
diff --git a/notmuch-reply.c b/notmuch-reply.c
index 6c15536..e8a0820 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -232,20 +232,37 @@ reply_to_header_is_redundant (notmuch_message_t *message)
 static const char *
 add_recipients_from_message (GMimeMessage *reply,
 notmuch_config_t *config,
-notmuch_message_t *message)
+notmuch_message_t *message,
+int reply_options)
 {
-struct {
+struct reply_to_map {
const char *header;
const char *fallback;
GMimeRecipientType recipient_type;
-} reply_to_map[] = {
+} ;
+const char *from_addr = NULL;
+unsigned int i;
+struct reply_to_map *reply_to_map;
+
+struct reply_to_map reply_to_map_all[] = {
{ "reply-to", "from", GMIME_RECIPIENT_TYPE_TO  },
{ "to", NULL, GMIME_RECIPIENT_TYPE_TO  },
{ "cc", NULL, GMIME_RECIPIENT_TYPE_CC  },
-   { "bcc",NULL, GMIME_RECIPIENT_TYPE_BCC }
+   { "bcc",NULL, GMIME_RECIPIENT_TYPE_BCC },
+   {  NULL,NULL, 0 }
 };
-const char *from_addr = NULL;
-unsigned int i;
+
+/* we try from first and then reply-to */
+struct reply_to_map reply_to_map_sender[] = {
+   { "from", "reply-to", GMIME_RECIPIENT_TYPE_TO  },
+   {  NULL,NULL, 0 }
+};
+
+if (reply_options == NOTMUCH_REPLY_SENDER_ONLY) {
+   reply_to_map = reply_to_map_sender;
+} else {
+   reply_to_map = reply_to_map_all;
+}

 /* Some mailing lists munge the Reply-To header despite it being A Bad
  * Thing, see http://www.unicom.com/pw/reply-to-harmful.html
@@ -263,7 +280,7 @@ add_recipients_from_message (GMimeMessage *reply,
reply_to_map[0].fallback = NULL;
 }

-for (i = 0; i < ARRAY_SIZE (reply_to_map); i++) {
+for (i = 0; reply_to_map[i].header; i++) {
const char *addr, *recipients;

recipients = notmuch_message_get_header (message,
@@ -283,7 +300,7 @@ add_recipients_from_message (GMimeMessage *reply,
 }

 static int
-notmuch_reply_format_default(void *ctx, notmuch_config_t *config, 
notmuch_query_t *query)
+notmuch_reply_format_default(void *ctx, notmuch_config_t *config, 
notmuch_query_t *query, int reply_options)
 {
 GMimeMessage *reply;
 notmuch_messages_t *messages;
@@ -311,7 +328,7 @@ notmuch_reply_format_default(void *ctx, notmuch_config_t 
*config, notmuch_query_
subject = talloc_asprintf (ctx, "Re: %s", subject);
g_mime_message_set_subject (reply, subject);

-   from_addr = add_recipients_from_message (reply, config, message);
+   from_addr = add_recipients_from_message (reply, config, message, 
reply_options);

if (from_addr == NULL)
from_addr = notmuch_config_get_user_primary_email (config);
@@ -359,7 +376,7 @@ notmuch_reply_format_default(void *ctx, notmuch_config_t 
*config, notmuch_query_

 /* This format is currently tuned for a git send-email --notmuch hook */
 static int
-notmuch_reply_format_headers_only(void *ctx, notmuch_config_t *config, 
notmuch_query_t *query)
+notmuch_reply_format_headers_only(void *ctx, notmuch_config_t *config, 
notmuch_query_t *query, int reply_options)
 {
 GMimeMessage *reply;
 notmuch_messages_t *messages;
@@ -399,7 +416,7 @@ notmuch_reply_format_headers_only(void *ctx, 
notmuch_config_t *config, notmuch_q
g_mime_object_set_header (GMIME_OBJECT (reply),
  "References", references);

-   (void)add_recipients_from_message (reply, config, message);
+   (void)add_recipients_from_message (reply, config, message, 
reply_options);

g_mime_object_set_header (GMIME_OBJECT (reply), "Bcc",
   notmuch_config_get_user_primary_email (config));
@@ -423,8 +440,8 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])
 notmuch_database_t *notmuch;
 notmuch_query_t *query;
 char *opt, *query_string;
-int i, ret = 0;
-int (*reply_format_func)(void *ctx, notmuch_config_t *config, 
notmuch_query_t *query);
+int i, ret = 0, reply_to = NOTMUCH_REPLY_ALL;
+int (*reply

[notmuch] [PATCH -V3 2/2] notmuch.el: Add support for reply-to sender

2010-03-10 Thread Aneesh Kumar K.V
From: Aneesh Kumar K.V aneesh.ku...@gmail.com

Add key binding to do a reply-to sender. This is mapped to 'R'

Signed-off-by: Aneesh Kumar K.V aneesh.ku...@gmail.com
---
 emacs/notmuch.el |   24 ++--
 1 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 5b553bb..9ba1ec1 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -78,7 +78,8 @@
 (define-key map s 'notmuch-search)
 (define-key map m 'message-mail)
 (define-key map f 'notmuch-show-forward-current)
-(define-key map r 'notmuch-show-reply)
+(define-key map r 'notmuch-show-reply-all)
+(define-key map R 'notmuch-show-reply)
 (define-key map | 'notmuch-show-pipe-message)
 (define-key map w 'notmuch-show-save-attachments)
 (define-key map V 'notmuch-show-view-raw-message)
@@ -446,12 +447,31 @@ buffer.
(forward-line)))
   (message-mode))
 
-(defun notmuch-show-reply ()
+(defun notmuch-show-reply-all ()
   Begin composing a reply to the current message in a new buffer.
   (interactive)
   (let ((message-id (notmuch-show-get-message-id)))
 (notmuch-reply message-id)))
 
+
+(defun notmuch-recipient-reply (recipient query-string)
+  (switch-to-buffer (generate-new-buffer notmuch-draft))
+  (call-process notmuch-command nil t nil reply
+   (concat --recipient= recipient) query-string)
+  (message-insert-signature)
+  (goto-char (point-min))
+  (if (re-search-forward ^$ nil t)
+  (progn
+   (insert --text follows this line--)
+   (forward-line)))
+  (message-mode))
+
+(defun notmuch-show-reply ()
+  Begin composing a reply to the current message in a new buffer.
+  (interactive)
+  (let ((message-id (notmuch-show-get-message-id)))
+(notmuch-recipient-reply sender message-id)))
+
 (defun notmuch-show-forward-current ()
   Forward the current message.
   (interactive)
-- 
1.7.0.2.157.gb7e7f

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


[notmuch] [PATCH -V3 1/2] notmuch-reply: Add support for replying only to sender

2010-03-10 Thread Aneesh Kumar K.V
From: Aneesh Kumar K.V aneesh.ku...@gmail.com

This patch add --recipient=all|sender option

Signed-off-by: Aneesh Kumar K.V aneesh.ku...@gmail.com
---
 notmuch-client.h |2 +
 notmuch-reply.c  |   55 -
 2 files changed, 43 insertions(+), 14 deletions(-)

diff --git a/notmuch-client.h b/notmuch-client.h
index c80b39c..26fdb4a 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -70,6 +70,8 @@
 #define STRNCMP_LITERAL(var, literal) \
 strncmp ((var), (literal), sizeof (literal) - 1)
 
+#define NOTMUCH_REPLY_ALL   0x1
+#define NOTMUCH_REPLY_SENDER_ONLY 0x2
 static inline void
 chomp_newline (char *str)
 {
diff --git a/notmuch-reply.c b/notmuch-reply.c
index 6c15536..e8a0820 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -232,20 +232,37 @@ reply_to_header_is_redundant (notmuch_message_t *message)
 static const char *
 add_recipients_from_message (GMimeMessage *reply,
 notmuch_config_t *config,
-notmuch_message_t *message)
+notmuch_message_t *message,
+int reply_options)
 {
-struct {
+struct reply_to_map {
const char *header;
const char *fallback;
GMimeRecipientType recipient_type;
-} reply_to_map[] = {
+} ;
+const char *from_addr = NULL;
+unsigned int i;
+struct reply_to_map *reply_to_map;
+
+struct reply_to_map reply_to_map_all[] = {
{ reply-to, from, GMIME_RECIPIENT_TYPE_TO  },
{ to, NULL, GMIME_RECIPIENT_TYPE_TO  },
{ cc, NULL, GMIME_RECIPIENT_TYPE_CC  },
-   { bcc,NULL, GMIME_RECIPIENT_TYPE_BCC }
+   { bcc,NULL, GMIME_RECIPIENT_TYPE_BCC },
+   {  NULL,NULL, 0 }
 };
-const char *from_addr = NULL;
-unsigned int i;
+
+/* we try from first and then reply-to */
+struct reply_to_map reply_to_map_sender[] = {
+   { from, reply-to, GMIME_RECIPIENT_TYPE_TO  },
+   {  NULL,NULL, 0 }
+};
+
+if (reply_options == NOTMUCH_REPLY_SENDER_ONLY) {
+   reply_to_map = reply_to_map_sender;
+} else {
+   reply_to_map = reply_to_map_all;
+}
 
 /* Some mailing lists munge the Reply-To header despite it being A Bad
  * Thing, see http://www.unicom.com/pw/reply-to-harmful.html
@@ -263,7 +280,7 @@ add_recipients_from_message (GMimeMessage *reply,
reply_to_map[0].fallback = NULL;
 }
 
-for (i = 0; i  ARRAY_SIZE (reply_to_map); i++) {
+for (i = 0; reply_to_map[i].header; i++) {
const char *addr, *recipients;
 
recipients = notmuch_message_get_header (message,
@@ -283,7 +300,7 @@ add_recipients_from_message (GMimeMessage *reply,
 }
 
 static int
-notmuch_reply_format_default(void *ctx, notmuch_config_t *config, 
notmuch_query_t *query)
+notmuch_reply_format_default(void *ctx, notmuch_config_t *config, 
notmuch_query_t *query, int reply_options)
 {
 GMimeMessage *reply;
 notmuch_messages_t *messages;
@@ -311,7 +328,7 @@ notmuch_reply_format_default(void *ctx, notmuch_config_t 
*config, notmuch_query_
subject = talloc_asprintf (ctx, Re: %s, subject);
g_mime_message_set_subject (reply, subject);
 
-   from_addr = add_recipients_from_message (reply, config, message);
+   from_addr = add_recipients_from_message (reply, config, message, 
reply_options);
 
if (from_addr == NULL)
from_addr = notmuch_config_get_user_primary_email (config);
@@ -359,7 +376,7 @@ notmuch_reply_format_default(void *ctx, notmuch_config_t 
*config, notmuch_query_
 
 /* This format is currently tuned for a git send-email --notmuch hook */
 static int
-notmuch_reply_format_headers_only(void *ctx, notmuch_config_t *config, 
notmuch_query_t *query)
+notmuch_reply_format_headers_only(void *ctx, notmuch_config_t *config, 
notmuch_query_t *query, int reply_options)
 {
 GMimeMessage *reply;
 notmuch_messages_t *messages;
@@ -399,7 +416,7 @@ notmuch_reply_format_headers_only(void *ctx, 
notmuch_config_t *config, notmuch_q
g_mime_object_set_header (GMIME_OBJECT (reply),
  References, references);
 
-   (void)add_recipients_from_message (reply, config, message);
+   (void)add_recipients_from_message (reply, config, message, 
reply_options);
 
g_mime_object_set_header (GMIME_OBJECT (reply), Bcc,
   notmuch_config_get_user_primary_email (config));
@@ -423,8 +440,8 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])
 notmuch_database_t *notmuch;
 notmuch_query_t *query;
 char *opt, *query_string;
-int i, ret = 0;
-int (*reply_format_func)(void *ctx, notmuch_config_t *config, 
notmuch_query_t *query);
+int i, ret = 0, reply_to = NOTMUCH_REPLY_ALL;
+int (*reply_format_func)(void *ctx, notmuch_config_t *config, 
notmuch_query_t *query, int reply_options);
 
 reply_format_func

[notmuch] [PATCH -V3] notmuch.el: Support for customizing search result display

2010-02-11 Thread Aneesh Kumar K. V
On Thu, 11 Feb 2010 22:11:46 +0530, "Aneesh Kumar K.V"  wrote:
> From: Aneesh Kumar K.V 
> 
> This patch helps in customizing search result display
> similar to mutt's index_format. The customization is done
> by defining an alist as below
> 
> (setq notmuch-search-result-format '(("date" . "%s ")
>("authors" . "%-40s ")
>("subject" . "%s ")
>("tags" . "(%s)")))
> 
> The supported keywords are date, count, authors, subject and tags.
> 
> Signed-off-by: Aneesh Kumar K.V 
> ---
>  notmuch.el |   56 +++-
>  1 files changed, 39 insertions(+), 17 deletions(-)
> 
> diff --git a/notmuch.el b/notmuch.el
> index 040997e..a4a89ac 100644
> --- a/notmuch.el
> +++ b/notmuch.el
> @@ -141,6 +141,19 @@ remaining lines into a button.")
>  (defvar notmuch-show-body-read-visible nil)
>  (defvar notmuch-show-citations-visible nil)
>  (defvar notmuch-show-signatures-visible nil)
> +(defcustom notmuch-search-result-format
> +  '(("date" . "%s")
> +("count" . "%-7s")
> +("authors" . "%-40s")
> +("subject" . "%s")
> +("tags" . "%s"))

I missed a '(' around tags. So the last line should be

("tags" . "(%s)"))

-aneesh


[notmuch] [PATCH -V3] notmuch.el: Support for customizing search result display

2010-02-11 Thread Aneesh Kumar K.V
From: Aneesh Kumar K.V <aneesh.ku...@gmail.com>

This patch helps in customizing search result display
similar to mutt's index_format. The customization is done
by defining an alist as below

(setq notmuch-search-result-format '(("date" . "%s ")
 ("authors" . "%-40s ")
 ("subject" . "%s ")
 ("tags" . "(%s)")))

The supported keywords are date, count, authors, subject and tags.

Signed-off-by: Aneesh Kumar K.V 
---
 notmuch.el |   56 +++-
 1 files changed, 39 insertions(+), 17 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 040997e..a4a89ac 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -141,6 +141,19 @@ remaining lines into a button.")
 (defvar notmuch-show-body-read-visible nil)
 (defvar notmuch-show-citations-visible nil)
 (defvar notmuch-show-signatures-visible nil)
+(defcustom notmuch-search-result-format
+  '(("date" . "%s")
+("count" . "%-7s")
+("authors" . "%-40s")
+("subject" . "%s")
+("tags" . "%s"))
+  "Search result formating. Supported fields are
+   date, count, authors, subject, tags
+ex: (setq notmuch-search-result-format \(\(\"authors\" . \"%-40s\"\)
+   \(\"subject\" . \"%s\"\)\)\)"
+:type '(alist :key-type (string) :value-type (string))
+:group 'notmuch)
+
 (defvar notmuch-show-headers-visible nil)

 ; XXX: This should be a generic function in emacs somewhere, not here
@@ -1175,11 +1188,6 @@ matching this search term are shown if non-nil. "
   "Notmuch search mode face used to highligh tags."
   :group 'notmuch)

-(defvar notmuch-tag-face-alist nil
-  "List containing the tag list that need to be highlighed")
-
-(defvar notmuch-search-font-lock-keywords  nil)
-
 ;;;###autoload
 (defun notmuch-search-mode ()
   "Major mode displaying results of a notmuch search.
@@ -1215,17 +1223,7 @@ Complete list of currently available key bindings:
   (setq truncate-lines t)
   (setq major-mode 'notmuch-search-mode
mode-name "notmuch-search")
-  (setq buffer-read-only t)
-  (if (not notmuch-tag-face-alist)
-  (add-to-list 'notmuch-search-font-lock-keywords (list
-   "(\\([^)]*\\))$" '(1  'notmuch-tag-face)))
-(let ((notmuch-search-tags (mapcar 'car notmuch-tag-face-alist)))
-  (loop for notmuch-search-tag  in notmuch-search-tags
-   do (add-to-list 'notmuch-search-font-lock-keywords (list
-   (concat "([^)]*\\(" notmuch-search-tag "\\)[^)]*)$")
-   `(1  ,(cdr (assoc notmuch-search-tag 
notmuch-tag-face-alist
-  (set (make-local-variable 'font-lock-defaults)
- '(notmuch-search-font-lock-keywords t)))
+  (setq buffer-read-only t))

 (defun notmuch-search-find-thread-id ()
   "Return the thread for the current thread"
@@ -1340,6 +1338,30 @@ This function advances the next thread when finished."
(insert (format " (process returned %d)" 
exit-status)))
(insert "\n"))

+(defun insert-tags (tags)
+  (insert (concat "(" (propertize tags
+'font-lock-face 'notmuch-tag-face) ")")))
+
+(defun insert-field (field date count authors subject tags)
+(if (string-equal field "date")
+(insert (format (cdr (assoc field notmuch-search-result-format)) date))
+  (if (string-equal field "count")
+(insert (format (cdr (assoc field notmuch-search-result-format)) count))
+  (if (string-equal field "authors")
+(insert (format (cdr (assoc field notmuch-search-result-format)) authors))
+  (if (string-equal field "subject")
+  (insert (format (cdr (assoc field notmuch-search-result-format)) 
subject))
+  (if (string-equal field "tags")
+  (insert-tags (format (cdr (assoc field notmuch-search-result-format)) 
tags)))
+)
+
+(defun notmuch-search-show-result (date count authors subject tags)
+(let ((fields) (field))
+  (setq fields (mapcar 'car notmuch-search-result-format))
+  (loop for field in  fields
+   do (insert-field field date count authors subject tags)))
+(insert "\n"))
+
 (defun notmuch-search-process-filter (proc string)
   "Process and filter the output of \"notmuch search\""
   (let ((buffer (process-buffer proc)))
@@ -1362,7 +1384,7 @@ This function advances the next thread when finished."
  (set 'authors (concat (substring authors 0 (- 40 3)) 
"...")))
  (goto-char (point-max))
  (let ((beg

[notmuch] [PATCH] notmuch.el: colorize lines in notmuch-search based on thread tags.

2010-02-07 Thread Aneesh Kumar K. V
On Thu, 04 Feb 2010 07:07:26 -0500, Jameson Rollins  wrote:
> Arbitrary font faces can be specified for given thread tags.  By
> default, no coloring is applied.  To specify coloring, place something
> like this in your .emacs:
> 
> (setq notmuch-search-line-faces '(("delete" . '(:foreground "red"))
>   ("unread" . '(:foreground "green"
> 
> Order matters: line faces listed first will take precedence (in the
> example above, a thread tagged both "delete" and "unread" will be
> colored red, since the "delete" face is listed before the "unread").


Doesn't 92c4dcc641e9dfb5f65026ebae5cedc8eb1d9e21 help you achive
something similar ?

-aneesh


[notmuch] [PATCH -V2] notmuch.el: Support for customizing search result display

2010-01-23 Thread Aneesh Kumar K.V
From: Aneesh Kumar K.V <aneesh.ku...@gmail.com>

This patch helps in customizing search result display
similar to mutt's index_format. The customization is done
by defining an alist as below

(setq notmuch-search-result-format '(("date" . "%s ")
 ("authors" . "%-40s ")
 ("subject" . "%s ")
 ("tags" . "(%s)")))

The supported keywords are date, count, authors, subject and tags.

Signed-off-by: Aneesh Kumar K.V 
---
 notmuch.el |   56 +++-
 1 files changed, 39 insertions(+), 17 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 97914f2..89dc32a 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -119,6 +119,14 @@ pattern can still test against the entire line).")
 (defvar notmuch-show-body-read-visible nil)
 (defvar notmuch-show-citations-visible nil)
 (defvar notmuch-show-signatures-visible nil)
+(defcustom notmuch-search-result-format nil
+  "Search result formating. Supported fields are
+   date, count, authors, subject, tags
+ex: (setq notmuch-search-result-format \(\(\"authors\" . \"%-40s\"\)
+   \(\"subject\" . \"%s\"\)\)\)"
+:type '(alist :key-type (string) :value-type (string))
+:group 'notmuch)
+
 (defvar notmuch-show-headers-visible nil)

 ; XXX: This should be a generic function in emacs somewhere, not here
@@ -1065,11 +1073,6 @@ matching this search term are shown if non-nil. "
   "Notmuch search mode face used to highligh tags."
   :group 'notmuch)

-(defvar notmuch-tag-face-alist nil
-  "List containing the tag list that need to be highlighed")
-
-(defvar notmuch-search-font-lock-keywords  nil)
-
 ;;;###autoload
 (defun notmuch-search-mode ()
   "Major mode displaying results of a notmuch search.
@@ -1105,17 +1108,7 @@ Complete list of currently available key bindings:
   (setq truncate-lines t)
   (setq major-mode 'notmuch-search-mode
mode-name "notmuch-search")
-  (setq buffer-read-only t)
-  (if (not notmuch-tag-face-alist)
-  (add-to-list 'notmuch-search-font-lock-keywords (list
-   "(\\([^)]*\\))$" '(1  'notmuch-tag-face)))
-(let ((notmuch-search-tags (mapcar 'car notmuch-tag-face-alist)))
-  (loop for notmuch-search-tag  in notmuch-search-tags
-   do (add-to-list 'notmuch-search-font-lock-keywords (list
-   (concat "([^)]*\\(" notmuch-search-tag "\\)[^)]*)$")
-   `(1  ,(cdr (assoc notmuch-search-tag 
notmuch-tag-face-alist
-  (set (make-local-variable 'font-lock-defaults)
- '(notmuch-search-font-lock-keywords t)))
+  (setq buffer-read-only t))

 (defun notmuch-search-find-thread-id ()
   "Return the thread for the current thread"
@@ -1230,6 +1223,30 @@ This function advances the next thread when finished."
(insert (format " (process returned %d)" 
exit-status)))
(insert "\n"))

+(defun insert-tags (tags)
+  (insert (concat "(" (propertize tags
+'font-lock-face 'notmuch-tag-face) ")")))
+
+(defun insert-field (field date count authors subject tags)
+(if (string-equal field "date")
+(insert (format (cdr (assoc field notmuch-search-result-format)) date))
+  (if (string-equal field "count")
+(insert (format (cdr (assoc field notmuch-search-result-format)) count))
+  (if (string-equal field "authors")
+(insert (format (cdr (assoc field notmuch-search-result-format)) authors))
+  (if (string-equal field "subject")
+  (insert (format (cdr (assoc field notmuch-search-result-format)) 
subject))
+  (if (string-equal field "tags")
+  (insert-tags (format (cdr (assoc field notmuch-search-result-format)) 
tags)))
+)
+
+(defun notmuch-search-show-result (date count authors subject tags)
+(let ((fields) (field))
+  (setq fields (mapcar 'car notmuch-search-result-format))
+  (loop for field in  fields
+   do (insert-field field date count authors subject tags)))
+(insert "\n"))
+
 (defun notmuch-search-process-filter (proc string)
   "Process and filter the output of \"notmuch search\""
   (let ((buffer (process-buffer proc)))
@@ -1252,7 +1269,12 @@ This function advances the next thread when finished."
  (set 'authors (concat (substring authors 0 (- 40 3)) 
"...")))
  (goto-char (point-max))
  (let ((beg (point-marker)))
-   (insert (format "%s %-7s %-40s %s (%s)\n" date count 
authors subject tags))
+   (if (not notmuch-search-result-form

[notmuch] [PATCH -V2 2/2] notmuch.el: Add support for reply-to sender

2010-01-23 Thread Aneesh Kumar K.V
From: Aneesh Kumar K.V <aneesh.ku...@gmail.com>

Add key binding to do a reply-to sender. This
is mapped to 'R'

Signed-off-by: Aneesh Kumar K.V 
---
 notmuch.el |   24 ++--
 1 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 97914f2..5589350 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -62,7 +62,8 @@
 (define-key map "s" 'notmuch-search)
 (define-key map "m" 'message-mail)
 (define-key map "f" 'notmuch-show-forward-current)
-(define-key map "r" 'notmuch-show-reply)
+(define-key map "r" 'notmuch-show-reply-all)
+(define-key map "R" 'notmuch-show-reply)
 (define-key map "|" 'notmuch-show-pipe-message)
 (define-key map "w" 'notmuch-show-save-attachments)
 (define-key map "V" 'notmuch-show-view-raw-message)
@@ -363,12 +364,31 @@ buffer."
(forward-line)))
   (message-mode))

-(defun notmuch-show-reply ()
+(defun notmuch-show-reply-all ()
   "Begin composing a reply to the current message in a new buffer."
   (interactive)
   (let ((message-id (notmuch-show-get-message-id)))
 (notmuch-reply message-id)))

+
+(defun notmuch-format-reply (format-string query-string)
+  (switch-to-buffer (generate-new-buffer "notmuch-draft"))
+  (call-process notmuch-command nil t nil "reply"
+   (concat "--format=" format-string) query-string)
+  (message-insert-signature)
+  (goto-char (point-min))
+  (if (re-search-forward "^$" nil t)
+  (progn
+   (insert "--text follows this line--")
+   (forward-line)))
+  (message-mode))
+
+(defun notmuch-show-reply ()
+  "Begin composing a reply to the current message in a new buffer."
+  (interactive)
+  (let ((message-id (notmuch-show-get-message-id)))
+(notmuch-format-reply "sender-only" message-id)))
+
 (defun notmuch-show-forward-current ()
   "Forward the current message."
   (interactive)
-- 
1.6.6.1.394.gdedc0



[notmuch] [PATCH -V2 1/2] notmuch-reply: Add support for replying only to sender

2010-01-23 Thread Aneesh Kumar K.V
From: Aneesh Kumar K.V <aneesh.ku...@gmail.com>

This patch add --format=sender-only option.

Signed-off-by: Aneesh Kumar K.V 
---
 notmuch-reply.c |   54 --
 1 files changed, 40 insertions(+), 14 deletions(-)

diff --git a/notmuch-reply.c b/notmuch-reply.c
index 0cda72d..859b725 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -23,15 +23,23 @@
 #include "notmuch-client.h"
 #include "gmime-filter-reply.h"

-static const struct {
+struct reply_map {
 const char *header;
 const char *fallback;
 GMimeRecipientType recipient_type;
-} reply_to_map[] = {
+};
+
+static const struct reply_map reply_to_all_map[] = {
 { "reply-to", "from", GMIME_RECIPIENT_TYPE_TO  },
 { "to", NULL, GMIME_RECIPIENT_TYPE_TO  },
 { "cc", NULL, GMIME_RECIPIENT_TYPE_CC  },
-{ "bcc",NULL, GMIME_RECIPIENT_TYPE_BCC }
+{ "bcc",NULL, GMIME_RECIPIENT_TYPE_BCC },
+{ NULL, NULL, 0}
+};
+
+static const struct reply_map reply_to_sender_map[] = {
+{ "reply-to", "from", GMIME_RECIPIENT_TYPE_TO  },
+{ NULL, NULL, 0}
 };

 static void
@@ -200,7 +208,8 @@ add_recipients_for_string (GMimeMessage *message,
 }

 static int
-notmuch_reply_format_default(void *ctx, notmuch_config_t *config, 
notmuch_query_t *query)
+__notmuch_reply(void *ctx, notmuch_config_t *config,
+   notmuch_query_t *query, const struct reply_map *map)
 {
 GMimeMessage *reply;
 notmuch_messages_t *messages;
@@ -229,17 +238,19 @@ notmuch_reply_format_default(void *ctx, notmuch_config_t 
*config, notmuch_query_
subject = talloc_asprintf (ctx, "Re: %s", subject);
g_mime_message_set_subject (reply, subject);

-   for (i = 0; i < ARRAY_SIZE (reply_to_map); i++) {
+   for (i = 0;; i++) {
const char *addr;

+   if (!map[i].header)
+   break;
recipients = notmuch_message_get_header (message,
-reply_to_map[i].header);
-   if ((recipients == NULL || recipients[0] == '\0') && 
reply_to_map[i].fallback)
+   map[i].header);
+   if ((recipients == NULL || recipients[0] == '\0') && 
map[i].fallback)
recipients = notmuch_message_get_header (message,
-
reply_to_map[i].fallback);
+map[i].fallback);

addr = add_recipients_for_string (reply, config,
- reply_to_map[i].recipient_type,
+ map[i].recipient_type,
  recipients);
if (from_addr == NULL)
from_addr = addr;
@@ -289,6 +300,12 @@ notmuch_reply_format_default(void *ctx, notmuch_config_t 
*config, notmuch_query_
 return 0;
 }

+static int
+notmuch_reply_format_default(void *ctx, notmuch_config_t *config, 
notmuch_query_t *query)
+{
+   return __notmuch_reply(ctx, config, query, reply_to_all_map);
+}
+
 /* This format is currently tuned for a git send-email --notmuch hook */
 static int
 notmuch_reply_format_headers_only(void *ctx, notmuch_config_t *config, 
notmuch_query_t *query)
@@ -332,17 +349,18 @@ notmuch_reply_format_headers_only(void *ctx, 
notmuch_config_t *config, notmuch_q
g_mime_object_set_header (GMIME_OBJECT (reply),
  "References", references);

-   for (i = 0; i < ARRAY_SIZE (reply_to_map); i++) {
+   for (i = 0; i < ARRAY_SIZE (reply_to_all_map); i++) {
const char *addr;

recipients = notmuch_message_get_header (message,
-reply_to_map[i].header);
-   if ((recipients == NULL || recipients[0] == '\0') && 
reply_to_map[i].fallback)
+
reply_to_all_map[i].header);
+   if ((recipients == NULL || recipients[0] == '\0') &&
+   reply_to_all_map[i].fallback)
recipients = notmuch_message_get_header (message,
-
reply_to_map[i].fallback);
+reply_to_all_map[i].fallback);

addr = add_recipients_for_string (reply, config,
- reply_to_map[i].recipient_type,
+ 
reply_to_all_map[i].recipient_type,
  recipients);
}

@@ -361,6 +379,12 @@ notmuch_reply_format_headers_only(void *ctx, 
notmuch_config_t *config, notmuch_q
 return 

[notmuch] [PATCH -v2] notmuch.el: Support for customizing search result display

2009-12-11 Thread Aneesh Kumar K. V
On Wed,  2 Dec 2009 18:19:38 +0530, "Aneesh Kumar K.V"  wrote:
> From: Aneesh Kumar K.V 
> 
> This patch helps in customizing search result display
> similar to mutt's index_format. The customization is done
> by defining an alist as below
> 
> (setq notmuch-search-result-format '(("date" . "%s ")
>("authors" . "%-40s ")
>("subject" . "%s ")
>("tags" . "(%s)")))
> 
> The supported keywords are date, count, authors, subject and tags.
> 

Any update on this patch . I would like to get this merged as well

-aneesh


[notmuch] [PATCH 1/2] notmuch-reply: Add support for replying only to sender

2009-12-11 Thread Aneesh Kumar K. V
On Fri, 04 Dec 2009 11:07:54 -0800, Carl Worth  wrote:
> On Thu,  3 Dec 2009 14:16:44 +0530, "Aneesh Kumar K.V"  linux.vnet.ibm.com> wrote:
> > From: Aneesh Kumar K.V 
> > 
> > This patch add --format=sender-only option.
> 
> I like the idea here, (and agree that an 'R' keybinding would be great).
> 
> But surely there's a way to implement this with dramatically less code
> duplication?

I sent an updated patch which did the above with less code duplication. Any
chance of getting this merged ?

-aneesh


Re: [notmuch] [PATCH 1/2] notmuch-reply: Add support for replying only to sender

2009-12-10 Thread Aneesh Kumar K. V
On Fri, 04 Dec 2009 11:07:54 -0800, Carl Worth cwo...@cworth.org wrote:
 On Thu,  3 Dec 2009 14:16:44 +0530, Aneesh Kumar K.V 
 aneesh.ku...@linux.vnet.ibm.com wrote:
  From: Aneesh Kumar K.V aneesh.ku...@gmail.com
  
  This patch add --format=sender-only option.
 
 I like the idea here, (and agree that an 'R' keybinding would be great).
 
 But surely there's a way to implement this with dramatically less code
 duplication?

I sent an updated patch which did the above with less code duplication. Any
chance of getting this merged ?

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


Re: [notmuch] [PATCH -v2] notmuch.el: Support for customizing search result display

2009-12-10 Thread Aneesh Kumar K. V
On Wed,  2 Dec 2009 18:19:38 +0530, Aneesh Kumar K.V 
aneesh.ku...@linux.vnet.ibm.com wrote:
 From: Aneesh Kumar K.V aneesh.ku...@gmail.com
 
 This patch helps in customizing search result display
 similar to mutt's index_format. The customization is done
 by defining an alist as below
 
 (setq notmuch-search-result-format '((date . %s )
(authors . %-40s )
(subject . %s )
(tags . (%s
 
 The supported keywords are date, count, authors, subject and tags.
 

Any update on this patch . I would like to get this merged as well

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


[notmuch] semi-usable notmuch-gtk client

2009-12-07 Thread Aneesh Kumar K. V
On Fri, 27 Nov 2009 19:58:38 +0200, Baruch Even  wrote:
> Hi,
> 
> I added a quick hack to show a message thread in notmuch-gtk and this 
> makes it semi-usable. I don't actually parse the reply of notmuch-show 
> but it's already passably usable to read mail.
> 

While discussing notmuch with some of the gnome developers they pointed
me to http://live.gnome.org/Anjal/ . The interface is suited to the way
notmuch displays threads. So i guess it would really cool if we can get
anjal to use nomuch as one of the backend.

That should also make sure you get a working mailclient in gtk with
minimal changes

-aneesh


[notmuch] [PATCH -V2] notmuch-reply: Add support for replying only to sender

2009-12-05 Thread Aneesh Kumar K.V
From: Aneesh Kumar K.V <aneesh.ku...@gmail.com>

This patch add --format=sender-only option.

Signed-off-by: Aneesh Kumar K.V 
---
 notmuch-reply.c |   54 --
 1 files changed, 40 insertions(+), 14 deletions(-)

diff --git a/notmuch-reply.c b/notmuch-reply.c
index 0cda72d..859b725 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -23,15 +23,23 @@
 #include "notmuch-client.h"
 #include "gmime-filter-reply.h"

-static const struct {
+struct reply_map {
 const char *header;
 const char *fallback;
 GMimeRecipientType recipient_type;
-} reply_to_map[] = {
+};
+
+static const struct reply_map reply_to_all_map[] = {
 { "reply-to", "from", GMIME_RECIPIENT_TYPE_TO  },
 { "to", NULL, GMIME_RECIPIENT_TYPE_TO  },
 { "cc", NULL, GMIME_RECIPIENT_TYPE_CC  },
-{ "bcc",NULL, GMIME_RECIPIENT_TYPE_BCC }
+{ "bcc",NULL, GMIME_RECIPIENT_TYPE_BCC },
+{ NULL, NULL, 0}
+};
+
+static const struct reply_map reply_to_sender_map[] = {
+{ "reply-to", "from", GMIME_RECIPIENT_TYPE_TO  },
+{ NULL, NULL, 0}
 };

 static void
@@ -200,7 +208,8 @@ add_recipients_for_string (GMimeMessage *message,
 }

 static int
-notmuch_reply_format_default(void *ctx, notmuch_config_t *config, 
notmuch_query_t *query)
+__notmuch_reply(void *ctx, notmuch_config_t *config,
+   notmuch_query_t *query, const struct reply_map *map)
 {
 GMimeMessage *reply;
 notmuch_messages_t *messages;
@@ -229,17 +238,19 @@ notmuch_reply_format_default(void *ctx, notmuch_config_t 
*config, notmuch_query_
subject = talloc_asprintf (ctx, "Re: %s", subject);
g_mime_message_set_subject (reply, subject);

-   for (i = 0; i < ARRAY_SIZE (reply_to_map); i++) {
+   for (i = 0;; i++) {
const char *addr;

+   if (!map[i].header)
+   break;
recipients = notmuch_message_get_header (message,
-reply_to_map[i].header);
-   if ((recipients == NULL || recipients[0] == '\0') && 
reply_to_map[i].fallback)
+   map[i].header);
+   if ((recipients == NULL || recipients[0] == '\0') && 
map[i].fallback)
recipients = notmuch_message_get_header (message,
-
reply_to_map[i].fallback);
+map[i].fallback);

addr = add_recipients_for_string (reply, config,
- reply_to_map[i].recipient_type,
+ map[i].recipient_type,
  recipients);
if (from_addr == NULL)
from_addr = addr;
@@ -289,6 +300,12 @@ notmuch_reply_format_default(void *ctx, notmuch_config_t 
*config, notmuch_query_
 return 0;
 }

+static int
+notmuch_reply_format_default(void *ctx, notmuch_config_t *config, 
notmuch_query_t *query)
+{
+   return __notmuch_reply(ctx, config, query, reply_to_all_map);
+}
+
 /* This format is currently tuned for a git send-email --notmuch hook */
 static int
 notmuch_reply_format_headers_only(void *ctx, notmuch_config_t *config, 
notmuch_query_t *query)
@@ -332,17 +349,18 @@ notmuch_reply_format_headers_only(void *ctx, 
notmuch_config_t *config, notmuch_q
g_mime_object_set_header (GMIME_OBJECT (reply),
  "References", references);

-   for (i = 0; i < ARRAY_SIZE (reply_to_map); i++) {
+   for (i = 0; i < ARRAY_SIZE (reply_to_all_map); i++) {
const char *addr;

recipients = notmuch_message_get_header (message,
-reply_to_map[i].header);
-   if ((recipients == NULL || recipients[0] == '\0') && 
reply_to_map[i].fallback)
+
reply_to_all_map[i].header);
+   if ((recipients == NULL || recipients[0] == '\0') &&
+   reply_to_all_map[i].fallback)
recipients = notmuch_message_get_header (message,
-
reply_to_map[i].fallback);
+reply_to_all_map[i].fallback);

addr = add_recipients_for_string (reply, config,
- reply_to_map[i].recipient_type,
+ 
reply_to_all_map[i].recipient_type,
  recipients);
}

@@ -361,6 +379,12 @@ notmuch_reply_format_headers_only(void *ctx, 
notmuch_config_t *config, notmuch_q
 return 

[notmuch] Recent (and forthcoming) improvements to the emacs interface

2009-12-04 Thread Aneesh Kumar K. V
On Thu, 03 Dec 2009 14:15:07 -0800, Carl Worth  wrote:
> I just pushed out a nice set of changes to the emacs interface. Here's a
> quick summary of what you can expect to get when you next update:
> 
>   * Much nicer looking presentation, (no more ugly reverse-video or
> underlines on the message summary line).
> 
>   * More reliable message-visibility buttons, (using RET in the first
> column of a message-summary line now works).
> 
>   * Space bar fixed to advance to next open message, (it was originally
> written this way, but has been broken since we changed from global
> to local toggling of hidden message parts).
> 
>   * Showing a thread where the search matches only a subset of the
> thread now opens only the matched messages (in addition to unread
> messages).
> 
> This last feature is the big one---the rest all just happened to come
> along at the same time. One thing that I often do is read some giant
> thread and then tag a single message deep in that thread for dealing
> with later. And previously, doing a search for that tag would bring back
> the entire thread. Now, it opens only the message I'm actually looking
> for. So this is a very welcome change
> 
> And thanks to Bart Trojanowski for the groundwork for this change. I
> think the vim interface has had this feature for a while, (or would have
> if I had pushed all of Bart's changes earlier).
> 
> Meanwhile, Keith and Eric gave me some helpful feedback about the
> notmuch user-interface over lunch today, and in particular about the
> handling of the "unread" tag. Here are some of the things discussed,
> along with some things I'd like to change in response.
> 
> I'm open to suggestions on all of these, and most importantly, wanted to
> let people know about some upcoming user-interface changes before they
> were in place and potentially surprising.
> 
>   * The magic space bar is too magic. Threads are separate conversations
> so one key for paging through the current conversation shouldn't
> also switch to the next conversation, (particularly when the
> complementary key DEL doesn't reverse this behavior of SPACE).
> 
> Recommendation: Make SPACE only page the current message. Recommend
> that user use 'a' to advance to next thread, (or 'x' to exit back to
> search results).
> 
>   * The unread tag is not handled transparently enough. Both Keith and
> Eric complained of frequently being presented with messages as
> "unread" that they had read before. (And I don't want to ever have
> to manually think about whether to remove a thread as "unread".)
> 
> Recommendation: Drop the 'A' and 'X' keybindings and make 'a' and
> 'x' mark remove the "unread" tag from all messages in the current
> thread (as well as the "inbox" tag as currently). Also make 'n' and
> 'p' remove the "unread tag as well.
> 
> Followup: This frees up 'N' and 'P', so I'd like to use the for
> "next message" and "previous message" and make 'n' and 'p' do "next
> open message" and "previous open message".
> 
>   * Opening up unread messages in notmuch-show mode is not
> helpful. Keith reads a lot of high-volume mailing lists by reading
> the subject lines in search mode and then doing "* -inbox". He likes
> that notmuch remembers that these messages are still unread, but if
> he later searches for a single message that happens to be in a giant
> thread of unread messages, then he wants to see just than one
> message, not all of them.
> 
> Recommendation: Make notmuch-show-mode open *only* messages that
> match the search---not unread messages as well. At this point the
> unread tag becomes just a hint to the user and won't be explicitly
> handled differently by the interface, (other than that various
> commands will remove the unread tag if present). The unread tag is
> still useful for when searching for something like "I know I read
> this message recently".
> 
> Followup: I wonder if I would miss one feature here. If I'm
> interrupted after reading part of a giant thread, currently I can
> quite and when I come back notmuch will remember right where I was
> while reading. One way to get this behavior back would be to make
> SPACE remove the inbox tag from each message its scrolled off. I'll
> have to think about that.
> 
>   * The current 'a' key in search-mode is unreliable. It seemed like a
> good idea to make 'a' only archive messages that match the search,
> but it's a flawed idea. Imagine the following scenario: Eric is
> reading his inbox and sees some threads related to a boring
> topic. He filters down to these with "f tag:boring". He's satisfied
> with the search results, and hits 'a' on each thread and even sees
> the "inbox" tag disappear from the presentation. But then when he
> returns to his inbox search and refreshes, the boring threads
> re-appear and have the 

[notmuch] Recent (and forthcoming) improvements to the emacs interface

2009-12-04 Thread Aneesh Kumar K. V
On Thu, 03 Dec 2009 14:15:07 -0800, Carl Worth  wrote:

.

> 
>   * The magic space bar is too magic. Threads are separate conversations
> so one key for paging through the current conversation shouldn't
> also switch to the next conversation, (particularly when the
> complementary key DEL doesn't reverse this behavior of SPACE).

agreed

> 
> Recommendation: Make SPACE only page the current message. Recommend
> that user use 'a' to advance to next thread, (or 'x' to exit back to
> search results).

Later you mention 'N' and 'n' to do the same task. Or are you suggesting
that 'a' would move to the next task after marking the current task read ?

> 
>   * The unread tag is not handled transparently enough. Both Keith and
> Eric complained of frequently being presented with messages as
> "unread" that they had read before. (And I don't want to ever have
> to manually think about whether to remove a thread as "unread".)
> 
> Recommendation: Drop the 'A' and 'X' keybindings and make 'a' and
> 'x' mark remove the "unread" tag from all messages in the current
> thread (as well as the "inbox" tag as currently). Also make 'n' and
> 'p' remove the "unread tag as well.


ok that explains. But with Xapian ticket 250 we would definitely want
some keybinding that move to the next mail without updating tags.


> 
> Followup: This frees up 'N' and 'P', so I'd like to use the for
> "next message" and "previous message" and make 'n' and 'p' do "next
> open message" and "previous open message".
> 
>   * Opening up unread messages in notmuch-show mode is not
> helpful. Keith reads a lot of high-volume mailing lists by reading
> the subject lines in search mode and then doing "* -inbox". He likes
> that notmuch remembers that these messages are still unread, but if
> he later searches for a single message that happens to be in a giant
> thread of unread messages, then he wants to see just than one
> message, not all of them.
> 
> Recommendation: Make notmuch-show-mode open *only* messages that
> match the search---not unread messages as well. At this point the
> unread tag becomes just a hint to the user and won't be explicitly
> handled differently by the interface, (other than that various
> commands will remove the unread tag if present). The unread tag is
> still useful for when searching for something like "I know I read
> this message recently".
> 
> Followup: I wonder if I would miss one feature here. If I'm
> interrupted after reading part of a giant thread, currently I can
> quite and when I come back notmuch will remember right where I was
> while reading. One way to get this behavior back would be to make
> SPACE remove the inbox tag from each message its scrolled off. I'll
> have to think about that.
> 
>   * The current 'a' key in search-mode is unreliable. It seemed like a
> good idea to make 'a' only archive messages that match the search,
> but it's a flawed idea. Imagine the following scenario: Eric is
> reading his inbox and sees some threads related to a boring
> topic. He filters down to these with "f tag:boring". He's satisfied
> with the search results, and hits 'a' on each thread and even sees
> the "inbox" tag disappear from the presentation. But then when he
> returns to his inbox search and refreshes, the boring threads
> re-appear and have the inbox tag again. Ugh. The presentation is
> inconsistent and things just feel unreliable and broken.
> 
> And a related issue:
> 
>   * The '*' key in search-mode doesn't provide any feedback that it has
> actually done anything, (none of the added/removed tags are changed
> in the presentation). And hitting '=' isn't necessarily ideal since
> it can make things irretrievably disappear, ('a' is different since
> it allows the user to confirm that things are good before making
> results disappear with '='). [*]
> 
> Recommendation: Revert 'a' to act on all messages in a thread---not
> only those that match the search results. Then change '*' to work by
> walking the list and explicitly calling the same action as 'a' on
> each line. This will provide the desired feedback and should be
> plenty fast.

With xapian ticket 250 doing a tag update per thread is going to be
really slow right ?


> 
> Note: There are still use cases where the user might want to modify
> the tags only on messages matching the search, (think, "remove from
> inbox all messages from:someone"). So I'm aware that there's still a
> hole in functionality here, but I really want to fix the current
> inconsistency in the presentation. And I'm open to further
> suggestions here.
> 
> Let me know if any of the above seems crazy,
> 

-aneesh


Re: [notmuch] Recent (and forthcoming) improvements to the emacs interface

2009-12-04 Thread Aneesh Kumar K. V
On Thu, 03 Dec 2009 14:15:07 -0800, Carl Worth cwo...@cworth.org wrote:

.

 
   * The magic space bar is too magic. Threads are separate conversations
 so one key for paging through the current conversation shouldn't
 also switch to the next conversation, (particularly when the
 complementary key DEL doesn't reverse this behavior of SPACE).

agreed

 
 Recommendation: Make SPACE only page the current message. Recommend
 that user use 'a' to advance to next thread, (or 'x' to exit back to
 search results).

Later you mention 'N' and 'n' to do the same task. Or are you suggesting
that 'a' would move to the next task after marking the current task read ?

 
   * The unread tag is not handled transparently enough. Both Keith and
 Eric complained of frequently being presented with messages as
 unread that they had read before. (And I don't want to ever have
 to manually think about whether to remove a thread as unread.)
 
 Recommendation: Drop the 'A' and 'X' keybindings and make 'a' and
 'x' mark remove the unread tag from all messages in the current
 thread (as well as the inbox tag as currently). Also make 'n' and
 'p' remove the unread tag as well.


ok that explains. But with Xapian ticket 250 we would definitely want
some keybinding that move to the next mail without updating tags.


 
 Followup: This frees up 'N' and 'P', so I'd like to use the for
 next message and previous message and make 'n' and 'p' do next
 open message and previous open message.
 
   * Opening up unread messages in notmuch-show mode is not
 helpful. Keith reads a lot of high-volume mailing lists by reading
 the subject lines in search mode and then doing * -inbox. He likes
 that notmuch remembers that these messages are still unread, but if
 he later searches for a single message that happens to be in a giant
 thread of unread messages, then he wants to see just than one
 message, not all of them.
 
 Recommendation: Make notmuch-show-mode open *only* messages that
 match the search---not unread messages as well. At this point the
 unread tag becomes just a hint to the user and won't be explicitly
 handled differently by the interface, (other than that various
 commands will remove the unread tag if present). The unread tag is
 still useful for when searching for something like I know I read
 this message recently.
 
 Followup: I wonder if I would miss one feature here. If I'm
 interrupted after reading part of a giant thread, currently I can
 quite and when I come back notmuch will remember right where I was
 while reading. One way to get this behavior back would be to make
 SPACE remove the inbox tag from each message its scrolled off. I'll
 have to think about that.
 
   * The current 'a' key in search-mode is unreliable. It seemed like a
 good idea to make 'a' only archive messages that match the search,
 but it's a flawed idea. Imagine the following scenario: Eric is
 reading his inbox and sees some threads related to a boring
 topic. He filters down to these with f tag:boring. He's satisfied
 with the search results, and hits 'a' on each thread and even sees
 the inbox tag disappear from the presentation. But then when he
 returns to his inbox search and refreshes, the boring threads
 re-appear and have the inbox tag again. Ugh. The presentation is
 inconsistent and things just feel unreliable and broken.
 
 And a related issue:
 
   * The '*' key in search-mode doesn't provide any feedback that it has
 actually done anything, (none of the added/removed tags are changed
 in the presentation). And hitting '=' isn't necessarily ideal since
 it can make things irretrievably disappear, ('a' is different since
 it allows the user to confirm that things are good before making
 results disappear with '='). [*]
 
 Recommendation: Revert 'a' to act on all messages in a thread---not
 only those that match the search results. Then change '*' to work by
 walking the list and explicitly calling the same action as 'a' on
 each line. This will provide the desired feedback and should be
 plenty fast.

With xapian ticket 250 doing a tag update per thread is going to be
really slow right ?


 
 Note: There are still use cases where the user might want to modify
 the tags only on messages matching the search, (think, remove from
 inbox all messages from:someone). So I'm aware that there's still a
 hole in functionality here, but I really want to fix the current
 inconsistency in the presentation. And I'm open to further
 suggestions here.
 
 Let me know if any of the above seems crazy,
 

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


[notmuch] [PATCH 2/2] notmuch.el: Add support for reply-to sender

2009-12-03 Thread Aneesh Kumar K.V
From: Aneesh Kumar K.V <aneesh.ku...@gmail.com>

Add key binding to do a reply-to sender. This
is mapped to 'R'

Signed-off-by: Aneesh Kumar K.V 
---
 notmuch.el |   24 ++--
 1 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index bd8a6ce..c067e63 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -62,7 +62,8 @@
 (define-key map "s" 'notmuch-search)
 (define-key map "m" 'message-mail)
 (define-key map "f" 'notmuch-show-forward-current)
-(define-key map "r" 'notmuch-show-reply)
+(define-key map "r" 'notmuch-show-reply-all)
+(define-key map "R" 'notmuch-show-reply)
 (define-key map "|" 'notmuch-show-pipe-message)
 (define-key map "w" 'notmuch-show-save-attachments)
 (define-key map "V" 'notmuch-show-view-raw-message)
@@ -367,12 +368,31 @@ buffer."
(forward-line)))
   (message-mode))

-(defun notmuch-show-reply ()
+(defun notmuch-show-reply-all ()
   "Begin composing a reply to the current message in a new buffer."
   (interactive)
   (let ((message-id (notmuch-show-get-message-id)))
 (notmuch-reply message-id)))

+
+(defun notmuch-format-reply (format-string query-string)
+  (switch-to-buffer (generate-new-buffer "notmuch-draft"))
+  (call-process notmuch-command nil t nil "reply" 
+   (concat "--format=" format-string) query-string)
+  (message-insert-signature)
+  (goto-char (point-min))
+  (if (re-search-forward "^$" nil t)
+  (progn
+   (insert "--text follows this line--")
+   (forward-line)))
+  (message-mode))
+
+(defun notmuch-show-reply ()
+  "Begin composing a reply to the current message in a new buffer."
+  (interactive)
+  (let ((message-id (notmuch-show-get-message-id)))
+(notmuch-format-reply "sender-only" message-id)))
+
 (defun notmuch-show-forward-current ()
   "Forward the current message."
   (interactive)
-- 
1.6.5.2.74.g610f9



[notmuch] [PATCH 1/2] notmuch-reply: Add support for replying only to sender

2009-12-03 Thread Aneesh Kumar K.V
From: Aneesh Kumar K.V <aneesh.ku...@gmail.com>

This patch add --format=sender-only option.

Signed-off-by: Aneesh Kumar K.V 
---
 notmuch-reply.c |   76 +++
 1 files changed, 76 insertions(+), 0 deletions(-)

diff --git a/notmuch-reply.c b/notmuch-reply.c
index 9ca1236..9d96ef1 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -354,6 +354,80 @@ notmuch_reply_format_headers_only(void *ctx, 
notmuch_config_t *config, notmuch_q
 }
 return 0;
 }
+static int
+notmuch_reply_format_sender_only(void *ctx, notmuch_config_t *config, 
notmuch_query_t *query)
+{
+GMimeMessage *reply;
+notmuch_messages_t *messages;
+notmuch_message_t *message;
+const char *subject, *recipient, *from_addr = NULL;
+const char *in_reply_to, *orig_references, *references;
+char *reply_headers;
+
+for (messages = notmuch_query_search_messages (query);
+notmuch_messages_has_more (messages);
+notmuch_messages_advance (messages))
+{
+   message = notmuch_messages_get (messages);
+
+   /* The 1 means we want headers in a "pretty" order. */
+   reply = g_mime_message_new (1);
+   if (reply == NULL) {
+   fprintf (stderr, "Out of memory\n");
+   return 1;
+   }
+
+   subject = notmuch_message_get_header (message, "subject");
+
+   if (strncasecmp (subject, "Re:", 3))
+   subject = talloc_asprintf (ctx, "Re: %s", subject);
+   g_mime_message_set_subject (reply, subject);
+
+   recipient = notmuch_message_get_header (message, "From");
+   g_mime_object_set_header (GMIME_OBJECT (reply),
+   "To", recipient);
+
+   from_addr = notmuch_config_get_user_primary_email (config);
+   from_addr = talloc_asprintf (ctx, "%s <%s>",
+notmuch_config_get_user_name (config),
+from_addr);
+   g_mime_object_set_header (GMIME_OBJECT (reply),
+ "From", from_addr);
+
+   g_mime_object_set_header (GMIME_OBJECT (reply), "Bcc",
+  notmuch_config_get_user_primary_email (config));
+
+   in_reply_to = talloc_asprintf (ctx, "<%s>",
+notmuch_message_get_message_id (message));
+
+   g_mime_object_set_header (GMIME_OBJECT (reply),
+ "In-Reply-To", in_reply_to);
+
+   orig_references = notmuch_message_get_header (message, "references");
+   references = talloc_asprintf (ctx, "%s%s%s",
+ orig_references ? orig_references : "",
+ orig_references ? " " : "",
+ in_reply_to);
+   g_mime_object_set_header (GMIME_OBJECT (reply),
+ "References", references);
+
+   reply_headers = g_mime_object_to_string (GMIME_OBJECT (reply));
+   printf ("%s", reply_headers);
+   free (reply_headers);
+
+   g_object_unref (G_OBJECT (reply));
+   reply = NULL;
+
+   printf ("On %s, %s wrote:\n",
+   notmuch_message_get_header (message, "date"),
+   notmuch_message_get_header (message, "from"));
+
+   show_message_body (notmuch_message_get_filename (message), reply_part);
+
+   notmuch_message_destroy (message);
+}
+return 0;
+}

 int
 notmuch_reply_command (void *ctx, int argc, char *argv[])
@@ -378,6 +452,8 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])
reply_format_func = notmuch_reply_format_default;
} else if (strcmp (opt, "headers-only") == 0) {
reply_format_func = notmuch_reply_format_headers_only;
+   } else if (strcmp (opt, "sender-only") == 0) {
+   reply_format_func = notmuch_reply_format_sender_only;
} else {
fprintf (stderr, "Invalid value for --format: %s\n", opt);
return 1;
-- 
1.6.5.2.74.g610f9



[notmuch] [PATCH -v2] notmuch.el: Support for customizing search result display

2009-12-02 Thread Aneesh Kumar K.V
From: Aneesh Kumar K.V <aneesh.ku...@gmail.com>

This patch helps in customizing search result display
similar to mutt's index_format. The customization is done
by defining an alist as below

(setq notmuch-search-result-format '(("date" . "%s ")
 ("authors" . "%-40s ")
 ("subject" . "%s ")
 ("tags" . "(%s)")))

The supported keywords are date, count, authors, subject and tags.

Signed-off-by: Aneesh Kumar K.V 
---

Changes from V1:
tags can be specified any where in the result format.
Dropped notmuch-tag-face-alist which implies we cannot
fontify select list of tag names.

 notmuch.el |   56 +++-
 1 files changed, 39 insertions(+), 17 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 1e5bf5b..bd8a6ce 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -119,6 +119,14 @@ pattern can still test against the entire line).")
 (defvar notmuch-show-body-read-visible nil)
 (defvar notmuch-show-citations-visible nil)
 (defvar notmuch-show-signatures-visible nil)
+(defcustom notmuch-search-result-format nil
+  "Search result formating. Supported fields are
+   date, count, authors, subject, tags
+ex: (setq notmuch-search-result-format \(\(\"authors\" . \"%-40s\"\)
+   \(\"subject\" . \"%s\"\)\)\)"
+:type '(alist :key-type (string) :value-type (string))
+:group 'notmuch)
+
 (defvar notmuch-show-headers-visible nil)

 ; XXX: This should be a generic function in emacs somewhere, not here
@@ -1060,11 +1068,6 @@ thread from that buffer can be show when done with this 
one)."
   "Notmuch search mode face used to highligh tags."
   :group 'notmuch)

-(defvar notmuch-tag-face-alist nil
-  "List containing the tag list that need to be highlighed")
-
-(defvar notmuch-search-font-lock-keywords  nil)
-
 ;;;###autoload
 (defun notmuch-search-mode ()
   "Major mode displaying results of a notmuch search.
@@ -1100,17 +1103,7 @@ Complete list of currently available key bindings:
   (setq truncate-lines t)
   (setq major-mode 'notmuch-search-mode
mode-name "notmuch-search")
-  (setq buffer-read-only t)
-  (if (not notmuch-tag-face-alist)
-  (add-to-list 'notmuch-search-font-lock-keywords (list
-   "(\\([^)]*\\))$" '(1  'notmuch-tag-face)))
-(let ((notmuch-search-tags (mapcar 'car notmuch-tag-face-alist)))
-  (loop for notmuch-search-tag  in notmuch-search-tags
-   do (add-to-list 'notmuch-search-font-lock-keywords (list
-   (concat "([^)]*\\(" notmuch-search-tag "\\)[^)]*)$")
-   `(1  ,(cdr (assoc notmuch-search-tag 
notmuch-tag-face-alist
-  (set (make-local-variable 'font-lock-defaults)
- '(notmuch-search-font-lock-keywords t)))
+  (setq buffer-read-only t))

 (defun notmuch-search-find-thread-id ()
   "Return the thread for the current thread"
@@ -1217,6 +1210,30 @@ This function advances the next thread when finished."
(insert (format " (process returned %d)" 
exit-status)))
(insert "\n"))

+(defun insert-tags (tags)
+  (insert (concat "(" (propertize tags
+'font-lock-face 'notmuch-tag-face) ")")))
+
+(defun insert-field (field date count authors subject tags)
+(if (string-equal field "date")
+(insert (format (cdr (assoc field notmuch-search-result-format)) date))
+  (if (string-equal field "count")
+(insert (format (cdr (assoc field notmuch-search-result-format)) count))
+  (if (string-equal field "authors")
+(insert (format (cdr (assoc field notmuch-search-result-format)) authors))
+  (if (string-equal field "subject")
+  (insert (format (cdr (assoc field notmuch-search-result-format)) 
subject))
+  (if (string-equal field "tags")
+  (insert-tags (format (cdr (assoc field notmuch-search-result-format)) 
tags)))
+)
+
+(defun notmuch-search-show-result (date count authors subject tags)
+(let ((fields) (field))
+  (setq fields (mapcar 'car notmuch-search-result-format))
+  (loop for field in  fields
+   do (insert-field field date count authors subject tags)))
+(insert "\n"))
+
 (defun notmuch-search-process-filter (proc string)
   "Process and filter the output of \"notmuch search\""
   (let ((buffer (process-buffer proc)))
@@ -1239,7 +1256,12 @@ This function advances the next thread when finished."
  (set 'authors (concat (substring authors 0 (- 40 3)) 
"...")))
  (goto-char (point-max))
   

[notmuch] [PATCH 3/3] notmuch.el: Support for customizing search result display

2009-12-01 Thread aneesh . kumar
From: Aneesh Kumar K.V aneesh.ku...@gmail.com

This patch helps in customizing search result display
similar to mutt's index_format. The customization is done
by defining an alist as below

(setq notmuch-search-result-format '((date . %s )
 (authors . %-40s )
 (subject . %s )
 (tags . (%s

The supported keywords are date, count, authors, subject and tags.
tags need to be last element for it to get highlighted by notmuch-tag-face.

Signed-off-by: Aneesh Kumar K.V aneesh.ku...@gmail.com
---
 notmuch.el |   31 ++-
 1 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 6a0c119..cbee989 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -125,6 +125,13 @@ pattern can still test against the entire line).)
 (defvar notmuch-show-body-read-visible nil)
 (defvar notmuch-show-citations-visible nil)
 (defvar notmuch-show-signatures-visible nil)
+(defcustom notmuch-search-result-format nil
+  Search result formating. Supported fields are
+   date, count, authors, subject, tags
+ex: \(\(\date\ \%s\\) \(\count\ \%-7s\) \(\authors\ \%-40s\\) 
\(\subject %s\\) \(\tag\ \(%s)\\)\)
+:type '(alist :key-type (string) :value-type (string))
+:group 'notmuch)
+
 (defvar notmuch-show-headers-visible nil)
 
 ; XXX: This should be a generic function in emacs somewhere, not here
@@ -1117,6 +1124,26 @@ This function advances point to the next line when 
finished.
(insert (format  (process returned %d) 
exit-status)))
(insert \n))
 
+(defun insert_field (field date count authors subject tags)
+(if (string-equal field date)
+(insert (format (cdr (assoc field notmuch-search-result-format)) date))
+  (if (string-equal field count)
+(insert (format (cdr (assoc field notmuch-search-result-format)) count))
+  (if (string-equal field authors)
+(insert (format (cdr (assoc field notmuch-search-result-format)) authors))
+  (if (string-equal field subject)
+  (insert (format (cdr (assoc field notmuch-search-result-format)) 
subject))
+  (if (string-equal field tags)
+(insert (format (cdr (assoc field notmuch-search-result-format)) tags)))
+)
+
+(defun notmuch-search-show-result (date count authors subject tags)
+(let ((fields) (field))
+  (setq fields (mapcar 'car notmuch-search-result-format))
+  (loop for field in  fields
+   do (insert_field field date count authors subject tags)))
+(insert \n))
+
 (defun notmuch-search-process-filter (proc string)
   Process and filter the output of \notmuch search\
   (let ((buffer (process-buffer proc)))
@@ -1139,7 +1166,9 @@ This function advances point to the next line when 
finished.
  (set 'authors (concat (substring authors 0 (- 40 3)) 
...)))
  (goto-char (point-max))
  (let ((beg (point-marker)))
-   (insert (format %s %-7s %-40s %s (%s)\n date count 
authors subject tags))
+   (if (not notmuch-search-result-format)
+   (insert (format %s %-7s %-40s %s (%s)\n date 
count authors subject tags))
+ (notmuch-search-show-result date count authors 
subject tags))
(put-text-property beg (point-marker) 
'notmuch-search-thread-id thread-id))
  (set 'line (match-end 0)))
  (set 'more nil))
-- 
1.6.5.2.74.g610f9

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


[notmuch] [PATCH] notmuch.el: Add face support to message summary and subject lines.

2009-11-30 Thread Aneesh Kumar K. V
On Mon, 30 Nov 2009 22:50:39 +0800, Kan-Ru Chen  wrote:
> Remove the underline of both message summary and subject lines.
> Message summary still defaults to reverse-video, use customize to
> change it to whatever you like.
> 
> Signed-off-by: Kan-Ru Chen 
> ---
>  notmuch.el |   20 
>  1 files changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/notmuch.el b/notmuch.el
> index 65473ba..730538c 100644
> --- a/notmuch.el
> +++ b/notmuch.el
> @@ -714,9 +714,8 @@ which this thread was originally shown."
>(let ((beg (point-marker))
>  (btn nil))
>  (end-of-line)
> -; Inverse video for subject
> -(overlay-put (make-overlay beg (point)) 'face '(:inverse-video t))
> -(setq btn (make-button beg (point) :type 
> 'notmuch-button-body-toggle-type))
> +(setq btn (make-button beg (point) :type 'notmuch-button-body-toggle-type
> +   'face 'notmuch-show-message-summary-face))
>  (forward-line 1)
>  (end-of-line)
>  (let ((beg-hidden (point-marker)))
> @@ -739,7 +738,8 @@ which this thread was originally shown."
>(forward-line)
>(make-button (line-beginning-position) (line-end-position)
>  'invisibility-spec (cons invis-spec t)
> -:type 'notmuch-button-headers-toggle-type))
> +:type 'notmuch-button-headers-toggle-type
> +'face 'notmuch-show-message-headers-face))
>  (goto-char end)
>  (insert "\n")
>   (set-marker beg nil)
> @@ -959,6 +959,18 @@ thread from that buffer can be show when done with this 
> one)."
>"Notmuch search mode face used to highligh tags."
>:group 'notmuch)
> 
> +(defface notmuch-show-message-summary-face
> +  '((default
> +(:bold t :inverse-video t)))
> +  "Notmuch show mode face used to highlight summary line."
> +  :group 'notmuch)
> +
> +(defface notmuch-show-message-headers-face
> +  '((default
> + (:bold t)))
> +  "Notmuch show mode face used to highlight header lines."
> +  :group 'notmuch)
> +
>  (defvar notmuch-tag-face-alist nil
>"List containing the tag list that need to be highlighed")
> 

The subject line is already have a font face value attached.
message-header-name to show the name of the header and
message-header-subject to show the subject details.

-aneesh  


[notmuch] [PATCH -v6] notmuch.el: Add face support to search mode

2009-11-28 Thread Aneesh Kumar K.V
This patch use notmuch-tag-face showing tags in the notmuch-search-mode.

We can selectively highlight each tag by setting notmuch-tag-face-alist as below

(defface notmuch-tag-unread-face
 'class color)) (:foreground "goldenrod")))
  "Notmuch search mode face used to highligh tags.")

(defface notmuch-tag-inbox-face
 'class color)) (:foreground "red")))
  "Notmuch search mode face used to highligh tags.")

(setq notmuch-tag-face-alist '(("unread" . 'notmuch-tag-unread-face)
   ("inbox" . 'notmuch-tag-inbox-face)))
(require 'notmuch)

Signed-off-by: Aneesh Kumar K.V 
---
 notmuch.el |   30 +-
 1 files changed, 29 insertions(+), 1 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index e9786c0..5cbfedf 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -846,6 +846,23 @@ thread from that buffer can be show when done with this 
one)."
   (goto-char (point-max))
   (forward-line -1))

+(defface notmuch-tag-face
+  'class color)
+  (background dark))
+ (:foreground "OliveDrab1"))
+(((class color)
+  (background light))
+ (:foreground "navy blue" :bold t))
+(t
+ (:bold t)))
+  "Notmuch search mode face used to highligh tags."
+  :group 'notmuch)
+
+(defvar notmuch-tag-face-alist nil
+  "List containing the tag list that need to be highlighed")
+
+(defvar notmuch-search-font-lock-keywords  nil)
+
 ;;;###autoload
 (defun notmuch-search-mode ()
   "Major mode for searching mail with notmuch.
@@ -876,7 +893,18 @@ global search.
   (setq truncate-lines t)
   (setq major-mode 'notmuch-search-mode
mode-name "notmuch-search")
-  (setq buffer-read-only t))
+  (setq buffer-read-only t)
+  (if (not notmuch-tag-face-alist)
+  (add-to-list 'notmuch-search-font-lock-keywords (list
+   "(\\([^)]*\\))$" '(1  'notmuch-tag-face)))
+(progn
+  (setq notmuch-search-tags (mapcar 'car notmuch-tag-face-alist))
+  (loop for notmuch-search-tag  in notmuch-search-tags
+do (add-to-list 'notmuch-search-font-lock-keywords (list
+   (concat "([^)]*\\(" notmuch-search-tag 
"\\)[^)]*)$")
+   `(1  ,(cdr (assoc notmuch-search-tag 
notmuch-tag-face-alist
+  (set (make-local-variable 'font-lock-defaults)
+ '(notmuch-search-font-lock-keywords t)))

 (defun notmuch-search-find-thread-id ()
   "Return the thread for the current thread"
-- 
1.6.5.2.74.g610f9



[notmuch] [PATCH -v6] notmuch.el: Use message-mode font-face to highlight mail headers

2009-11-27 Thread Aneesh Kumar K.V
Signed-off-by: Aneesh Kumar K.V 
---
 notmuch.el |   29 +++--
 1 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index d2ebb40..b089732 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -604,6 +604,32 @@ which this thread was originally shown."
   (set-marker beg nil)
   (set-marker end nil)
   )))
+(defun notmuch-fontify-headers ()
+  (progn
+(if (looking-at "[Tt]o:")
+   (progn
+ (overlay-put (make-overlay (point) (re-search-forward ":"))
+   'face 'message-header-name)
+  (overlay-put (make-overlay (point) (re-search-forward ".*$"))
+   'face 'message-header-to))
+(if (looking-at "[B]?[Cc][Cc]:")
+   (progn
+ (overlay-put (make-overlay (point) (re-search-forward ":"))
+   'face 'message-header-name)
+  (overlay-put (make-overlay (point) (re-search-forward ".*$"))
+   'face 'message-header-cc))
+(if (looking-at "[Ss]ubject:")
+   (progn
+ (overlay-put (make-overlay (point) (re-search-forward ":"))
+   'face 'message-header-name)
+  (overlay-put (make-overlay (point) (re-search-forward ".*$"))
+   'face 'message-header-subject))
+(if (looking-at "[Ff]rom:")
+   (progn
+ (overlay-put (make-overlay (point) (re-search-forward ":"))
+   'face 'message-header-name)
+  (overlay-put (make-overlay (point) (re-search-forward ".*$"))
+   'face 'message-header-other

 (defun notmuch-show-markup-header (depth)
   (re-search-forward notmuch-show-header-begin-regexp)
@@ -624,8 +650,7 @@ which this thread was originally shown."
 (forward-line)
 (while (looking-at "[A-Za-z][-A-Za-z0-9]*:")
   (beginning-of-line)
-  (overlay-put (make-overlay (point) (re-search-forward ":"))
-   'face 'bold)
+ (notmuch-fontify-headers)
   (forward-line)
   )
(indent-rigidly beg end depth)
-- 
1.6.5.2.74.g610f9



[notmuch] [PATCH -v5] notmuch.el: Use message-mode font-face to highlight mail headers

2009-11-27 Thread Aneesh Kumar K.V
Signed-off-by: Aneesh Kumar K.V 
---
 notmuch.el |   35 +--
 1 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 89ccef6..851c60c 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -595,6 +595,38 @@ which this thread was originally shown."
   (set-marker beg nil)
   (set-marker end nil)
   )))
+(defun notmuch-fontify-headers ()
+  (progn
+(if (looking-at "[Tt]o:")
+   (progn
+ (overlay-put (make-overlay (point) (re-search-forward ":"))
+   'face 'message-header-name)
+  (overlay-put (make-overlay (point) (re-search-forward ".*$"))
+   'face 'message-header-to)))
+(beginning-of-line)
+(if (looking-at "[B]?[Cc][Cc]:")
+   (progn
+ (overlay-put (make-overlay (point) (re-search-forward ":"))
+   'face 'message-header-name)
+  (overlay-put (make-overlay (point) (re-search-forward ".*$"))
+   'face 'message-header-cc)))
+(beginning-of-line)
+(if (looking-at "[Ss]ubject:")
+   (progn
+ (overlay-put (make-overlay (point) (re-search-forward ":"))
+   'face 'message-header-name)
+  (overlay-put (make-overlay (point) (re-search-forward ".*$"))
+   'face 'message-header-subject)))
+(beginning-of-line)
+(if (looking-at "[Ff]rom:")
+   (progn
+ (overlay-put (make-overlay (point) (re-search-forward ":"))
+   'face 'message-header-name)
+  (overlay-put (make-overlay (point) (re-search-forward ".*$"))
+   'face 'message-header-other)))
+(beginning-of-line)
+
+))

 (defun notmuch-show-markup-header (depth)
   (re-search-forward notmuch-show-header-begin-regexp)
@@ -615,8 +647,7 @@ which this thread was originally shown."
 (forward-line)
 (while (looking-at "[A-Za-z][-A-Za-z0-9]*:")
   (beginning-of-line)
-  (overlay-put (make-overlay (point) (re-search-forward ":"))
-   'face 'bold)
+ (notmuch-fontify-headers)
   (forward-line)
   )
(indent-rigidly beg end depth)
-- 
1.6.5.2.74.g610f9



[notmuch] [PATCH -v5] notmuch.el: Add face support to search mode

2009-11-27 Thread Aneesh Kumar K.V
This patch use notmuch-tag-face showing tags in the notmuch-search-mode.

We can selectively highlight each tag by setting notmuch-tag-face-alist as below

(defface notmuch-tag-unread-face
 'class color)) (:foreground "goldenrod")))
  "Notmuch search mode face used to highligh tags.")

(defface notmuch-tag-inbox-face
 'class color)) (:foreground "red")))
  "Notmuch search mode face used to highligh tags.")

(setq notmuch-tag-face-alist '(("unread" . 'notmuch-tag-unread-face)
   ("inbox" . 'notmuch-tag-inbox-face)))
(require 'notmuch)

Signed-off-by: Aneesh Kumar K.V 
---
 notmuch.el |   23 ++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 551048a..4dc5a06 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -835,6 +835,16 @@ thread from that buffer can be show when done with this 
one)."
   (goto-char (point-max))
   (forward-line -1))

+(defface notmuch-tag-face
+ 'class color)) (:foreground "red")))
+  "Notmuch search mode face used to highligh tags."
+  :group 'notmuch)
+
+(defvar notmuch-tag-face-alist nil
+  "List containing the tag list that need to be highlighed")
+
+(defvar notmuch-search-font-lock-keywords  nil)
+
 ;;;###autoload
 (defun notmuch-search-mode ()
   "Major mode for searching mail with notmuch.
@@ -865,7 +875,18 @@ global search.
   (setq truncate-lines t)
   (setq major-mode 'notmuch-search-mode
mode-name "notmuch-search")
-  (setq buffer-read-only t))
+  (setq buffer-read-only t)
+  (if (not notmuch-tag-face-alist)
+  (add-to-list 'notmuch-search-font-lock-keywords (list
+   "\\(([^)]*)$\\)" '(1  'notmuch-tag-face)))
+(progn
+  (setq notmuch-search-tags (mapcar 'car notmuch-tag-face-alist))
+  (loop for notmuch-search-tag  in notmuch-search-tags
+do (add-to-list 'notmuch-search-font-lock-keywords (list
+   (concat "\\(" notmuch-search-tag "\\)")
+   `(1  ,(cdr (assoc notmuch-search-tag 
notmuch-tag-face-alist
+  (set (make-local-variable 'font-lock-defaults)
+ '(notmuch-search-font-lock-keywords t)))

 (defun notmuch-search-find-thread-id ()
   "Return the thread for the current thread"
-- 
1.6.5.2.74.g610f9



[notmuch] [PATCH -v5] notmuch.el: Use message-mode font-face to highlight mail headers

2009-11-27 Thread Aneesh Kumar K.V
Signed-off-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com
---
 notmuch.el |   35 +--
 1 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 89ccef6..851c60c 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -595,6 +595,38 @@ which this thread was originally shown.
   (set-marker beg nil)
   (set-marker end nil)
   )))
+(defun notmuch-fontify-headers ()
+  (progn
+(if (looking-at [Tt]o:)
+   (progn
+ (overlay-put (make-overlay (point) (re-search-forward :))
+   'face 'message-header-name)
+  (overlay-put (make-overlay (point) (re-search-forward .*$))
+   'face 'message-header-to)))
+(beginning-of-line)
+(if (looking-at [B]?[Cc][Cc]:)
+   (progn
+ (overlay-put (make-overlay (point) (re-search-forward :))
+   'face 'message-header-name)
+  (overlay-put (make-overlay (point) (re-search-forward .*$))
+   'face 'message-header-cc)))
+(beginning-of-line)
+(if (looking-at [Ss]ubject:)
+   (progn
+ (overlay-put (make-overlay (point) (re-search-forward :))
+   'face 'message-header-name)
+  (overlay-put (make-overlay (point) (re-search-forward .*$))
+   'face 'message-header-subject)))
+(beginning-of-line)
+(if (looking-at [Ff]rom:)
+   (progn
+ (overlay-put (make-overlay (point) (re-search-forward :))
+   'face 'message-header-name)
+  (overlay-put (make-overlay (point) (re-search-forward .*$))
+   'face 'message-header-other)))
+(beginning-of-line)
+
+))
 
 (defun notmuch-show-markup-header (depth)
   (re-search-forward notmuch-show-header-begin-regexp)
@@ -615,8 +647,7 @@ which this thread was originally shown.
 (forward-line)
 (while (looking-at [A-Za-z][-A-Za-z0-9]*:)
   (beginning-of-line)
-  (overlay-put (make-overlay (point) (re-search-forward :))
-   'face 'bold)
+ (notmuch-fontify-headers)
   (forward-line)
   )
(indent-rigidly beg end depth)
-- 
1.6.5.2.74.g610f9

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


[notmuch] [PATCH -v6] notmuch.el: Use message-mode font-face to highlight mail headers

2009-11-27 Thread Aneesh Kumar K.V
Signed-off-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com
---
 notmuch.el |   29 +++--
 1 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index d2ebb40..b089732 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -604,6 +604,32 @@ which this thread was originally shown.
   (set-marker beg nil)
   (set-marker end nil)
   )))
+(defun notmuch-fontify-headers ()
+  (progn
+(if (looking-at [Tt]o:)
+   (progn
+ (overlay-put (make-overlay (point) (re-search-forward :))
+   'face 'message-header-name)
+  (overlay-put (make-overlay (point) (re-search-forward .*$))
+   'face 'message-header-to))
+(if (looking-at [B]?[Cc][Cc]:)
+   (progn
+ (overlay-put (make-overlay (point) (re-search-forward :))
+   'face 'message-header-name)
+  (overlay-put (make-overlay (point) (re-search-forward .*$))
+   'face 'message-header-cc))
+(if (looking-at [Ss]ubject:)
+   (progn
+ (overlay-put (make-overlay (point) (re-search-forward :))
+   'face 'message-header-name)
+  (overlay-put (make-overlay (point) (re-search-forward .*$))
+   'face 'message-header-subject))
+(if (looking-at [Ff]rom:)
+   (progn
+ (overlay-put (make-overlay (point) (re-search-forward :))
+   'face 'message-header-name)
+  (overlay-put (make-overlay (point) (re-search-forward .*$))
+   'face 'message-header-other
 
 (defun notmuch-show-markup-header (depth)
   (re-search-forward notmuch-show-header-begin-regexp)
@@ -624,8 +650,7 @@ which this thread was originally shown.
 (forward-line)
 (while (looking-at [A-Za-z][-A-Za-z0-9]*:)
   (beginning-of-line)
-  (overlay-put (make-overlay (point) (re-search-forward :))
-   'face 'bold)
+ (notmuch-fontify-headers)
   (forward-line)
   )
(indent-rigidly beg end depth)
-- 
1.6.5.2.74.g610f9

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


[notmuch] OpenPGP support

2009-11-26 Thread Aneesh Kumar K. V
On Thu, 26 Nov 2009 01:01:32 -0500, Jameson Graef Rollins  wrote:
> On Mon, Nov 23, 2009 at 08:00:09AM -0500, Jameson Graef Rollins wrote:
> > Hi, folks.  I know it's a hairy problem, but has anyone started
> > looking into OpenPGP support for notmuch?
> 
> Hey, folks.  I wanted to try to follow up on this question.
> 
> I would really like to start using notmuch with emacs beyond just
> testing, but I really need to be able to handle/read/send mail with
> PGP/MIME encoded attachments.  Do folks have any suggestions on how to
> handle this?  Is there a separate emacs mode that people use for
> signing/verifying/{de,en}crypting mail buffers, or is this something
> that is going to have to be integrated into the notmuch mode?  I guess
> the notmuch-show mode at least will need to do some verifying and
> decrypting.
> 
> I've noticed that some people on this list sign their mails.  Are
> those of you that do using notmuch?  If so, I would love to learn how
> you handle it.  Thanks so much for the info.
> 

message-mode can sign the message using C-c RET C-s
which is mml-secure-message-sign


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



[notmuch] [PATCH -v4] notmuch.el: Add face support to search and show mode

2009-11-25 Thread Aneesh Kumar K. V
On Tue, 24 Nov 2009 21:24:07 -0800, Alexander Botero-Lowry  wrote:
> On Wed, 25 Nov 2009 10:28:00 +0530, "Aneesh Kumar K.V"  linux.vnet.ibm.com> wrote:
> > This add two faces, notmuch-show-subject-face and
> > notmuch-tag-face. The first face is used to show the subject
> > line in the notmuch-show-mode and the second one to show tags
> > in the notmuch-search-mode.
> > 
> First, I definetly think fontification is the way to go instead of
> the adhoc/crappy way that cworth and I have been doing this in the
> past.
> 
> [snip]
> 
> > +(defvar notmuch-show-font-lock-keywords
> > +  (list ;; header in font-lock-type-face
> > +   (list "\\(Subject:.*$\\)"
> > +'(1  'notmuch-show-subject-face)))
> > +  "Additonal expression to hightlight in notmuch-show-mode")
> > +
> So what happens if I have Subject:  in my message?

It will highlight them too. I initially tried to highlight it only
in the header fields. But then my elisp is not good to find out
how to do it for the full message. That is we need to search the
header area of each message and highlight specific fields. And all
the message fall in the same buffer. 


> We already ran
> into a problem where a patch sent the list that included notmuch control
> character caused it to go into an infinite loop, I'd prefer our
> fontification code be a bit more resilient. At the very least this
> should use the font-lock syntax tables stuff to only do header
> fontification when inside the header block. This would probably require
> that fontification occur before the message is post-processed by 
> notmuch-show to remove the section markers etc.

Highlighting specific part of the email should not get any trouble
like infinite loop. Unless somebody figure out how to make elisp 
highlight specific area, it would be nice to have the patch applied.
I really found it to help me when reading mails.


> 
> Also +1 for more subduded colors than red. :) Possibly consider copying
> the message-mode colors, so that there is a bit of consistency between
> sending and viewing mail? Might even be able to steal the message-mode
> faces by importing their symbols.
> 

I use yellow with black background. It is difficult to find a color that
everybody likes. Infact once of the reason the patch was not applied
till now was yellow may the subject line not readable. So i went for
read which kind of looked fine with white background.



> [snip]
> 
> >  (defun notmuch-search-mode ()
> >"Major mode for searching mail with notmuch.
> > @@ -865,7 +888,18 @@ global search.
> >(setq truncate-lines t)
> >(setq major-mode 'notmuch-search-mode
> > mode-name "notmuch-search")
> > -  (setq buffer-read-only t))
> > +  (setq buffer-read-only t)
> > +  (if (not notmuch-tag-face-alist)
> > +  (add-to-list 'notmuch-search-font-lock-keywords (list
> > +   "\\(([^)]*)$\\)" '(1  'notmuch-tag-face)))
> This way of detecting the tags seems ok, but I think it would be nicer
> if it could be done even more deterministically. :) One idea that be
> neat is to have a --format=sexp for notmuch search, which exports sexps
> (probably alists, but could be some other format) for the search results
> that can just be eval'd and processed in a cleaner way (and would also
> make for nicer APIs in emacs for querying notmuch itself). Actually I
> really like the idea of a sexp output mode for show too, instead of the
> markers *plots*
> 
> > +(progn
> > +  (setq notmuch-search-tags (mapcar 'car notmuch-tag-face-alist))
> > +  (loop for notmuch-search-tag  in notmuch-search-tags
> > +do (add-to-list 'notmuch-search-font-lock-keywords (list
> > +   (concat "\\(" notmuch-search-tag "\\)")
> > +   `(1  ,(cdr (assoc notmuch-search-tag 
> > notmuch-tag-face-alist
> > +  (set (make-local-variable 'font-lock-defaults)
> > + '(notmuch-search-font-lock-keywords t)))
> >  
> I don't really see the point of fontifying all tags the same way if no
> tag-faces have been set, especially if none of the rest of the search
> results are fontified.

This was done as per Carl's request. The idea was to make tags stand out
from rest of the subject. 

-aneesh


[notmuch] [PATCH] notmuch-new: Fix notmuch new to look at files within symbolic links

2009-11-25 Thread Aneesh Kumar K.V
We look at the modified time of the database and the directory
to decide whether we need to look at only the subdirectories.
ie, if directory modified time is < database modified time
then we have already looking at all the files withing the
directory. So we just need to iterate through the subdirectories

But with symlinks we need to make sure we follow them even if
the directory modified time is less than database modified time

Signed-off-by: Aneesh Kumar K.V 
---
 notmuch-new.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/notmuch-new.c b/notmuch-new.c
index e32b92a..ba5bb5a 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -149,7 +149,7 @@ add_files_recursive (notmuch_database_t *notmuch,
/* If this directory hasn't been modified since the last
 * add_files, then we only need to look further for
 * sub-directories. */
-   if (path_mtime <= path_dbtime && entry->d_type != DT_DIR)
+   if (path_mtime <= path_dbtime && entry->d_type == DT_REG)
continue;

/* Ignore special directories to avoid infinite recursion.
-- 
1.6.5.2.74.g610f9



[notmuch] [PATCH -v2] notmuch.el: Use variable notmuch-search-oldest-first to decide the search order

2009-11-25 Thread Aneesh Kumar K.V
Make sure we use notmuch-search-oldest-first to decide the how
the search result should be displayed. This helps to set the
value to nil and have latest mail shown first. This also fix the
notmuch-folder mode to use the right search order when we select
a folder. Also the notmuch command is fixed to use the right ordering.


Signed-off-by: Aneesh Kumar K.V 
---
 notmuch.el |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 5737f77..45c3dc6 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -817,7 +817,8 @@ thread from that buffer can be show when done with this 
one)."
 (fset 'notmuch-search-mode-map notmuch-search-mode-map)

 (defvar notmuch-search-query-string)
-(defvar notmuch-search-oldest-first)
+(defvar notmuch-search-oldest-first t
+  "Show the oldest mail first in the search-mode")


 (defun notmuch-search-scroll-up ()
@@ -1129,7 +1130,7 @@ current search results AND that are tagged with the given 
tag."
 (defun notmuch ()
   "Run notmuch to display all mail with tag of 'inbox'"
   (interactive)
-  (notmuch-search "tag:inbox" t))
+  (notmuch-search "tag:inbox" notmuch-search-oldest-first))

 (setq mail-user-agent 'message-user-agent)

@@ -1199,7 +1200,7 @@ results for the search terms in that line.
   (setq folder (notmuch-folder-find-name)))
   (let ((search (assoc folder notmuch-folders)))
 (if search
-   (notmuch-search (cdr search) t
+   (notmuch-search (cdr search) notmuch-search-oldest-first

 (defun notmuch-folder ()
   "Show the notmuch folder view and update the displayed counts."
-- 
1.6.5.2.74.g610f9



[notmuch] [PATCH -v4] notmuch.el: Add face support to search and show mode

2009-11-25 Thread Aneesh Kumar K.V
This add two faces, notmuch-show-subject-face and
notmuch-tag-face. The first face is used to show the subject
line in the notmuch-show-mode and the second one to show tags
in the notmuch-search-mode.

We can selectively highlight each tag by setting notmuch-tag-face-alist as below

(defface notmuch-tag-unread-face
 'class color) (background light)) (:foreground "goldenrod" :bold t))
(((class color) (background dark)) (:foreground "goldenrod" :bold t)))
  "Notmuch search mode face used to highligh tags.")

(defface notmuch-tag-inbox-face
 'class color) (background light)) (:foreground "red" :bold t))
(((class color) (background dark)) (:foreground "red" :bold t)))
  "Notmuch search mode face used to highligh tags.")

(setq notmuch-tag-face-alist '(("unread" . 'notmuch-tag-unread-face)
 ("inbox" . 'notmuch-tag-inbox-face)))
(require 'notmuch)

Signed-off-by: Aneesh Kumar K.V 
---
 notmuch.el |   38 --
 1 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 551048a..5737f77 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -663,6 +663,17 @@ which this thread was originally shown."
   (notmuch-show-markup-message)))
   (notmuch-show-hide-markers))

+(defface notmuch-show-subject-face
+ 'class color)) (:foreground "red")))
+  "Notmuch show mode face used to highligh subject line."
+  :group 'notmuch)
+
+(defvar notmuch-show-font-lock-keywords
+  (list ;; header in font-lock-type-face
+   (list "\\(Subject:.*$\\)"
+'(1  'notmuch-show-subject-face)))
+  "Additonal expression to hightlight in notmuch-show-mode")
+
 ;;;###autoload
 (defun notmuch-show-mode ()
   "Major mode for viewing a thread with notmuch.
@@ -695,7 +706,9 @@ view, (remove the \"inbox\" tag from each), with
   (use-local-map notmuch-show-mode-map)
   (setq major-mode 'notmuch-show-mode
mode-name "notmuch-show")
-  (setq buffer-read-only t))
+  (setq buffer-read-only t)
+  (set (make-local-variable 'font-lock-defaults)
+ '(notmuch-show-font-lock-keywords t)))

 ;;;###autoload

@@ -835,6 +848,16 @@ thread from that buffer can be show when done with this 
one)."
   (goto-char (point-max))
   (forward-line -1))

+(defface notmuch-tag-face
+ 'class color)) (:foreground "red")))
+  "Notmuch search mode face used to highligh tags."
+  :group 'notmuch)
+
+(defvar notmuch-tag-face-alist nil
+  "List containing the tag list that need to be highlighed")
+
+(defvar notmuch-search-font-lock-keywords  nil)
+
 ;;;###autoload
 (defun notmuch-search-mode ()
   "Major mode for searching mail with notmuch.
@@ -865,7 +888,18 @@ global search.
   (setq truncate-lines t)
   (setq major-mode 'notmuch-search-mode
mode-name "notmuch-search")
-  (setq buffer-read-only t))
+  (setq buffer-read-only t)
+  (if (not notmuch-tag-face-alist)
+  (add-to-list 'notmuch-search-font-lock-keywords (list
+   "\\(([^)]*)$\\)" '(1  'notmuch-tag-face)))
+(progn
+  (setq notmuch-search-tags (mapcar 'car notmuch-tag-face-alist))
+  (loop for notmuch-search-tag  in notmuch-search-tags
+do (add-to-list 'notmuch-search-font-lock-keywords (list
+   (concat "\\(" notmuch-search-tag "\\)")
+   `(1  ,(cdr (assoc notmuch-search-tag 
notmuch-tag-face-alist
+  (set (make-local-variable 'font-lock-defaults)
+ '(notmuch-search-font-lock-keywords t)))

 (defun notmuch-search-find-thread-id ()
   "Return the thread for the current thread"
-- 
1.6.5.2.74.g610f9



[notmuch] [PATCH] notmuch.el: Use variable notmuch-search-oldest-first to decide the search order

2009-11-23 Thread Aneesh Kumar K.V
Make sure we use notmuch-search-oldest-first to decide the how
the search result should be displayed. This helps to set the
value to nil and have latest mail shown first

Signed-off-by: Aneesh Kumar K.V 
---
 notmuch.el |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index af4ceec..5582132 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -840,7 +840,8 @@ thread from that buffer can be show when done with this 
one)."
 (fset 'notmuch-search-mode-map notmuch-search-mode-map)

 (defvar notmuch-search-query-string)
-(defvar notmuch-search-oldest-first)
+(defvar notmuch-search-oldest-first t
+  "Show the oldest mail first in the search-mode")

 (defun notmuch-search-scroll-up ()
   "Scroll up, moving point to last message in thread if at end."
@@ -1106,7 +1107,7 @@ current search results AND that are tagged with the given 
tag."
 (defun notmuch ()
   "Run notmuch to display all mail with tag of 'inbox'"
   (interactive)
-  (notmuch-search "tag:inbox" t))
+  (notmuch-search "tag:inbox" notmuch-search-oldest-first))

 (setq mail-user-agent 'message-user-agent)

@@ -1176,7 +1177,7 @@ results for the search terms in that line.
   (setq folder (notmuch-folder-find-name)))
   (let ((search (assoc folder notmuch-folders)))
 (if search
-   (notmuch-search (cdr search) t
+   (notmuch-search (cdr search) notmuch-search-oldest-first

 (defun notmuch-folder ()
   "Show the notmuch folder view and update the displayed counts."
-- 
1.6.5.2.74.g610f9



[notmuch] [RFC PATCH -V2] notmuch: Add support for multiple maildirs

2009-11-23 Thread Aneesh Kumar K.V
On Mon, Nov 23, 2009 at 04:51:34AM +0100, Carl Worth wrote:
> Finally, (and maybe I should have started with this), what's the actual
> use case here? Is it difficult to just arrange all mail to be under one
> top-level directory, (perhaps just using symlinks even).
> 

Ok i switched to using a separate directory for notmuch and symlink the
interested folders into that. So you can ignore the patch

-aneesh


[notmuch] [PATCH -v3] notmuch.el: Add face support to search and show mode

2009-11-23 Thread Aneesh Kumar K.V
This add two faces, notmuch-show-subject-face and
notmuch-tag-face. The first face is used to show the subject
line in the notmuch-show-mode and the second one to show tags
in the notmuch-search-mode.

We can selectively highlight each tag by setting notmuch-tag-face-alist as below

(defface notmuch-tag-unread-face
 'class color) (background light)) (:foreground "goldenrod" :bold t))
(((class color) (background dark)) (:foreground "goldenrod" :bold t)))
  "Notmuch search mode face used to highligh tags.")

(defface notmuch-tag-inbox-face
 'class color) (background light)) (:foreground "red" :bold t))
(((class color) (background dark)) (:foreground "red" :bold t)))
  "Notmuch search mode face used to highligh tags.")

(setq notmuch-tag-face-alist '(("unread" . 'notmuch-tag-unread-face)
 ("inbox" . 'notmuch-tag-inbox-face)))
(require 'notmuch)

Signed-off-by: Aneesh Kumar K.V 
---
 notmuch.el |   40 ++--
 1 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 1f24461..2aa6d5a 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -686,6 +686,18 @@ which this thread was originally shown."
   (force-window-update)
   (redisplay t))

+(defface notmuch-show-subject-face
+ 'class color) (background light)) (:foreground "yellow" :bold t))
+(((class color) (background dark)) (:foreground "yellow" :bold t)))
+  "Notmuch show mode face used to highligh subject line."
+  :group 'notmuch)
+
+(defvar notmuch-show-font-lock-keywords
+  (list ;; header in font-lock-type-face
+   (list "\\(Subject:.*$\\)"
+'(1  'notmuch-show-subject-face)))
+  "Additonal expression to hightlight in notmuch-show-mode")
+
 ;;;###autoload
 (defun notmuch-show-mode ()
   "Major mode for viewing a thread with notmuch.
@@ -726,7 +738,9 @@ view, (remove the \"inbox\" tag from each), with
   (use-local-map notmuch-show-mode-map)
   (setq major-mode 'notmuch-show-mode
mode-name "notmuch-show")
-  (setq buffer-read-only t))
+  (setq buffer-read-only t)
+  (set (make-local-variable 'font-lock-defaults)
+ '(notmuch-show-font-lock-keywords t)))

 ;;;###autoload

@@ -855,6 +869,17 @@ thread from that buffer can be show when done with this 
one)."
   (goto-char (point-max))
   (forward-line -1))

+(defface notmuch-tag-face
+ 'class color) (background light)) (:foreground "goldenrod" :bold t))
+(((class color) (background dark)) (:foreground "goldenrod" :bold t)))
+  "Notmuch search mode face used to highligh tags."
+  :group 'notmuch)
+
+(defvar notmuch-tag-face-alist nil
+  "List containing the tag list that need to be highlighed")
+
+(defvar notmuch-search-font-lock-keywords  nil)
+
 ;;;###autoload
 (defun notmuch-search-mode ()
   "Major mode for searching mail with notmuch.
@@ -885,7 +910,18 @@ global search.
   (setq truncate-lines t)
   (setq major-mode 'notmuch-search-mode
mode-name "notmuch-search")
-  (setq buffer-read-only t))
+  (setq buffer-read-only t)
+  (if (not notmuch-tag-face-alist)
+  (add-to-list 'notmuch-search-font-lock-keywords (list
+   "\\(([^)]*)$\\)" '(1  'notmuch-tag-face)))
+(progn
+  (setq notmuch-search-tags (mapcar 'car notmuch-tag-face-alist))
+  (loop for notmuch-search-tag  in notmuch-search-tags
+do (add-to-list 'notmuch-search-font-lock-keywords (list
+   (concat "\\(" notmuch-search-tag "\\)")
+   `(1  ,(cdr (assoc notmuch-search-tag 
notmuch-tag-face-alist
+  (set (make-local-variable 'font-lock-defaults)
+ '(notmuch-search-font-lock-keywords t)))

 (defun notmuch-search-find-thread-id ()
   (save-excursion
-- 
1.6.5.2.74.g610f9



[notmuch] [RFC PATCH -V2] notmuch: Add support for multiple maildirs

2009-11-22 Thread Aneesh Kumar K.V
This patch separate database path and maildir paths.
It also adds support for multiple maildir paths which
is represented by comma separated values. You need
to have in ~/.notmuch-config

[maildirs]
path=path1,path2

Signed-off-by: Aneesh Kumar K.V 
---
 notmuch-client.h |   12 
 notmuch-config.c |   54 ++
 notmuch-new.c|   24 +---
 notmuch-setup.c  |   37 +++--
 4 files changed, 122 insertions(+), 5 deletions(-)

diff --git a/notmuch-client.h b/notmuch-client.h
index ea77686..f2fc19f 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -83,6 +83,11 @@ typedef struct {
 add_files_callback_t callback;
 } add_files_state_t;

+struct count_ele {
+   int count;
+   char ele[0];
+};
+
 static inline void
 chomp_newline (char *str)
 {
@@ -182,4 +187,11 @@ notmuch_config_set_user_other_email (notmuch_config_t 
*config,
 notmuch_bool_t
 debugger_is_active (void);

+const struct count_ele *
+notmuch_config_get_maildirs (notmuch_config_t *config);
+
+void
+notmuch_config_set_maildirs (notmuch_config_t *config,
+   const char *maildirs);
+
 #endif
diff --git a/notmuch-config.c b/notmuch-config.c
index aaa0372..330da48 100644
--- a/notmuch-config.c
+++ b/notmuch-config.c
@@ -62,6 +62,7 @@ struct _notmuch_config {
 char *user_primary_email;
 char **user_other_email;
 size_t user_other_email_length;
+struct count_ele *maildirs;
 };

 static int
@@ -345,6 +346,59 @@ notmuch_config_set_database_path (notmuch_config_t *config,
 config->database_path = NULL;
 }

+const struct count_ele *
+notmuch_config_get_maildirs (notmuch_config_t *config)
+{
+   int size;
+   char *cur_ptr;
+   char *dirs, *token, *saveptr;
+   struct count_ele *maildirs = NULL;
+   if (config->maildirs == NULL) {
+dirs = g_key_file_get_string (config->key_file,
+"maildirs", "path", NULL);
+   if (dirs) {
+   size = sizeof(struct count_ele) + strlen(dirs) + 1;
+   /* comma separated paths */
+   maildirs = (struct count_ele *)malloc(size);
+   maildirs->count = 0;
+   cur_ptr = maildirs->ele;
+   token = strtok_r(dirs, ",", );
+   if (token == NULL) {
+   /* only one element */
+   strcpy(maildirs->ele, dirs);
+   maildirs->count = 1;
+   free(dirs);
+   config->maildirs = maildirs;
+   return maildirs;
+   }
+   strcpy(maildirs->ele, token);
+   maildirs->count++;
+   cur_ptr += strlen(token) + 1;
+   while ((token = strtok_r(NULL, ",", ))) {
+   strcpy(cur_ptr, token);
+   maildirs->count++;
+   cur_ptr += strlen(token) + 1;
+   }
+   free (dirs);
+   }
+   config->maildirs = maildirs;
+   }
+   return config->maildirs;
+
+
+}
+
+void
+notmuch_config_set_maildirs (notmuch_config_t *config,
+ const char *maildirs)
+{
+g_key_file_set_string (config->key_file,
+  "maildirs", "path", maildirs);
+
+free (config->maildirs);
+config->maildirs = NULL;
+}
+
 const char *
 notmuch_config_get_user_name (notmuch_config_t *config)
 {
diff --git a/notmuch-new.c b/notmuch-new.c
index 0dd2784..1a9406b 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -385,14 +385,16 @@ notmuch_new_command (void *ctx,
 {
 notmuch_config_t *config;
 notmuch_database_t *notmuch;
+const struct count_ele *maildirs;
 add_files_state_t add_files_state;
 double elapsed;
 struct timeval tv_now;
-int ret = 0;
+int ret = 0, maildirs_count;
 struct stat st;
 const char *db_path;
 char *dot_notmuch_path;
 struct sigaction action;
+const char *maildir_path;

 /* Setup our handler for SIGINT */
 memset (, 0, sizeof (struct sigaction));
@@ -406,6 +408,9 @@ notmuch_new_command (void *ctx,
return 1;

 db_path = notmuch_config_get_database_path (config);
+maildirs = notmuch_config_get_maildirs (config);
+if (maildirs == NULL)
+   return 1;

 dot_notmuch_path = talloc_asprintf (ctx, "%s/%s", db_path, ".notmuch");

@@ -413,7 +418,13 @@ notmuch_new_command (void *ctx,
int count;

count = 0;
-   count_files (db_path, );
+   maildirs_count = maildirs->count;
+   maildir_path   = m

[notmuch] [RFC PATCH] notmuch: Add support for multiple maildirs

2009-11-22 Thread Aneesh Kumar K.V
This patch separate database path and maildir paths.
It also adds support for multiple maildir paths which
is represented by comma separated values. You need
to have in ~/.notmuch-config

[maildirs]
path=path1,path2

Signed-off-by: Aneesh Kumar K.V 
---
 notmuch-client.h |8 
 notmuch-config.c |   43 +++
 notmuch-new.c|   24 +---
 3 files changed, 72 insertions(+), 3 deletions(-)

diff --git a/notmuch-client.h b/notmuch-client.h
index ea77686..128fd7f 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -83,6 +83,11 @@ typedef struct {
 add_files_callback_t callback;
 } add_files_state_t;

+struct count_ele {
+   int count;
+   char ele[0];
+};
+
 static inline void
 chomp_newline (char *str)
 {
@@ -182,4 +187,7 @@ notmuch_config_set_user_other_email (notmuch_config_t 
*config,
 notmuch_bool_t
 debugger_is_active (void);

+const struct count_ele *
+notmuch_config_get_maildirs (notmuch_config_t *config);
+
 #endif
diff --git a/notmuch-config.c b/notmuch-config.c
index aaa0372..12b0081 100644
--- a/notmuch-config.c
+++ b/notmuch-config.c
@@ -62,6 +62,7 @@ struct _notmuch_config {
 char *user_primary_email;
 char **user_other_email;
 size_t user_other_email_length;
+struct count_ele *maildirs;
 };

 static int
@@ -334,6 +335,48 @@ notmuch_config_get_database_path (notmuch_config_t *config)
 return config->database_path;
 }

+const struct count_ele *
+notmuch_config_get_maildirs (notmuch_config_t *config)
+{
+   int size;
+   char *cur_ptr;
+   char *dirs, *token, *saveptr;
+   struct count_ele *maildirs = NULL;
+   if (config->maildirs == NULL) {
+dirs = g_key_file_get_string (config->key_file,
+"maildirs", "path", NULL);
+   if (dirs) {
+   size = sizeof(struct count_ele) + strlen(dirs) + 1;
+   /* comma separated paths */
+   maildirs = (struct count_ele *)malloc(size);
+   maildirs->count = 0;
+   cur_ptr = maildirs->ele;
+   token = strtok_r(dirs, ",", );
+   if (token == NULL) {
+   /* only one element */
+   strcpy(maildirs->ele, dirs);
+   maildirs->count = 1;
+   free(dirs);
+   config->maildirs = maildirs;
+   return maildirs;
+   }
+   strcpy(maildirs->ele, token);
+   maildirs->count++;
+   cur_ptr += strlen(token) + 1;
+   while ((token = strtok_r(NULL, ",", ))) {
+   strcpy(cur_ptr, token);
+   maildirs->count++;
+   cur_ptr += strlen(token) + 1;
+   }
+   free (dirs);
+   }
+   config->maildirs = maildirs;
+   }
+   return config->maildirs;
+
+
+}
+
 void
 notmuch_config_set_database_path (notmuch_config_t *config,
  const char *database_path)
diff --git a/notmuch-new.c b/notmuch-new.c
index 0dd2784..1a9406b 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -385,14 +385,16 @@ notmuch_new_command (void *ctx,
 {
 notmuch_config_t *config;
 notmuch_database_t *notmuch;
+const struct count_ele *maildirs;
 add_files_state_t add_files_state;
 double elapsed;
 struct timeval tv_now;
-int ret = 0;
+int ret = 0, maildirs_count;
 struct stat st;
 const char *db_path;
 char *dot_notmuch_path;
 struct sigaction action;
+const char *maildir_path;

 /* Setup our handler for SIGINT */
 memset (, 0, sizeof (struct sigaction));
@@ -406,6 +408,9 @@ notmuch_new_command (void *ctx,
return 1;

 db_path = notmuch_config_get_database_path (config);
+maildirs = notmuch_config_get_maildirs (config);
+if (maildirs == NULL)
+   return 1;

 dot_notmuch_path = talloc_asprintf (ctx, "%s/%s", db_path, ".notmuch");

@@ -413,7 +418,13 @@ notmuch_new_command (void *ctx,
int count;

count = 0;
-   count_files (db_path, );
+   maildirs_count = maildirs->count;
+   maildir_path   = maildirs->ele;
+   while (maildirs_count) {
+   count_files (maildir_path, );
+   maildir_path += strlen(maildir_path) + 1;
+   maildirs_count--;
+   }
if (interrupted)
return 1;

@@ -439,7 +450,14 @@ notmuch_new_command (void *ctx,
 add_files_state.added_messages = 0;
 gettimeofday (_files_state.tv_start, NULL);

-ret = add_files (notmuch, db_path, _files_state);
+maildirs_count

[notmuch] [PATCH -v2] notmuch.el: Add face support to search and show mode

2009-11-22 Thread Aneesh Kumar K.V
On Sun, Nov 22, 2009 at 01:02:21PM +0100, Carl Worth wrote:
> On Sun, 22 Nov 2009 14:07:56 +0530, "Aneesh Kumar K.V"  linux.vnet.ibm.com> wrote:
> > This add two faces, notmuch-show-subject-face and
> > notmuch-tag-unread-face. The first face is used to show the subject
> > line in the notmuch-show-mode and the second one to show the unread
> > tag in the notmuch-search-mode. We can set additional tags by setting
> > notmuch-tag-face-alist as below
> 
> Hi Aneesh,
> 
> I've been meaning to follow-up with you on this since I did get it
> working.
> 
> > (setq notmuch-tag-face-alist '(("unread" . 'notmuch-tag-unread-face)
> >  ("inbox" . 'notmuch-tag-inbox-face)))
> 
> It's interesting to be able to highlight specific tags like this. But I
> think that first I'd like to have a single 'notmuch-tag face to make it
> easier to see all the tag names, since they're hard to see among the
> subject. And then maybe after that have s 'notmuch-tag-important-face or
> something. I'm guessing that just that much would cover most people's
> needs, before needing to choose custom colors for each tag name.

The default search pattern for notmuch is inbox and unread right. So adding
both of them to the notmuch-tag-face-alist should color the tags properly.

> 
> > +(defface notmuch-show-subject-face
> > + 'class color) (background light)) (:foreground "yellow" :bold t))
> > +(((class color) (background dark)) (:foreground "yellow" :bold t)))
> > +  "Notmuch show mode face used to highligh subject line."
> > +  :group 'notmuch)
> 
> Color selection can be pretty difficult, and I don't think we're ever
> all going to agree on things. But I can at least say that I can't read
> yellow on white at all, (maybe yellow on black works out a bit better, I
> don't know).
> 
> So I'd definitely like to hear people's ideas on what the presentation
> should look like here.
> 
> First, the current reverse-video is definitely not something I really
> like. That was just a placeholder since I didn't know how to configure
> other faces, (and I needed _something_ to distinguish one message from
> another).
> 
> Second, from the time I spent with sup, I found that it was hard for me
> to read entire lines of bold text. So I think I'd rather just have the
> header name ("Subject:", for example) in bold and the rest of the
> subject not bold. Hmm... maybe we could use a "From:" at the beginning
> of the one line summary.
> 
> Finally, for separating one message from the other, I think I'd really
> just like a one-pixel line drawn between the last line of text of one
> message and the first line of text of the next message. Does anybody
> know how to achieve that?
> 
> Back to the patch, I think I'll be able to push it as soon as I can
> apply it and still _see_ the subject lines. ;-)

One of the easy part with emacs is we can use customize-face and select 
notmuch-show-subject-face to select what ever suites your configuration.
For me with black background i found yellow with bold to be nice.

-aneesh


[notmuch] [PATCH -v2] notmuch.el: Add face support to search and show mode

2009-11-22 Thread Aneesh Kumar K.V
This add two faces, notmuch-show-subject-face and
notmuch-tag-unread-face. The first face is used to show the subject
line in the notmuch-show-mode and the second one to show the unread
tag in the notmuch-search-mode. We can set additional tags by setting
notmuch-tag-face-alist as below

(defface notmuch-tag-unread-face
 'class color) (background light)) (:foreground "goldenrod" :bold t))
(((class color) (background dark)) (:foreground "goldenrod" :bold t)))
  "Notmuch search mode face used to highligh tags.")

(defface notmuch-tag-inbox-face
 'class color) (background light)) (:foreground "red" :bold t))
(((class color) (background dark)) (:foreground "red" :bold t)))
  "Notmuch search mode face used to highligh tags.")

(setq notmuch-tag-face-alist '(("unread" . 'notmuch-tag-unread-face)
 ("inbox" . 'notmuch-tag-inbox-face)))
(require 'notmuch)

Signed-off-by: Aneesh Kumar K.V 
---
 notmuch.el |   36 ++--
 1 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 0144b61..a0f5aaa 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -637,6 +637,18 @@ which this thread was originally shown."
   (force-window-update)
   (redisplay t))

+(defface notmuch-show-subject-face
+ 'class color) (background light)) (:foreground "yellow" :bold t))
+(((class color) (background dark)) (:foreground "yellow" :bold t)))
+  "Notmuch show mode face used to highligh subject line."
+  :group 'notmuch)
+
+(defvar notmuch-show-font-lock-keywords
+  (list ;; header in font-lock-type-face
+   (list "\\(Subject:.*$\\)"
+'(1  'notmuch-show-subject-face)))
+  "Additonal expression to hightlight in notmuch-show-mode")
+
 ;;;###autoload
 (defun notmuch-show-mode ()
   "Major mode for viewing a thread with notmuch.
@@ -677,7 +689,9 @@ view, (remove the \"inbox\" tag from each), with
   (use-local-map notmuch-show-mode-map)
   (setq major-mode 'notmuch-show-mode
mode-name "notmuch-show")
-  (setq buffer-read-only t))
+  (setq buffer-read-only t)
+  (set (make-local-variable 'font-lock-defaults)
+ '(notmuch-show-font-lock-keywords t)))

 ;;;###autoload

@@ -806,6 +820,17 @@ thread from that buffer can be show when done with this 
one)."
   (goto-char (point-max))
   (forward-line -1))

+(defface notmuch-tag-unread-face
+ 'class color) (background light)) (:foreground "goldenrod" :bold t))
+(((class color) (background dark)) (:foreground "goldenrod" :bold t)))
+  "Notmuch search mode face used to highligh tags."
+  :group 'notmuch)
+
+(defvar notmuch-tag-face-alist `(("unread" . 'notmuch-tag-unread-face))
+  "List containing the tag list that need to be highlighed")
+
+(defvar notmuch-search-font-lock-keywords  nil)
+
 ;;;###autoload
 (defun notmuch-search-mode ()
   "Major mode for searching mail with notmuch.
@@ -836,7 +861,14 @@ global search.
   (setq truncate-lines t)
   (setq major-mode 'notmuch-search-mode
mode-name "notmuch-search")
-  (setq buffer-read-only t))
+  (setq buffer-read-only t)
+  (setq notmuch-search-tags (mapcar 'car notmuch-tag-face-alist))
+  (loop for notmuch-search-tag  in notmuch-search-tags
+do (add-to-list 'notmuch-search-font-lock-keywords (list
+   (concat "\\(" notmuch-search-tag "\\)")
+   `(1  ,(cdr (assoc notmuch-search-tag 
notmuch-tag-face-alist))
+  (set (make-local-variable 'font-lock-defaults)
+ '(notmuch-search-font-lock-keywords t)))

 (defun notmuch-search-find-thread-id ()
   (save-excursion
-- 
1.6.5.2.74.g610f9



[notmuch] [PATCH] notmuch.el: Add face support to search and show mode

2009-11-21 Thread Aneesh Kumar K.V
On Sat, Nov 21, 2009 at 03:59:12AM +0100, Carl Worth wrote:
> On Fri, 20 Nov 2009 20:57:24 +0530, "Aneesh Kumar K.V"  linux.vnet.ibm.com> wrote:
> > This add two faces, notmuch-show-subject-face and
> > notmuch-tag-unread-face. The first face is used to show the subject
> > line in the notmuch-show-mode and the second one the unread tag in
> > the notmuch-search-mode.
> > 
> > The changes are done looking at message.el in emacs source
> 
> Hi Aneesh,
> 
> This looks like very interesting stuff, but I wasn't able to get it to
> work. Initially I was running emacs within a terminal (emacs -nw) so I
> thought that might be preventing me from seeing the face differences or
> so.
> 
> But I can't seem to see anything in graphical emacs either.
> 
> Is there something more I need to do to make this work?

To verify whether i have some setting in .emacs i ran emacs -q and still
i am able see the colors. So not sure what extra is needed. I also tried
emacs23 and that also worked. Are you able to see this faces via customize-face
command ? And what is the color they display in customize-face ?

-aneesh



[notmuch] [PATCH] notmuch.el: Add face support to search and show mode

2009-11-20 Thread Aneesh Kumar K.V
This add two faces, notmuch-show-subject-face and
notmuch-tag-unread-face. The first face is used to show the subject
line in the notmuch-show-mode and the second one the unread tag in
the notmuch-search-mode.

The changes are done looking at message.el in emacs source

Signed-off-by: Aneesh Kumar K.V 
---
 notmuch.el |   55 ++-
 1 files changed, 50 insertions(+), 5 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 4b2936a..71e9dea 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -603,9 +603,37 @@ which this thread was originally shown."
   (force-window-update)
   (redisplay t))

+(defun notmuch-font-lock-matcher (regexp)
+  (let ((form
+ `(lambda (limit)
+(let ((start (point)))
+  (save-restriction
+(widen)
+(goto-char (point-min))
+   (setq limit (min limit (point-max)))
+(goto-char start))
+  (and (< start limit)
+   (re-search-forward ,regexp limit t))
+(if (featurep 'bytecomp)
+(byte-compile form)
+  form)))
+
+(defface notmuch-show-subject-face
+ 'class color) (background light)) (:foreground "yellow" :bold t))
+(((class color) (background dark)) (:foreground "yellow" :bold t)))
+  "Notmuch show mode face used to highligh subject line."
+  :group 'notmuch)
+
+(defvar notmuch-show-font-lock-keywords
+  (let ((content ""))
+`((,(notmuch-font-lock-matcher
+(concat "\\(Subject:.*$\\)" content))
+(1 'notmuch-show-subject-face nil t
+  "Additonal expression to hightlight in notmuch-search-mode")
+
 ;;;###autoload
-(defun notmuch-show-mode ()
-  "Major mode for viewing a thread with notmuch.
+(define-derived-mode notmuch-show-mode text-mode "notmuch-show"
+"Major mode for viewing a thread with notmuch.

 This buffer contains the results of the \"notmuch show\" command
 for displaying a single thread of email from your email archives.
@@ -643,7 +671,9 @@ view, (remove the \"inbox\" tag from each), with
   (use-local-map notmuch-show-mode-map)
   (setq major-mode 'notmuch-show-mode
mode-name "notmuch-show")
-  (setq buffer-read-only t))
+  (setq buffer-read-only t)
+  (set (make-local-variable 'font-lock-defaults)
+ '(notmuch-show-font-lock-keywords t)))

 ;;;###autoload

@@ -769,8 +799,21 @@ thread from that buffer can be show when done with this 
one)."
   (end-of-buffer arg)
   (forward-line -1))

+(defface notmuch-tag-unread-face
+ 'class color) (background light)) (:foreground "goldenrod" :bold t))
+(((class color) (background dark)) (:foreground "goldenrod" :bold t)))
+  "Notmuch search mode face used to highligh inbox tags."
+  :group 'notmuch)
+
+(defvar notmuch-search-font-lock-keywords
+  (let ((content ""))
+`((,(notmuch-font-lock-matcher
+(concat "\\(unread\\)" content))
+(1 'notmuch-tag-unread-face nil t
+  "Additonal expression to hightlight in notmuch-search-mode")
+
 ;;;###autoload
-(defun notmuch-search-mode ()
+(define-derived-mode notmuch-search-mode text-mode "notmuch-search"
   "Major mode for searching mail with notmuch.

 This buffer contains the results of a \"notmuch search\" of your
@@ -799,7 +842,9 @@ global search.
   (setq truncate-lines t)
   (setq major-mode 'notmuch-search-mode
mode-name "notmuch-search")
-  (setq buffer-read-only t))
+  (setq buffer-read-only t)
+  (set (make-local-variable 'font-lock-defaults)
+ '(notmuch-search-font-lock-keywords t)))

 (defun notmuch-search-find-thread-id ()
   (save-excursion
-- 
1.6.5.2.74.g610f9



[notmuch] [PATCH -V3] notmuch: Add search mode hook

2009-11-19 Thread Aneesh Kumar K.V
This patch add notmuch-search-hook that gets run when we
after displaying search results


Signed-off-by: Aneesh Kumar K.V 
Cc:Keith Packard 

---
 notmuch.el |   12 +++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 706e9f3..1fc54c3 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -654,6 +654,12 @@ view, (remove the \"inbox\" tag from each), with
   :options '(goto-address)
   :group 'notmuch)

+(defcustom notmuch-search-hook nil
+  "List of functions to call when notmuch displays the search results."
+  :type 'hook
+  :options '(hl-line-mode)
+  :group 'notmuch)
+
 ; Make show mode a bit prettier, highlighting URLs and using word wrap

 (defun notmuch-show-pretty-hook ()
@@ -661,6 +667,9 @@ view, (remove the \"inbox\" tag from each), with
   (visual-line-mode))

 (add-hook 'notmuch-show-hook 'notmuch-show-pretty-hook)
+(add-hook 'notmuch-search-hook
+ (lambda()
+   (hl-line-mode 1) ))

 (defun notmuch-show (thread-id  parent-buffer)
   "Run \"notmuch show\" with the given thread ID and display results.
@@ -911,7 +920,8 @@ This function advances point to the next line when 
finished."
(call-process "notmuch" nil t nil "search" "--sort=oldest-first" 
query)
  (call-process "notmuch" nil t nil "search" "--sort=newest-first" 
query))
(notmuch-search-markup-thread-ids)
-   
+   ))
+(run-hooks 'notmuch-search-hook)))

 (defun notmuch-search-refresh-view ()
   "Refresh the current view.
-- 
1.6.5.2.74.g610f9



[notmuch] [PATCH] notmuch: Add search mode hook

2009-11-19 Thread Aneesh Kumar K.V
On Wed, Nov 18, 2009 at 09:21:11PM -0800, Keith Packard wrote:
> On Thu, 19 Nov 2009 10:25:37 +0530, "Aneesh Kumar K.V"  linux.vnet.ibm.com> wrote:
> 
> > This patch add notmuch-search-mode-hook and rename
> > notmuch-show-hook to notmuch-show-mode-hook. This
> > also runs notmuch-show-mode-hook when we enable
> > notmuch-show-mode
> 
> I'm not sure we want to run the hooks that early; I can easily imagine
> hooks that want to be run after the message has been loaded.

Ok i will move them and send another patch

-aneesh



[notmuch] [PATCH] notmuch: Add search mode hook

2009-11-19 Thread Aneesh Kumar K.V
This patch add notmuch-search-mode-hook and rename
notmuch-show-hook to notmuch-show-mode-hook. This
also runs notmuch-show-mode-hook when we enable
notmuch-show-mode

Signed-off-by: Aneesh Kumar K.V 
CC:Keith Packard 
---
 notmuch.el |   20 +++-
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 706e9f3..2f11b2b 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -640,7 +640,8 @@ view, (remove the \"inbox\" tag from each), with
   (use-local-map notmuch-show-mode-map)
   (setq major-mode 'notmuch-show-mode
mode-name "notmuch-show")
-  (setq buffer-read-only t))
+  (setq buffer-read-only t)
+  (run-hooks 'notmuch-show-mode-hook))

 ;;;###autoload

@@ -648,19 +649,28 @@ view, (remove the \"inbox\" tag from each), with
   "Notmuch mail reader for Emacs."
   :group 'mail)

-(defcustom notmuch-show-hook nil
+(defcustom notmuch-show-mode-hook nil
   "List of functions to call when notmuch displays a message."
   :type 'hook
   :options '(goto-address)
   :group 'notmuch)

+(defcustom notmuch-search-mode-hook nil
+  "List of functions to call when notmuch displays the search results."
+  :type 'hook
+  :options '(hl-line-mode)
+  :group 'notmuch)
+
 ; Make show mode a bit prettier, highlighting URLs and using word wrap

 (defun notmuch-show-pretty-hook ()
   (goto-address-mode 1)
   (visual-line-mode))

-(add-hook 'notmuch-show-hook 'notmuch-show-pretty-hook)
+(add-hook 'notmuch-show-mode-hook 'notmuch-show-pretty-hook)
+(add-hook 'notmuch-search-mode-hook 
+ (lambda()
+   (hl-line-mode 1) ))

 (defun notmuch-show (thread-id  parent-buffer)
   "Run \"notmuch show\" with the given thread ID and display results.
@@ -684,7 +694,6 @@ thread from that buffer can be show when done with this 
one)."
(call-process "notmuch" nil t nil "show" thread-id)
(notmuch-show-markup-messages)
)
-  (run-hooks 'notmuch-show-hook)
   ; Move straight to the first unread message
   (if (not (notmuch-show-message-unread-p))
  (progn
@@ -787,7 +796,8 @@ global search.
   (setq truncate-lines t)
   (setq major-mode 'notmuch-search-mode
mode-name "notmuch-search")
-  (setq buffer-read-only t))
+  (setq buffer-read-only t)
+  (run-hooks 'notmuch-search-mode-hook))

 (defun notmuch-search-find-thread-id ()
   (save-excursion
-- 
1.6.5.2.74.g610f9



[notmuch] [PATCH] notmuch: Add Maildir directory name as tag name for messages

2009-11-18 Thread Aneesh Kumar K.V

>From 24711481dfe770417aa0a13308a9bb842dfb03f4 Mon Sep 17 00:00:00 2001
From: Aneesh Kumar K.V <aneesh.ku...@linux.vnet.ibm.com>
Date: Wed, 18 Nov 2009 21:20:12 +0530
Subject: [PATCH] notmuch: Add Maildir directory name as tag name for messages

This patch adds maildir directory name as the tag name for
messages. This helps in adding tags using filtering already
provided by procmail.


Signed-off-by: Aneesh Kumar K.V 
---
 notmuch-new.c |   12 ++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/notmuch-new.c b/notmuch-new.c
index 5405a9f..50d0a5a 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -96,6 +96,7 @@ add_files_print_progress (add_files_state_t *state)
 static notmuch_status_t
 add_files_recursive (notmuch_database_t *notmuch,
 const char *path,
+const char *tag,
 struct stat *st,
 add_files_state_t *state)
 {
@@ -186,6 +187,7 @@ add_files_recursive (notmuch_database_t *notmuch,
case NOTMUCH_STATUS_SUCCESS:
state->added_messages++;
tag_inbox_and_unread (message);
+   notmuch_message_add_tag (message, tag);
break;
/* Non-fatal issues (go on to next file) */
case NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID:
@@ -223,7 +225,13 @@ add_files_recursive (notmuch_database_t *notmuch,
}
}
} else if (S_ISDIR (st->st_mode)) {
-   status = add_files_recursive (notmuch, next, st, state);
+   if ((strcmp (entry->d_name, "cur") == 0) ||
+   (strcmp (entry->d_name, "new") == 0) ||
+   (strcmp (entry->d_name, "tmp") == 0)) {
+   status = add_files_recursive (notmuch, next, tag, st, 
state);
+   } else {
+   status = add_files_recursive (notmuch, next, 
entry->d_name, st, state);
+   }
if (status && ret == NOTMUCH_STATUS_SUCCESS)
ret = status;
}
@@ -285,7 +293,7 @@ add_files (notmuch_database_t *notmuch,
 timerval.it_value.tv_usec = 0;
 setitimer (ITIMER_REAL, , NULL);

-status = add_files_recursive (notmuch, path, , state);
+status = add_files_recursive (notmuch, path, basename(path), , state);

 /* Now stop the timer. */
 timerval.it_interval.tv_sec = 0;
-- 
1.6.5.2.74.g610f9



[notmuch] [PATCH] notmuch: Add tag archive when archiving the mails

2009-11-18 Thread Aneesh Kumar K.V

>From a2325b950016f39290a0c6f0d6aa3417584eb4e8 Mon Sep 17 00:00:00 2001
From: Aneesh Kumar K.V <aneesh.ku...@linux.vnet.ibm.com>
Date: Wed, 18 Nov 2009 20:45:45 +0530
Subject: [PATCH] notmuch: Add tag archive when archiving the mails

This enables us to search for archived mails later

Signed-off-by: Aneesh Kumar K.V 
---
 notmuch.el |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 87116f9..ec2155a 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -196,6 +196,7 @@ Unlike builtin `next-line' this version accepts no 
arguments."
   (if markread
  (notmuch-show-remove-tag "unread" "inbox")
(notmuch-show-remove-tag "inbox"))
+  (notmuch-show-add-tag "archive")
   (if (not (eobp))
  (forward-char))
   (if (not (re-search-forward notmuch-show-message-begin-regexp nil t))
-- 
1.6.5.2.74.g610f9



[notmuch] [PATCH] notmuch: Add hooks for show-mode and search-mode

2009-11-18 Thread Aneesh Kumar K.V

>From e3a801c90ed5e037b68bd16807606388e6dbe6e8 Mon Sep 17 00:00:00 2001
From: Aneesh Kumar K.V <aneesh.ku...@linux.vnet.ibm.com>
Date: Wed, 18 Nov 2009 20:43:13 +0530
Subject: [PATCH] notmuch: Add hooks for show-mode and search-mode

This enables to do things like

(add-hook 'notmuch-search-mode-hook
  (lambda()
(hl-line-mode 1) ))

Signed-off-by: Aneesh Kumar K.V 
---
 notmuch.el |   12 ++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 014d15b..87116f9 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -57,6 +57,12 @@
   "Keymap for \"notmuch show\" buffers.")
 (fset 'notmuch-show-mode-map notmuch-show-mode-map)

+(defvar notmuch-show-mode-hook nil
+  "Hooks run when notmuch-show-mode is enabled")
+
+(defvar notmuch-search-mode-hook nil
+  "Hooks run when notmuch-search-mode is enabled")
+
 (defvar notmuch-show-signature-regexp "\\(-- ?\\|_+\\)$"
   "Pattern to match a line that separates content from signature.

@@ -636,7 +642,8 @@ view, (remove the \"inbox\" tag from each), with
   (use-local-map notmuch-show-mode-map)
   (setq major-mode 'notmuch-show-mode
mode-name "notmuch-show")
-  (setq buffer-read-only t))
+  (setq buffer-read-only t)
+  (run-hooks 'notmuch-show-mode-hook))

 (defun notmuch-show (thread-id  parent-buffer)
   "Run \"notmuch show\" with the given thread ID and display results.
@@ -759,7 +766,8 @@ global search.
   (use-local-map notmuch-search-mode-map)
   (setq major-mode 'notmuch-search-mode
mode-name "notmuch-search")
-  (setq buffer-read-only t))
+  (setq buffer-read-only t)
+  (run-hooks 'notmuch-search-mode-hook))

 (defun notmuch-search-find-thread-id ()
   (save-excursion
-- 
1.6.5.2.74.g610f9



[notmuch] How to list archived mails

2009-11-18 Thread Aneesh Kumar K.V
Hi,

Once i mark the mail as archived how do i search for them ?
Right now with notmuch.el i am adding a tag "archive" when
i am archiving the mail. I am just wondering is this the right
way ?

-aneesh