[notmuch] [PATCH v2] notmuch.el: Make notmuch-show buffer name first subject, instead of thread-id

2010-02-12 Thread Jesse Rosenthal

Change the buffer name to a uniquified subject of the thread (i.e. the
subject of the first message in the thread) instead of the thread-id. This
is more meaningful to the user, and will make it easier to scroll through
numerous open buffers.

Note that this patch adds an optionsal `buffer-name' argument to notmuch
show.

This version of the patch improves on the first version by ensuring that
the buffer names are unique, and that the `notmuch-show' command can
still be used interactively.

Signed-off-by: Jesse Rosenthal 
---
 notmuch.el |   25 +++--
 1 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 040997e..9667320 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -1041,7 +1041,7 @@ All currently available key bindings:
  (lambda()
(hl-line-mode 1) ))

-(defun notmuch-show (thread-id  parent-buffer query-context)
+(defun notmuch-show (thread-id  parent-buffer query-context 
buffer-name)
   "Run \"notmuch show\" with the given thread ID and display results.

 The optional PARENT-BUFFER is the notmuch-search buffer from
@@ -1051,7 +1051,8 @@ thread from that buffer can be show when done with this 
one).
 The optional QUERY-CONTEXT is a notmuch search term. Only messages from the 
thread
 matching this search term are shown if non-nil. "
   (interactive "sNotmuch show: ")
-  (let ((buffer (get-buffer-create (concat "*notmuch-show-" thread-id "*"
+  (let* ((thread-buffer-name (generate-new-buffer-name buffer-name))
+(buffer (get-buffer-create thread-buffer-name)))
 (switch-to-buffer buffer)
 (notmuch-show-mode)
 (set (make-local-variable 'notmuch-show-parent-buffer) parent-buffer)
@@ -1063,8 +1064,10 @@ matching this search term are shown if non-nil. "
   (erase-buffer)
   (goto-char (point-min))
   (save-excursion
-   (let* ((basic-args (list notmuch-command nil t nil "show" 
"--entire-thread" thread-id))
-   (args (if query-context (append basic-args (list "and (" 
query-context ")")) basic-args)))
+   (let* ((basic-args (list notmuch-command nil t nil "show" 
"--entire-thread" "\'" thread-id))
+   (args (if query-context
+ (append basic-args (list "and (" query-context ")\'"))
+   (append basic-args (list "\'")
  (apply 'call-process args)
  (when (and (eq (buffer-size) 0) query-context)
(apply 'call-process basic-args)))
@@ -1242,9 +1245,19 @@ Complete list of currently available key bindings:
 (defun notmuch-search-show-thread ()
   "Display the currently selected thread."
   (interactive)
-  (let ((thread-id (notmuch-search-find-thread-id)))
+  (let ((thread-id (notmuch-search-find-thread-id))
+   (subject (notmuch-search-find-subject))
+   buffer-name)
+(when (string-match "^[ \t]*$" subject)
+  (setq subject "[No Subject]"))
+(setq buffer-name (concat "*"
+ (truncate-string-to-width subject 32 nil nil t)
+ "*"))
 (if (> (length thread-id) 0)
-   (notmuch-show thread-id (current-buffer) notmuch-search-query-string)
+   (notmuch-show thread-id
+ (current-buffer)
+ notmuch-search-query-string
+ buffer-name)
   (error "End of search results"

 (defun notmuch-search-reply-to-thread ()
-- 
1.6.5.3



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

2010-02-12 Thread Michal Sojka
On Tue, 09 Feb 2010 18:18:38 -0800, Carl Worth  wrote:
> On Tue,  9 Feb 2010 17:55:21 -0800, Alexander Botero-Lowry  at gmail.com> wrote:
> > 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
> 
> Excellent! I've pushed this out now. Greatly appreciated.

Hi,

I have the following problem when viewing HTML inline. With certain HTML
messages containing non-ASCII characters, these non-ASCII characters are
not displayed. Since we use many non-ASCII characters in czech language,
this is quite a problem. It is interesting that this doesn't happen with
all messages. Does anybody know what might cause this behaviour?

Thanks
Michal


[notmuch] [PATCH 2/2] notmuch.el: add a submap (on "z" for "ztash") to stash things.

2010-02-12 Thread Michal Sojka
On Thu, 11 Feb 2010 23:01:08 -0400, david at tethera.net wrote:
> From: David Bremner 
> 
> Provide key bindings for stuffing various RFC822 header fields and other 
> metadata
> into the emacs kill-ring as text. The bindings are as follows:
> 
> z F   notmuch-show-stash-filename
> z T   notmuch-show-stash-tags
> z c   notmuch-show-stash-cc
> z d   notmuch-show-stash-date
> z f   notmuch-show-stash-from
> z m   notmuch-show-stash-message-id
> z s   notmuch-show-stash-subject
> z t   notmuch-show-stash-to

Great! I've always wished to have this.

Michal


[notmuch] A functional (but rudimentary) test suite for notmuch

2010-02-12 Thread Michal Sojka
On Thu, 11 Feb 2010 13:42:08 -0800, Carl Worth  wrote:
> Interesting. My only real concern at this point is that some of the new files
> have a copyright header identifying Junio as the copyright holder, but
> no license information. Meanwhile, the implicit license of git (GPLv2
> only) is incompatible with that of notmuch (GPLv3+).

I'm not lawyer, but I'd say it should be no problem to use GPLv2 test
suite to test your GPLv3 application. You are not linking them
together.

On the other hand, if you want the tests cases to be GPLv3 then you are
probably right. Is this the case?


Michal


[notmuch] [RFC] improved display of message/rfc822 parts

2010-02-12 Thread David Edmondson
I seem to get a lot of forwarded message/rfc822 parts and the default
formatting (which is to inline the contents of the included message) is
very confusing.

Attached is a patch which attempts to improve this. Given that I'm new
to notmuch hacking, any comments would be appreciated.

-- next part --
A non-text attachment was scrubbed...
Name: 0001-show-Make-message-rfc822-parts-explicit-in-show-outp.patch
Type: text/x-diff
Size: 1743 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100212/1d2cd466/attachment.patch>
-- next part --

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


[notmuch] [PATCH] notmuch.el: Make notmuch-show buffer name first subject, instead of thread-id

2010-02-12 Thread Jameson Rollins
On Fri, 12 Feb 2010 12:10:41 -0500, Jesse Rosenthal  
wrote:
> Change the buffer name to the subject of the thread instead of
> the thread-id. This is more meaningful to the user, and will make it easier
> to scroll through numerous open buffers.

Wow, what a great idea.  I was getting annoyed that I couldn't find the
email I was composing without shuffling through all my open buffers.
Well done.

jamie.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100212/bdcad1af/attachment.pgp>


[notmuch] notmuch reply template

2010-02-12 Thread martin f krafft
also sprach Sebastian Spaeth  [2010.02.12.0254 +1300]:
> I've had enough of the 
> 
>  On a sunny Sunday the 30th in timezone , male human  with mail
>  address  hit the reply button  microseconds after 1970 while being 
> at latitude :
> 
> type of reply template in notmuch. :-)
> 
> May I suggest to use a simpler:
> 
>  "On 11 Feb 2010, David Edmondson wrote:" 

This should be configurable so everyone can set their own.

-- 
martin | http://madduck.net/ | http://two.sentenc.es/

if god had meant for us to be naked,
we would have been born that way.

spamtraps: madduck.bogus at madduck.net
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature (see http://martin-krafft.net/gpg/)
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100212/ed87657b/attachment.pgp>


[notmuch] A functional (but rudimentary) test suite for notmuch

2010-02-12 Thread Carl Worth
On Fri, 12 Feb 2010 15:47:56 +0100, Michal Sojka  wrote:
> I'm not lawyer, but I'd say it should be no problem to use GPLv2 test
> suite to test your GPLv3 application. You are not linking them
> together.

Right. We could do that. But we'd have to be careful to document things
carefully to keep track of things, (which the current patches at least,
don't do).

> On the other hand, if you want the tests cases to be GPLv3 then you are
> probably right. Is this the case?

I think things are a lot simpler if we keep everything in the repository
under a single license. So I'd prefer that.

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100212/bb49325f/attachment.pgp>


[notmuch] Backport of Xapian term update optimisation

2010-02-12 Thread David Edmondson
On Thu, 4 Feb 2010 23:23:56 +, Olly Betts  wrote:
> If I get a lot of positive feedback on the snapshot version, that'll encourage
> me to push ahead with it.  I've also announced it on the sup mailing list (as
> they have similar issues with adding tags) and will on the Xapian list later
> today.

I'm using the version from the experimental repository and it's working
well for me so far.

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


Re: [notmuch] Backport of Xapian term update optimisation

2010-02-12 Thread David Edmondson
On Thu, 4 Feb 2010 23:23:56 +, Olly Betts o...@survex.com wrote:
 If I get a lot of positive feedback on the snapshot version, that'll encourage
 me to push ahead with it.  I've also announced it on the sup mailing list (as
 they have similar issues with adding tags) and will on the Xapian list later
 today.

I'm using the version from the experimental repository and it's working
well for me so far.

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


Re: [notmuch] A functional (but rudimentary) test suite for notmuch

2010-02-12 Thread Michal Sojka
On Thu, 11 Feb 2010 13:42:08 -0800, Carl Worth cwo...@cworth.org wrote:
 Interesting. My only real concern at this point is that some of the new files
 have a copyright header identifying Junio as the copyright holder, but
 no license information. Meanwhile, the implicit license of git (GPLv2
 only) is incompatible with that of notmuch (GPLv3+).

I'm not lawyer, but I'd say it should be no problem to use GPLv2 test
suite to test your GPLv3 application. You are not linking them
together.

On the other hand, if you want the tests cases to be GPLv3 then you are
probably right. Is this the case?


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


[notmuch] [RFC] improved display of message/rfc822 parts

2010-02-12 Thread David Edmondson
I seem to get a lot of forwarded message/rfc822 parts and the default
formatting (which is to inline the contents of the included message) is
very confusing.

Attached is a patch which attempts to improve this. Given that I'm new
to notmuch hacking, any comments would be appreciated.

From 7fd7ad00f4b8f8a2610eb1598a1c0bb4351e Mon Sep 17 00:00:00 2001
From: David Edmondson d...@dme.org
Date: Fri, 12 Feb 2010 15:01:06 +
Subject: [PATCH] show: Make message/rfc822 parts explicit in show output.
 show: Display header information for message/rfc822 parts.

---
 notmuch-show.c |   32 
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/notmuch-show.c b/notmuch-show.c
index 376aacd..6f12560 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -97,6 +97,34 @@ show_part_content (GMimeObject *part)
 }
 
 static void
+show_message_rfc822 (GMimeObject *part, int *part_count,
+		 void (*show_part) (GMimeObject *part, int *part_count))
+{
+GMimeMessage *message;
+const char *headers[] = {
+	Subject, From, To, Cc, Bcc, Date
+};
+const char *name, *value;
+unsigned int i;
+
+*part_count = *part_count + 1;
+
+message = g_mime_message_part_get_message (GMIME_MESSAGE_PART (part));
+
+printf (\n);
+for (i = 0; i  ARRAY_SIZE (headers); i++) {
+	name = headers[i];
+	value = g_mime_object_get_header (GMIME_OBJECT (message), name);
+	if (value)
+	printf (%s: %s\n, name, value);
+}
+printf (\n);
+
+show_part (g_mime_message_get_mime_part (message),
+	   part_count);
+}
+
+static void
 show_part (GMimeObject *part, int *part_count)
 {
 GMimeContentDisposition *disposition;
@@ -137,6 +165,10 @@ show_part (GMimeObject *part, int *part_count)
 {
 	show_part_content (part);
 }
+else if (g_mime_content_type_is_type (content_type, message, rfc822))
+{
+	show_message_rfc822 (part, part_count, show_part);
+}
 else
 {
 	printf (Non-text part: %s\n,
-- 
1.6.6.1


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


Re: [notmuch] [PATCH 2/2] notmuch.el: add a submap (on z for ztash) to stash things.

2010-02-12 Thread Michal Sojka
On Thu, 11 Feb 2010 23:01:08 -0400, da...@tethera.net wrote:
 From: David Bremner brem...@unb.ca
 
 Provide key bindings for stuffing various RFC822 header fields and other 
 metadata
 into the emacs kill-ring as text. The bindings are as follows:
 
 z F   notmuch-show-stash-filename
 z T   notmuch-show-stash-tags
 z c   notmuch-show-stash-cc
 z d   notmuch-show-stash-date
 z f   notmuch-show-stash-from
 z m   notmuch-show-stash-message-id
 z s   notmuch-show-stash-subject
 z t   notmuch-show-stash-to

Great! I've always wished to have this.

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


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

2010-02-12 Thread Michal Sojka
On Tue, 09 Feb 2010 18:18:38 -0800, Carl Worth cwo...@cworth.org wrote:
 On Tue,  9 Feb 2010 17:55:21 -0800, Alexander Botero-Lowry 
 alex.boterolo...@gmail.com wrote:
  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
 
 Excellent! I've pushed this out now. Greatly appreciated.

Hi,

I have the following problem when viewing HTML inline. With certain HTML
messages containing non-ASCII characters, these non-ASCII characters are
not displayed. Since we use many non-ASCII characters in czech language,
this is quite a problem. It is interesting that this doesn't happen with
all messages. Does anybody know what might cause this behaviour?

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


Re: [notmuch] A functional (but rudimentary) test suite for notmuch

2010-02-12 Thread Carl Worth
On Fri, 12 Feb 2010 15:47:56 +0100, Michal Sojka sojk...@fel.cvut.cz wrote:
 I'm not lawyer, but I'd say it should be no problem to use GPLv2 test
 suite to test your GPLv3 application. You are not linking them
 together.

Right. We could do that. But we'd have to be careful to document things
carefully to keep track of things, (which the current patches at least,
don't do).

 On the other hand, if you want the tests cases to be GPLv3 then you are
 probably right. Is this the case?

I think things are a lot simpler if we keep everything in the repository
under a single license. So I'd prefer that.

-Carl


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


[notmuch] [PATCH] notmuch.el: Make notmuch-show buffer name first subject, instead of thread-id

2010-02-12 Thread Jesse Rosenthal

Change the buffer name to the subject of the thread instead of
the thread-id. This is more meaningful to the user, and will make it easier
to scroll through numerous open buffers.

Note that this patch adds a required `buffer-name' argument to notmuch-show.

Signed-off-by: Jesse Rosenthal jrosent...@jhu.edu
---
 notmuch.el |   24 ++--
 1 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 040997e..fbf547e 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -1041,7 +1041,7 @@ All currently available key bindings:
  (lambda()
(hl-line-mode 1) ))
 
-(defun notmuch-show (thread-id optional parent-buffer query-context)
+(defun notmuch-show (thread-id buffer-name optional parent-buffer 
query-context)
   Run \notmuch show\ with the given thread ID and display results.
 
 The optional PARENT-BUFFER is the notmuch-search buffer from
@@ -1051,7 +1051,7 @@ thread from that buffer can be show when done with this 
one).
 The optional QUERY-CONTEXT is a notmuch search term. Only messages from the 
thread
 matching this search term are shown if non-nil. 
   (interactive sNotmuch show: )
-  (let ((buffer (get-buffer-create (concat *notmuch-show- thread-id *
+  (let ((buffer (get-buffer-create buffer-name)))
 (switch-to-buffer buffer)
 (notmuch-show-mode)
 (set (make-local-variable 'notmuch-show-parent-buffer) parent-buffer)
@@ -1063,8 +1063,10 @@ matching this search term are shown if non-nil. 
   (erase-buffer)
   (goto-char (point-min))
   (save-excursion
-   (let* ((basic-args (list notmuch-command nil t nil show 
--entire-thread thread-id))
-   (args (if query-context (append basic-args (list and ( 
query-context ))) basic-args)))
+   (let* ((basic-args (list notmuch-command nil t nil show 
--entire-thread \' thread-id))
+   (args (if query-context
+ (append basic-args (list and ( query-context )\'))
+   (append basic-args (list \')
  (apply 'call-process args)
  (when (and (eq (buffer-size) 0) query-context)
(apply 'call-process basic-args)))
@@ -1242,9 +1244,19 @@ Complete list of currently available key bindings:
 (defun notmuch-search-show-thread ()
   Display the currently selected thread.
   (interactive)
-  (let ((thread-id (notmuch-search-find-thread-id)))
+  (let ((thread-id (notmuch-search-find-thread-id))
+   (subject (notmuch-search-find-subject))
+   buffer-name)
+(when (string-match ^[ \t]*$ subject)
+  (setq subject [No Subject]))
+(setq buffer-name (concat *
+ (truncate-string-to-width subject 32 nil nil t)
+ *))
 (if ( (length thread-id) 0)
-   (notmuch-show thread-id (current-buffer) notmuch-search-query-string)
+   (notmuch-show thread-id
+ buffer-name
+ (current-buffer)
+ notmuch-search-query-string)
   (error End of search results
 
 (defun notmuch-search-reply-to-thread ()
-- 
1.6.5.3

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


Re: [notmuch] [PATCH] notmuch.el: Make notmuch-show buffer name first subject, instead of thread-id

2010-02-12 Thread Jameson Rollins
On Fri, 12 Feb 2010 12:10:41 -0500, Jesse Rosenthal jrosent...@jhu.edu wrote:
 Change the buffer name to the subject of the thread instead of
 the thread-id. This is more meaningful to the user, and will make it easier
 to scroll through numerous open buffers.

Wow, what a great idea.  I was getting annoyed that I couldn't find the
email I was composing without shuffling through all my open buffers.
Well done.

jamie.


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


[notmuch] [PATCH v2] notmuch.el: Make notmuch-show buffer name first subject, instead of thread-id

2010-02-12 Thread Jesse Rosenthal

Change the buffer name to a uniquified subject of the thread (i.e. the
subject of the first message in the thread) instead of the thread-id. This
is more meaningful to the user, and will make it easier to scroll through
numerous open buffers.

Note that this patch adds an optionsal `buffer-name' argument to notmuch
show.

This version of the patch improves on the first version by ensuring that
the buffer names are unique, and that the `notmuch-show' command can
still be used interactively.

Signed-off-by: Jesse Rosenthal jrosent...@jhu.edu
---
 notmuch.el |   25 +++--
 1 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 040997e..9667320 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -1041,7 +1041,7 @@ All currently available key bindings:
  (lambda()
(hl-line-mode 1) ))
 
-(defun notmuch-show (thread-id optional parent-buffer query-context)
+(defun notmuch-show (thread-id optional parent-buffer query-context 
buffer-name)
   Run \notmuch show\ with the given thread ID and display results.
 
 The optional PARENT-BUFFER is the notmuch-search buffer from
@@ -1051,7 +1051,8 @@ thread from that buffer can be show when done with this 
one).
 The optional QUERY-CONTEXT is a notmuch search term. Only messages from the 
thread
 matching this search term are shown if non-nil. 
   (interactive sNotmuch show: )
-  (let ((buffer (get-buffer-create (concat *notmuch-show- thread-id *
+  (let* ((thread-buffer-name (generate-new-buffer-name buffer-name))
+(buffer (get-buffer-create thread-buffer-name)))
 (switch-to-buffer buffer)
 (notmuch-show-mode)
 (set (make-local-variable 'notmuch-show-parent-buffer) parent-buffer)
@@ -1063,8 +1064,10 @@ matching this search term are shown if non-nil. 
   (erase-buffer)
   (goto-char (point-min))
   (save-excursion
-   (let* ((basic-args (list notmuch-command nil t nil show 
--entire-thread thread-id))
-   (args (if query-context (append basic-args (list and ( 
query-context ))) basic-args)))
+   (let* ((basic-args (list notmuch-command nil t nil show 
--entire-thread \' thread-id))
+   (args (if query-context
+ (append basic-args (list and ( query-context )\'))
+   (append basic-args (list \')
  (apply 'call-process args)
  (when (and (eq (buffer-size) 0) query-context)
(apply 'call-process basic-args)))
@@ -1242,9 +1245,19 @@ Complete list of currently available key bindings:
 (defun notmuch-search-show-thread ()
   Display the currently selected thread.
   (interactive)
-  (let ((thread-id (notmuch-search-find-thread-id)))
+  (let ((thread-id (notmuch-search-find-thread-id))
+   (subject (notmuch-search-find-subject))
+   buffer-name)
+(when (string-match ^[ \t]*$ subject)
+  (setq subject [No Subject]))
+(setq buffer-name (concat *
+ (truncate-string-to-width subject 32 nil nil t)
+ *))
 (if ( (length thread-id) 0)
-   (notmuch-show thread-id (current-buffer) notmuch-search-query-string)
+   (notmuch-show thread-id
+ (current-buffer)
+ notmuch-search-query-string
+ buffer-name)
   (error End of search results
 
 (defun notmuch-search-reply-to-thread ()
-- 
1.6.5.3

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