[notmuch] emacs: On getting support for inline images

2010-02-10 Thread Alexander Botero-Lowry
On Wed, 10 Feb 2010 12:20:00 -0800, Carl Worth  wrote:
> For a while I've seen that I can very conveniently deal with attachments
> such as PDF files or even OpenOffice (or PowerPoint) presentations with
> the notmuch/emacs client. I simply hit 'v' and an external viewer comes
> up with the attached file. That's all very nice.
> 
Yeah, though it would b enice if we had more fine-grained control over
it, like allowing you to save a file regardless of mm-* thinks it should
get to display it or not.

> Here are some ideas for possible (and independent) fixes:
> 
> 1. With the current setup, we know we are using a temporary buffer that
>the user won't see, so notmuch could temporarily set
>mm-inline-media-tests to nil forcing everything to use external
>viewers when the user presses 'v'.
> 
I think this is a crappy, but perfectly fine temporary fix. 

> 2. The original presentation of Mime parts could examine
>mm-inline-media-tests and directly render anything possible within
>the original presentation of the message. This would allow images to
>be viewed directly without requiring the user to press 'v'. And the
>user could configure this existing variable to control what content
>is displayed inline.
>
Yes, I think some kind of mapping of interesting parts in the message to
the mm-dissect-buffer parts and extending the text/html only inliner to
also inline those interesting parts is the right thing (tm).

Which points out a huge issue in my current inlining code, the parts
aren't actually mapped, we're basically counting on the coincidence that
the parts are in the correct place when we do the inlining, and that
seems to basically work. That being said, it's the cause of some
messages occasionally giving you a save dialog, or failing to be parsed
correctly.

> 3. We could move away from these various mm- functions for displaying
>MIME parts and simply add functionality to the notmuch command line
>for extracting individual MIME parts from messages, (which is
>something that a non-emacs client will likely want anyway). Then we
>can use the lower-level functions to display things directly. (For
>example, displaying an image looks as simple as calling the
>create-image and put-image functions).
>
Just talking about this on IRC. I think this is the wrong approach but
with some right bits. notmuch cli needs to support saving
parts. Period. but mm-* is a very complex and magical library happily
used by (almost?) all the emacs mailers. It does a nice job once you
learn how to wield its magic correctly (and indeed, one of our bigger
problems is the thread-view is something it wasn't really designed for,
so we just need to figure out the best-practice for working around
that).

mm-* should continue to be used, and we need to figure out the right
technique for mapping between parts mentioned in the output of notmuch
show and the actual parts in the mm-dissect-buffer output.

I want to work on this, but I've been kind of busy and not felt like
hacking elisp lately, so hopefilly that'll turn around :/

alex


Re: [notmuch] emacs: On getting support for inline images

2010-02-10 Thread Alexander Botero-Lowry
On Wed, 10 Feb 2010 12:20:00 -0800, Carl Worth cwo...@cworth.org wrote:
 For a while I've seen that I can very conveniently deal with attachments
 such as PDF files or even OpenOffice (or PowerPoint) presentations with
 the notmuch/emacs client. I simply hit 'v' and an external viewer comes
 up with the attached file. That's all very nice.
 
Yeah, though it would b enice if we had more fine-grained control over
it, like allowing you to save a file regardless of mm-* thinks it should
get to display it or not.

 Here are some ideas for possible (and independent) fixes:
 
 1. With the current setup, we know we are using a temporary buffer that
the user won't see, so notmuch could temporarily set
mm-inline-media-tests to nil forcing everything to use external
viewers when the user presses 'v'.
 
I think this is a crappy, but perfectly fine temporary fix. 

 2. The original presentation of Mime parts could examine
mm-inline-media-tests and directly render anything possible within
the original presentation of the message. This would allow images to
be viewed directly without requiring the user to press 'v'. And the
user could configure this existing variable to control what content
is displayed inline.

Yes, I think some kind of mapping of interesting parts in the message to
the mm-dissect-buffer parts and extending the text/html only inliner to
also inline those interesting parts is the right thing (tm).

Which points out a huge issue in my current inlining code, the parts
aren't actually mapped, we're basically counting on the coincidence that
the parts are in the correct place when we do the inlining, and that
seems to basically work. That being said, it's the cause of some
messages occasionally giving you a save dialog, or failing to be parsed
correctly.
 
 3. We could move away from these various mm- functions for displaying
MIME parts and simply add functionality to the notmuch command line
for extracting individual MIME parts from messages, (which is
something that a non-emacs client will likely want anyway). Then we
can use the lower-level functions to display things directly. (For
example, displaying an image looks as simple as calling the
create-image and put-image functions).

Just talking about this on IRC. I think this is the wrong approach but
with some right bits. notmuch cli needs to support saving
parts. Period. but mm-* is a very complex and magical library happily
used by (almost?) all the emacs mailers. It does a nice job once you
learn how to wield its magic correctly (and indeed, one of our bigger
problems is the thread-view is something it wasn't really designed for,
so we just need to figure out the best-practice for working around
that).

mm-* should continue to be used, and we need to figure out the right
technique for mapping between parts mentioned in the output of notmuch
show and the actual parts in the mm-dissect-buffer output.
 
I want to work on this, but I've been kind of busy and not felt like
hacking elisp lately, so hopefilly that'll turn around :/

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


[notmuch] [PATCH] Reintroduce HTML inlining, with a much needed optimization

2010-02-09 Thread Alexander Botero-Lowry
Now instead of requiring every single message be parsed, we now check
the Content-type in the parsed headers and only do HTML inlining if it's
text/html
---
 notmuch.el |   54 --
 1 files changed, 40 insertions(+), 14 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 6f69001..b49d4d1 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -133,6 +133,8 @@ remaining lines into a button.")
 (defvar notmuch-show-id-regexp "\\(id:[^ ]*\\)")
 (defvar notmuch-show-depth-match-regexp " depth:\\([0-9]*\\).*match:\\([01]\\) 
")
 (defvar notmuch-show-filename-regexp "filename:\\(.*\\)$")
+(defvar notmuch-show-contentype-regexp "Content-type: \\(.*\\)")
+
 (defvar notmuch-show-tags-regexp "(\\([^)]*\\))$")

 (defvar notmuch-show-parent-buffer nil)
@@ -713,20 +715,44 @@ is what to put on the button."
 (defun notmuch-show-markup-part (beg end depth)
   (if (re-search-forward notmuch-show-part-begin-regexp nil t)
   (progn
-   (forward-line)
-   (let ((beg (point-marker)))
- (re-search-forward notmuch-show-part-end-regexp)
- (let ((end (copy-marker (match-beginning 0
-   (goto-char end)
-   (if (not (bolp))
-   (insert "\n"))
-   (indent-rigidly beg end depth)
-   (notmuch-show-markup-citations-region beg end depth)
-   ; Advance to the next part (if any) (so the outer loop can
-   ; determine whether we've left the current message.
-   (if (re-search-forward notmuch-show-part-begin-regexp nil t)
-   (beginning-of-line)
-(goto-char end)))
+(let (mime-message mime-type)
+  (save-excursion
+(re-search-forward notmuch-show-contentype-regexp end t)
+(setq mime-type (car (split-string (buffer-substring 
+(match-beginning 1) (match-end 
1))
+
+  (if (equal mime-type "text/html")
+  (let ((filename (notmuch-show-get-filename)))
+(with-temp-buffer
+  (insert-file-contents filename nil nil nil t)
+  (setq mime-message (mm-dissect-buffer)
+  (forward-line)
+  (let ((beg (point-marker)))
+(re-search-forward notmuch-show-part-end-regexp)
+(let ((end (copy-marker (match-beginning 0
+  (goto-char end)
+  (if (not (bolp))
+  (insert "\n"))
+  (indent-rigidly beg end depth)
+  (if (not (eq mime-message nil))
+  (save-excursion
+(goto-char beg)
+(forward-line -1)
+(let ((handle-type (mm-handle-type mime-message))
+  mime-type)
+  (if (sequencep (car handle-type))
+  (setq mime-type (car handle-type))
+(setq mime-type (car (car (cdr handle-type
+)
+  (if (equal mime-type "text/html")
+  (mm-display-part mime-message
+)
+  (notmuch-show-markup-citations-region beg end depth)
+  ; Advance to the next part (if any) (so the outer loop can
+  ; determine whether we've left the current message.
+  (if (re-search-forward notmuch-show-part-begin-regexp nil t)
+  (beginning-of-line)
+(goto-char end

 (defun notmuch-show-markup-parts-region (beg end depth)
   (save-excursion
-- 
1.6.5.2



[notmuch] viewing text/html (inline or otherwise)

2010-02-09 Thread Alexander Botero-Lowry
On Tue, 09 Feb 2010 16:22:56 -0800, Carl Worth  wrote:
> On Tue, 09 Feb 2010 21:28:25 +1100, Alex Ghitza  wrote:
> > Ideally, I'd like to be able to see what's hidden behind the 
> > "Non-text part: text/html", and if it could happen inline that would be
> > great.  I would also entertain the idea of opening an external browser
> > window, if that's the way this has to go.
> 
> We actually had some support for inline viewing of HTML message parts
> for a while. I reverted the code only because it was slowing down
> rendering of non-HTML messages. And I did that with the expectation that
> the code would appear again shortly with the obvious optimization to not
> do any extra work for non-HTML messages.
EBUSY...

I'll get around to it, I continue to run ancient notmuch with my patch
still in place though because I find it basically unuseable without it,
so I hope to get some free time to pull the change back up and add the
optimization (which is to check the type of the mime part before trying
to do an mm-display-parts on it, so that you save the time of the
dissection if it's not needed).

alex


Re: [notmuch] viewing text/html (inline or otherwise)

2010-02-09 Thread Alexander Botero-Lowry
On Tue, 09 Feb 2010 16:22:56 -0800, Carl Worth cwo...@cworth.org wrote:
 On Tue, 09 Feb 2010 21:28:25 +1100, Alex Ghitza aghi...@gmail.com wrote:
  Ideally, I'd like to be able to see what's hidden behind the 
  Non-text part: text/html, and if it could happen inline that would be
  great.  I would also entertain the idea of opening an external browser
  window, if that's the way this has to go.
 
 We actually had some support for inline viewing of HTML message parts
 for a while. I reverted the code only because it was slowing down
 rendering of non-HTML messages. And I did that with the expectation that
 the code would appear again shortly with the obvious optimization to not
 do any extra work for non-HTML messages.
EBUSY...

I'll get around to it, I continue to run ancient notmuch with my patch
still in place though because I find it basically unuseable without it,
so I hope to get some free time to pull the change back up and add the
optimization (which is to check the type of the mime part before trying
to do an mm-display-parts on it, so that you save the time of the
dissection if it's not needed).

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


[notmuch] [PATCH] Reintroduce HTML inlining, with a much needed optimization

2010-02-09 Thread Alexander Botero-Lowry
Now instead of requiring every single message be parsed, we now check
the Content-type in the parsed headers and only do HTML inlining if it's
text/html
---
 notmuch.el |   54 --
 1 files changed, 40 insertions(+), 14 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 6f69001..b49d4d1 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -133,6 +133,8 @@ remaining lines into a button.)
 (defvar notmuch-show-id-regexp \\(id:[^ ]*\\))
 (defvar notmuch-show-depth-match-regexp  depth:\\([0-9]*\\).*match:\\([01]\\) 
)
 (defvar notmuch-show-filename-regexp filename:\\(.*\\)$)
+(defvar notmuch-show-contentype-regexp Content-type: \\(.*\\))
+
 (defvar notmuch-show-tags-regexp (\\([^)]*\\))$)
 
 (defvar notmuch-show-parent-buffer nil)
@@ -713,20 +715,44 @@ is what to put on the button.
 (defun notmuch-show-markup-part (beg end depth)
   (if (re-search-forward notmuch-show-part-begin-regexp nil t)
   (progn
-   (forward-line)
-   (let ((beg (point-marker)))
- (re-search-forward notmuch-show-part-end-regexp)
- (let ((end (copy-marker (match-beginning 0
-   (goto-char end)
-   (if (not (bolp))
-   (insert \n))
-   (indent-rigidly beg end depth)
-   (notmuch-show-markup-citations-region beg end depth)
-   ; Advance to the next part (if any) (so the outer loop can
-   ; determine whether we've left the current message.
-   (if (re-search-forward notmuch-show-part-begin-regexp nil t)
-   (beginning-of-line)
-(goto-char end)))
+(let (mime-message mime-type)
+  (save-excursion
+(re-search-forward notmuch-show-contentype-regexp end t)
+(setq mime-type (car (split-string (buffer-substring 
+(match-beginning 1) (match-end 
1))
+
+  (if (equal mime-type text/html)
+  (let ((filename (notmuch-show-get-filename)))
+(with-temp-buffer
+  (insert-file-contents filename nil nil nil t)
+  (setq mime-message (mm-dissect-buffer)
+  (forward-line)
+  (let ((beg (point-marker)))
+(re-search-forward notmuch-show-part-end-regexp)
+(let ((end (copy-marker (match-beginning 0
+  (goto-char end)
+  (if (not (bolp))
+  (insert \n))
+  (indent-rigidly beg end depth)
+  (if (not (eq mime-message nil))
+  (save-excursion
+(goto-char beg)
+(forward-line -1)
+(let ((handle-type (mm-handle-type mime-message))
+  mime-type)
+  (if (sequencep (car handle-type))
+  (setq mime-type (car handle-type))
+(setq mime-type (car (car (cdr handle-type
+)
+  (if (equal mime-type text/html)
+  (mm-display-part mime-message
+)
+  (notmuch-show-markup-citations-region beg end depth)
+  ; Advance to the next part (if any) (so the outer loop can
+  ; determine whether we've left the current message.
+  (if (re-search-forward notmuch-show-part-begin-regexp nil t)
+  (beginning-of-line)
+(goto-char end
 
 (defun notmuch-show-markup-parts-region (beg end depth)
   (save-excursion
-- 
1.6.5.2

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


[notmuch] slowdown with large html heavy threads

2009-12-05 Thread Alexander Botero-Lowry
Carl mentioned that he saw some nasty performance issues with threads
that had a lot of HTML messages in them.

If you are experiencing this problem, would you mind trying some
alternative mm-text-html-renderer setting:

http://mh-e.sourceforge.net/manual/html/HTML.html

Also, if you have elinks, I recommend my custom renderer:

(require 'mm-view)
(add-to-list 'mm-text-html-renderer-alist 
  '(elinks mm-inline-render-with-stdin nil "elinks" "-force-html" "-dump"))
(setq mm-text-html-renderer 'elinks)


Alex


[notmuch] Trouble with notmuch-show

2009-12-04 Thread Alexander Botero-Lowry
On Fri, 04 Dec 2009 11:06:15 -0800, Carl Worth  wrote:
> On Thu, 03 Dec 2009 23:08:31 +0100, Jed Brown  wrote:
> > I know html support is still poor, but the following seems worse than
> > not showing anything.  When I visit this message, I get prompted to save
> > the MIME part and the following is displayed (including all the hidden
> > stuff).  Original message is attached.
> 
> I ran into this recently as well.
> 
> When the HTML formatting works, it's quite impressive. But when it
> decides it needs to save some attachment, then notmuch gets tripped up
> and ends up displaying a very raw message.
> 
Yes. I've notied this but only with spam. I've been not bothered to look
into it because of that, but it's starting to break my spacebar flow, so
I'll try and figure out what's going on.

alex


[notmuch] [PATCH] Use libgcrypt for hashing.

2009-11-27 Thread Alexander Botero-Lowry
On Fri, 27 Nov 2009 23:43:34 -0600, Jeffrey Ollie  wrote:
> On Fri, Nov 27, 2009 at 9:59 PM, Ingmar Vanhassel  
> wrote:
> >
> > Most distributions have a rather strict policy to use system libraries
> > over internal copies.
> 
> Fedora [...], Debian [...]
> 
> If there are other distributions out there that have similar policies
> I'd be interested in learning about them.
> 
FreeBSD ports are expected to not use bundled libraries as well.

Alex


[notmuch] [PATCH 4/9] Factor out message buffer mgmt from notmuch-show-view-all-mime-parts

2009-11-27 Thread Alexander Botero-Lowry
On Fri, 27 Nov 2009 21:10:42 -0800, Carl Worth  wrote:
> On Fri, 27 Nov 2009 05:30:10 -0800, camalot at picnicpark.org wrote:
> > From: Keith Amidon 
> > 
> > The ability to temporarily create a buffer containing only the
> > contents of the currently selected message in notmuch show mode is
> > generally useful.  This commit factors the majority of the code
> > required to do so out of notmuch-show-view-all-mime-parts into a macro
> > called with-current-notmuch-show-message and rewrites the original
> > function in terms of the macro.
> > 
> > A future set of commits will provide additional functionality using
> > the macro as well.
> 
> Hurrah! I'm glad to see that you are wholly more capable with emacs lisp
> than I am. I knew of lisp macros of course, but didn't know the actual
> syntax for writing one.
> 
I actually did something similar for my html support. except I used
`with-temp-buffer' macro instead. I'm hoping that the need to ever
actually use the raw message buffer directly goes away, so I think it
would be better to use with-temp-buffer in your macro instead of the
named buffer.

Alex


Re: [notmuch] [PATCH 4/9] Factor out message buffer mgmt from notmuch-show-view-all-mime-parts

2009-11-27 Thread Alexander Botero-Lowry
On Fri, 27 Nov 2009 21:10:42 -0800, Carl Worth cwo...@cworth.org wrote:
 On Fri, 27 Nov 2009 05:30:10 -0800, cama...@picnicpark.org wrote:
  From: Keith Amidon ke...@nicira.com
  
  The ability to temporarily create a buffer containing only the
  contents of the currently selected message in notmuch show mode is
  generally useful.  This commit factors the majority of the code
  required to do so out of notmuch-show-view-all-mime-parts into a macro
  called with-current-notmuch-show-message and rewrites the original
  function in terms of the macro.
  
  A future set of commits will provide additional functionality using
  the macro as well.
 
 Hurrah! I'm glad to see that you are wholly more capable with emacs lisp
 than I am. I knew of lisp macros of course, but didn't know the actual
 syntax for writing one.
 
I actually did something similar for my html support. except I used
`with-temp-buffer' macro instead. I'm hoping that the need to ever
actually use the raw message buffer directly goes away, so I think it
would be better to use with-temp-buffer in your macro instead of the
named buffer.

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


[notmuch] [PATCH 2/2] add some very rudimentary support for handling html parts

2009-11-25 Thread Alexander Botero-Lowry
I was planning to be committing super awesome mime-handling support
that would make notmuch rival every mail program ever for pure mime
awesomeness. It turns out, that mime is confusing and hard, and the
mm-* functions do awesome things like provide different forms based
on the number and composition of mime-parts in a document, so I set
my first-pass goal a bit lower. What this does, is if there is an
html mime-part in the message and it's the first part, it gets inlined
using `mm-display-part'. This should solve the biggest problem I was
facing, which is HTML only messages that I have to go into the awful
mime-mode to view.

This still even leaves in the Non-text part: message and all.
---
 notmuch.el |   41 -
 1 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 1853762..fa061c3 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -554,29 +554,52 @@ which this thread was originally shown."
 (goto-char end))
   (forward-line

-(defun notmuch-show-markup-part (beg end depth)
+(defun notmuch-show-markup-part (beg end depth mime-message)
   (if (re-search-forward notmuch-show-part-begin-regexp nil t)
   (progn
+(if (eq mime-message nil)
+(let ((filename (notmuch-show-get-filename)))
+  (with-temp-buffer
+(insert-file-contents filename nil nil nil t)
+(setq mime-message (mm-dissect-buffer)
(forward-line)
-   (let ((beg (point-marker)))
+   (let ((part-beg (point-marker)))
  (re-search-forward notmuch-show-part-end-regexp)
- (let ((end (copy-marker (match-beginning 0
-   (goto-char end)
+
+ (let ((part-end (copy-marker (match-beginning 0
+   (goto-char part-end)
(if (not (bolp))
(insert "\n"))
-   (indent-rigidly beg end depth)
-   (notmuch-show-markup-citations-region beg end depth)
+   (indent-rigidly part-beg part-end depth)
+(save-excursion
+  (goto-char part-beg)
+  (forward-line -1)
+  (beginning-of-line)
+  (let ((handle-type (mm-handle-type mime-message))
+mime-type)
+(if (sequencep (car handle-type))
+(setq mime-type (car handle-type))
+  (setq mime-type (car (car (cdr handle-type
+  )
+(if (equal mime-type "text/html")
+(mm-display-part mime-message
+
+   (notmuch-show-markup-citations-region part-beg part-end depth)
; Advance to the next part (if any) (so the outer loop can
; determine whether we've left the current message.
(if (re-search-forward notmuch-show-part-begin-regexp nil t)
(beginning-of-line)
-(goto-char end)))
+(goto-char end))
+  mime-message)

 (defun notmuch-show-markup-parts-region (beg end depth)
   (save-excursion
 (goto-char beg)
-(while (< (point) end)
-  (notmuch-show-markup-part beg end depth
+(let (mime-message)
+  (while (< (point) end)
+(setq mime-message
+  (notmuch-show-markup-part
+   beg end depth mime-message))

 (defun notmuch-show-markup-body (depth btn)
   (re-search-forward notmuch-show-body-begin-regexp)
-- 
1.6.5.2



[notmuch] [PATCH 1/2] add functions to toggle the nearest backwards button of a given type

2009-11-25 Thread Alexander Botero-Lowry
It was noted that though local expansion was nice, it was also pretty
nice to have an easy way to just open the headers without moving to the
header button. So this exposes a number of symbols which search backwards
in the buffer for the nearest button of the desire type and push it
---
 notmuch.el |   33 +
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 551048a..1853762 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -771,6 +771,39 @@ thread from that buffer can be show when done with this 
one)."
   
   )))

+(defun notmuch-toggle-hidden-section (section-button-type) 
+  (save-excursion
+(let ((btn (forward-button -1)))
+  (while btn
+(if (button-has-type-p btn section-button-type)
+(progn (push-button)
+   (setq btn nil))
+  (condition-case err
+  (setq btn (forward-button -1))
+(error (setq btn nil))
+)
+)
+
+(defun notmuch-toggle-hidden-headers ()
+  (interactive)
+  (notmuch-toggle-hidden-section 'notmuch-button-headers-toggle-type)
+)
+
+(defun notmuch-toggle-hidden-body ()
+  (interactive)
+  (notmuch-toggle-hidden-section 'notmuch-button-body-toggle-type)
+)
+
+(defun notmuch-toggle-hidden-citation ()
+  (interactive)
+  (notmuch-toggle-hidden-section 'notmuch-button-citation-toggle-type)
+)
+
+(defun notmuch-toggle-hidden-signature ()
+  (interactive)
+  (notmuch-toggle-hidden-section 'notmuch-button-signature-toggle-type)
+)
+
 (defvar notmuch-search-authors-width 40
   "Number of columns to use to display authors in a notmuch-search buffer.")

-- 
1.6.5.2



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

2009-11-24 Thread Alexander Botero-Lowry
On Wed, 25 Nov 2009 10:28:00 +0530, "Aneesh Kumar K.V"  wrote:
> This add two faces, notmuch-show-subject-face and
> notmuch-tag-face. The first face is used to show the subject
> line in the notmuch-show-mode and the second one to show tags
> in the notmuch-search-mode.
> 
First, I definetly think fontification is the way to go instead of
the adhoc/crappy way that cworth and I have been doing this in the
past.

[snip]

> +(defvar notmuch-show-font-lock-keywords
> +  (list ;; header in font-lock-type-face
> +   (list "\\(Subject:.*$\\)"
> +  '(1  'notmuch-show-subject-face)))
> +  "Additonal expression to hightlight in notmuch-show-mode")
> +
So what happens if I have Subject:  in my message? We already ran
into a problem where a patch sent the list that included notmuch control
character caused it to go into an infinite loop, I'd prefer our
fontification code be a bit more resilient. At the very least this
should use the font-lock syntax tables stuff to only do header
fontification when inside the header block. This would probably require
that fontification occur before the message is post-processed by 
notmuch-show to remove the section markers etc.

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

[snip]

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

> +(progn
> +  (setq notmuch-search-tags (mapcar 'car notmuch-tag-face-alist))
> +  (loop for notmuch-search-tag  in notmuch-search-tags
> +do (add-to-list 'notmuch-search-font-lock-keywords (list
> + (concat "\\(" notmuch-search-tag "\\)")
> + `(1  ,(cdr (assoc notmuch-search-tag 
> notmuch-tag-face-alist
> +  (set (make-local-variable 'font-lock-defaults)
> + '(notmuch-search-font-lock-keywords t)))
>  
I don't really see the point of fontifying all tags the same way if no
tag-faces have been set, especially if none of the rest of the search
results are fontified.

Alex


[notmuch] [PATCH 1/5] make headers locally expandable/collapsable

2009-11-24 Thread Alexander Botero-Lowry
On Tue, 24 Nov 2009 11:40:24 -0800, Carl Worth  wrote:

[snip]

> Anyway, this is really great stuff, Alexander. Thanks for coding it up!
> 
Awesome thanks. Makes things much more useable anyway. :)

> I've pushed it out now, (with a little bit more in the way of commit
> messages---thanks for humoring me).
> 
Ahh, come on, Lorem Ipsum was such a clear and detailed commit message. :D

> I noticed that I could open and re-collapse a message that notmuch
> initially presents as hidden, but I didn't seem to be able to collapse
> an initially-open message. Now, I'm sure that's due to broken-ness in
> code I wrote myself originally. But as a future-feature request, that
> might be some consistency that would be nice to have.
> 
Odd. I wouldn't be suprised were that behavior the case, but I can not
reproduce it locally. I totally agree it should be the case, but I seem
to be able to expand collapse already open messages without a problem..

alex


[notmuch] [PATCH 5/5] Remove the global expand body keymapping

2009-11-23 Thread Alexander Botero-Lowry
---
 notmuch.el |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index af0c487..907df2c 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -61,7 +61,6 @@
 ; overlays-at to query and manipulate the current overlay.
 (define-key map "a" 'notmuch-show-archive-thread)
 (define-key map "A" 'notmuch-show-mark-read-then-archive-thread)
-(define-key map "b" 'notmuch-show-toggle-body-read-visible)
 (define-key map "m" 'message-mail)
 (define-key map "n" 'notmuch-show-next-message)
 (define-key map "N" 'notmuch-show-mark-read-then-next-open-message)
-- 
1.6.5.2



[notmuch] [PATCH 4/5] Make bodies locally toggleable

2009-11-23 Thread Alexander Botero-Lowry
Having actually implemented this, I realized that my
initial approach of providing a function to configure
a button was wrong. Instead I've replaced that with
button types. This then makes it possible to provide
the fully expanded view when all threads in a message
are unread.

It also has the potential to allow global-expansion functions
if that is desireable
---
 notmuch.el |   89 +++
 1 files changed, 47 insertions(+), 42 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 23a07cc..af0c487 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -497,12 +497,15 @@ which this thread was originally shown."
   (force-window-update)
   (redisplay t))

-(defun notmuch-configure-invisibility-button (btn invis-spec help-msg)
-  (button-put btn 'invisibility-spec invis-spec)
-  (button-put btn 'action 'notmuch-toggle-invisible-action)
-  (button-put btn 'follow-link t)
-  (button-put btn 'help-echo (concat "mouse-1, RET: " help-msg))
-)
+(define-button-type 'notmuch-button-invisibility-toggle-type 'action 
'notmuch-toggle-invisible-action 'follow-link t)
+(define-button-type 'notmuch-button-citation-toggle-type 'help-echo "mouse-1, 
RET: Show citation"
+  :supertype 'notmuch-button-invisibility-toggle-type)
+(define-button-type 'notmuch-button-signature-toggle-type 'help-echo "mouse-1, 
RET: Show signature"
+  :supertype 'notmuch-button-invisibility-toggle-type)
+(define-button-type 'notmuch-button-headers-toggle-type 'help-echo "mouse-1, 
RET: Show headers"
+  :supertype 'notmuch-button-invisibility-toggle-type)
+(define-button-type 'notmuch-button-body-toggle-type 'help-echo "mouse-1, RET: 
Show message"
+  :supertype 'notmuch-button-invisibility-toggle-type)

 (defun notmuch-show-markup-citations-region (beg end depth)
   (goto-char beg)
@@ -525,7 +528,9 @@ which this thread was originally shown."
  "-line citation.]")))
 (goto-char (- beg-sub 1))
 (insert (concat "\n" indent))
-(notmuch-configure-invisibility-button (insert-button 
cite-button-text) invis-spec "Show citation")
+(insert-button cite-button-text
+   'invisibility-spec invis-spec
+   :type 'notmuch-button-citation-toggle-type)
 (insert "\n")
 (goto-char (+ (length cite-button-text) p))
   
@@ -541,9 +546,11 @@ which this thread was originally shown."

 (goto-char (- beg-sub 1))
 (insert (concat "\n" indent))
-(notmuch-configure-invisibility-button
- (insert-button (concat "[" (number-to-string sig-lines)
-"-line signature.]"))  invis-spec 
"Show signature")
+(let ((sig-button-text (concat "[" (number-to-string 
sig-lines)
+   "-line signature.]")))
+  (insert-button sig-button-text 'invisibility-spec 
invis-spec
+ :type 
'notmuch-button-signature-toggle-type)
+ )
 (insert "\n")
 (goto-char end))
   (forward-line
@@ -572,16 +579,19 @@ which this thread was originally shown."
 (while (< (point) end)
   (notmuch-show-markup-part beg end depth

-(defun notmuch-show-markup-body (depth)
+(defun notmuch-show-markup-body (depth btn)
   (re-search-forward notmuch-show-body-begin-regexp)
   (forward-line)
   (let ((beg (point-marker)))
 (re-search-forward notmuch-show-body-end-regexp)
 (let ((end (copy-marker (match-beginning 0
   (notmuch-show-markup-parts-region beg end depth)
-  (if (not (notmuch-show-message-unread-p))
- (overlay-put (make-overlay beg end)
-  'invisible 'notmuch-show-body-read))
+  (let ((invis-spec (make-symbol "notmuch-show-body-read")))
+(overlay-put (make-overlay beg end)
+ 'invisible invis-spec)
+(button-put btn 'invisibility-spec invis-spec)
+(if (not (notmuch-show-message-unread-p))
+(add-to-invisibility-spec invis-spec)))
   (set-marker beg nil)
   (set-marker end nil)
   )))
@@ -589,10 +599,12 @@ which this thread was originally shown."
 (defun notmuch-show-markup-header (depth)
   (re-search-forward notmuch-show-header-begin-regexp)
   (forward-line)
-  (let ((beg (point-marker)))
+  (let ((beg (point-marker))
+(btn nil))
 (end-of-line)
 ; Inverse video for subject
 (overlay-put (make-overlay beg (point)) 'face '(:inverse-video t))
+(setq btn (make-button beg (point) :type 'notmuch-button-body-toggle-type))
 (forward-line 1)
 (end-of-line)
 (let ((beg-hidden (point-marker)))
@@ -614,23 +626,25 @@ which this thread was originally shown."
'invisible invis-spec)
   (goto-char 

[notmuch] [PATCH 3/5] make a nice function for generating invisibility toggle buttons

2009-11-23 Thread Alexander Botero-Lowry
I realized I was replicating this code over and over again, so this
way if I change my mind about something I only have to do it on one
place.
---
 notmuch.el |   45 -
 1 files changed, 16 insertions(+), 29 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index ed1f7cb..23a07cc 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -497,6 +497,13 @@ which this thread was originally shown."
   (force-window-update)
   (redisplay t))

+(defun notmuch-configure-invisibility-button (btn invis-spec help-msg)
+  (button-put btn 'invisibility-spec invis-spec)
+  (button-put btn 'action 'notmuch-toggle-invisible-action)
+  (button-put btn 'follow-link t)
+  (button-put btn 'help-echo (concat "mouse-1, RET: " help-msg))
+)
+
 (defun notmuch-show-markup-citations-region (beg end depth)
   (goto-char beg)
   (beginning-of-line)
@@ -512,22 +519,13 @@ which this thread was originally shown."
   (invis-spec (make-symbol "notmuch-citation-region")))
   (add-to-invisibility-spec invis-spec)
  (overlay-put overlay 'invisible invis-spec)
-  (let (
-(p (point))
+  (let ((p (point))
 (cite-button-text
  (concat "["  (number-to-string (count-lines beg-sub 
(point)))
- "-line citation.]"))
-)
+ "-line citation.]")))
 (goto-char (- beg-sub 1))
 (insert (concat "\n" indent))
-(let ((cite-button (insert-button cite-button-text)))
-  (button-put cite-button 'invisibility-spec invis-spec)
-  (button-put cite-button 'action 
'notmuch-toggle-invisible-action)
-  (button-put cite-button 'follow-link t)
-  (button-put cite-button 'help-echo
-  "mouse-1, RET: Show citation")
-
-  )
+(notmuch-configure-invisibility-button (insert-button 
cite-button-text) invis-spec "Show citation")
 (insert "\n")
 (goto-char (+ (length cite-button-text) p))
   
@@ -543,16 +541,9 @@ which this thread was originally shown."

 (goto-char (- beg-sub 1))
 (insert (concat "\n" indent))
-(let ((sig-button (insert-button 
-   (concat "[" (number-to-string sig-lines)
- "-line signature.]"
-  (button-put sig-button 'invisibility-spec invis-spec)
-  (button-put sig-button 'action
-  'notmuch-toggle-invisible-action)
-  (button-put sig-button 'follow-link t)
-  (button-put sig-button 'help-echo
-  "mouse-1, RET: Show signature")
-  )
+(notmuch-configure-invisibility-button
+ (insert-button (concat "[" (number-to-string sig-lines)
+"-line signature.]"))  invis-spec 
"Show signature")
 (insert "\n")
 (goto-char end))
   (forward-line
@@ -623,13 +614,9 @@ which this thread was originally shown."
'invisible invis-spec)
   (goto-char beg)
   (forward-line)
-  (let ((header-button (make-button (line-beginning-position) 
(line-end-position
-(button-put header-button 'invisibility-spec (cons invis-spec t))
-(button-put header-button 'action 'notmuch-toggle-invisible-action)
-(button-put header-button 'follow-link t)
-(button-put header-button 'help-echo
-"mouse-1, RET: Show headers")
-  ))
+  (notmuch-configure-invisibility-button
+   (make-button (line-beginning-position) (line-end-position))
+   (cons invis-spec t) "Show headers"))
 (goto-char end)
 (insert "\n")
(set-marker beg nil)
-- 
1.6.5.2



[notmuch] [PATCH 2/5] cleanup a lot of left-overs from the global invis

2009-11-23 Thread Alexander Botero-Lowry
---
 notmuch.el |   36 
 1 files changed, 0 insertions(+), 36 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 8aee286..ed1f7cb 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -62,8 +62,6 @@
 (define-key map "a" 'notmuch-show-archive-thread)
 (define-key map "A" 'notmuch-show-mark-read-then-archive-thread)
 (define-key map "b" 'notmuch-show-toggle-body-read-visible)
-(define-key map "c" 'notmuch-show-toggle-citations-visible)
-(define-key map "h" 'notmuch-show-toggle-headers-visible)
 (define-key map "m" 'message-mail)
 (define-key map "n" 'notmuch-show-next-message)
 (define-key map "N" 'notmuch-show-mark-read-then-next-open-message)
@@ -72,7 +70,6 @@
 (define-key map (kbd "C-p") 'notmuch-show-previous-line)
 (define-key map "q" 'kill-this-buffer)
 (define-key map "r" 'notmuch-show-reply)
-(define-key map "s" 'notmuch-show-toggle-signatures-visible)
 (define-key map "v" 'notmuch-show-view-all-mime-parts)
 (define-key map "w" 'notmuch-show-view-raw-message)
 (define-key map "x" 'kill-this-buffer)
@@ -666,39 +663,6 @@ which this thread was originally shown."
   (notmuch-show-markup-message)))
   (notmuch-show-hide-markers))

-(defun notmuch-show-toggle-citations-visible ()
-  "Toggle visibility of citations"
-  (interactive)
-  (if notmuch-show-citations-visible
-  (add-to-invisibility-spec 'notmuch-show-citation)
-(remove-from-invisibility-spec 'notmuch-show-citation))
-  (set 'notmuch-show-citations-visible (not notmuch-show-citations-visible))
-  ; Need to force the redisplay for some reason
-  (force-window-update)
-  (redisplay t))
-
-(defun notmuch-show-toggle-signatures-visible ()
-  "Toggle visibility of signatures"
-  (interactive)
-  (if notmuch-show-signatures-visible
-  (add-to-invisibility-spec 'notmuch-show-signature)
-(remove-from-invisibility-spec 'notmuch-show-signature))
-  (set 'notmuch-show-signatures-visible (not notmuch-show-signatures-visible))
-  ; Need to force the redisplay for some reason
-  (force-window-update)
-  (redisplay t))
-
-(defun notmuch-show-toggle-headers-visible ()
-  "Toggle visibility of header fields"
-  (interactive)
-  (if notmuch-show-headers-visible
-  (add-to-invisibility-spec 'notmuch-show-header)
-(remove-from-invisibility-spec 'notmuch-show-header))
-  (set 'notmuch-show-headers-visible (not notmuch-show-headers-visible))
-  ; Need to force the redisplay for some reason
-  (force-window-update)
-  (redisplay t))
-
 (defun notmuch-show-toggle-body-read-visible ()
   "Toggle visibility of message bodies of read messages"
   (interactive)
-- 
1.6.5.2



[notmuch] [PATCH 1/5] make headers locally expandable/collapsable

2009-11-23 Thread Alexander Botero-Lowry
---
 notmuch.el |   18 +++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index fa6e7de..8aee286 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -605,7 +605,8 @@ which this thread was originally shown."
 (end-of-line)
 ; Inverse video for subject
 (overlay-put (make-overlay beg (point)) 'face '(:inverse-video t))
-(forward-line 2)
+(forward-line 1)
+(end-of-line)
 (let ((beg-hidden (point-marker)))
   (re-search-forward notmuch-show-header-end-regexp)
   (beginning-of-line)
@@ -619,8 +620,19 @@ which this thread was originally shown."
   (forward-line)
   )
(indent-rigidly beg end depth)
-   (overlay-put (make-overlay beg-hidden end)
-'invisible 'notmuch-show-header)
+(let ((invis-spec (make-symbol "notmuch-show-header")))
+  (add-to-invisibility-spec (cons invis-spec t))
+  (overlay-put (make-overlay beg-hidden end)
+   'invisible invis-spec)
+  (goto-char beg)
+  (forward-line)
+  (let ((header-button (make-button (line-beginning-position) 
(line-end-position
+(button-put header-button 'invisibility-spec (cons invis-spec t))
+(button-put header-button 'action 'notmuch-toggle-invisible-action)
+(button-put header-button 'follow-link t)
+(button-put header-button 'help-echo
+"mouse-1, RET: Show headers")
+  ))
 (goto-char end)
 (insert "\n")
(set-marker beg nil)
-- 
1.6.5.2



[notmuch] [PATCH] Mac OS X compatibility fixes

2009-11-21 Thread Alexander Botero-Lowry
On Sun, 22 Nov 2009 11:07:36 +0800, Jjgod Jiang  wrote:
> Add missing GNU extensions strdup() and getline(). The C library
> shipped with Mac OS X does not include them (though it does support
> some GNU extensions when _GNU_SOURCE is defined), so we have to
> add these two. The getline() implementation is a modified version
> of getdelim() from GNU Libc.
Awesome!

> diff --git a/lib/xutil.c b/lib/xutil.c
> index 6fa5eb0..805b236 100644
> --- a/lib/xutil.c
> +++ b/lib/xutil.c
> @@ -79,6 +79,105 @@ xstrdup (const char *s)
>  return ret;
>  }
>  
> +#ifdef __APPLE__
Not awesome.

This should be done in a capabilites way, for example strndup was added
to FreeBSD in 7.2 (which is this current release of the 7 line), and so
for older versions of FreeBSD strndup will be needed. getdelim() and
getline() came in FreeBSD 8, so they'll be needed for the entire 7 line.
So Instead of just assuming __APPLE__ this should be done by determing
if the symbols are generally needed.

alex


[notmuch] lots of emacs mode enhancements

2009-11-20 Thread Alexander Botero-Lowry
I've just been diving into the elisp, and have added a bunch of useful
features.

1) buttonized citation and signature expanders and made them locally
collapsable instead of globally (this could take some cleanup to remove
the global key-map binding or make it work again)
2) fixed an annoying warning about cons not being a face name
3) made header names bold to make it easier to distingush them from
their value

My next target is to carry the buttonization through to threads and
headers, and then I'm going to look into doing better mime-handling in
general.

also, RFP includes a -p argument that gives a patch :)

alex


The following changes since commit 9b560fb3eb87b2a4f9d092bc1b124ccb6d11c975:
  Alexander Botero-Lowry (1):
Checkin some command-only tcsh completions

are available in the git repository at:

  git://alexbl.net/notmuch.git master

Alexander Botero-Lowry (5):
  Buttonize citation expander.
  buttonize signatures as well
  fix the message about cons not being a valid face attribute
  Make expanding/collapsing signatures and citations local to them
  make header names bold in show-mode

 notmuch.el |   72 +++
 1 files changed, 57 insertions(+), 15 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 1fc54c3..bb69aa3 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -440,6 +440,14 @@ which this thread was originally shown."
(if last
(notmuch-show-archive-thread))

+(defun notmuch-toggle-invisible-action (cite-button)
+  (let ((invis-spec (button-get button 'invisibility-spec)))
+(if (invisible-p invis-spec)
+(remove-from-invisibility-spec invis-spec)
+  (add-to-invisibility-spec invis-spec)
+  ))
+  (goto-char (button-end cite-button)))
+
 (defun notmuch-show-markup-citations-region (beg end depth)
   (goto-char beg)
   (beginning-of-line)
@@ -451,25 +459,51 @@ which this thread was originally shown."
  (progn
(while (looking-at citation)
  (forward-line))
-   (let ((overlay (make-overlay beg-sub (point
- (overlay-put overlay 'invisible 'notmuch-show-citation)
- (overlay-put overlay 'before-string
-  (concat indent
-  "[" (number-to-string (count-lines beg-sub 
(point)))
-  "-line citation. Press 'c' to show.]\n")
+   (let ((overlay (make-overlay beg-sub (point)))
+  (invis-spec (make-symbol "notmuch-citation-region")))
+  (add-to-invisibility-spec invis-spec)
+ (overlay-put overlay 'invisible invis-spec)
+  (let (
+(p (point))
+(cite-button-text
+ (concat "["  (number-to-string (count-lines beg-sub 
(point)))
+ "-line citation.]"))
+)
+(goto-char (- beg-sub 1))
+(insert (concat "\n" indent))
+(let ((cite-button (insert-button cite-button-text)))
+  (button-put cite-button 'invisibility-spec invis-spec)
+  (button-put cite-button 'action 
'notmuch-toggle-invisible-action)
+  (button-put cite-button 'help-echo
+  "mouse-2, RET: Show citation")
+
+  )
+(insert "\n")
+(goto-char (+ (length cite-button-text) p))
+  
   (move-to-column depth)
   (if (looking-at notmuch-show-signature-regexp)
  (let ((sig-lines (- (count-lines beg-sub end) 1)))
(if (<= sig-lines notmuch-show-signature-lines-max)
(progn
- (overlay-put (make-overlay beg-sub end)
-  'invisible 'notmuch-show-signature)
- (overlay-put (make-overlay beg (- beg-sub 1))
-  'after-string
-  (concat "\n" indent
-  "[" (number-to-string sig-lines)
-  "-line signature. Press 's' to show.]"))
- (goto-char end)
+  (let ((invis-spec (make-symbol "notmuch-signature-region")))
+(add-to-invisibility-spec invis-spec)
+(overlay-put (make-overlay beg-sub end)
+ 'invisible invis-spec)
+  
+(goto-char (- beg-sub 1))
+(insert (concat "\n" indent))
+(let ((sig-button (insert-button 
+   (concat "[" (number-to-string sig-lines)
+ "-line signature.]"
+  

[notmuch] [PATCH] Buttonize citation expander.

2009-11-19 Thread Alexander Botero-Lowry
Currently the button has no action or special handling at all.
---
 notmuch.el |   15 +++
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 1fc54c3..6a34282 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -453,10 +453,17 @@ which this thread was originally shown."
  (forward-line))
(let ((overlay (make-overlay beg-sub (point
  (overlay-put overlay 'invisible 'notmuch-show-citation)
- (overlay-put overlay 'before-string
-  (concat indent
-  "[" (number-to-string (count-lines beg-sub 
(point)))
-  "-line citation. Press 'c' to show.]\n")
+  (let (
+(p (point))
+(cite-button-text (concat "[" (number-to-string 
(count-lines beg-sub (point)))
+  "-line citation. Press 'c' to 
show.]"))
+)
+(goto-char (- beg-sub 1))
+(insert (concat "\n" indent))
+(insert-button cite-button-text)
+(insert "\n")
+(goto-char (+ (length cite-button-text) p))
+  
   (move-to-column depth)
   (if (looking-at notmuch-show-signature-regexp)
  (let ((sig-lines (- (count-lines beg-sub end) 1)))
-- 
1.6.5.2



[notmuch] [PATCH] Checkin some command-only tcsh completions

2009-11-18 Thread Alexander Botero-Lowry
---
 notmuch-completion.tcsh |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
 create mode 100644 notmuch-completion.tcsh

diff --git a/notmuch-completion.tcsh b/notmuch-completion.tcsh
new file mode 100644
index 000..c0d3a44
--- /dev/null
+++ b/notmuch-completion.tcsh
@@ -0,0 +1,2 @@
+set NOTMUCH_CMD=`notmuch help | awk '/\t/' | cut -f2 |grep -v '^$'`
+complete notmuch 'p/1/$NOTMUCH_CMD/'
-- 
1.6.5.2



[notmuch] Mac OS X/Darwin compatibility issues

2009-11-18 Thread Alexander Botero-Lowry
On Thu, 19 Nov 2009 10:45:28 +1100, Stewart Smith  
wrote:
> On Wed, Nov 18, 2009 at 11:27:20PM +0100, Carl Worth wrote:
> > Yes. I knew I was "cheating" by using some GNU extensions here. I'm
> > happy to accept portability patches for these things, but it's hard for
> > me to get excited about writing them myself.
> > 
> > Care to take a whack at these?
> 
> http://www.gnu.org/software/gnulib/
> 
> could be a partial answer.
> 
Why add yet another dependency for a couple of functions? Especially
considering how notmuch already depends on glib which includes portability
functions for various things.

alex


[notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap

2009-11-18 Thread Alexander Botero-Lowry
On Wed, 18 Nov 2009 00:29:59 -0800, Keith Packard  wrote:
> I created the notmuch-show-hook precisely so I could add these two
> options, but I suspect most people will want them, so I just made them
> the default. If you don't want them, you can use remove-hook to get
> rid of this.
> 
Yes, hooks should be added for search as well. :)

> +; Make show mode a bit prettier, highlighting URLs and using word wrap
> +
> +(defun notmuch-show-pretty-hook ()
> +  (goto-address-mode 1)
> +  (visual-line-mode))
> +
visual-line-mode turns out to make subject look pretty ugly if there is a
continuation. It doesn't do much good for the citation headers
either. We probably need to do our own intelligent wrapping rather then
use visual-line-mode to make this actually look right.

goto-address-mode is important though. :)

alex


[notmuch] request for pull

2009-11-18 Thread Alexander Botero-Lowry
The following changes since commit e8c9c3e6a534fc6c2919c2c1de63cea7250eb488:
  Ingmar Vanhassel (1):
Makefile: Manual pages shouldn't be executable

are available in the git repository at:

  git://alexbl.net/notmuch.git master

Alexander Botero-Lowry (2):
  Error out if no query is supplied to search instead of going into an 
infinite loop
  set a local truncate-line variable in notmuch-search-mode, so that 
subjects don't wrap and make the output look weird

 notmuch-search.c |5 +
 notmuch.el   |1 +
 2 files changed, 6 insertions(+), 0 deletions(-)


[notmuch] Mac OS X/Darwin compatibility issues

2009-11-17 Thread Alexander Botero-Lowry
On Wed, 18 Nov 2009 14:14:27 +0800, Jjgod Jiang  wrote:
> Hi,
> 
> On Wed, Nov 18, 2009 at 1:45 PM, Alexander Botero-Lowry
>  wrote:
> > for getline do you mind trying #define _GNU_SOURCE 1
> > before #include  in the offending files? The FreeBSD man pages
> > mentions that as a way of enabling the GNU version of getline().
> 
> It seems even _GNU_SOURCE is defined, getline is still not present.
> the C lib in Mac OS X simply doesn't have it. See also [1].
> 
Alas. Since it's ostensibly based on the FreeBSD one, I figured there
was a chance that would fix the problem. :/


[notmuch] Mac OS X/Darwin compatibility issues

2009-11-17 Thread Alexander Botero-Lowry
On Wed, 18 Nov 2009 11:50:17 +0800, Jjgod Jiang  wrote:
> Hi,
> 
> When I tried to compile notmuch under Mac OS X 10.6, several issues
> arisen:
> 
> 1. g++ reports 'warning: command line option "-Wmissing-declarations"
> is valid for C/ObjC but not for C++'
> 
I got that too. I presume it's newly supported in GCC4.4?

> 3. Several errors about missing GNU extensions like getline() and strndup():
> 
strndup from V8:

char* strndup(char* str, size_t n) {
  // Stupid implementation of strndup since macos isn't born with
  // one.
  size_t len = strlen(str);
  if (len <= n)
return StrDup(str);
  char* result = new char[n+1];
  size_t i;
  for (i = 0; i <= n; i++)
result[i] = str[i];
  result[i] = '\0';
  return result;
}

> warning: implicit declaration of function ?getline?
> error: ?strndup? was not declared in this scope
> 
for getline do you mind trying #define _GNU_SOURCE 1
before #include  in the offending files? The FreeBSD man pages
mentions that as a way of enabling the GNU version of getline().

Alex