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 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



[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
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 -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-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] [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 -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] [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