[RFC] Enhancements to address completion

2011-03-13 Thread servilio
I have been working in some enhancements to the emacs UI address
completion, and this weekend I was able to find a way to finish the
implementation to an acceptable (to me) state.

The gist of it is allowing the completion in Emacs to match against
any part of the addresses returned by the notmuch-addrlookup command.
I could not find a way to have completing-read behave that way, the
strategy of matching anchored to the beginning of strings is
in-grained in its design for what I've seen.

The current implementation uses Ido, included with Emacs at least in
version 23, and is available at:

git://git.latertulia.org/servilio/notmuch.git

In the branch complete-name-and-address-v2. There is a web interface
if you prefer to see the changes, just use "http" as the protocol in
your web browser.

The first few changes in the branch are fixes and small enhancements I
found while working on this, and I have sent them as separate patches
for acceptance as they are independent of this work. All of this has
been in use (in the form of the branch without "-v2") for almost a
year. I started a message in August but somehow successfully forgot
completely about it.

Regards,

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


[PATCH] No initial input for completing-read.

2011-03-13 Thread servilio
Seeding the autocompletion with the first match makes it harder to see
what the other matches are, as all the extra characters would need to
be deleted before being able to see the matches.
---
 emacs/notmuch-address.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
index 2960da9..fc2df12 100644
--- a/emacs/notmuch-address.el
+++ b/emacs/notmuch-address.el
@@ -57,7 +57,7 @@ line."
 (chosen (if (eq num-options 1)
 (car options)
   (completing-read (format "Address (%s matches): " 
num-options)
-   (cdr options) nil nil (car options)
+   options nil nil nil
'notmuch-address-history
 (when chosen
   (push chosen notmuch-address-history)
-- 
1.7.4.1
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] Save global match data when looking for the beginning of field.

2011-03-13 Thread servilio
Thus avoid disrupting usage of regular expressions functions
elsewhere.
---
 emacs/notmuch-address.el |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
index 52e320d..2960da9 100644
--- a/emacs/notmuch-address.el
+++ b/emacs/notmuch-address.el
@@ -47,9 +47,9 @@ line."
 (defun notmuch-address-expand-name ()
   (let* ((end (point))
 (beg (save-excursion
-   (re-search-backward "\\(\\`\\|[\n:,]\\)[ \t]*")
-   (match-end 0)
-   ))
+   (save-match-data
+ (re-search-backward "\\(\\`\\|[\n:,]\\)[ \t]*")
+ (match-end 0
 (orig (buffer-substring-no-properties beg end))
 (completion-ignore-case t)
 (options (notmuch-address-options orig))
-- 
1.7.4.1
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] Eliminate redundant code.

2011-03-13 Thread servilio
There is no need to move the cursor to the position if you can
retrieve its value directly.
---
 emacs/notmuch-address.el |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
index 1a7c577..52e320d 100644
--- a/emacs/notmuch-address.el
+++ b/emacs/notmuch-address.el
@@ -48,8 +48,8 @@ line."
   (let* ((end (point))
 (beg (save-excursion
(re-search-backward "\\(\\`\\|[\n:,]\\)[ \t]*")
-   (goto-char (match-end 0))
-   (point)))
+   (match-end 0)
+   ))
 (orig (buffer-substring-no-properties beg end))
 (completion-ignore-case t)
 (options (notmuch-address-options orig))
-- 
1.7.4.1
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Backtrace with latest crypto branch

2011-03-13 Thread Xavier Maillard
Hi David,

On Wed, 09 Mar 2011 17:20:05 -0400, David Bremner  wrote:
> On Wed, 09 Mar 2011 22:14:55 +0100, Xavier Maillard  wrote:
> > Hi,
> > 
> > No problem, Cc'ing accordingly.
> > 
> > Hope that'll help in debugging this issue.
> > 
> 
> Can one of you post the backtrace?

Here it is:

Debugger entered--Lisp error: (wrong-type-argument char-or-string-p ((:content 
((:content "Hey, folks.  I just wanted to give all the crypto early adopters a 
heads
up that I just changed the crypto customization variable name in my
crypto branch to be:

  notmuch-process-crypto-mime

Daniel Gillmor has been doing a lot of great work with GMIME upstream to
include support for handling s/mime parts with the same crypto context.
When this work gets finished, pgp/mime and s/mime parts will both be
processed with the same crypto hooks.  Looking ahead, I thought the
previous variable name (notmuch-process-pgpmime) was overly specific.
And I wanted to get this change in before cworth's rumored imminent next
release push (waiting with bated breath!).

jamie.


!DSPAM:1,4d72d0f035413102713680!
" :content-type "text/plain" :id 3) (:content-type "application/pgp-signature" 
:id 4)) :content-type "multipart/signed" :id 2) (:content 
"___
notmuch mailing list
notmuch at notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


!DSPAM:1,4d72d0f035413102713680!
" :content-type "text/plain" :id 5)))
  insert(((:content (... ...) :content-type "multipart/signed" :id 2) (:content 
"___\nnotmuch mailing list\nnotmuch 
at 
notmuchmail.org\nhttp://notmuchmail.org/mailman/listinfo/notmuch\n\n\n!DSPAM:1,4d72d0f035413102713680!\n";
 :content-type "text/plain" :id 5)))
  (progn (insert content) (let (...) (set-buffer display-buffer) (if ... ... 
nil)))
  (unwind-protect (progn (insert content) (let ... ... ...)) (and (buffer-name 
temp-buffer) (kill-buffer temp-buffer)))
  (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn ... ...) 
(and ... ...)))
  (with-current-buffer temp-buffer (unwind-protect (progn ... ...) (and ... 
...)))
  (let ((temp-buffer ...)) (with-current-buffer temp-buffer (unwind-protect ... 
...)))
  (with-temp-buffer (insert content) (let (...) (set-buffer display-buffer) (if 
... ... nil)))
  (let ((display-buffer ...)) (with-temp-buffer (insert content) (let ... ... 
...)))
  notmuch-show-mm-display-part-inline((:body ((:content ... :content-type 
"multipart/mixed" :id 1)) :headers (:Date "Sat, 05 Mar 2011 16:10:06 -0800" 
:Bcc "" :Cc "" :To "Notmuch Mail " :From "Jameson 
Rollins " :Subject "change of crypto mime 
customization variable") :tags ("notmuch" "replied") :date_relative "Yest. 
01:10" :timestamp 1299370206.0 :filename 
"/home/xavier/im.maillard/INBOX/cur/1299485584_0.23858.kcals,U=129150,FMD5=7e33429f656f1e6e9d79b29c3f82c57e:2,RS"
 :match t :id "87ipvx9kip.fsf at servo.finestructure.net") (:content ((:content 
... :content-type "multipart/signed" :id 2) (:content 
"___\nnotmuch mailing list\nnotmuch 
at 
notmuchmail.org\nhttp://notmuchmail.org/mailman/listinfo/notmuch\n\n\n!DSPAM:1,4d72d0f035413102713680!\n";
 :content-type "text/plain" :id 5)) :content-type "multipart/mixed" :id 1) 
"multipart/mixed" ((:content (... ...) :content-type "multipart/signed" :id 2) 
(:content "___\nnotmuch mailing 
list\nnotmuch at 
notmuchmail.org\nhttp://notmuchmail.org/mailman/listinfo/notmuch\n\n\n!DSPAM:1,4d72d0f035413102713680!\n";
 :content-type "text/plain" :id 5)))
  (if content (notmuch-show-mm-display-part-inline msg part content-type 
content))
  (let ((content ...)) (if content (notmuch-show-mm-display-part-inline msg 
part content-type content)))
  notmuch-show-insert-part-*/*((:body ((:content ... :content-type 
"multipart/mixed" :id 1)) :headers (:Date "Sat, 05 Mar 2011 16:10:06 -0800" 
:Bcc "" :Cc "" :To "Notmuch Mail " :From "Jameson 
Rollins " :Subject "change of crypto mime 
customization variable") :tags ("notmuch" "replied") :date_relative "Yest. 
01:10" :timestamp 1299370206.0 :filename 
"/home/xavier/im.maillard/INBOX/cur/1299485584_0.23858.kcals,U=129150,FMD5=7e33429f656f1e6e9d79b29c3f82c57e:2,RS"
 :match t :id "87ipvx9kip.fsf at servo.finestructure.net") (:content ((:content 
... :content-type "multipart/signed" :id 2) (:content 
"___\nnotmuch mailing list\nnotmuch 
at 
notmuchmail.org\nhttp://notmuchmail.org/mailman/listinfo/notmuch\n\n\n!DSPAM:1,4d72d0f035413102713680!\n";
 :content-type "text/plain" :id 5)) :content-type "multipart/mixed" :id 1) 
"multipart/mixed" 1 0 "multipart/mixed")
  funcall(notmuch-show-insert-part-*/* (:body ((:content ... :content-type 
"multipart/mixed" :id 1)) :headers (:Date "Sat, 05 Mar 2011 16:10:06 -0800" 
:Bcc "" :Cc "" :To "Notmuch Mail " :From "Jameson 
Rollins " :Subject "change of crypto mime 
customization variable") :tags (

Backtrace with latest crypto branch

2011-03-13 Thread Xavier Maillard
Hi

On Thu, 10 Mar 2011 03:13:34 -0800, Jameson Rollins  wrote:
> On Wed, 09 Mar 2011 22:14:55 +0100, Xavier Maillard  wrote:
> > I did update and restarted emacs, yes. 
> > Pressing RET on any message failed with the given backtrace. It also
> > just displays headers but nothing about the content which is just
> > trashed away (in the backtrace); any child message is also just trashed.
> 
> Hey, Xavier.  Let's go back a step.  Do you see the same problem when
> you view the message from the command line?  

Maybe I am unclear but the problem is with notmuch.el not the binary.

> Try:
> 
> notmuch show --format=json --verify id:87ei6h41s6.fsf at 
> servo.finestructure.net
> 
> Do you see the body of the message ok in the json output?

I see a lot of things including messages content.

/Xavier


Re: Backtrace with latest crypto branch

2011-03-13 Thread Xavier Maillard
Hi David,

On Wed, 09 Mar 2011 17:20:05 -0400, David Bremner  wrote:
> On Wed, 09 Mar 2011 22:14:55 +0100, Xavier Maillard  wrote:
> > Hi,
> > 
> > No problem, Cc'ing accordingly.
> > 
> > Hope that'll help in debugging this issue.
> > 
> 
> Can one of you post the backtrace?

Here it is:

Debugger entered--Lisp error: (wrong-type-argument char-or-string-p ((:content 
((:content "Hey, folks.  I just wanted to give all the crypto early adopters a 
heads
up that I just changed the crypto customization variable name in my
crypto branch to be:

  notmuch-process-crypto-mime

Daniel Gillmor has been doing a lot of great work with GMIME upstream to
include support for handling s/mime parts with the same crypto context.
When this work gets finished, pgp/mime and s/mime parts will both be
processed with the same crypto hooks.  Looking ahead, I thought the
previous variable name (notmuch-process-pgpmime) was overly specific.
And I wanted to get this change in before cworth's rumored imminent next
release push (waiting with bated breath!).

jamie.


!DSPAM:1,4d72d0f035413102713680!
" :content-type "text/plain" :id 3) (:content-type "application/pgp-signature" 
:id 4)) :content-type "multipart/signed" :id 2) (:content 
"___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


!DSPAM:1,4d72d0f035413102713680!
" :content-type "text/plain" :id 5)))
  insert(((:content (... ...) :content-type "multipart/signed" :id 2) (:content 
"___\nnotmuch mailing 
list\nnotm...@notmuchmail.org\nhttp://notmuchmail.org/mailman/listinfo/notmuch\n\n\n!DSPAM:1,4d72d0f035413102713680!\n";
 :content-type "text/plain" :id 5)))
  (progn (insert content) (let (...) (set-buffer display-buffer) (if ... ... 
nil)))
  (unwind-protect (progn (insert content) (let ... ... ...)) (and (buffer-name 
temp-buffer) (kill-buffer temp-buffer)))
  (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn ... ...) 
(and ... ...)))
  (with-current-buffer temp-buffer (unwind-protect (progn ... ...) (and ... 
...)))
  (let ((temp-buffer ...)) (with-current-buffer temp-buffer (unwind-protect ... 
...)))
  (with-temp-buffer (insert content) (let (...) (set-buffer display-buffer) (if 
... ... nil)))
  (let ((display-buffer ...)) (with-temp-buffer (insert content) (let ... ... 
...)))
  notmuch-show-mm-display-part-inline((:body ((:content ... :content-type 
"multipart/mixed" :id 1)) :headers (:Date "Sat, 05 Mar 2011 16:10:06 -0800" 
:Bcc "" :Cc "" :To "Notmuch Mail " :From "Jameson 
Rollins " :Subject "change of crypto mime 
customization variable") :tags ("notmuch" "replied") :date_relative "Yest. 
01:10" :timestamp 1299370206.0 :filename 
"/home/xavier/im.maillard/INBOX/cur/1299485584_0.23858.kcals,U=129150,FMD5=7e33429f656f1e6e9d79b29c3f82c57e:2,RS"
 :match t :id "87ipvx9kip@servo.finestructure.net") (:content ((:content 
... :content-type "multipart/signed" :id 2) (:content 
"___\nnotmuch mailing 
list\nnotm...@notmuchmail.org\nhttp://notmuchmail.org/mailman/listinfo/notmuch\n\n\n!DSPAM:1,4d72d0f035413102713680!\n";
 :content-type "text/plain" :id 5)) :content-type "multipart/mixed" :id 1) 
"multipart/mixed" ((:content (... ...) :content-type "multipart/signed" :id
  2) (:content "___\nnotmuch 
mailing 
list\nnotm...@notmuchmail.org\nhttp://notmuchmail.org/mailman/listinfo/notmuch\n\n\n!DSPAM:1,4d72d0f035413102713680!\n";
 :content-type "text/plain" :id 5)))
  (if content (notmuch-show-mm-display-part-inline msg part content-type 
content))
  (let ((content ...)) (if content (notmuch-show-mm-display-part-inline msg 
part content-type content)))
  notmuch-show-insert-part-*/*((:body ((:content ... :content-type 
"multipart/mixed" :id 1)) :headers (:Date "Sat, 05 Mar 2011 16:10:06 -0800" 
:Bcc "" :Cc "" :To "Notmuch Mail " :From "Jameson 
Rollins " :Subject "change of crypto mime 
customization variable") :tags ("notmuch" "replied") :date_relative "Yest. 
01:10" :timestamp 1299370206.0 :filename 
"/home/xavier/im.maillard/INBOX/cur/1299485584_0.23858.kcals,U=129150,FMD5=7e33429f656f1e6e9d79b29c3f82c57e:2,RS"
 :match t :id "87ipvx9kip@servo.finestructure.net") (:content ((:content 
... :content-type "multipart/signed" :id 2) (:content 
"___\nnotmuch mailing 
list\nnotm...@notmuchmail.org\nhttp://notmuchmail.org/mailman/listinfo/notmuch\n\n\n!DSPAM:1,4d72d0f035413102713680!\n";
 :content-type "text/plain" :id 5)) :content-type "multipart/mixed" :id 1) 
"multipart/mixed" 1 0 "multipart/mixed")
  funcall(notmuch-show-insert-part-*/* (:body ((:content ... :content-type 
"multipart/mixed" :id 1)) :headers (:Date "Sat, 05 Mar 2011 16:10:06 -0800" 
:Bcc "" :Cc "" :To "Notmuch Mail " :From "Jameson 
Rollins " :Subject "change of crypto mime 
customization variable") :tags ("notmuch" "replied") :d

Re: Backtrace with latest crypto branch

2011-03-13 Thread Xavier Maillard
Hi

On Thu, 10 Mar 2011 03:13:34 -0800, Jameson Rollins 
 wrote:
> On Wed, 09 Mar 2011 22:14:55 +0100, Xavier Maillard  wrote:
> > I did update and restarted emacs, yes. 
> > Pressing RET on any message failed with the given backtrace. It also
> > just displays headers but nothing about the content which is just
> > trashed away (in the backtrace); any child message is also just trashed.
> 
> Hey, Xavier.  Let's go back a step.  Do you see the same problem when
> you view the message from the command line?  

Maybe I am unclear but the problem is with notmuch.el not the binary.

> Try:
> 
> notmuch show --format=json --verify id:87ei6h41s6@servo.finestructure.net
> 
> Do you see the body of the message ok in the json output?

I see a lot of things including messages content.

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


[PATCH] test: "search-by-folder" single-word search terms should be updated correctly when directories are renamed.

2011-03-13 Thread Pieter Praet
On Mon, 17 Jan 2011 14:00:41 +0100, Sebastian Spaeth  
wrote:
> However, when moving files into another folder and rerunning notmuch
> new, the folder value is never updated, it seems.

This appears to occur only when searching with a single-word folder
path.

---
 test/search-by-folder |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/test/search-by-folder b/test/search-by-folder
index 162158c..63ed57b 100755
--- a/test/search-by-folder
+++ b/test/search-by-folder
@@ -28,13 +28,17 @@ notmuch new
 output=$(notmuch search folder:bad/news | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; 
Bears (inbox unread)"

-test_begin_subtest "After rename, old path returns nothing"
+test_begin_subtest "After rename, old multi-word path returns nothing"
 mv "${MAIL_DIR}/duplicate/bad/news" "${MAIL_DIR}/duplicate/bad/olds"
 increment_mtime "${MAIL_DIR}/duplicate/bad"
 notmuch new
 output=$(notmuch search folder:bad/news | notmuch_search_sanitize)
 test_expect_equal "$output" ""

+test_begin_subtest "After rename, old single-word path returns nothing"
+output=$(notmuch search folder:news | notmuch_search_sanitize)
+test_expect_equal "$output" ""
+
 test_begin_subtest "After rename, new path returns result"
 output=$(notmuch search folder:bad/olds | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; 
Bears (inbox unread)"
---


[RFC] notmuch new : {blacklist,whitelist,exclud,ignor}ing

2011-03-13 Thread Pieter Praet
Hi all,

First of all, *immense respect* to each and every one of you for making
the legendary "MUA-hopper stopper" a reality! Emacs has been aching for
this for a *very* long time.

Much to my misfortune, I discovered Notmuch merely a year ago (after
declaring "sup" a rather unflatteringly executed fantastic idea), yet am
happy to say I've been living in email nirvana ever since.


One essential feature I've yet to see merged in, however, is notmuch new
{blacklist,whitelist,exclud,ignor}ing. This would -among other things-
significantly reduce the noise for us aberrants who stuff everything but
their coffee (I wish) in git.

Way back when, the only obstacle seemed to be the lack of a
configuration file. Since then, it's been mentioned as well as
implemented in a variety of flavors (in chronological order):
- id:"87my2dg8ww.fsf at yoom.home.cworth.org"
- id:"87r5r0ctl3.wl%djcb at djcbsoftware.nl"
- id:"878wc69h0j.wl%djcb at djcbsoftware.nl"
- id:"20100114084713.GA22273 at harikalardiyari"
- id:"E1NWgMo-0001qb-Vn at po8.org"
- id:"87my083mgh.fsf at SSpaeth.de"
- id:"E1NjeZ1-0001qw-HZ at po8.org"
- id:"ylp7hi23mw8.fsf at tyndall.ie"


Thoughts/suggestions?

Peace

-Pieter