[RFC] Several minor enhancements to the Emacs interface

2011-05-31 Thread Xavier Maillard
Hi Thomas,

On Tue, 31 May 2011 16:47:27 +0200, Thomas Jost  
wrote:
> Hi list,
> 
> The thread regarding multiple sender identities seems to have been of
> interest for several people, so I'd like to share a few other snippets
> From my Emacs configuration file.
> 
> Please tell me what you think of them. If you like them, I'd be glad to
> write some patches so they can be merged in notmuch.

Just send patch cause I think that all that stuff could be quite useful.

Anyway thank you.

/Xavier


Decryption fails

2011-05-31 Thread Felix Geller
On Tue, 31 May 2011 00:18:26 -0700, Jameson Graef Rollins  wrote:
> Hey, Felix.  As David said, all crypto tests should be passing with
> libgmime 2.4.24.  It would probably be instructive to know which crypto
> tests failed and why.  Maybe you could supply some output from the
> failed crypto tests.

Ok, so the following tests pass:

 PASS   emacs delivery of signed message
 PASS   emacs delivery of encrypted + signed message
 PASS   emacs delivery of encrypted message with attachment

I'm attaching the full output for the cypto tests.

I get the following trace when using show --decrypt to decrypt a
specific message (have to kill the process to actually get the trace):

#0  0x0001006121a6 in poll ()
#1  0x00010006d3d2 in gpg_ctx_op_step ()
#2  0x00010006e5c7 in gpg_decrypt ()
#3  0x0001000566cf in g_mime_multipart_encrypted_decrypt ()
#4  0x0001a413 in show_message_part (part=0x10606fc20,
#state=0x7fff5fbfd1c0, format=0x10002ef80, params=0x7fff5fbfd2c0,
#first=1) at show-message.c:71

So I guess it ends up looping or waiting in poll(), but I can't tell why
it would do that. I guess the next step is to post to the gmime mailing
list, or?


Cheers,
Felix


-- next part --
An embedded and charset-unspecified text was scrubbed...
Name: crypto_tests.txt
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110531/95889c83/attachment-0001.txt>
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 202 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110531/95889c83/attachment-0001.pgp>


[python] get all messages of a thread

2011-05-31 Thread Carl Worth
On Sat, 28 May 2011 14:18:05 +0100, Patrick Totzke  wrote:
> It seems that nobody needed this before. Even in bindings/python/notmuch.py
> only Threads.get_toplevel_messages() gets called, and then a (undocumented)
> Messages.print_messages is used (cf line 639, in show)
> 
> any suggestions?

Looks like a bug in the bindings to me.

> I would rather not call the notmuch binary and parse its output..

Of course not!

Python folks, does someone have a quick fix here?

-Carl

-- 
carl.d.worth at intel.com
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110531/01259e53/attachment.pgp>


[RFC] Several minor enhancements to the Emacs interface

2011-05-31 Thread Thomas Jost
Hi list,

The thread regarding multiple sender identities seems to have been of
interest for several people, so I'd like to share a few other snippets


Fixed recent regression (corruption of binary parts)

2011-05-31 Thread Carl Worth
I just fixed a bug that I should at least mention to the list.

On the notmuch master branch, since May 23, there has been a bug which
could lead to corruption when saving binary attachments from
messages.

A recent change to share more code internally (to provide "notmuch show
--part" rather than a separate top-level command of "notmuch part
--part") inadvertently passed the part content through a function that
would convert CRLF character pairs to LF and would also potentially
convert to UTF-8, (though only if the part being saved had a non-UTF-8
charset explicitly declared).

Fortunately, I happened to be sent a large attachment hitting the
CRLF->LF corruption so I was able to find and fix this bug.

I've just pushed a fix for this (along with a test case). So if you're
running notmuch newer than 0.5, you'll probably want to update to the
latest to avoid the chance of hitting this bug.

Thanks,

-Carl

-- 
carl.d.worth at intel.com
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110531/0b3ac9c0/attachment.pgp>


[PATCH v2 0/2] test: add test for saving attachments using notmuch-show-save-part

2011-05-31 Thread Carl Worth
On Tue, 10 May 2011 07:30:49 +0400, Dmitry Kurochkin  wrote:
> This is amended patch from
> id:"1304990689-10933-1-git-send-email-dmitry.kurochkin at gmail.com"
> to test saving attachments withing Emacs using
> notmuch-show-save-part.  It uses test_expect_equal_file instead
> of test_expect_equal as suggested by Jameson.

Thanks, Dmitry.

I've now pushed these new tests, (along with the previous patch to fix
the bug being tested here).

-Carl

-- 
carl.d.worth at intel.com
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110531/cb540490/attachment.pgp>


compile error of current git on F15

2011-05-31 Thread Daniel Kahn Gillmor
i'm CC'ing the upstream lead developer of gmime here to see if he has
any thoughts (and can correct any misrepresentations from me) -- Hi Jeffrey!

On 05/30/2011 02:43 PM, Jameson Graef Rollins wrote:
> On Sun, 29 May 2011 11:44:05 -0700, Dirk Hohndel  
> wrote:
>> CC -O2 notmuch-reply.o
>> notmuch-reply.c: In function ?notmuch_reply_command?:
>> notmuch-reply.c:658:3: error: unknown type name ?GMimeSession?
>> notmuch-reply.c:659:3: warning: passing argument 1 of 
>> ?g_mime_gpg_context_new? from incompatible pointer type [enabled by default]
>> /usr/include/gmime-2.6/gmime/gmime-gpg-context.h:64:21: note: expected 
>> ?GMimePasswordRequestFunc? but argument is of type ?int *?
>> make: *** [notmuch-reply.o] Error 1
>>
>> This seems to have been introduced in Jameson's crypto patch series...
>>
>> ./configure shows:
>>
>> Checking for Xapian development files... Yes (1.2.4).
>> Checking for GMime development files... Yes (gmime-2.6).
>> Checking for Glib development files (>= 2.14)... Yes.
> 
> Hey, Dirk.  Looks like you're using gmime-2.6, which is something I've
> never looked at, and it looks like there are API changes.  This of
> course doesn't help you, Dirk, but this probably means we should require
> libgmime-2.4, at least until we can figure out how to support both
> versions, which I'm not sure how to handle.
> 
> Dirk, just out of curiosity, what system are you running that is
> provides gmime 2.6?

F15 probably means Fedora 15.

gmime 2.6 has not been released yet; gmime 2.5 is the development
version (which itself has an unstable API); the project uses the
even=stable/odd=unstable version numbering scheme.

As the dev version, gmime 2.5 identifies itself as 2.6.  I'm not sure i
can justify this decision.  Jeffrey, can you explain?

If F15 does not have gmime 2.4 available in it, it's possible that it
may not be able to build notmuch :/

I don't think that notmuch should attempt to target a library with an
unstable API.  But if anyone is interested in preparing for the gmime
2.6 release (maybe jeffrey can hint at the timeline for us) may want to
prepare changesets that #ifdef the relevant code depending on the API
version.

Once gmime 2.6 is released, we'll need to decide if we want to remain
compatible with the old API as well, or just require gmime 2.6; but i
don't think we need to cross that bridge right now.

Regards,

--dkg

-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1030 bytes
Desc: OpenPGP digital signature
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110531/d18e45ff/attachment.pgp>


release-candidate/0.6 redux

2011-05-31 Thread Jameson Graef Rollins
Hi, folks.  I have pushed a new version of the release-candidate/0.6
branch to my repo [0].  It is all reworked on top of notmuch/master [1],
and includes:

* the miscellaneous fixes/improvements patch series starting at
  id:"1306619520-25730-2-git-send-email-jrollins at finestructure.net"
* the notmuch-show refresh patches
* Austin's atomicity patches
* Felipe's vim patches
* updates to the debian packaging

cworth: do you want to review this for the new release?  We're very close!
One last push and we can get this thing out.

bremner: do you want to reconcile this with what you've already pushed
to Debian experimental, and then push another version?

jamie.

[0] git://finestructure.net/notmuch [release-candidate/0.6]
[1] cb8418784c21155ffea79cce8409a7ea3c546937
-- 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/20110531/b777c53e/attachment.pgp>


[PATCH] emacs: Add callback functions to crypto sigstatus button.

2011-05-31 Thread Jameson Graef Rollins
This adds two callback functions to the sigstatus button.  If the sig
status is "good", then clicking the button displays the output of "gpg
--list-keys" on the key fingerprint.  If the sigstatus is "bad", then
clicking the button will retrieve the key from the keyserver, and
redisplay the current buffer.

Thanks to David Bremner  for help with this.
---
 emacs/notmuch-crypto.el |   52 +-
 1 files changed, 42 insertions(+), 10 deletions(-)

diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el
index f03266f..096dc5e 100644
--- a/emacs/notmuch-crypto.el
+++ b/emacs/notmuch-crypto.el
@@ -70,20 +70,26 @@ search."
   (let* ((status (plist-get sigstatus :status))
 (help-msg nil)
 (label "Signature not processed")
-(face 'notmuch-crypto-signature-unknown))
+(face 'notmuch-crypto-signature-unknown)
+(button-action '(lambda (button) (message (button-get button 
'help-echo)
 (cond
  ((string= status "good")
-  ; if userid present, userid has full or greater validity
-  (if (plist-member sigstatus :userid)
- (let ((userid (plist-get sigstatus :userid)))
-   (setq label (concat "Good signature by: " userid))
-   (setq face 'notmuch-crypto-signature-good))
-   (let ((fingerprint (concat "0x" (plist-get sigstatus :fingerprint
- (setq label (concat "Good signature by key: " fingerprint))
- (setq face 'notmuch-crypto-signature-good-key
+  (let ((fingerprint (concat "0x" (plist-get sigstatus :fingerprint
+   ;; if userid present, userid has full or greater validity
+   (if (plist-member sigstatus :userid)
+   (let ((userid (plist-get sigstatus :userid)))
+ (setq label (concat "Good signature by: " userid))
+ (setq face 'notmuch-crypto-signature-good))
+ (progn
+   (setq label (concat "Good signature by key: " fingerprint))
+   (setq face 'notmuch-crypto-signature-good-key)))
+   (setq button-action 'notmuch-crypto-sigstatus-good-callback)
+   (setq help-msg (concat "Click to list key ID 0x" fingerprint "."
  ((string= status "error")
   (let ((keyid (concat "0x" (plist-get sigstatus :keyid
-   (setq label (concat "Unknown key ID " keyid " or unsupported 
algorithm"
+   (setq label (concat "Unknown key ID " keyid " or unsupported 
algorithm"))
+   (setq button-action 'notmuch-crypto-sigstatus-error-callback)
+   (setq help-msg (concat "Click to retreive key ID " keyid " from 
keyserver and redisplay."
  ((string= status "bad")
   (let ((keyid (concat "0x" (plist-get sigstatus :keyid
(setq label (concat "Bad signature (claimed key ID " keyid ")"))
@@ -97,10 +103,36 @@ search."
  'help-echo help-msg
  'face face
  'mouse-face face
+ 'action button-action
  :notmuch-sigstatus sigstatus
  :notmuch-from from)
 (insert "\n")))

+(declare-function notmuch-show-refresh-view "notmuch-show" ( 
crypto-switch))
+
+(defun notmuch-crypto-sigstatus-good-callback (button)
+  (let* ((sigstatus (button-get button :notmuch-sigstatus))
+(fingerprint (concat "0x" (plist-get sigstatus :fingerprint)))
+(buffer (get-buffer-create "*notmuch-crypto-gpg-out*"))
+(window (display-buffer buffer t nil)))
+(with-selected-window window
+  (with-current-buffer buffer
+   (call-process "gpg" nil t t "--list-keys" fingerprint))
+  (recenter -1
+
+(defun notmuch-crypto-sigstatus-error-callback (button)
+  (let* ((sigstatus (button-get button :notmuch-sigstatus))
+(keyid (concat "0x" (plist-get sigstatus :keyid)))
+(buffer (get-buffer-create "*notmuch-crypto-gpg-out*"))
+(window (display-buffer buffer t nil)))
+(with-selected-window window
+  (with-current-buffer buffer
+   (call-process "gpg" nil t t "--recv-keys" keyid)
+   (insert "\n")
+   (call-process "gpg" nil t t "--list-keys" keyid))
+  (recenter -1))
+(notmuch-show-refresh-view)))
+
 (defun notmuch-crypto-insert-encstatus-button (encstatus)
   (let* ((status (plist-get encstatus :status))
 (help-msg nil)
-- 
1.7.4.4



[PATCH] emacs: update notmuch-crypto-process-mime config variable documentation.

2011-05-31 Thread Jameson Graef Rollins
This mentions the fact that prefix arguments are now used to enable to
crypto switch.
---
 emacs/notmuch-crypto.el |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el
index 096dc5e..44fccae 100644
--- a/emacs/notmuch-crypto.el
+++ b/emacs/notmuch-crypto.el
@@ -31,8 +31,9 @@ on the success or failure of the verification process and on 
the
 validity of user ID of the signer.

 The effect of setting this variable can be seen temporarily by
-viewing a signed or encrypted message with M-RET in notmuch
-search."
+providing a prefix when viewing a signed or encrypted message, or
+by providing a prefix when reloading the message in notmuch-show
+mode."
   :group 'notmuch
   :type 'boolean)

-- 
1.7.4.4



Decryption fails

2011-05-31 Thread Jameson Graef Rollins
On Mon, 30 May 2011 21:30:03 +0200, Felix Geller  wrote:
> Most of the test cases in crypto fail as well, but I'm not sure which
> ones are actually supposed to work.

Hey, Felix.  As David said, all crypto tests should be passing with
libgmime 2.4.24.  It would probably be instructive to know which crypto
tests failed and why.  Maybe you could supply some output from the
failed crypto tests.

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/20110531/fbd681ca/attachment-0001.pgp>


[RFC] Several minor enhancements to the Emacs interface

2011-05-31 Thread Thomas Jost
Hi list,

The thread regarding multiple sender identities seems to have been of
interest for several people, so I'd like to share a few other snippets
From my Emacs configuration file.

Please tell me what you think of them. If you like them, I'd be glad to
write some patches so they can be merged in notmuch.

*** HTML support ***
The current solution for opening HTML parts in a browser seems to be an
external script relying on the munpack executable:
http://notmuchmail.org/emacstips/#index8h2
However Emacs has everything that is needed. Here's a function that will
open text/html parts in a browser using nothing but pure elisp:

(defun schnouki/notmuch-view-html ()
  Open the HTML parts of a mail in a web browser.
  (interactive)
  (with-current-notmuch-show-message
   (let ((mm-handle (mm-dissect-buffer)))
 (notmuch-foreach-mime-part
  (lambda (p)
(if (string-equal (mm-handle-media-type p) text/html)
(mm-display-external p (lambda ()
 (message Opening web browser...)
 (browse-url-of-buffer)
 (bury-buffer)
  mm-handle

(Bound to H in notmuch-show-mode in my .emacs)


*** Filter by date ***
When displaying a search with lots of results (like tag:notmuch...), I'm
often only interested in what happened during the last few days. Here's
a little function, bound to d in notmuch-search-mode in my .emacs,
that asks for the number of days to display on restricts the search
accordingly:

(defun schnouki/notmuch-search-filter-by-date (days)
  (interactive NNumber of days to display: )
  (let* ((now (current-time))
 (beg (time-subtract now (days-to-time days)))
 (filter
  (concat
   (format-time-string %s.. beg)
   (format-time-string %s now
(notmuch-search-filter filter)))

The funny thing is that it also works with decimal inputs: d 1.5 RET,
and here is the list of messages received during the last 36 hours :)

This is really basic and could be improved by using something like
calendar-read-date (or better: org-read-date) to select the bounds of
the search. Please tell me if you're interested.


*** Autorefresh notmuch-hello via D-Bus ***
I process my incoming mails with a massive shell scripts that does many
things: the obvious and essential ones (offlineimap, notmuch new, call
autotag script), and the optional and fancy ones (update desktop widget
with a unread messages counter, display a desktop notification with the
last unread messages, make a daily backup of the notmuch DB, etc.). A
recent addition was to tell Emacs to update the *notmuch-hello* buffer
by calling a D-Bus method. This requires Emacs 23 compiled with D-Bus
support. Here's the corresponding code:

(require 'dbus)
(defun schnouki/notmuch-dbus-notify ()
  (when (get-buffer *notmuch-hello*)
(message Notmuch notify)
(notmuch-hello-update t)))
 (dbus-register-method :session dbus-service-emacs dbus-path-emacs
   dbus-service-emacs NotmuchNotify
   'schnouki/notmuch-dbus-notify)

The shell script then runs the following command:

dbus-send --session --dest=org.gnu.Emacs \
/org/gnu/Emacs org.gnu.Emacs.NotmuchNotify

Et voilà! *notmuch-hello* is updated.
(This probably shouldn't be integrated in notmuch because it has almost
nothing to do with notmuch itself, but it's still a cool hack and I'm
quite proud of it, so I just wanted to share it here :))


*** Automagical message signature selection ***
This function selects the signature to insert at the end of a message
according to the From header. It's based on a set of rules: when the
From header matches a rule, the content of the corresponding file is
inserted at the end of the message.

(setq schnouki/message-signatures '((m...@work.tld . ~/.signature/work)
(m...@fsfe.org . ~/.signature/fsfe)
(.*  . ~/.signature/normal))
(defun schnouki/choose-signature ()
  (let* ((from (message-fetch-field From))
 (sigfile
  (catch 'first-match
(dolist (re-file schnouki/message-signatures)
  (when (string-match-p (car re-file) from)
(throw 'first-match (cdr re-file)))
(if sigfile
(with-temp-buffer
  (insert-file-contents sigfile)
  (buffer-string)
(setq message-signature 'schnouki/choose-signature)


*** Not done yet :) ***
notmuch-search-archive-thread and notmuch-show-archive-thread are nice,
but they only remove the inbox tag. When quickly browsing through
messages I don't wan't to read, I'd also want it to remove the unread
tag.
Right now I copy-pasted them in my .emacs and just added that manually,
but I'd like it 

Re: compile error of current git on F15

2011-05-31 Thread Daniel Kahn Gillmor
i'm CC'ing the upstream lead developer of gmime here to see if he has
any thoughts (and can correct any misrepresentations from me) -- Hi Jeffrey!

On 05/30/2011 02:43 PM, Jameson Graef Rollins wrote:
 On Sun, 29 May 2011 11:44:05 -0700, Dirk Hohndel hohn...@infradead.org 
 wrote:
 CC -O2 notmuch-reply.o
 notmuch-reply.c: In function ‘notmuch_reply_command’:
 notmuch-reply.c:658:3: error: unknown type name ‘GMimeSession’
 notmuch-reply.c:659:3: warning: passing argument 1 of 
 ‘g_mime_gpg_context_new’ from incompatible pointer type [enabled by default]
 /usr/include/gmime-2.6/gmime/gmime-gpg-context.h:64:21: note: expected 
 ‘GMimePasswordRequestFunc’ but argument is of type ‘int *’
 make: *** [notmuch-reply.o] Error 1

 This seems to have been introduced in Jameson's crypto patch series...

 ./configure shows:

 Checking for Xapian development files... Yes (1.2.4).
 Checking for GMime development files... Yes (gmime-2.6).
 Checking for Glib development files (= 2.14)... Yes.
 
 Hey, Dirk.  Looks like you're using gmime-2.6, which is something I've
 never looked at, and it looks like there are API changes.  This of
 course doesn't help you, Dirk, but this probably means we should require
 libgmime-2.4, at least until we can figure out how to support both
 versions, which I'm not sure how to handle.
 
 Dirk, just out of curiosity, what system are you running that is
 provides gmime 2.6?

F15 probably means Fedora 15.

gmime 2.6 has not been released yet; gmime 2.5 is the development
version (which itself has an unstable API); the project uses the
even=stable/odd=unstable version numbering scheme.

As the dev version, gmime 2.5 identifies itself as 2.6.  I'm not sure i
can justify this decision.  Jeffrey, can you explain?

If F15 does not have gmime 2.4 available in it, it's possible that it
may not be able to build notmuch :/

I don't think that notmuch should attempt to target a library with an
unstable API.  But if anyone is interested in preparing for the gmime
2.6 release (maybe jeffrey can hint at the timeline for us) may want to
prepare changesets that #ifdef the relevant code depending on the API
version.

Once gmime 2.6 is released, we'll need to decide if we want to remain
compatible with the old API as well, or just require gmime 2.6; but i
don't think we need to cross that bridge right now.

Regards,

--dkg



signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] emacs: update notmuch-crypto-process-mime config variable documentation.

2011-05-31 Thread Jameson Graef Rollins
This mentions the fact that prefix arguments are now used to enable to
crypto switch.
---
 emacs/notmuch-crypto.el |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el
index 096dc5e..44fccae 100644
--- a/emacs/notmuch-crypto.el
+++ b/emacs/notmuch-crypto.el
@@ -31,8 +31,9 @@ on the success or failure of the verification process and on 
the
 validity of user ID of the signer.
 
 The effect of setting this variable can be seen temporarily by
-viewing a signed or encrypted message with M-RET in notmuch
-search.
+providing a prefix when viewing a signed or encrypted message, or
+by providing a prefix when reloading the message in notmuch-show
+mode.
   :group 'notmuch
   :type 'boolean)
 
-- 
1.7.4.4

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


[PATCH] emacs: Add callback functions to crypto sigstatus button.

2011-05-31 Thread Jameson Graef Rollins
This adds two callback functions to the sigstatus button.  If the sig
status is good, then clicking the button displays the output of gpg
--list-keys on the key fingerprint.  If the sigstatus is bad, then
clicking the button will retrieve the key from the keyserver, and
redisplay the current buffer.

Thanks to David Bremner brem...@unb.ca for help with this.
---
 emacs/notmuch-crypto.el |   52 +-
 1 files changed, 42 insertions(+), 10 deletions(-)

diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el
index f03266f..096dc5e 100644
--- a/emacs/notmuch-crypto.el
+++ b/emacs/notmuch-crypto.el
@@ -70,20 +70,26 @@ search.
   (let* ((status (plist-get sigstatus :status))
 (help-msg nil)
 (label Signature not processed)
-(face 'notmuch-crypto-signature-unknown))
+(face 'notmuch-crypto-signature-unknown)
+(button-action '(lambda (button) (message (button-get button 
'help-echo)
 (cond
  ((string= status good)
-  ; if userid present, userid has full or greater validity
-  (if (plist-member sigstatus :userid)
- (let ((userid (plist-get sigstatus :userid)))
-   (setq label (concat Good signature by:  userid))
-   (setq face 'notmuch-crypto-signature-good))
-   (let ((fingerprint (concat 0x (plist-get sigstatus :fingerprint
- (setq label (concat Good signature by key:  fingerprint))
- (setq face 'notmuch-crypto-signature-good-key
+  (let ((fingerprint (concat 0x (plist-get sigstatus :fingerprint
+   ;; if userid present, userid has full or greater validity
+   (if (plist-member sigstatus :userid)
+   (let ((userid (plist-get sigstatus :userid)))
+ (setq label (concat Good signature by:  userid))
+ (setq face 'notmuch-crypto-signature-good))
+ (progn
+   (setq label (concat Good signature by key:  fingerprint))
+   (setq face 'notmuch-crypto-signature-good-key)))
+   (setq button-action 'notmuch-crypto-sigstatus-good-callback)
+   (setq help-msg (concat Click to list key ID 0x fingerprint .
  ((string= status error)
   (let ((keyid (concat 0x (plist-get sigstatus :keyid
-   (setq label (concat Unknown key ID  keyid  or unsupported 
algorithm
+   (setq label (concat Unknown key ID  keyid  or unsupported 
algorithm))
+   (setq button-action 'notmuch-crypto-sigstatus-error-callback)
+   (setq help-msg (concat Click to retreive key ID  keyid  from 
keyserver and redisplay.
  ((string= status bad)
   (let ((keyid (concat 0x (plist-get sigstatus :keyid
(setq label (concat Bad signature (claimed key ID  keyid )))
@@ -97,10 +103,36 @@ search.
  'help-echo help-msg
  'face face
  'mouse-face face
+ 'action button-action
  :notmuch-sigstatus sigstatus
  :notmuch-from from)
 (insert \n)))
 
+(declare-function notmuch-show-refresh-view notmuch-show (optional 
crypto-switch))
+
+(defun notmuch-crypto-sigstatus-good-callback (button)
+  (let* ((sigstatus (button-get button :notmuch-sigstatus))
+(fingerprint (concat 0x (plist-get sigstatus :fingerprint)))
+(buffer (get-buffer-create *notmuch-crypto-gpg-out*))
+(window (display-buffer buffer t nil)))
+(with-selected-window window
+  (with-current-buffer buffer
+   (call-process gpg nil t t --list-keys fingerprint))
+  (recenter -1
+
+(defun notmuch-crypto-sigstatus-error-callback (button)
+  (let* ((sigstatus (button-get button :notmuch-sigstatus))
+(keyid (concat 0x (plist-get sigstatus :keyid)))
+(buffer (get-buffer-create *notmuch-crypto-gpg-out*))
+(window (display-buffer buffer t nil)))
+(with-selected-window window
+  (with-current-buffer buffer
+   (call-process gpg nil t t --recv-keys keyid)
+   (insert \n)
+   (call-process gpg nil t t --list-keys keyid))
+  (recenter -1))
+(notmuch-show-refresh-view)))
+
 (defun notmuch-crypto-insert-encstatus-button (encstatus)
   (let* ((status (plist-get encstatus :status))
 (help-msg nil)
-- 
1.7.4.4

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


Re: Decryption fails

2011-05-31 Thread Felix Geller
On Tue, 31 May 2011 00:18:26 -0700, Jameson Graef Rollins 
jroll...@finestructure.net wrote:
 Hey, Felix.  As David said, all crypto tests should be passing with
 libgmime 2.4.24.  It would probably be instructive to know which crypto
 tests failed and why.  Maybe you could supply some output from the
 failed crypto tests.

Ok, so the following tests pass:

 PASS   emacs delivery of signed message
 PASS   emacs delivery of encrypted + signed message
 PASS   emacs delivery of encrypted message with attachment

I'm attaching the full output for the cypto tests.

I get the following trace when using show --decrypt to decrypt a
specific message (have to kill the process to actually get the trace):

#0  0x0001006121a6 in poll ()
#1  0x00010006d3d2 in gpg_ctx_op_step ()
#2  0x00010006e5c7 in gpg_decrypt ()
#3  0x0001000566cf in g_mime_multipart_encrypted_decrypt ()
#4  0x0001a413 in show_message_part (part=0x10606fc20,
#state=0x7fff5fbfd1c0, format=0x10002ef80, params=0x7fff5fbfd2c0,
#first=1) at show-message.c:71

So I guess it ends up looping or waiting in poll(), but I can't tell why
it would do that. I guess the next step is to post to the gmime mailing
list, or?


Cheers,
Felix


crypto: Testing PGP/MIME signature verification and decryption
 PASS   emacs delivery of signed message
 FAIL   signature verification
--- crypto.2.expected   2011-05-31 17:30:47.0 +
+++ crypto.2.output 2011-05-31 17:30:47.0 +
@@ -1,23 +1 @@
-[[[{id: X,
- match: true,
- filename: Y,
- timestamp: 946728000,
- date_relative: 2000-01-01,
- tags: [inbox,signed],
- headers: {Subject: test signed message 001,
- From: Notmuch Test Suite test_su...@notmuchmail.org,
- To: test_su...@notmuchmail.org,
- Cc: ,
- Bcc: ,
- Date: 01 Jan 2000 12:00:00 -},
- body: [{id: 1,
- sigstatus: [{status: good,
- fingerprint: 5AEAB11F5E33DCE875DDB75B6D92612D94E46381,
- created: 946728000}],
- content-type: multipart/signed,
- content: [{id: 2,
- content-type: text/plain,
- content: This is a test signed message.\n},
- {id: 3,
- content-type: application/pgp-signature}]}]},
- [
+[]
 FAIL   signature verification with full owner trust
--- crypto.3.expected   2011-05-31 17:30:47.0 +
+++ crypto.3.output 2011-05-31 17:30:47.0 +
@@ -1,24 +1 @@
-[[[{id: X,
- match: true,
- filename: Y,
- timestamp: 946728000,
- date_relative: 2000-01-01,
- tags: [inbox,signed],
- headers: {Subject: test signed message 001,
- From: Notmuch Test Suite test_su...@notmuchmail.org,
- To: test_su...@notmuchmail.org,
- Cc: ,
- Bcc: ,
- Date: 01 Jan 2000 12:00:00 -},
- body: [{id: 1,
- sigstatus: [{status: good,
- fingerprint: 5AEAB11F5E33DCE875DDB75B6D92612D94E46381,
- created: 946728000,
- userid:  Notmuch Test Suite test_su...@notmuchmail.org 
(INSECURE!)}],
- content-type: multipart/signed,
- content: [{id: 2,
- content-type: text/plain,
- content: This is a test signed message.\n},
- {id: 3,
- content-type: application/pgp-signature}]}]},
- [
+[]
 FAIL   signature verification with signer key unavailable
--- crypto.4.expected   2011-05-31 17:30:47.0 +
+++ crypto.4.output 2011-05-31 17:30:47.0 +
@@ -1,23 +1 @@
-[[[{id: X,
- match: true,
- filename: Y,
- timestamp: 946728000,
- date_relative: 2000-01-01,
- tags: [inbox,signed],
- headers: {Subject: test signed message 001,
- From: Notmuch Test Suite test_su...@notmuchmail.org,
- To: test_su...@notmuchmail.org,
- Cc: ,
- Bcc: ,
- Date: 01 Jan 2000 12:00:00 -},
- body: [{id: 1,
- sigstatus: [{status: error,
- keyid: 6D92612D94E46381,
- errors: 2}],
- content-type: multipart/signed,
- content: [{id: 2,
- content-type: text/plain,
- content: This is a test signed message.\n},
- {id: 3,
- content-type: application/pgp-signature}]}]},
- [
+[]
 PASS   emacs delivery of encrypted message with attachment
 FAIL   decryption, --format=text
--- crypto.6.expected   2011-05-31 17:30:48.0 +
+++ crypto.6.output 2011-05-31 17:30:48.0 +
@@ -1,25 +1 @@
-message{ id:X depth:0 match:1 filename:X
-header{
-Notmuch Test Suite test_su...@notmuchmail.org (2000-01-01) 
(encrypted inbox)
-Subject: test encrypted message 001
-From: Notmuch Test Suite 

Re: release-candidate/0.6 redux

2011-05-31 Thread Jameson Graef Rollins
Hi, folks.  I have pushed a new version of the release-candidate/0.6
branch to my repo [0].  It is all reworked on top of notmuch/master [1],
and includes:

* the miscellaneous fixes/improvements patch series starting at
  id:1306619520-25730-2-git-send-email-jroll...@finestructure.net
* the notmuch-show refresh patches
* Austin's atomicity patches
* Felipe's vim patches
* updates to the debian packaging

cworth: do you want to review this for the new release?  We're very close!
One last push and we can get this thing out.

bremner: do you want to reconcile this with what you've already pushed
to Debian experimental, and then push another version?

jamie.

[0] git://finestructure.net/notmuch [release-candidate/0.6]
[1] cb8418784c21155ffea79cce8409a7ea3c546937


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


Re: [RFC] Several minor enhancements to the Emacs interface

2011-05-31 Thread Xavier Maillard
Hi Thomas,

On Tue, 31 May 2011 16:47:27 +0200, Thomas Jost schno...@schnouki.net wrote:
 Hi list,
 
 The thread regarding multiple sender identities seems to have been of
 interest for several people, so I'd like to share a few other snippets
 From my Emacs configuration file.
 
 Please tell me what you think of them. If you like them, I'd be glad to
 write some patches so they can be merged in notmuch.

Just send patch cause I think that all that stuff could be quite useful.

Anyway thank you.

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


Fixed recent regression (corruption of binary parts)

2011-05-31 Thread Carl Worth
I just fixed a bug that I should at least mention to the list.

On the notmuch master branch, since May 23, there has been a bug which
could lead to corruption when saving binary attachments from
messages.

A recent change to share more code internally (to provide notmuch show
--part rather than a separate top-level command of notmuch part
--part) inadvertently passed the part content through a function that
would convert CRLF character pairs to LF and would also potentially
convert to UTF-8, (though only if the part being saved had a non-UTF-8
charset explicitly declared).

Fortunately, I happened to be sent a large attachment hitting the
CRLF-LF corruption so I was able to find and fix this bug.

I've just pushed a fix for this (along with a test case). So if you're
running notmuch newer than 0.5, you'll probably want to update to the
latest to avoid the chance of hitting this bug.

Thanks,

-Carl

-- 
carl.d.wo...@intel.com


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


Re: [python] get all messages of a thread

2011-05-31 Thread Carl Worth
On Sat, 28 May 2011 14:18:05 +0100, Patrick Totzke 
patricktot...@googlemail.com wrote:
 It seems that nobody needed this before. Even in bindings/python/notmuch.py
 only Threads.get_toplevel_messages() gets called, and then a (undocumented)
 Messages.print_messages is used (cf line 639, in show)
 
 any suggestions?

Looks like a bug in the bindings to me.

 I would rather not call the notmuch binary and parse its output..

Of course not!

Python folks, does someone have a quick fix here?

-Carl

-- 
carl.d.wo...@intel.com


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


Re: [python] get all messages of a thread

2011-05-31 Thread Brian May
On 28 May 2011 23:18, Patrick Totzke patricktot...@googlemail.com wrote:

if r: #because we cant iterate on NoneType


I don't understand why, but this line sets r._msgs to None. So it crashes,
because it has no message ids to look for.

If you change it to

if r is not None:

... then it works for me.

Oh, I see, for your code, there is a implied call to __len__, and the
__len__ function is completely broken for the reasons described in the
documentation:

  .. note:: As this iterates over the messages, we will not be able to=
   iterate over them again! So this will fail::

 #THIS FAILS
 msgs = Database().create_query('').search_message()
 if len(msgs)  0:  #this 'exhausts' msgs
 # next line raises
NotmuchError(STATUS.NOT_INITIALIZED)!!!
 for msg in msgs: print msg

   Most of the time, using the
   :meth:`Query.count_messages` is therefore more
   appropriate (and much faster). While not guaranteeing
   that it will return the exact same number than len(),
   in my tests it effectively always did so.



-- 
Brian May br...@microcomaustralia.com.au
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: Multiple sender identities (composing)

2011-05-31 Thread Brian May
On 16 May 2011 19:29, Stewart Smith stew...@flamingspork.com wrote:

 Thought I'd share this bit of my .emacs snippet that may be useful to go
 on the emacs tips page.

 This does the following:
 - sets up a list of possible identities to have mail From
 - on composing mail, it prompts you for who you want to send mail from
 - pressing enter will give you the default (first in the list)
 - otherwise you have tab completion


Is it possible to have it change the signature per identity also?
-- 
Brian May br...@microcomaustralia.com.au
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch