[PATCH] emacs: add default value to notmuch-search-line-faces

2012-01-26 Thread Jani Nikula
On Thu, 26 Jan 2012 14:41:46 -0500, Austin Clements  wrote:
> Quoth Jani Nikula on Jan 26 at  9:21 pm:
> > Add default value to notmuch-search-line-faces to show "unread"
> > messages in bold, and "flagged" messages in red, to have some visual
> > indication of important messages in search results. This should be
> > helpful for new users.
> > 
> > "unread" tag is quite obvious, and handled specially both in the lib
> > and emacs ui. "flagged" is synced to maildir F flag in the lib. If one
> > syncs the maildir to IMAP, this also translates to corresponding IMAP
> > flag. (This is "starred" in GMail and Android.)
> > 
> > Signed-off-by: Jani Nikula 
> 
> While I'm sure this can be bikeshod to death, I do have one legitimate
> concern (and one illegitimate).
> 
> I completely agree with what you said on IRC, though, that setting
> this to non-nil is more about making this capability more discoverable
> to new users than trying to come up with the perfect faces.

Thanks for repeating that here too before full blown bikeshedding. I'm
just trying to help other people find this option quicker than I and
some others did...

> > ---
> >  emacs/notmuch.el |3 ++-
> >  1 files changed, 2 insertions(+), 1 deletions(-)
> > 
> > diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> > index 6b2c252..551ea9d 100644
> > --- a/emacs/notmuch.el
> > +++ b/emacs/notmuch.el
> > @@ -662,7 +662,8 @@ This function advances the next thread when finished."
> >   (goto-char (point-min))
> >   (forward-line (1- notmuch-search-target-line
> >  
> > -(defcustom notmuch-search-line-faces nil
> > +(defcustom notmuch-search-line-faces '(("unread" :weight bold)
> 
> As much as I would like this, many terminals don't visually
> distinguish between the default face and the default face in bold.

Would it really matter, though? People on such terminals are probably
aware they are missing out on a bunch of visual stuff. But please do
suggest an alternative that could be "composited" with the :foreground
setting below for "unread" and "flagged" threads.

> > +  ("flagged" :foreground "red"))
> 
> Red is pretty universally used to indicate danger or a serious
> condition, while "flagged" is simply supposed to draw attention.  I
> would say blue as a neutral and distinct indicator, but it also has
> poor visibility (I used to use blue, but found that when scanning my
> mail, I would habitually skip over flagged messages because they were
> dark, which was the opposite of what I wanted).  Personally I've
> settled on yellow; it's visually distinct enough to be easily
> noticeable and bright enough that I don't skip over it, though it
> obviously wouldn't work on a light background.

Can be yellow, I don't really care that much. But isn't a light
background the default for emacs in most distros? If that matters,
*shrug*.


BR,
Jani.


gmime2.6 packaging for debian

2012-01-26 Thread Jameson Graef Rollins
On Thu, 26 Jan 2012 02:47:57 -0500, Daniel Kahn Gillmor  wrote:
> those of you who run debian might be interested in the gmime2.6
> packaging which i cobbled together for debian from the existing gmime2.4
> packaging:
> 
>  http://bugs.debian.org/657426
> 
> Those of you developing notmuch with the gmime 2.6 patchsets might be
> interested in trying it out.  Please let me know of any problems you
> might have with the experimental packaging.
> 
> It would be good if we could change the build-deps to
> 
>  libgmime2.6-dev | libgmime2.4-dev

Hey, folks.  FYI, I build a gmime2.6 debian package from Daniel's new
packaging [0], and it built and installed completely cleanly.  After
reconfiguring notmuch, it picked up the 2.6 library and compiled and
works without issue.

Thanks so much dkg and everyone who got the compatibility working!
Sounds like official packages might be showing up in experimental soon.

jamie.

[0] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=657426#15
-- 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/20120126/4f6561d1/attachment.pgp>


[PATCH 1/2] emacs: Re-enable line wrapping in `notmuch-show-mode'.

2012-01-26 Thread Tomi Ollila
On Thu, 26 Jan 2012 08:17:50 +, David Edmondson  wrote:
> Turn on `visual-line-mode' via a hook, so that those who so choose can
> avoid it.
> ---

+1

I think the docstring is good (or it could be
nonexistent like in 'turn-on-font-lock).


Tomi


[PATCH] emacs: add completion to "tag all" operation ("*" binding)

2012-01-26 Thread Dmitry Kurochkin
On Thu, 26 Jan 2012 08:46:00 +, David Edmondson  wrote:
> On Thu, 26 Jan 2012 05:47:07 +0400, Dmitry Kurochkin  gmail.com> wrote:
> > > > +  ;; Perform some validation
> > > > +  (let ((words action))
> > > > +(when (null words) (error "No operation given"))
> > > > +(while words
> > > > +  (unless (string-match-p "^[-+][-+_.[:word:]]+$" (car words))
> > > > +   (error "Action must be of the form `+thistag -that_tag'"))
> > > > +  (setq words (cdr words
> > > 
> > > This should really be a mapc or a dolist, but maybe that's for another
> > > patch.
> > 
> > Yes, I changed "this_tag" spelling in v2, but would prefer to leave
> > non-trivial changes in this code for another patch.
> 
> If you were going to submit another patch then fine, but the chances are
> it will just get forgotten.

No worries, v5 has a cleanup patch added :)

Regards,
  Dmitry


[PATCH v4] emacs: add completion to "tag all" operation ("*" binding)

2012-01-26 Thread Dmitry Kurochkin
On Thu, 26 Jan 2012 02:04:39 -0500, Austin Clements  wrote:
> Quoth Dmitry Kurochkin on Jan 26 at  9:06 am:
> > The patch adds  completion to "tag all" operation bound to "*"
> > (`notmuch-search-operate-all' function).
> > ---
> > 
> > On a second thought, `notmuch-select-tag-with-completion' should never
> > need `prefixes' argument at all.  So I reverted the API and related
> > changes.
> > 
> > Changes:
> > 
> > v4:
> > 
> > * do not change `notmuch-select-tag-with-completion' API, revert
> >   related changes
> > 
> > v3:
> > 
> > * fixed comments from Austin's review [1]
> > 
> > v2:
> > 
> > * s/thistag/this_tag/ for consistency with "that_tag", since we touch
> >   the line anyway
> > 
> > Regards,
> >   Dmitry
> > 
> > [1] id:"20120126013727.GB1176 at mit.edu"
> > 
> >  emacs/notmuch.el |   53 
> > -
> >  1 files changed, 40 insertions(+), 13 deletions(-)
> > 
> > diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> > index e02966f..d2af630 100644
> > --- a/emacs/notmuch.el
> > +++ b/emacs/notmuch.el
> > @@ -48,6 +48,7 @@
> >  ;; required, but is available from http://notmuchmail.org).
> >  
> >  (eval-when-compile (require 'cl))
> > +(require 'crm)
> >  (require 'mm-view)
> >  (require 'message)
> >  
> > @@ -75,12 +76,36 @@ For example:
> >  (defvar notmuch-query-history nil
> >"Variable to store minibuffer history for notmuch queries")
> >  
> > -(defun notmuch-select-tag-with-completion (prompt  search-terms)
> > +(defun notmuch-tag-completions ( prefixes search-terms)
> >(let ((tag-list
> >  (with-output-to-string
> >(with-current-buffer standard-output
> >  (apply 'call-process notmuch-command nil t nil "search-tags" 
> > search-terms)
> > -(completing-read prompt (split-string tag-list "\n+" t) nil nil nil)))
> > +(setq tag-list (split-string tag-list "\n+" t))
> 
> Since this setq is unconditional, you can do the split-string right in
> the let binding, around the with-output-to-string.
> 

I was thinking about it, but decided to use `setq', to make the diff
smaller and the let binding simpler.  Changed in v5.

> > +(if (null prefixes)
> > +   tag-list
> > +  (apply #'append
> > +(mapcar (lambda (tag)
> > +  (mapcar (lambda (prefix)
> > +(concat prefix tag)) prefixes))
> > +tag-list)
> > +
> > +(defun notmuch-select-tag-with-completion (prompt  search-terms)
> > +  (let ((tag-list (notmuch-tag-completions nil search-terms)))
> > +(completing-read prompt tag-list)))
> > +
> > +(defun notmuch-select-tags-with-completion (prompt  prefixes 
> >  search-terms)
> > +  (let ((tag-list (notmuch-tag-completions prefixes search-terms))
> > +   (crm-separator " ")
> > +   (crm-local-completion-map
> > +(let ((map (make-sparse-keymap)))
> > +  (set-keymap-parent map crm-local-completion-map)
> > +  map)))
> > +;; By default, space is bound to "complete word" function.
> > +;; Re-bind it to insert a space instead.  Note that  still
> > +;; does the completion.
> > +(define-key crm-local-completion-map " " 'self-insert-command)
> 
> You could do the define-key inside the (let ((map ..)) ..) so you get
> back the fully formed keymap.  Your call.
> 

Good point.  Changed in v5.

> > +(completing-read-multiple prompt tag-list)))
> >  
> >  (defun notmuch-foreach-mime-part (function mm-handle)
> >(cond ((stringp (car mm-handle))
> > @@ -849,7 +874,7 @@ non-authors is found, assume that all of the authors 
> > match."
> >   (goto-char found-target)))
> >(delete-process proc
> >  
> > -(defun notmuch-search-operate-all (action)
> > +(defun notmuch-search-operate-all ( actions)
> >"Add/remove tags from all matching messages.
> >  
> >  This command adds or removes tags from all messages matching the
> > @@ -860,16 +885,18 @@ will prompt for tags to be added or removed. Tags 
> > prefixed with
> >  Each character of the tag name may consist of alphanumeric
> >  characters as well as `_.+-'.
> >  "
> > -  (interactive "sOperation (+add -drop): notmuch tag ")
> > -  (let ((action-split (split-string action " +")))
> > -;; Perform some validation
> > -(let ((words action-split))
> > -  (when (null words) (error "No operation given"))
> > -  (while words
> > -   (unless (string-match-p "^[-+][-+_.[:word:]]+$" (car words))
> > - (error "Action must be of the form `+thistag -that_tag'"))
> > -   (setq words (cdr words
> > -(apply 'notmuch-tag notmuch-search-query-string action-split)))
> > +  (interactive (notmuch-select-tags-with-completion
> > +   "Operations (+add -drop): notmuch tag "
> > +   '("+" "-")))
> > +  (setq actions (delete "" actions))
> 
> Either this line isn't necessary or
> notmuch-select-tags-with-completion can do something funny that it
> should take care of internally.
> 

It is necessary and it belongs to 

[PATCH v5 2/2] emacs: `notmuch-search-operate-all' code cleanup, no functional changes

2012-01-26 Thread Dmitry Kurochkin
---
 emacs/notmuch.el |   11 +--
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 291eca2..72f78ed 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -891,12 +891,11 @@ characters as well as `_.+-'.
"Operations (+add -drop): notmuch tag "
'("+" "-")))
   ;; Perform some validation
-  (let ((words actions))
-(when (null words) (error "No operations given"))
-(while words
-  (unless (string-match-p "^[-+][-+_.[:word:]]+$" (car words))
-   (error "Action must be of the form `+this_tag' or `-that_tag'"))
-  (setq words (cdr words
+  (when (null actions) (error "No operations given"))
+  (mapc (lambda (action)
+ (unless (string-match-p "^[-+][-+_.[:word:]]+$" action)
+   (error "Action must be of the form `+this_tag' or `-that_tag'")))
+   actions)
   (apply 'notmuch-tag notmuch-search-query-string actions))

 (defun notmuch-search-buffer-title (query)
-- 
1.7.8.3



[PATCH v5 1/2] emacs: add completion to "tag all" operation ("*" binding)

2012-01-26 Thread Dmitry Kurochkin
The patch adds  completion to "tag all" operation bound to "*"
(`notmuch-search-operate-all' function).
---
 emacs/notmuch.el |   60 +++--
 1 files changed, 44 insertions(+), 16 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index e02966f..291eca2 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -48,6 +48,7 @@
 ;; required, but is available from http://notmuchmail.org).

 (eval-when-compile (require 'cl))
+(require 'crm)
 (require 'mm-view)
 (require 'message)

@@ -75,12 +76,38 @@ For example:
 (defvar notmuch-query-history nil
   "Variable to store minibuffer history for notmuch queries")

-(defun notmuch-select-tag-with-completion (prompt  search-terms)
+(defun notmuch-tag-completions ( prefixes search-terms)
   (let ((tag-list
-(with-output-to-string
-  (with-current-buffer standard-output
-(apply 'call-process notmuch-command nil t nil "search-tags" 
search-terms)
-(completing-read prompt (split-string tag-list "\n+" t) nil nil nil)))
+(split-string
+ (with-output-to-string
+   (with-current-buffer standard-output
+ (apply 'call-process notmuch-command nil t
+nil "search-tags" search-terms)))
+ "\n+" t)))
+(if (null prefixes)
+   tag-list
+  (apply #'append
+(mapcar (lambda (tag)
+  (mapcar (lambda (prefix)
+(concat prefix tag)) prefixes))
+tag-list)
+
+(defun notmuch-select-tag-with-completion (prompt  search-terms)
+  (let ((tag-list (notmuch-tag-completions nil search-terms)))
+(completing-read prompt tag-list)))
+
+(defun notmuch-select-tags-with-completion (prompt  prefixes  
search-terms)
+  (let ((tag-list (notmuch-tag-completions prefixes search-terms))
+   (crm-separator " ")
+   ;; By default, space is bound to "complete word" function.
+   ;; Re-bind it to insert a space instead.  Note that 
+   ;; still does the completion.
+   (crm-local-completion-map
+(let ((map (make-sparse-keymap)))
+  (set-keymap-parent map crm-local-completion-map)
+  (define-key map " " 'self-insert-command)
+  map)))
+(delete "" (completing-read-multiple prompt tag-list

 (defun notmuch-foreach-mime-part (function mm-handle)
   (cond ((stringp (car mm-handle))
@@ -849,7 +876,7 @@ non-authors is found, assume that all of the authors match."
  (goto-char found-target)))
   (delete-process proc

-(defun notmuch-search-operate-all (action)
+(defun notmuch-search-operate-all ( actions)
   "Add/remove tags from all matching messages.

 This command adds or removes tags from all messages matching the
@@ -860,16 +887,17 @@ will prompt for tags to be added or removed. Tags 
prefixed with
 Each character of the tag name may consist of alphanumeric
 characters as well as `_.+-'.
 "
-  (interactive "sOperation (+add -drop): notmuch tag ")
-  (let ((action-split (split-string action " +")))
-;; Perform some validation
-(let ((words action-split))
-  (when (null words) (error "No operation given"))
-  (while words
-   (unless (string-match-p "^[-+][-+_.[:word:]]+$" (car words))
- (error "Action must be of the form `+thistag -that_tag'"))
-   (setq words (cdr words
-(apply 'notmuch-tag notmuch-search-query-string action-split)))
+  (interactive (notmuch-select-tags-with-completion
+   "Operations (+add -drop): notmuch tag "
+   '("+" "-")))
+  ;; Perform some validation
+  (let ((words actions))
+(when (null words) (error "No operations given"))
+(while words
+  (unless (string-match-p "^[-+][-+_.[:word:]]+$" (car words))
+   (error "Action must be of the form `+this_tag' or `-that_tag'"))
+  (setq words (cdr words
+  (apply 'notmuch-tag notmuch-search-query-string actions))

 (defun notmuch-search-buffer-title (query)
   "Returns the title for a buffer with notmuch search results."
-- 
1.7.8.3



[PATCH v5 0/2] emacs: add completion to "tag all" operation

2012-01-26 Thread Dmitry Kurochkin
Changes:

v5:

* fixed comments from Austin's review [2]

* add a second patch with `notmuch-search-operate-all' code cleanup
  suggested by Austin [1]

v4:

* do not change `notmuch-select-tag-with-completion' API, revert
  related changes

v3:

* fixed comments from Austin's review [1]

v2:

* s/thistag/this_tag/ for consistency with "that_tag", since we touch
  the line anyway

Regards,
  Dmitry

[1] id:"20120126013727.GB1176 at mit.edu"
[2] id:"20120126070439.GC1940 at mit.edu"



[PATCH] emacs: add default value to notmuch-search-line-faces

2012-01-26 Thread Jani Nikula
Add default value to notmuch-search-line-faces to show "unread"
messages in bold, and "flagged" messages in red, to have some visual
indication of important messages in search results. This should be
helpful for new users.

"unread" tag is quite obvious, and handled specially both in the lib
and emacs ui. "flagged" is synced to maildir F flag in the lib. If one
syncs the maildir to IMAP, this also translates to corresponding IMAP
flag. (This is "starred" in GMail and Android.)

Signed-off-by: Jani Nikula 
---
 emacs/notmuch.el |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 6b2c252..551ea9d 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -662,7 +662,8 @@ This function advances the next thread when finished."
  (goto-char (point-min))
  (forward-line (1- notmuch-search-target-line

-(defcustom notmuch-search-line-faces nil
+(defcustom notmuch-search-line-faces '(("unread" :weight bold)
+  ("flagged" :foreground "red"))
   "Tag/face mapping for line highlighting in notmuch-search.

 Here is an example of how to color search results based on tags.
-- 
1.7.5.4



[PATCH 0/2] re-enable line wrapping and add some header bling

2012-01-26 Thread Dmitry Kurochkin
Hi David.

On Thu, 26 Jan 2012 08:17:49 +, David Edmondson  wrote:
> By default, re-enable `visual-line-mode' in `notmuch-show-mode'. Do it
> via a hook so that purists (ahem) can turn it off.
> 
> Add some more processing of headers to make them look nice. Do it via
> hooks so that unbelievers can turn it off.
> 

I did not review the code, but here is a general comment for both
patches (but especially for the first one).  It would be nice to have a
more detailed documentation for hooks.  Docstring like "Enable Visual
Line mode." for a function named `notmuch-show-turn-on-visual-line-mode'
is near useless.  It is quite obvious that the function enables
visual-line-mode from it's name.  And it does not give any information
on why would someone actually want to use it.  I do not remember what
visual-line-mode is exactly, so to understand whether this hook is
actually useful for me, I have to read visual-line-mode docs, think
about how it helps in notmuch-show, read some code, perhaps, etc.  I
would argue that since the hook itself is trivial, the main point in
having it is to provide a clearly documented solution for a common
problem for those who do not know how to solve this problem right away.
Currently, those who know what visual-line-mode is do not need this
hook, because they can easily write their own, and those who do not know
what visual-line-mode is can not use this hook, because it says nothing
about why it is actually useful.

Also, in addition to better docs, I would rename
`notmuch-show-turn-on-visual-line-mode' to something that reflects what
it does from user POV (like the other two hooks).

Though, the fact that the hook is enabled by default makes the above
arguments less important, I guess.

Regards,
  Dmitry

> David Edmondson (2):
>   emacs: Re-enable line wrapping in `notmuch-show-mode'.
>   emacs: Add more processing of displayed headers.
> 
>  emacs/notmuch-show.el |   50 +---
>  1 files changed, 42 insertions(+), 8 deletions(-)
> 
> -- 
> 1.7.8.3
> 
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 0/2] re-enable line wrapping and add some header bling

2012-01-26 Thread Jani Nikula
On Thu, 26 Jan 2012 08:17:49 +, David Edmondson  wrote:
> By default, re-enable `visual-line-mode' in `notmuch-show-mode'. Do it
> via a hook so that purists (ahem) can turn it off.
> 
> Add some more processing of headers to make them look nice. Do it via
> hooks so that unbelievers can turn it off.

Tried them all, I like them all. I think it's good to have them enabled
by default.

Had to play with the options a bit to realize what the difference
between notmuch-show-fill-headers and
notmuch-show-turn-on-visual-line-mode is, especially when it comes to
headers and the "title line" for each message, and why I'd want to have
them both enabled (I do). So perhaps you could improve the documentation
as Dmitry suggested.

Thanks for these patches.

BR,
Jani.

> 
> David Edmondson (2):
>   emacs: Re-enable line wrapping in `notmuch-show-mode'.
>   emacs: Add more processing of displayed headers.
> 
>  emacs/notmuch-show.el |   50 +---
>  1 files changed, 42 insertions(+), 8 deletions(-)
> 
> -- 
> 1.7.8.3
> 
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v5 0/2] emacs: add completion to "tag all" operation

2012-01-26 Thread David Edmondson
The series look good to me.
-- 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/20120126/6775806c/attachment.pgp>


[PATCH 2/2] test: Update tests for new 'Tags' header.

2012-01-26 Thread David Edmondson
---
 test/emacs |3 +++
 .../notmuch-show-thread-maildir-storage|7 +++
 ...hread-maildir-storage-with-fourfold-indentation |7 +++
 ...show-thread-maildir-storage-without-indentation |7 +++
 4 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/test/emacs b/test/emacs
index f150d95..eda5438 100755
--- a/test/emacs
+++ b/test/emacs
@@ -82,6 +82,7 @@ cat 

[PATCH 1/2] emacs: Add a fake Tags: header during display.

2012-01-26 Thread David Edmondson
If `truncate-lines' is `nil' in `notmuch-show-mode' the tags can be
lost from the right edge of the window. Create a fake 'Tags' header to
display them with the other headers.

Enable it by default by adding it to `notmuch-message-headers' and
keep it up to date during tagging operations.
---
 emacs/notmuch-show.el |   24 +++-
 1 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index c37479a..a975a29 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -41,7 +41,7 @@
 (declare-function notmuch-select-tag-with-completion "notmuch" (prompt  
search-terms))
 (declare-function notmuch-search-show-thread "notmuch" nil)

-(defcustom notmuch-message-headers '("Subject" "To" "Cc" "Date")
+(defcustom notmuch-message-headers '("Subject" "To" "Cc" "Date" "Tags")
   "Headers that should be shown in a message, in this order.

 For an open message, all of these headers will be made visible
@@ -255,6 +255,8 @@ operation on the contents of the current buffer."
'message-header-subject)
   ((looking-at "[Ff]rom:")
'message-header-from)
+  ((looking-at "Tags:")
+   'notmuch-tag-face)
   (t
'message-header-other

@@ -277,13 +279,21 @@ operation on the contents of the current buffer."
 (defun notmuch-show-update-tags (tags)
   "Update the displayed tags of the current message."
   (save-excursion
-(goto-char (notmuch-show-message-top))
-(if (re-search-forward "(\\([^()]*\\))$" (line-end-position) t)
-   (let ((inhibit-read-only t))
+;; Update the header line.
+(let ((inhibit-read-only t))
+  (goto-char (notmuch-show-message-top))
+  (if (re-search-forward "(\\([^()]*\\))$" (line-end-position) t)
  (replace-match (concat "("
 (propertize (mapconcat 'identity tags " ")
 'face 'notmuch-tag-face)
-")"))
+")")))
+  ;; Update the header, if present.
+  (when (member "Tags" notmuch-message-headers)
+   (goto-char (notmuch-show-message-top))
+   (if (re-search-forward"^ *Tags: \\(.*\\)$" 
(notmuch-show-message-bottom) t)
+   (replace-match (propertize (mapconcat 'identity tags " ")
+  'face 'notmuch-tag-face)
+  nil t nil 1))

 (defun notmuch-show-clean-address (address)
   "Try to clean a single email ADDRESS for display.  Return
@@ -789,6 +799,10 @@ current buffer, if possible."
 (message-invis-spec (notmuch-show-make-symbol "message"))
 (bare-subject (notmuch-show-strip-re (plist-get headers :Subject

+;; Add a fake 'Tags' header which can be used in
+;; `notmuch-show-insert-headers'.
+(plist-put headers :Tags (mapconcat #'identity (plist-get msg :tags) " "))
+
 ;; Set `buffer-invisibility-spec' to `nil' (a list), otherwise
 ;; removing items from `buffer-invisibility-spec' (which is what
 ;; `notmuch-show-headers-visible' and
-- 
1.7.8.3



[PATCH 0/2] Add a fake 'Tags' header

2012-01-26 Thread David Edmondson
>From a discussion in #notmuch, add a fake 'Tags' header when
displaying messages and ensure that it's kept up to date.

David Edmondson (2):
  emacs: Add a fake Tags: header during display.
  test: Update tests for new 'Tags' header.

 emacs/notmuch-show.el  |   24 +++
 test/emacs |3 ++
 .../notmuch-show-thread-maildir-storage|7 +
 ...hread-maildir-storage-with-fourfold-indentation |7 +
 ...show-thread-maildir-storage-without-indentation |7 +
 5 files changed, 43 insertions(+), 5 deletions(-)

-- 
1.7.8.3



[PATCH] emacs: make `notmuch-show-open-or-close-all' toggle visibility

2012-01-26 Thread Tomi Ollila

+1

Tomi


[PATCH] emacs: add default value to notmuch-search-line-faces

2012-01-26 Thread Austin Clements
Quoth Jeremy Nickurak on Jan 26 at  2:59 pm:
> On Thu, Jan 26, 2012 at 12:41, Austin Clements  wrote:
> > As much as I would like this, many terminals don't visually
> > distinguish between the default face and the default face in bold.
> 
> I've taken a shot at this under xterm, gnome-terminal, and a basic
> linux VT. I figure that if something is broken in another terminal
> that breaks in one of these, it's somebody-elses-problem :)
> 
> Xterm/gnome-terminal support bold just fine. With a Linux VT, emacs
> just chooses i slightly lighter color, which is totally usable.

Cool.  If this works in those, then I'm happy with the bold.  (Upon
further inspection, it's possible that I'm just full of it and the
font I've been using for the past decade or so is simply too small to
have a bold variant.)


[PATCH 1/3] emacs: s/buttonise/buttonize/g

2012-01-26 Thread Tomi Ollila

I personally like -ise (easier to my mind, 'z' is so "hard" in finnish
language), but -ize is just prevalent in emacs (customiSe, propertiSe)

Tomi


[PATCH] emacs: make `notmuch-show-open-or-close-all' toggle visibility

2012-01-26 Thread David Edmondson
On Thu, 26 Jan 2012 14:02:15 +0100, Pieter Praet  wrote:
> I may be missing something, but wouldn't both issues be solved by simply
> pressing M-RET a second time?  I've been using this for a little while
> now, and IMO it makes navigating through long and diverging threads a lot
> faster, much like zooming in/out on an outline.
> 
> How about if C-u M-RET behaved as usual ?

Okay, I used it for a day and I'm happy that the original patch is
good.

+2 (which leaves me at +1).
-- 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/20120126/3d153aaf/attachment.pgp>


[PATCH] emacs: add default value to notmuch-search-line-faces

2012-01-26 Thread Jeremy Nickurak
On Thu, Jan 26, 2012 at 12:41, Austin Clements  wrote:
> As much as I would like this, many terminals don't visually
> distinguish between the default face and the default face in bold.

I've taken a shot at this under xterm, gnome-terminal, and a basic
linux VT. I figure that if something is broken in another terminal
that breaks in one of these, it's somebody-elses-problem :)

Xterm/gnome-terminal support bold just fine. With a Linux VT, emacs
just chooses i slightly lighter color, which is totally usable.


[PATCH 1/3] emacs: bind "s" to `notmuch-search' in notmuch-hello buffer

2012-01-26 Thread Pieter Praet
On Tue, 17 Jan 2012 23:22:30 +0200, Jani Nikula  wrote:
> [...]
> 
> After this, what would the user have to do to bind some key to put the
> point in the search box? If someone wants to restore old behaviour for
> themselves.
> 

This should work:

  #+begin_src emacs-lisp
(add-hook 'notmuch-hello-mode-hook
  (lambda ()
 (local-set-key (kbd "s")
  (lambda() (interactive)
   (re-search-forward "Search: ")
  #+end_src


Peace

-- 
Pieter


[PATCH] emacs: add default value to notmuch-search-line-faces

2012-01-26 Thread Austin Clements
Quoth Jani Nikula on Jan 26 at  9:21 pm:
> Add default value to notmuch-search-line-faces to show "unread"
> messages in bold, and "flagged" messages in red, to have some visual
> indication of important messages in search results. This should be
> helpful for new users.
> 
> "unread" tag is quite obvious, and handled specially both in the lib
> and emacs ui. "flagged" is synced to maildir F flag in the lib. If one
> syncs the maildir to IMAP, this also translates to corresponding IMAP
> flag. (This is "starred" in GMail and Android.)
> 
> Signed-off-by: Jani Nikula 

While I'm sure this can be bikeshod to death, I do have one legitimate
concern (and one illegitimate).

I completely agree with what you said on IRC, though, that setting
this to non-nil is more about making this capability more discoverable
to new users than trying to come up with the perfect faces.

> ---
>  emacs/notmuch.el |3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> index 6b2c252..551ea9d 100644
> --- a/emacs/notmuch.el
> +++ b/emacs/notmuch.el
> @@ -662,7 +662,8 @@ This function advances the next thread when finished."
> (goto-char (point-min))
> (forward-line (1- notmuch-search-target-line
>  
> -(defcustom notmuch-search-line-faces nil
> +(defcustom notmuch-search-line-faces '(("unread" :weight bold)

As much as I would like this, many terminals don't visually
distinguish between the default face and the default face in bold.

> +("flagged" :foreground "red"))

Red is pretty universally used to indicate danger or a serious
condition, while "flagged" is simply supposed to draw attention.  I
would say blue as a neutral and distinct indicator, but it also has
poor visibility (I used to use blue, but found that when scanning my
mail, I would habitually skip over flagged messages because they were
dark, which was the opposite of what I wanted).  Personally I've
settled on yellow; it's visually distinct enough to be easily
noticeable and bright enough that I don't skip over it, though it
obviously wouldn't work on a light background.

>"Tag/face mapping for line highlighting in notmuch-search.
>  
>  Here is an example of how to color search results based on tags.


[RFC] Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-26 Thread David Edmondson
In general, I like this.

- I think that the stash function(s) should take an optional argument
  specifying the archive to use. That will make testing simpler and also
  allow people to produce preferred bindings more easily.

- "Message archive: " feels better than "ML Archive: ", but I don't
  really care.

- Don't base the patch on the thing that I posted, just on master from
  the repository - no need to make David's life harder.
-- 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/20120126/05712156/attachment.pgp>


Bug?: notmuch-search-show-thread shows several threads; only one containing matching messages

2012-01-26 Thread Pieter Praet
On Thu, 26 Jan 2012 13:44:50 +0100, Gregor Zattler  wrote:
> Hi Jamie, Austin,
> * Jameson Graef Rollins  [25. Jan. 2012]:
> > On Wed, 25 Jan 2012 20:19:03 -0500, Austin Clements  
> > wrote:
> >> One very common cause of this is someone using "reply" to get an
> >> initial set of recipients, but then replacing the entire message and
> >> subject (presumably without realizing that the mail is still tracking
> >> what it was a reply to).  This can also happen if someone
> >> intentionally replies to multiple messages (though few mail clients
> >> support this), or if there was a message ID collision.
> > 
> > This is a very common occurrence for me as well.  I would put money down
> > that this is what you're seeing.
> 
> I thought about this too and this is why I checked for any
> occurrence of Message-IDs in the other emails: 
> 
>|> I isolated the thread I was interested in,
>|> extracted the message ids of its messages and greped the rest of
>|> the messages for this message ids: no matches.[2] Therefore no of
>|> the rests messages are part of the thread I was interested in
> 
> perhaps there was a logic error in how I did this:
> 
>|> [2] grep -I "^Message-Id:" /tmp/thread-I-m-interested-in.mbox |sed -e 
> "s/Message-Id: $//" >really.mid
>|> grep -I -F really.mid rest.mbox
>|> --> no match
> 

Did you mean to do case-insensitive grep? ('-i' instead of '-I').

Also, the '-F' option expects input on stdin, not a filename.


Try this (with all individual threads split into separate mboxes):

  #+begin_src sh
for i in $(ls *.mbox) ; do
grep -i '^Message-Id:' "${i}" | \
sed -e 's/^.\{13\}//' -e 's/>$//' \
> "${i}.mids"
done
for i in $(ls *.mids) ; do
echo "## Grepping for ${i}'s Message-Ids"
grep -i -F "$(cat ${i})" *.mbox
done
  #+end_src


Here's another couple of threads squashed into a single one:
- [O] [Use Question] Capture and long lines
  - id:"BANLkTikoF4tXuNLLufRzNSD6k2ZYs7sUcg at mail.gmail.com"
- [O] Worg update
  - id:"m1wrfiz3ch.fsf at tsdye.com"
- [O] Table formula to convert hex to dec
  - id:"20110724080054.GB16388 at x201"
- [O] ICS import?
  - id:"20120125173421.GQ3747 at x201"


AFAICT, none of them share Message-Id's...


> /tmp/thread-I-m-interested-in.mbox  is a mbox with messages
> I'minterested in, the "real" ones.  really.mid is a list of
> Message-IDs of these "real" emails.  rest.mbox is a mbox with the
> other emails, Emacs showed in his notmuch show buffer but are
> other threads.
> 
> Since there is no match I concluded, the threads are not linked.
> Perhaps I made a mistake.  I'l retest it and report again.  But
> right now I don't have the time to do this.
> 
> Ciao, Gregor
> -- 
>  -... --- .-. . -.. ..--.. ...-.-
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


Peace

-- 
Pieter


[PATCH] emacs: Quote MML tags in replies

2012-01-26 Thread Austin Clements
Quoth Aaron Ecay on Jan 19 at  5:56 pm:
> On Thu, 19 Jan 2012 17:48:42 -0500, Austin Clements  
> wrote:
> > >  
> > >  (defun notmuch-mua-forward-message ()
> > >(message-forward)
> > 
> > Speaking of future-proofing, it would be good to have a test.
> 
> It would.  ;)  I?ll work on one.

Were you planning to roll a new version of this patch with a test?


[PATCH 1/3] emacs: bind "s" to `notmuch-search' in notmuch-hello buffer

2012-01-26 Thread Jani Nikula
On Thu, 26 Jan 2012 14:48:44 +0100, Pieter Praet  wrote:
> On Tue, 17 Jan 2012 23:22:30 +0200, Jani Nikula  wrote:
> > [...]
> > 
> > After this, what would the user have to do to bind some key to put the
> > point in the search box? If someone wants to restore old behaviour for
> > themselves.
> > 
> 
> This should work:
> 
>   #+begin_src emacs-lisp
> (add-hook 'notmuch-hello-mode-hook
>   (lambda ()
>  (local-set-key (kbd "s")
>   (lambda() (interactive)
>(re-search-forward "Search: ")
>   #+end_src

Thanks for the basic idea, iterated into:

(define-key notmuch-hello-mode-map "S"
  (lambda() (interactive)
(goto-char (point-min))
(re-search-forward "Search: ")))


BR,
Jani.


[RFC] Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-26 Thread Pieter Praet
---

Depends on id:"1327397873-20596-1-git-send-email-dme at dme.org"

 emacs/notmuch-show.el |   55 ++--
 test/emacs|2 +-
 2 files changed, 40 insertions(+), 17 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index c4d45e7..0acc4cf 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -123,6 +123,20 @@ indentation."
 (const :tag "View interactively"
notmuch-show-interactively-view-part)))

+(defcustom notmuch-show-stash-mlarchive-link-alist
+  '(("Gmane" . "http://mid.gmane.org/;)
+("MARC" . "http://marc.info/?i=;)
+("Mail Archive, The" . "http://www.mail-archive.com/search?l=mid=;)
+;; FIXME: can these services be searched by `Message-Id' ?
+;; ("MarkMail" . "http://markmail.org/;)
+;; ("Nabble" . "http://nabble.com/;)
+;; ("opensubscriber" . "http://opensubscriber.com/;)
+)
+  "Default Mailing List Archive to use when stashing links."
+  :type '(alist :key-type (string :tag "Name")
+   :value-type (string :tag "URL"))
+  :group 'notmuch-show)
+
 (defmacro with-current-notmuch-show-message ( body)
   "Evaluate body with current buffer set to the text of current message"
   `(save-excursion
@@ -1016,8 +1030,8 @@ thread id.  If a prefix is given, crypto processing is 
toggled."
 (define-key map "s" 'notmuch-show-stash-subject)
 (define-key map "T" 'notmuch-show-stash-tags)
 (define-key map "t" 'notmuch-show-stash-to)
-(define-key map "g" 'notmuch-show-stash-gmane)
-(define-key map "G" 'notmuch-show-stash-gmane-and-go)
+(define-key map "l" 'notmuch-show-stash-mlarchive-link)
+(define-key map "L" 'notmuch-show-stash-mlarchive-link-and-go)
 map)
   "Submap for stash commands")
 (fset 'notmuch-show-stash-map notmuch-show-stash-map)
@@ -1605,23 +1619,32 @@ buffer."
   (interactive)
   (notmuch-common-do-stash (notmuch-show-get-to)))

-(defun notmuch-show-stash-gmane ()
-  "Copy a Gmane URI for the current message to the kill-ring.
+(defun notmuch-show-stash-mlarchive-link ()
+  "Copy an ML Archive URI for the current message to the kill-ring.

-This presumes that the message is available at Gmane."
-  (interactive)
-  (notmuch-common-do-stash (concat "http://mid.gmane.org/;
-  (substring (notmuch-show-get-message-id) 4 
-1
+This presumes that the message is available at the selected Mailing List 
Archive.

-(defun notmuch-show-stash-gmane-and-go ()
-  "Copy a Gmane URI for the current message to the kill-ring and visit it.
-
-This presumes that the message is available at Gmane."
+Also see `notmuch-show-stash-mlarchive-link-alist'."
+  (interactive)
+  (notmuch-common-do-stash
+   (concat (cdr (assoc
+(let ((completion-ignore-case t))
+  (completing-read
+   "ML Archive: "
+   notmuch-show-stash-mlarchive-link-alist
+   nil t nil nil "Gmane"))
+notmuch-show-stash-mlarchive-link-alist))
+  (substring (notmuch-show-get-message-id) 4 -1
+
+(defun notmuch-show-stash-mlarchive-link-and-go ()
+  "Copy an ML Archive URI for the current message to the kill-ring and visit 
it.
+
+This presumes that the message is available at the selected Mailing List 
Archive.
+
+Also see `notmuch-show-stash-mlarchive-link-alist'."
   (interactive)
-  (let ((uri (concat "http://mid.gmane.org/;
-(substring (notmuch-show-get-message-id) 4 -1
-(notmuch-common-do-stash uri)
-(browse-url uri)))
+  (notmuch-show-stash-mlarchive-link)
+  (browse-url (current-kill 0 t)))

 ;; Commands typically bound to buttons.

diff --git a/test/emacs b/test/emacs
index 5f7467d..4e08726 100755
--- a/test/emacs
+++ b/test/emacs
@@ -382,7 +382,7 @@ test_emacs '(notmuch-show "id:\"bought\"")
(notmuch-show-stash-message-id-stripped)
(notmuch-show-stash-tags)
(notmuch-show-stash-filename)
-   (notmuch-show-stash-gmane)
+   (notmuch-show-stash-mlarchive-link)
(switch-to-buffer
  (generate-new-buffer "*test-stashing*"))
(dotimes (i 10)
-- 
1.7.8.1



[PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-26 Thread Pieter Praet
On Wed, 25 Jan 2012 06:31:43 +, David Edmondson  wrote:
> On Wed, 25 Jan 2012 01:50:08 +0100, Pieter Praet  wrote:
> > In a perfect world, everyone would be using Notmuch and have a local
> > copy of every message ever sent to any ML.  While we're waiting for
> > Atlantis to resurface, we'll need an interim solution.
> > 
> > +1 for the idea, but Gmane doesn't archive *all* MLs, so we should leave
> > the user some legroom.  Since I've already made the necessary changes,
> > I'll just send the patch instead of wasting your time with suggestions.
> > Feel free to merge it into yours.
> 
> This is definitely a good idea, but...
> 
> > Peace
> > 
> > ---
> >  emacs/notmuch-show.el |   40 ++--
> >  test/emacs|2 +-
> >  2 files changed, 31 insertions(+), 11 deletions(-)
> > 
> > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> > index c4d45e7..7f209cd 100644
> > --- a/emacs/notmuch-show.el
> > +++ b/emacs/notmuch-show.el
> > @@ -123,6 +123,24 @@ indentation."
> >  (const :tag "View interactively"
> > notmuch-show-interactively-view-part)))
> >  
> > +(defcustom notmuch-show-stash-mlarchive-link-pref "http://mid.gmane.org/;
> > +  "Default Mailing List Archive to use when stashing links."
> > +  :group 'notmuch-show
> > +  ;; TODO: find a working `Message-Id' search arg for all options.
> > +  :type '(choice (const :tag "Gmane"
> > +   "http://mid.gmane.org/;)
> > +;; (const :tag "MARC"
> > +;; "http://marc.info/;)
> > +(const :tag "Mail Archive, The"
> > +   "http://www.mail-archive.com/search?l=mid=;)
> > +;; (const :tag "MarkMail"
> > +;; "http://markmail.org/;)
> > +;; (const :tag "opensubscriber"
> > +;; "http://opensubscriber.com/;)
> > +;; (const :tag "Nabble"
> > +;; "http://nabble.com/;)
> > +(string :tag "Custom URI")))
> 
> ...do we not now how to reference messages by message-id on these other
> services?
> 

I've found the missing Message-Id search URI for 'marc.info', but as
for the remaining services:  if they provide search by Message-Id,
they're pretty damn good at hiding it...


> Your point about Gmane not having everything applies equally to any
> service, suggesting that perhaps the user should also have an option to
> choose which service to use at stash time. Thoughts?
> 

Definitely.

Patch follows.


> > +
> >  (defmacro with-current-notmuch-show-message ( body)
> >"Evaluate body with current buffer set to the text of current message"
> >`(save-excursion
> > @@ -1016,8 +1034,8 @@ thread id.  If a prefix is given, crypto processing 
> > is toggled."
> >  (define-key map "s" 'notmuch-show-stash-subject)
> >  (define-key map "T" 'notmuch-show-stash-tags)
> >  (define-key map "t" 'notmuch-show-stash-to)
> > -(define-key map "g" 'notmuch-show-stash-gmane)
> > -(define-key map "G" 'notmuch-show-stash-gmane-and-go)
> > +(define-key map "l" 'notmuch-show-stash-mlarchive-link)
> > +(define-key map "L" 'notmuch-show-stash-mlarchive-link-and-go)
> >  map)
> >"Submap for stash commands")
> >  (fset 'notmuch-show-stash-map notmuch-show-stash-map)
> > @@ -1605,20 +1623,22 @@ buffer."
> >(interactive)
> >(notmuch-common-do-stash (notmuch-show-get-to)))
> >  
> > -(defun notmuch-show-stash-gmane ()
> > -  "Copy a Gmane URI for the current message to the kill-ring.
> > +(defun notmuch-show-stash-mlarchive-link ()
> > +  "Copy an ML Archive URI for the current message to the kill-ring.
> >  
> > -This presumes that the message is available at Gmane."
> > +This presumes that the message is available at the Mailing List Archive
> > +configured in `notmuch-show-stash-mlarchive-link-pref'."
> >(interactive)
> > -  (notmuch-common-do-stash (concat "http://mid.gmane.org/;
> > +  (notmuch-common-do-stash (concat notmuch-show-stash-mlarchive-link-pref
> >(substring (notmuch-show-get-message-id) 4 
> > -1
> >  
> > -(defun notmuch-show-stash-gmane-and-go ()
> > -  "Copy a Gmane URI for the current message to the kill-ring and visit it.
> > +(defun notmuch-show-stash-mlarchive-link-and-go ()
> > +  "Copy an ML Archive URI for the current message to the kill-ring and 
> > visit it.
> >  
> > -This presumes that the message is available at Gmane."
> > +This presumes that the message is available at the Mailing List Archive
> > +configured in `notmuch-show-stash-mlarchive-link-pref'."
> >(interactive)
> > -  (let ((uri (concat "http://mid.gmane.org/;
> > +  (let ((uri (concat notmuch-show-stash-mlarchive-link-pref
> >  (substring (notmuch-show-get-message-id) 4 -1
> >  (notmuch-common-do-stash uri)
> >  (browse-url uri)))
> > diff --git a/test/emacs b/test/emacs
> > index 5f7467d..4e08726 100755
> > --- a/test/emacs
> > +++ 

[PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-26 Thread Pieter Praet
On Wed, 25 Jan 2012 15:00:22 +0200, Tomi Ollila  wrote:
> [...]
> So, 'completing-read' -- or something that does the same thing better (ymmv).
> 

Thanks for the suggestion, but `completing-read' will do just fine...  ;D


> Tomi


Peace

-- 
Pieter


[PATCH] emacs: make `notmuch-show-open-or-close-all' toggle visibility

2012-01-26 Thread Pieter Praet
On Wed, 25 Jan 2012 06:35:33 +, David Edmondson  wrote:
> On Wed, 25 Jan 2012 06:25:39 +0100, Pieter Praet  wrote:
> > * emacs/notmuch-show.el (notmuch-show-open-or-close-all):
> >   Rename to `notmuch-show-toggle-all-messages', and make it toggle
> >   visibility of all messages based on the visibility of the current
> >   message, instead of setting visibility based on whether or not a
> >   prefix arg was supplied.
> > 
> > Same functionality, less effort (reaching for 'C-u' is a pain)...
> 
> -1.
> 
> The behaviour you've provided is not what I want, from two perspectives:
> - currently it's clear what will happen when I use M-RET or
>   C-uM-RET without me having to think about whether the cursor
>   is over an open message,
> - often I'll be reading an open message and I want to open all
>   of the rest to look at some context. That's a little more
>   awkward after this change.

I may be missing something, but wouldn't both issues be solved by simply
pressing M-RET a second time?  I've been using this for a little while
now, and IMO it makes navigating through long and diverging threads a lot
faster, much like zooming in/out on an outline.

How about if C-u M-RET behaved as usual ?


> > 
> > ---
> >  emacs/notmuch-show.el |   22 --
> >  1 files changed, 12 insertions(+), 10 deletions(-)
> > 
> > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> > index e6a5b31..2d17f74 100644
> > --- a/emacs/notmuch-show.el
> > +++ b/emacs/notmuch-show.el
> > @@ -1050,8 +1050,8 @@ thread id.  If a prefix is given, crypto processing 
> > is toggled."
> > (define-key map "p" 'notmuch-show-previous-open-message)
> > (define-key map (kbd "DEL") 'notmuch-show-rewind)
> > (define-key map " " 'notmuch-show-advance-and-archive)
> > -   (define-key map (kbd "M-RET") 'notmuch-show-open-or-close-all)
> > (define-key map (kbd "RET") 'notmuch-show-toggle-message)
> > +   (define-key map (kbd "M-RET") 'notmuch-show-toggle-all-messages)
> > (define-key map "#" 'notmuch-show-print-message)
> > map)
> >"Keymap for \"notmuch show\" buffers.")
> > @@ -1502,16 +1502,18 @@ the result."
> >   (not (plist-get props :message-visible
> >(force-window-update))
> >  
> > -(defun notmuch-show-open-or-close-all ()
> > -  "Set the visibility all of the messages in the current thread.
> > -By default make all of the messages visible. With a prefix
> > -argument, hide all of the messages."
> > +(defun notmuch-show-toggle-all-messages ()
> > +  "Toggle the visibility of all messages in the current thread.
> > +If the current message is visible, hide all messages -- and vice versa."
> >(interactive)
> > -  (save-excursion
> > -(goto-char (point-min))
> > -(loop do (notmuch-show-message-visible 
> > (notmuch-show-get-message-properties)
> > -  (not current-prefix-arg))
> > - until (not (notmuch-show-goto-message-next
> > +  (let ((toggle (notmuch-show-message-visible-p)))
> > +(save-excursion
> > +  (goto-char (point-min))
> > +  (loop do (notmuch-show-message-visible
> > +   (notmuch-show-get-message-properties)
> > +   (not toggle))
> > +   until (not (notmuch-show-goto-message-next)
> > +  (recenter-top-bottom 1)
> >(force-window-update))
> >  
> >  (defun notmuch-show-next-button ()
> > -- 
> > 1.7.8.1
> > 
> > ___
> > notmuch mailing list
> > notmuch at notmuchmail.org
> > http://notmuchmail.org/mailman/listinfo/notmuch


Peace

-- 
Pieter


[PATCH 1/3] emacs: s/buttonise/buttonize/g

2012-01-26 Thread Pieter Praet
On Wed, 25 Jan 2012 07:16:13 -0400, David Bremner  wrote:
> On Thu, 12 Jan 2012 18:23:43 +0100, Pieter Praet  wrote:
> > "Worldwide, -ize endings prevail in scientific writing and are commonly
> > used by many international organizations, such as the ISO and the
> > WHO. The European Union switched from -ize to -ise some years ago in its
> > English language publications, and this resulted in the coexistence of
> 
> needs rebasing against master. 
> 

Actually, it's been superseded by:
  id:"1327222469-29487-1-git-send-email-pieter at praet.org"

> d
> 
> P.S. Personally think it's a bit silly, [...]

Perhaps it is, but then again, spelling errors may be considered as
being indicative of the quality of the project as a whole, so it
wouldn't hurt to keep them to a minimum.

> [...] but that might be because I'm
> Canadian, and we are all about the inconsistent anglo/american
> spelling. [...]

Exactly!

"American and Canadian spelling accepts only -ize endings in
most cases, [...]" [1]  :)

> [...] But if the consensus is to follow the UN black helicopter
> spelling police, ok :).

Follow WHO? (lame pun intended...)


Peace

-- 
Pieter

[1] 
http://en.wikipedia.org/wiki/American_and_British_English_spelling_differences#-ise.2C_-ize_.28-isation.2C_-ization.29


Bug?: notmuch-search-show-thread shows several threads; only one containing matching messages

2012-01-26 Thread Gregor Zattler
Hi Jamie, Austin,
* Jameson Graef Rollins  [25. Jan. 2012]:
> On Wed, 25 Jan 2012 20:19:03 -0500, Austin Clements  
> wrote:
>> One very common cause of this is someone using "reply" to get an
>> initial set of recipients, but then replacing the entire message and
>> subject (presumably without realizing that the mail is still tracking
>> what it was a reply to).  This can also happen if someone
>> intentionally replies to multiple messages (though few mail clients
>> support this), or if there was a message ID collision.
> 
> This is a very common occurrence for me as well.  I would put money down
> that this is what you're seeing.

I thought about this too and this is why I checked for any
occurrence of Message-IDs in the other emails: 

   |> I isolated the thread I was interested in,
   |> extracted the message ids of its messages and greped the rest of
   |> the messages for this message ids: no matches.[2] Therefore no of
   |> the rests messages are part of the thread I was interested in

perhaps there was a logic error in how I did this:

   |> [2] grep -I "^Message-Id:" /tmp/thread-I-m-interested-in.mbox |sed -e 
"s/Message-Id: $//" >really.mid
   |> grep -I -F really.mid rest.mbox
   |> --> no match

/tmp/thread-I-m-interested-in.mbox  is a mbox with messages
I'minterested in, the "real" ones.  really.mid is a list of
Message-IDs of these "real" emails.  rest.mbox is a mbox with the
other emails, Emacs showed in his notmuch show buffer but are
other threads.

Since there is no match I concluded, the threads are not linked.
Perhaps I made a mistake.  I'l retest it and report again.  But
right now I don't have the time to do this.

Ciao, Gregor
-- 
 -... --- .-. . -.. ..--.. ...-.-


[PATCH v5 0/2] emacs: add completion to "tag all" operation

2012-01-26 Thread Austin Clements
Quoth Dmitry Kurochkin on Jan 26 at  9:34 pm:
> Changes:
> 
> v5:
> 
> * fixed comments from Austin's review [2]
> 
> * add a second patch with `notmuch-search-operate-all' code cleanup
>   suggested by Austin [1]

LGTM.


Bug?: notmuch-search-show-thread shows several threads; only one containing matching messages

2012-01-26 Thread Jani Nikula
On Thu, 26 Jan 2012 13:44:50 +0100, Gregor Zattler  wrote:
> Hi Jamie, Austin,
> * Jameson Graef Rollins  [25. Jan. 2012]:
> > On Wed, 25 Jan 2012 20:19:03 -0500, Austin Clements  
> > wrote:
> >> One very common cause of this is someone using "reply" to get an
> >> initial set of recipients, but then replacing the entire message and
> >> subject (presumably without realizing that the mail is still tracking
> >> what it was a reply to).  This can also happen if someone
> >> intentionally replies to multiple messages (though few mail clients
> >> support this), or if there was a message ID collision.
> > 
> > This is a very common occurrence for me as well.  I would put money down
> > that this is what you're seeing.
> 
> I thought about this too and this is why I checked for any
> occurrence of Message-IDs in the other emails: 
> 
>|> I isolated the thread I was interested in,
>|> extracted the message ids of its messages and greped the rest of
>|> the messages for this message ids: no matches.[2] Therefore no of
>|> the rests messages are part of the thread I was interested in
> 
> perhaps there was a logic error in how I did this:
> 
>|> [2] grep -I "^Message-Id:" /tmp/thread-I-m-interested-in.mbox |sed -e 
> "s/Message-Id: $//" >really.mid
>|> grep -I -F really.mid rest.mbox
>|> --> no match
> 
> /tmp/thread-I-m-interested-in.mbox  is a mbox with messages
> I'minterested in, the "real" ones.  really.mid is a list of
> Message-IDs of these "real" emails.  rest.mbox is a mbox with the
> other emails, Emacs showed in his notmuch show buffer but are
> other threads.
> 
> Since there is no match I concluded, the threads are not linked.
> Perhaps I made a mistake.  I'l retest it and report again.  But
> right now I don't have the time to do this.

Do you have an mbox file in the maildir indexed by notmuch? That seems
like the issue.

Jani.


[PATCH 2/2] added support for user-specified directories to exclude

2012-01-26 Thread Jani Nikula
On Thu, 26 Jan 2012 12:11:58 +0200, Tomi Ollila  wrote:
> A new configuration key 'database.exclude' is used to determine
> which directories user wants not to be scanned for new mails.
> 
> ---
> 
> Notes (from 2011-09-13):
> 
> 1) Currently the comments for newly created configuration file are not
> updated, so for not this is 'undocumented feature'. Should there be an
> empty configuration line as a placeholder ... ?
> 
> 2) Whenever some already existing directory is added to the exclude list
> and the parent directory timestamp has not changed, notmuch new will not
> notice the directory has gone (as it still is there), user needs to 'touch'
> the parent directory before next 'notmuch new' no make notmuch notice.
> 
> 2012-01-26: could notmuch track mtime of the configuration file and if
> that changes, ignore mail directory timestamps ?
> 
> 3) count_files() function is not touched. The functionality there has fallen
> behind of add_files_recursive (maildir+tmp check and following symlinks).
> The question there should it be updated, or attempted to merge with
> add_files (as the comment says). count_files() is only called at the beginning
> when database is not yet initialised.
> ---
>  notmuch-client.h |3 +++
>  notmuch-config.c |   13 +
>  notmuch-new.c|   22 --
>  3 files changed, 36 insertions(+), 2 deletions(-)
> 
> diff --git a/notmuch-client.h b/notmuch-client.h
> index e0eb594..78460fc 100644
> --- a/notmuch-client.h
> +++ b/notmuch-client.h
> @@ -219,6 +219,9 @@ void
>  notmuch_config_set_database_path (notmuch_config_t *config,
> const char *database_path);
>  
> +const char **
> +notmuch_config_get_database_exclude (notmuch_config_t *config,
> +  size_t *length);
>  const char *
>  notmuch_config_get_user_name (notmuch_config_t *config);
>  
> diff --git a/notmuch-config.c b/notmuch-config.c
> index a124e34..e236114 100644
> --- a/notmuch-config.c
> +++ b/notmuch-config.c
> @@ -99,6 +99,8 @@ struct _notmuch_config {
>  GKeyFile *key_file;
>  
>  char *database_path;
> +const char **database_exclude;
> +size_t database_exclude_length;
>  char *user_name;
>  char *user_primary_email;
>  const char **user_other_email;
> @@ -258,6 +260,8 @@ notmuch_config_open (void *ctx,
>  config->key_file = g_key_file_new ();
>  
>  config->database_path = NULL;
> +config->database_exclude = NULL;
> +config->database_exclude_length = 0;
>  config->user_name = NULL;
>  config->user_primary_email = NULL;
>  config->user_other_email = NULL;
> @@ -537,6 +541,15 @@ notmuch_config_set_database_path (notmuch_config_t 
> *config,
>  config->database_path = NULL;
>  }
>  
> +const char **
> +notmuch_config_get_database_exclude (notmuch_config_t *config,
> +  size_t *length)
> +{
> +return _config_get_list (config, "database", "exclude",
> +  &(config->database_exclude),
> +  &(config->database_exclude_length), length);
> +}
> +
>  const char *
>  notmuch_config_get_user_name (notmuch_config_t *config)
>  {
> diff --git a/notmuch-new.c b/notmuch-new.c
> index a569a54..d607f5b 100644
> --- a/notmuch-new.c
> +++ b/notmuch-new.c
> @@ -39,6 +39,8 @@ typedef struct {
>  int verbose;
>  const char **new_tags;
>  size_t new_tags_length;
> +const char **database_exclude;
> +size_t database_exclude_length;
>  
>  int total_files;
>  int processed_files;
> @@ -300,6 +302,8 @@ add_files_recursive (notmuch_database_t *notmuch,
>  is_maildir = _entries_resemble_maildir (fs_entries, num_fs_entries);
>  
>  for (i = 0; i < num_fs_entries; i++) {
> + size_t j;
> +
>   if (interrupted)
>   break;
>  
> @@ -323,8 +327,6 @@ add_files_recursive (notmuch_database_t *notmuch,
>* Also ignore the .notmuch directory and any "tmp" directory
>* that appears within a maildir.
>*/
> - /* XXX: Eventually we'll want more sophistication to let the
> -  * user specify files to be ignored. */
>   if (strcmp (entry->d_name, ".") == 0 ||
>   strcmp (entry->d_name, "..") == 0 ||
>   (is_maildir && strcmp (entry->d_name, "tmp") == 0) ||
> @@ -332,6 +334,12 @@ add_files_recursive (notmuch_database_t *notmuch,
>   {
>   continue;
>   }
> + /* Ignore user-specified directories */
> + for (j = 0; j < state->database_exclude_length; j++)
> + if (strcmp(entry->d_name, state->database_exclude[j]) == 0)
> + break;
> + if (j < state->database_exclude_length)
> + continue;

How about wrapping that in a function you can use here and below?

if (user_wants_this_excluded (...))
continue;

Please also have a look at id:"87pqecylon.fsf at nikula.org" and the
patches Austin posted. "Auto ignore"?

BR,
Jani.

>  
>   next = talloc_asprintf 

[PATCH 1/2] moved _notmuch_get_list () and _notmuch_set_list () up in file

2012-01-26 Thread Jani Nikula
On Thu, 26 Jan 2012 12:11:57 +0200, Tomi Ollila  wrote:
> Moved _notmuch_get_list () and _notmuch_set_list () to a location
> in notmuch-config.c so that new functions that will be located 
> before the old location of those functions can also use these.

Parse error. ;)

You mean something along the lines of: "Move _notmuch_get_list () and
_notmuch_set_list () earlier in the file to avoid forward declarations
in further work. No functional changes."

I'm sure native speakers can bikeshed that further. ;)

BR,
Jani.


> ---
> 
> This patch is independent of the next one (just required by it)
> and can (should) be pushed early.
> 
>  notmuch-config.c |   84 
> +++---
>  1 files changed, 42 insertions(+), 42 deletions(-)
> 
> diff --git a/notmuch-config.c b/notmuch-config.c
> index 0ded6d7..a124e34 100644
> --- a/notmuch-config.c
> +++ b/notmuch-config.c
> @@ -467,6 +467,48 @@ notmuch_config_save (notmuch_config_t *config)
>  return 0;
>  }
>  
> +static const char **
> +_config_get_list (notmuch_config_t *config,
> +   const char *section, const char *key,
> +   const char ***outlist, size_t *list_length, size_t 
> *ret_length)
> +{
> +assert(outlist);
> +
> +if (*outlist == NULL) {
> +
> + char **inlist = g_key_file_get_string_list (config->key_file,
> +  section, key, list_length, NULL);
> + if (inlist) {
> + unsigned int i;
> +
> + *outlist = talloc_size (config, sizeof (char *) * (*list_length + 
> 1));
> +
> + for (i = 0; i < *list_length; i++)
> + (*outlist)[i] = talloc_strdup (*outlist, inlist[i]);
> +
> + (*outlist)[i] = NULL;
> +
> + g_strfreev (inlist);
> + }
> +}
> +
> +if (ret_length)
> + *ret_length = *list_length;
> +
> +return *outlist;
> +}
> +
> +static void
> +_config_set_list (notmuch_config_t *config,
> +   const char *group, const char *name,
> +   const char *list[],
> +   size_t length, const char ***config_var )
> +{
> +g_key_file_set_string_list (config->key_file, group, name, list, length);
> +talloc_free (*config_var);
> +*config_var = NULL;
> +}
> +
>  const char *
>  notmuch_config_get_database_path (notmuch_config_t *config)
>  {
> @@ -551,37 +593,6 @@ notmuch_config_set_user_primary_email (notmuch_config_t 
> *config,
>  config->user_primary_email = NULL;
>  }
>  
> -static const char **
> -_config_get_list (notmuch_config_t *config,
> -   const char *section, const char *key,
> -   const char ***outlist, size_t *list_length, size_t 
> *ret_length)
> -{
> -assert(outlist);
> -
> -if (*outlist == NULL) {
> -
> - char **inlist = g_key_file_get_string_list (config->key_file,
> -  section, key, list_length, NULL);
> - if (inlist) {
> - unsigned int i;
> -
> - *outlist = talloc_size (config, sizeof (char *) * (*list_length + 
> 1));
> -
> - for (i = 0; i < *list_length; i++)
> - (*outlist)[i] = talloc_strdup (*outlist, inlist[i]);
> -
> - (*outlist)[i] = NULL;
> -
> - g_strfreev (inlist);
> - }
> -}
> -
> -if (ret_length)
> - *ret_length = *list_length;
> -
> -return *outlist;
> -}
> -
>  const char **
>  notmuch_config_get_user_other_email (notmuch_config_t *config,   size_t 
> *length)
>  {
> @@ -598,17 +609,6 @@ notmuch_config_get_new_tags (notmuch_config_t *config,   
> size_t *length)
>&(config->new_tags_length), length);
>  }
>  
> -static void
> -_config_set_list (notmuch_config_t *config,
> -   const char *group, const char *name,
> -   const char *list[],
> -   size_t length, const char ***config_var )
> -{
> -g_key_file_set_string_list (config->key_file, group, name, list, length);
> -talloc_free (*config_var);
> -*config_var = NULL;
> -}
> -
>  void
>  notmuch_config_set_user_other_email (notmuch_config_t *config,
>const char *list[],
> -- 
> 1.7.6.4
> 
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 2/2] added support for user-specified directories to exclude

2012-01-26 Thread Tomi Ollila
A new configuration key 'database.exclude' is used to determine
which directories user wants not to be scanned for new mails.

---

Notes (from 2011-09-13):

1) Currently the comments for newly created configuration file are not
updated, so for not this is 'undocumented feature'. Should there be an
empty configuration line as a placeholder ... ?

2) Whenever some already existing directory is added to the exclude list
and the parent directory timestamp has not changed, notmuch new will not
notice the directory has gone (as it still is there), user needs to 'touch'
the parent directory before next 'notmuch new' no make notmuch notice.

2012-01-26: could notmuch track mtime of the configuration file and if
that changes, ignore mail directory timestamps ?

3) count_files() function is not touched. The functionality there has fallen
behind of add_files_recursive (maildir+tmp check and following symlinks).
The question there should it be updated, or attempted to merge with
add_files (as the comment says). count_files() is only called at the beginning
when database is not yet initialised.
---
 notmuch-client.h |3 +++
 notmuch-config.c |   13 +
 notmuch-new.c|   22 --
 3 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/notmuch-client.h b/notmuch-client.h
index e0eb594..78460fc 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -219,6 +219,9 @@ void
 notmuch_config_set_database_path (notmuch_config_t *config,
  const char *database_path);

+const char **
+notmuch_config_get_database_exclude (notmuch_config_t *config,
+size_t *length);
 const char *
 notmuch_config_get_user_name (notmuch_config_t *config);

diff --git a/notmuch-config.c b/notmuch-config.c
index a124e34..e236114 100644
--- a/notmuch-config.c
+++ b/notmuch-config.c
@@ -99,6 +99,8 @@ struct _notmuch_config {
 GKeyFile *key_file;

 char *database_path;
+const char **database_exclude;
+size_t database_exclude_length;
 char *user_name;
 char *user_primary_email;
 const char **user_other_email;
@@ -258,6 +260,8 @@ notmuch_config_open (void *ctx,
 config->key_file = g_key_file_new ();

 config->database_path = NULL;
+config->database_exclude = NULL;
+config->database_exclude_length = 0;
 config->user_name = NULL;
 config->user_primary_email = NULL;
 config->user_other_email = NULL;
@@ -537,6 +541,15 @@ notmuch_config_set_database_path (notmuch_config_t *config,
 config->database_path = NULL;
 }

+const char **
+notmuch_config_get_database_exclude (notmuch_config_t *config,
+size_t *length)
+{
+return _config_get_list (config, "database", "exclude",
+&(config->database_exclude),
+&(config->database_exclude_length), length);
+}
+
 const char *
 notmuch_config_get_user_name (notmuch_config_t *config)
 {
diff --git a/notmuch-new.c b/notmuch-new.c
index a569a54..d607f5b 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -39,6 +39,8 @@ typedef struct {
 int verbose;
 const char **new_tags;
 size_t new_tags_length;
+const char **database_exclude;
+size_t database_exclude_length;

 int total_files;
 int processed_files;
@@ -300,6 +302,8 @@ add_files_recursive (notmuch_database_t *notmuch,
 is_maildir = _entries_resemble_maildir (fs_entries, num_fs_entries);

 for (i = 0; i < num_fs_entries; i++) {
+   size_t j;
+
if (interrupted)
break;

@@ -323,8 +327,6 @@ add_files_recursive (notmuch_database_t *notmuch,
 * Also ignore the .notmuch directory and any "tmp" directory
 * that appears within a maildir.
 */
-   /* XXX: Eventually we'll want more sophistication to let the
-* user specify files to be ignored. */
if (strcmp (entry->d_name, ".") == 0 ||
strcmp (entry->d_name, "..") == 0 ||
(is_maildir && strcmp (entry->d_name, "tmp") == 0) ||
@@ -332,6 +334,12 @@ add_files_recursive (notmuch_database_t *notmuch,
{
continue;
}
+   /* Ignore user-specified directories */
+   for (j = 0; j < state->database_exclude_length; j++)
+   if (strcmp(entry->d_name, state->database_exclude[j]) == 0)
+   break;
+   if (j < state->database_exclude_length)
+   continue;

next = talloc_asprintf (notmuch, "%s/%s", path, entry->d_name);
status = add_files_recursive (notmuch, next, state);
@@ -364,11 +372,20 @@ add_files_recursive (notmuch_database_t *notmuch,
 /* Pass 2: Scan for new files, removed files, and removed directories. */
 for (i = 0; i < num_fs_entries; i++)
 {
+   size_t j;
+
if (interrupted)
break;

 entry = fs_entries[i];

+   /* Ignore user-specified files & directories */
+   for (j = 0; j < state->database_exclude_length; j++)
+

[PATCH 1/2] moved _notmuch_get_list () and _notmuch_set_list () up in file

2012-01-26 Thread Tomi Ollila
Moved _notmuch_get_list () and _notmuch_set_list () to a location
in notmuch-config.c so that new functions that will be located 
before the old location of those functions can also use these.
---

This patch is independent of the next one (just required by it)
and can (should) be pushed early.

 notmuch-config.c |   84 +++---
 1 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/notmuch-config.c b/notmuch-config.c
index 0ded6d7..a124e34 100644
--- a/notmuch-config.c
+++ b/notmuch-config.c
@@ -467,6 +467,48 @@ notmuch_config_save (notmuch_config_t *config)
 return 0;
 }

+static const char **
+_config_get_list (notmuch_config_t *config,
+ const char *section, const char *key,
+ const char ***outlist, size_t *list_length, size_t 
*ret_length)
+{
+assert(outlist);
+
+if (*outlist == NULL) {
+
+   char **inlist = g_key_file_get_string_list (config->key_file,
+section, key, list_length, NULL);
+   if (inlist) {
+   unsigned int i;
+
+   *outlist = talloc_size (config, sizeof (char *) * (*list_length + 
1));
+
+   for (i = 0; i < *list_length; i++)
+   (*outlist)[i] = talloc_strdup (*outlist, inlist[i]);
+
+   (*outlist)[i] = NULL;
+
+   g_strfreev (inlist);
+   }
+}
+
+if (ret_length)
+   *ret_length = *list_length;
+
+return *outlist;
+}
+
+static void
+_config_set_list (notmuch_config_t *config,
+ const char *group, const char *name,
+ const char *list[],
+ size_t length, const char ***config_var )
+{
+g_key_file_set_string_list (config->key_file, group, name, list, length);
+talloc_free (*config_var);
+*config_var = NULL;
+}
+
 const char *
 notmuch_config_get_database_path (notmuch_config_t *config)
 {
@@ -551,37 +593,6 @@ notmuch_config_set_user_primary_email (notmuch_config_t 
*config,
 config->user_primary_email = NULL;
 }

-static const char **
-_config_get_list (notmuch_config_t *config,
- const char *section, const char *key,
- const char ***outlist, size_t *list_length, size_t 
*ret_length)
-{
-assert(outlist);
-
-if (*outlist == NULL) {
-
-   char **inlist = g_key_file_get_string_list (config->key_file,
-section, key, list_length, NULL);
-   if (inlist) {
-   unsigned int i;
-
-   *outlist = talloc_size (config, sizeof (char *) * (*list_length + 
1));
-
-   for (i = 0; i < *list_length; i++)
-   (*outlist)[i] = talloc_strdup (*outlist, inlist[i]);
-
-   (*outlist)[i] = NULL;
-
-   g_strfreev (inlist);
-   }
-}
-
-if (ret_length)
-   *ret_length = *list_length;
-
-return *outlist;
-}
-
 const char **
 notmuch_config_get_user_other_email (notmuch_config_t *config,   size_t 
*length)
 {
@@ -598,17 +609,6 @@ notmuch_config_get_new_tags (notmuch_config_t *config,   
size_t *length)
 &(config->new_tags_length), length);
 }

-static void
-_config_set_list (notmuch_config_t *config,
- const char *group, const char *name,
- const char *list[],
- size_t length, const char ***config_var )
-{
-g_key_file_set_string_list (config->key_file, group, name, list, length);
-talloc_free (*config_var);
-*config_var = NULL;
-}
-
 void
 notmuch_config_set_user_other_email (notmuch_config_t *config,
 const char *list[],
-- 
1.7.6.4



[PATCH v4] emacs: add completion to "tag all" operation ("*" binding)

2012-01-26 Thread Dmitry Kurochkin
The patch adds  completion to "tag all" operation bound to "*"
(`notmuch-search-operate-all' function).
---

On a second thought, `notmuch-select-tag-with-completion' should never
need `prefixes' argument at all.  So I reverted the API and related
changes.

Changes:

v4:

* do not change `notmuch-select-tag-with-completion' API, revert
  related changes

v3:

* fixed comments from Austin's review [1]

v2:

* s/thistag/this_tag/ for consistency with "that_tag", since we touch
  the line anyway

Regards,
  Dmitry

[1] id:"20120126013727.GB1176 at mit.edu"

 emacs/notmuch.el |   53 -
 1 files changed, 40 insertions(+), 13 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index e02966f..d2af630 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -48,6 +48,7 @@
 ;; required, but is available from http://notmuchmail.org).

 (eval-when-compile (require 'cl))
+(require 'crm)
 (require 'mm-view)
 (require 'message)

@@ -75,12 +76,36 @@ For example:
 (defvar notmuch-query-history nil
   "Variable to store minibuffer history for notmuch queries")

-(defun notmuch-select-tag-with-completion (prompt  search-terms)
+(defun notmuch-tag-completions ( prefixes search-terms)
   (let ((tag-list
 (with-output-to-string
   (with-current-buffer standard-output
 (apply 'call-process notmuch-command nil t nil "search-tags" 
search-terms)
-(completing-read prompt (split-string tag-list "\n+" t) nil nil nil)))
+(setq tag-list (split-string tag-list "\n+" t))
+(if (null prefixes)
+   tag-list
+  (apply #'append
+(mapcar (lambda (tag)
+  (mapcar (lambda (prefix)
+(concat prefix tag)) prefixes))
+tag-list)
+
+(defun notmuch-select-tag-with-completion (prompt  search-terms)
+  (let ((tag-list (notmuch-tag-completions nil search-terms)))
+(completing-read prompt tag-list)))
+
+(defun notmuch-select-tags-with-completion (prompt  prefixes  
search-terms)
+  (let ((tag-list (notmuch-tag-completions prefixes search-terms))
+   (crm-separator " ")
+   (crm-local-completion-map
+(let ((map (make-sparse-keymap)))
+  (set-keymap-parent map crm-local-completion-map)
+  map)))
+;; By default, space is bound to "complete word" function.
+;; Re-bind it to insert a space instead.  Note that  still
+;; does the completion.
+(define-key crm-local-completion-map " " 'self-insert-command)
+(completing-read-multiple prompt tag-list)))

 (defun notmuch-foreach-mime-part (function mm-handle)
   (cond ((stringp (car mm-handle))
@@ -849,7 +874,7 @@ non-authors is found, assume that all of the authors match."
  (goto-char found-target)))
   (delete-process proc

-(defun notmuch-search-operate-all (action)
+(defun notmuch-search-operate-all ( actions)
   "Add/remove tags from all matching messages.

 This command adds or removes tags from all messages matching the
@@ -860,16 +885,18 @@ will prompt for tags to be added or removed. Tags 
prefixed with
 Each character of the tag name may consist of alphanumeric
 characters as well as `_.+-'.
 "
-  (interactive "sOperation (+add -drop): notmuch tag ")
-  (let ((action-split (split-string action " +")))
-;; Perform some validation
-(let ((words action-split))
-  (when (null words) (error "No operation given"))
-  (while words
-   (unless (string-match-p "^[-+][-+_.[:word:]]+$" (car words))
- (error "Action must be of the form `+thistag -that_tag'"))
-   (setq words (cdr words
-(apply 'notmuch-tag notmuch-search-query-string action-split)))
+  (interactive (notmuch-select-tags-with-completion
+   "Operations (+add -drop): notmuch tag "
+   '("+" "-")))
+  (setq actions (delete "" actions))
+  ;; Perform some validation
+  (let ((words actions))
+(when (null words) (error "No operations given"))
+(while words
+  (unless (string-match-p "^[-+][-+_.[:word:]]+$" (car words))
+   (error "Action must be of the form `+this_tag' or `-that_tag'"))
+  (setq words (cdr words
+  (apply 'notmuch-tag notmuch-search-query-string actions))

 (defun notmuch-search-buffer-title (query)
   "Returns the title for a buffer with notmuch search results."
-- 
1.7.8.3



Emacs: Crypto: How to get automatic encryption?

2012-01-26 Thread David Edmondson
On Wed, 25 Jan 2012 09:45:01 -0800, Jameson Graef Rollins  wrote:
> On Wed, 25 Jan 2012 10:20:26 +, David Edmondson  wrote:
> > Isn't it still necessary to ensure that you have encryption keys
> > appropriate to the recipient?
> 
> I want to ensure that all replies to encrypted to be encrypted.  I
> would rather have the reply fail outright than fall back to
> unencrypted.

That's a policy decision that a user can (and perhaps should) take, but
not something that should be enforced by the tool. Encouraging this
approach is fine, of course. I can think of various situations where I
might send an un-encrypted reply to an encrypted message.

> Here's a behavior that I think would be reasonable:
> 
>  * notmuch reply outputs JSON encrypted flag
> 
>  * emacs does a quick check to see if the needed key is available
> 
>  * if key not available: give a nice mini-buffer prompt, something like:
>  
> 'encryption key for "Foo Bar " not found.  Retrieve?'
> 
>* if response is yes: call gpg to retrieve the key
> 
>  * if key available: add encrypt flag
> 
>else: I feel like this should abort, but maybe there's something to
>  be done here.  Allow reply but don't quote the original?

How about:
- notmuch reply outputs JSON encrypted flag,
- emacs inserts the relevant mml to request that the reply is sent
  encrypted if the flag is present.

With this approach the default behaviour is to send an encrypted reply
to an encrypted message, but the user has the chance to change the
behaviour using familiar (well, as familiar as mml can be) tools.

Adding improvements to retrieve keys for outgoing messages would be
generally useful - it's not just an issue for replies.
-- 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/20120126/f6f95fb9/attachment.pgp>


[PATCH] emacs: add completion to "tag all" operation ("*" binding)

2012-01-26 Thread David Edmondson
On Thu, 26 Jan 2012 05:47:07 +0400, Dmitry Kurochkin  wrote:
> > > +  ;; Perform some validation
> > > +  (let ((words action))
> > > +(when (null words) (error "No operation given"))
> > > +(while words
> > > +  (unless (string-match-p "^[-+][-+_.[:word:]]+$" (car words))
> > > + (error "Action must be of the form `+thistag -that_tag'"))
> > > +  (setq words (cdr words
> > 
> > This should really be a mapc or a dolist, but maybe that's for another
> > patch.
> 
> Yes, I changed "this_tag" spelling in v2, but would prefer to leave
> non-trivial changes in this code for another patch.

If you were going to submit another patch then fine, but the chances are
it will just get forgotten.
-- 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/20120126/51f5f706/attachment.pgp>


[PATCH 0/4 v3] more care when hiding regions with buttons

2012-01-26 Thread David Bremner
On Thu, 26 Jan 2012 07:19:36 +, David Edmondson  wrote:
> Address Dmitry's comments.
> 
> David Edmondson (4):
>   test: `visible-buffer-substring' should not return text properties.
>   test: `notmuch-test-run' should protect against buffer switching.
pushed the first two.

>   test: Add test for Original Message hiding at point-min.
>   emacs: Take more care when hiding regions with buttons.

waiting on review.

d


[PATCH] emacs: Make the part content available to `mm-inlinable-p'.

2012-01-26 Thread David Bremner
On Thu, 19 Jan 2012 09:34:07 +, David Edmondson  wrote:
> The `mm-inlinable-p' function works better if it has access to the
> data of the relevant part, so load that content before calling it.

pushed

d


[PATCH] emacs: Fix a notmuch-print.el compiler warning.

2012-01-26 Thread David Bremner
On Wed, 25 Jan 2012 08:52:15 +, David Edmondson  wrote:
> `notmuch-show-get-prop' should be declared.

pushed.

d


[PATCH] emacs: polish notmuch-hello help text

2012-01-26 Thread David Bremner
On Wed, 25 Jan 2012 22:24:56 +0400, Dmitry Kurochkin  wrote:
> Make `=' binding description consistent with others.

pushed.

d


[PATCH 2/2] emacs: Add more processing of displayed headers.

2012-01-26 Thread David Edmondson
Wrap headers to the width of the window and indent continuations.
---
 emacs/notmuch-show.el |   43 ---
 1 files changed, 36 insertions(+), 7 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index effd2fd..ad286d1 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -67,9 +67,16 @@ any given message."
   :type 'boolean
   :group 'notmuch-show)

-(defvar notmuch-show-markup-headers-hook '(notmuch-show-colour-headers)
+(defcustom notmuch-show-markup-headers-hook '(notmuch-show-colour-headers
+ notmuch-show-fill-headers
+ notmuch-show-indent-continuations)
   "A list of functions called to decorate the headers listed in
-`notmuch-message-headers'.")
+`notmuch-message-headers'."
+  :type 'hook
+  :options '(notmuch-show-colour-headers
+notmuch-show-fill-headers
+notmuch-show-indent-continuations)
+  :group 'notmuch-show)

 (defcustom notmuch-show-hook '(notmuch-show-turn-on-visual-line-mode)
   "Functions called after populating a `notmuch-show' buffer."
@@ -268,13 +275,35 @@ operation on the contents of the current buffer."
 (overlay-put (make-overlay (point) (re-search-forward ".*$"))
 'face face)))

-(defun notmuch-show-colour-headers ()
+(defun notmuch-show-colour-headers (depth)
   "Apply some colouring to the current headers."
   (goto-char (point-min))
   (while (looking-at "^[A-Za-z][-A-Za-z0-9]*:")
 (notmuch-show-fontify-header)
 (forward-line)))

+(defun notmuch-show-fill-headers (depth)
+  "Wrap the text of the current headers."
+
+  ;; '-5' to allow for the indentation code.
+  (let ((fill-column (- (window-width) depth 5)))
+(goto-char (point-min))
+(while (not (eobp))
+  (let ((start (point)))
+   (end-of-line)
+   ;; We're left at the start of the next line, so there's no need
+   ;; to move forward after filling.
+   (fill-region-as-paragraph start (point))
+
+(defun notmuch-show-indent-continuations (depth)
+  "Indent any continuation lines."
+  (goto-char (point-min))
+  (while (not (eobp))
+(if (not (looking-at "^[A-Za-z][-A-Za-z0-9]*:"))
+   ;; Four spaces tends to work well with 'To' and 'Cc' headers.
+   (insert ""))
+(forward-line)))
+
 (defun notmuch-show-spaces-n (n)
   "Return a string comprised of `n' spaces."
   (make-string n ? ))
@@ -329,7 +358,7 @@ message at DEPTH in the current thread."
   "Insert a single header."
   (insert header ": " header-value "\n"))

-(defun notmuch-show-insert-headers (headers)
+(defun notmuch-show-insert-headers (headers depth)
   "Insert the headers of the current message."
   (let ((start (point)))
 (mapc (lambda (header)
@@ -342,7 +371,7 @@ message at DEPTH in the current thread."
 (save-excursion
   (save-restriction
(narrow-to-region start (point-max))
-   (run-hooks 'notmuch-show-markup-headers-hook)
+   (run-hook-with-args 'notmuch-show-markup-headers-hook depth)

 (define-button-type 'notmuch-show-part-button-type
   'action 'notmuch-show-part-button-default
@@ -633,7 +662,7 @@ current buffer, if possible."
 ;; Override `notmuch-message-headers' to force `From' to be
 ;; displayed.
 (let ((notmuch-message-headers '("From" "Subject" "To" "Cc" "Date")))
-  (notmuch-show-insert-headers (plist-get message :headers)))
+  (notmuch-show-insert-headers (plist-get message :headers) 0))

 ;; Blank line after headers to be compatible with the normal
 ;; message display.
@@ -826,7 +855,7 @@ current buffer, if possible."
 ;; Set `headers-start' to point after the 'Subject:' header to be
 ;; compatible with the existing implementation. This just sets it
 ;; to after the first header.
-(notmuch-show-insert-headers headers)
+(notmuch-show-insert-headers headers depth)
 ;; Headers should include a blank line (backwards compatibility).
 (insert "\n")
 (save-excursion
-- 
1.7.8.3



[PATCH 1/2] emacs: Re-enable line wrapping in `notmuch-show-mode'.

2012-01-26 Thread David Edmondson
Turn on `visual-line-mode' via a hook, so that those who so choose can
avoid it.
---
 emacs/notmuch-show.el |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index e6a5b31..effd2fd 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -71,9 +71,10 @@ any given message."
   "A list of functions called to decorate the headers listed in
 `notmuch-message-headers'.")

-(defcustom notmuch-show-hook nil
+(defcustom notmuch-show-hook '(notmuch-show-turn-on-visual-line-mode)
   "Functions called after populating a `notmuch-show' buffer."
   :type 'hook
+  :options '(notmuch-show-turn-on-visual-line-mode)
   :group 'notmuch-show
   :group 'notmuch-hooks)

@@ -133,6 +134,10 @@ indentation."
, at body)
 (kill-buffer buf)

+(defun notmuch-show-turn-on-visual-line-mode ()
+  "Enable Visual Line mode."
+  (visual-line-mode t))
+
 (defun notmuch-show-view-all-mime-parts ()
   "Use external viewers to view all attachments from the current message."
   (interactive)
-- 
1.7.8.3



[PATCH 0/2] re-enable line wrapping and add some header bling

2012-01-26 Thread David Edmondson
By default, re-enable `visual-line-mode' in `notmuch-show-mode'. Do it
via a hook so that purists (ahem) can turn it off.

Add some more processing of headers to make them look nice. Do it via
hooks so that unbelievers can turn it off.

David Edmondson (2):
  emacs: Re-enable line wrapping in `notmuch-show-mode'.
  emacs: Add more processing of displayed headers.

 emacs/notmuch-show.el |   50 +---
 1 files changed, 42 insertions(+), 8 deletions(-)

-- 
1.7.8.3



[PATCH 3/4 v2] test: Add test for Original Message hiding at point-min.

2012-01-26 Thread David Edmondson
I've applied changes in accordance with all of the feedback in this mail
and the others, except for...

On Wed, 25 Jan 2012 21:53:08 +0400, Dmitry Kurochkin  wrote:
> > +  (let ((notmuch-show-insert-text/plain-hook 
> > '(notmuch-wash-excerpt-citations))
> 
> Do we have to override the default value here?  I thought
> notmuch-wash-excerpt-citations was enabled by default.

It avoids potential confusion over where the problem lies.

> [...]
> 
> IMO writing the test in lisp does not give any benefit in this case.
> Quite the opposite: a simple test is split in two files and becomes more
> complex.
> 
> But since we accepted this way of writing tests and you seem to prefer
> it, I would not argue about changing it.

You're right - it's simpler in the original style here, so v3 switches
to that.
-- 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/20120126/105cee90/attachment.pgp>


[PATCH 4/4 v3] emacs: Take more care when hiding regions with buttons.

2012-01-26 Thread David Edmondson
If the region to be hidden with a button by
`notmuch-wash-region-to-button' starts at the beginning of the buffer,
the invisible region will include the inserted button. This is
unfortunate, as it means that it is not possible to see the button to
be pressed.

Make a little space at the start of the buffer before inserting the
button to avoid this, not forgetting to remove the inserted space upon
completion.

Mark the relevant test as no longer broken.
---
 emacs/notmuch-wash.el|   57 --
 test/emacs-message-hiding.sh |1 -
 2 files changed, 38 insertions(+), 20 deletions(-)

diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el
index 5c1e830..4afd3b3 100644
--- a/emacs/notmuch-wash.el
+++ b/emacs/notmuch-wash.el
@@ -147,25 +147,44 @@ insert before the button, probably for indentation."
   ;; symbols because of the way the button code works. Note that
   ;; replacing intern-soft with make-symbol will cause this to fail,
   ;; since the newly created symbol has no plist.
-
-  (let ((overlay (make-overlay beg end))
-   (message-invis-spec (plist-get msg :message-invis-spec))
-   (invis-spec (make-symbol (concat "notmuch-" type "-region")))
-   (button-type (intern-soft (concat "notmuch-wash-button-"
- type "-toggle-type"
-(add-to-invisibility-spec invis-spec)
-(overlay-put overlay 'invisible (list invis-spec message-invis-spec))
-(overlay-put overlay 'isearch-open-invisible 
#'notmuch-wash-region-isearch-show)
-(overlay-put overlay 'priority 10)
-(overlay-put overlay 'type type)
-(goto-char (1+ end))
-(save-excursion
-  (goto-char (1- beg))
-  (insert prefix)
-  (insert-button (notmuch-wash-button-label overlay)
-'invisibility-spec invis-spec
-'overlay overlay
-:type button-type
+  (save-excursion
+;; If the beginning of the region to be converted to a button is the
+;; beginning of the buffer we must move forward a little to avoid
+;; creating an overlay that will hide the button intended to be used
+;; to reveal the hidden region.
+(let (scene-of-crime)
+  (when (eq beg (point-min))
+   (goto-char (point-min))
+   (insert "\n")
+   (setq scene-of-crime (point-min)
+ beg (point)))
+
+  ;; This uses some slightly tricky conversions between strings and
+  ;; symbols because of the way the button code works. Note that
+  ;; replacing intern-soft with make-symbol will cause this to fail,
+  ;; since the newly created symbol has no plist.
+
+  (let ((overlay (make-overlay beg end))
+   (message-invis-spec (plist-get msg :message-invis-spec))
+   (invis-spec (make-symbol (concat "notmuch-" type "-region")))
+   (button-type (intern-soft (concat "notmuch-wash-button-"
+ type "-toggle-type"
+   (add-to-invisibility-spec invis-spec)
+   (overlay-put overlay 'invisible (list invis-spec message-invis-spec))
+   (overlay-put overlay 'isearch-open-invisible 
#'notmuch-wash-region-isearch-show)
+   (overlay-put overlay 'priority 10)
+   (overlay-put overlay 'type type)
+
+   (goto-char (1- beg))
+   (insert prefix)
+   (insert-button (notmuch-wash-button-label overlay)
+  'invisibility-spec invis-spec
+  'overlay overlay
+  :type button-type))
+
+  (when scene-of-crime
+   (goto-char scene-of-crime)
+   (delete-char 1)

 (defun notmuch-wash-excerpt-citations (msg depth)
   "Excerpt citations and up to one signature."
diff --git a/test/emacs-message-hiding.sh b/test/emacs-message-hiding.sh
index 70bc66d..36708d7 100755
--- a/test/emacs-message-hiding.sh
+++ b/test/emacs-message-hiding.sh
@@ -31,7 +31,6 @@ test_emacs '
(visible-buffer-string)))
 '

-test_subtest_known_broken
 test_expect_equal_file EXPECTED OUTPUT

 test_done
-- 
1.7.8.3



[PATCH 3/4 v3] test: Add test for Original Message hiding at point-min.

2012-01-26 Thread David Edmondson
---
 test/emacs-message-hiding.sh |   37 +
 test/notmuch-test|1 +
 2 files changed, 38 insertions(+), 0 deletions(-)
 create mode 100755 test/emacs-message-hiding.sh

diff --git a/test/emacs-message-hiding.sh b/test/emacs-message-hiding.sh
new file mode 100755
index 000..70bc66d
--- /dev/null
+++ b/test/emacs-message-hiding.sh
@@ -0,0 +1,37 @@
+#!/usr/bin/env bash
+
+test_description="emacs Original Message hiding"
+. test-lib.sh
+
+test_begin_subtest "Hiding an Original Message region at point-min"
+add_message \
+'[id]="OriginalMessageHiding.1 at notmuchmail.org"' \
+'[from]="Sender "' \
+'[to]=mailinglist at notmuchmail.org' \
+'[subject]="hiding an Original Message"' \
+'[date]="Tue, 05 Jan 2010 15:43:56 -"' \
+'[body]="-Original Message-
+Text here.
+"'
+
+cat > EXPECTED < (2010-01-05) (inbox)
+Subject: hiding an Original Message
+To: mailinglist at notmuchmail.org
+Date: Tue, 05 Jan 2010 15:43:56 -
+
+[ 2-line hidden original message. Click/Enter to show. ]
+
+EOF
+
+test_emacs '
+(notmuch-test-run
+ (let ((notmuch-show-insert-text/plain-hook (quote 
notmuch-wash-excerpt-citations)))
+   (notmuch-show "id:\"OriginalMessageHiding.1 at notmuchmail.org\"")
+   (visible-buffer-string)))
+'
+
+test_subtest_known_broken
+test_expect_equal_file EXPECTED OUTPUT
+
+test_done
diff --git a/test/notmuch-test b/test/notmuch-test
index 3f1740c..6631f87 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -54,6 +54,7 @@ TESTS="
   argument-parsing
   emacs-test-functions.sh
   emacs-address-cleaning.sh
+  emacs-message-hiding.sh
 "
 TESTS=${NOTMUCH_TESTS:=$TESTS}

-- 
1.7.8.3



[PATCH 2/4 v3] test: `notmuch-test-run' should protect against buffer switching.

2012-01-26 Thread David Edmondson
The body of the test may cause the current buffer to change. Ensure
that the output goes to the correct buffer by switching back before
inserting it.
---
 test/test-lib.el |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/test/test-lib.el b/test/test-lib.el
index 5b32e0a..6271da2 100644
--- a/test/test-lib.el
+++ b/test/test-lib.el
@@ -92,7 +92,9 @@ nothing."
 (defmacro notmuch-test-run ( body)
   "Evaluate a BODY of test expressions and output the result."
   `(with-temp-buffer
- (let ((result (progn , at body)))
+ (let ((buffer (current-buffer))
+  (result (progn , at body)))
+   (switch-to-buffer buffer)
(insert (if (stringp result)
   result
 (prin1-to-string result)))
-- 
1.7.8.3



[PATCH 1/4 v3] test: `visible-buffer-substring' should not return text properties.

2012-01-26 Thread David Edmondson
When using `visible-buffer-substring' to examine a buffer, the text
properties are not useful, so don't include them.
---
 test/test-lib.el |9 ++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/test/test-lib.el b/test/test-lib.el
index bc75f06..5b32e0a 100644
--- a/test/test-lib.el
+++ b/test/test-lib.el
@@ -51,16 +51,19 @@ FILENAME is OUTPUT."
 (with-temp-file (or filename "OUTPUT") (insert text

 (defun visible-buffer-string ()
-  "Same as `buffer-string', but excludes invisible text."
+  "Same as `buffer-string', but excludes invisible text and
+removes any text properties."
   (visible-buffer-substring (point-min) (point-max)))

 (defun visible-buffer-substring (start end)
-  "Same as `buffer-substring', but excludes invisible text."
+  "Same as `buffer-substring-no-properties', but excludes
+invisible text."
   (let (str)
 (while (< start end)
   (let ((next-pos (next-char-property-change start end)))
(when (not (invisible-p start))
- (setq str (concat str (buffer-substring start next-pos
+ (setq str (concat str (buffer-substring-no-properties
+start next-pos
(setq start next-pos)))
 str))

-- 
1.7.8.3



[PATCH 0/4 v3] more care when hiding regions with buttons

2012-01-26 Thread David Edmondson
Address Dmitry's comments.

David Edmondson (4):
  test: `visible-buffer-substring' should not return text properties.
  test: `notmuch-test-run' should protect against buffer switching.
  test: Add test for Original Message hiding at point-min.
  emacs: Take more care when hiding regions with buttons.

 emacs/notmuch-wash.el|   57 --
 test/emacs-message-hiding.sh |   36 ++
 test/notmuch-test|1 +
 test/test-lib.el |   13 ++---
 4 files changed, 84 insertions(+), 23 deletions(-)
 create mode 100755 test/emacs-message-hiding.sh

-- 
1.7.8.3



[PATCH v3] emacs: add completion to "tag all" operation ("*" binding)

2012-01-26 Thread Dmitry Kurochkin
The patch adds  completion to "tag all" operation bound to "*"
(`notmuch-search-operate-all' function).
---

Changes:

v3:

* fixed comments from Austin's review [1]

v2:

* s/thistag/this_tag/ for consistency with "that_tag", since we touch
  the line anyway

Regards,
  Dmitry

[1] id:"20120126013727.GB1176 at mit.edu"

 emacs/notmuch-show.el |4 +-
 emacs/notmuch.el  |   55 
 2 files changed, 43 insertions(+), 16 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index e6a5b31..b23a981 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -38,7 +38,7 @@

 (declare-function notmuch-call-notmuch-process "notmuch" ( args))
 (declare-function notmuch-fontify-headers "notmuch" nil)
-(declare-function notmuch-select-tag-with-completion "notmuch" (prompt  
search-terms))
+(declare-function notmuch-select-tag-with-completion "notmuch" (prompt 
 prefixes  search-terms))
 (declare-function notmuch-search-show-thread "notmuch" nil)

 (defcustom notmuch-message-headers '("Subject" "To" "Cc" "Date")
@@ -1474,7 +1474,7 @@ the result."
   "Remove a tag from the current message."
   (interactive
(list (notmuch-select-tag-with-completion
- "Tag to remove: " (notmuch-show-get-message-id
+ "Tag to remove: " nil (notmuch-show-get-message-id

   (let* ((current-tags (notmuch-show-get-tags))
 (new-tags (notmuch-show-del-tags-worker current-tags toremove)))
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index e02966f..ba8f8e1 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -48,6 +48,7 @@
 ;; required, but is available from http://notmuchmail.org).

 (eval-when-compile (require 'cl))
+(require 'crm)
 (require 'mm-view)
 (require 'message)

@@ -75,12 +76,36 @@ For example:
 (defvar notmuch-query-history nil
   "Variable to store minibuffer history for notmuch queries")

-(defun notmuch-select-tag-with-completion (prompt  search-terms)
+(defun notmuch-tag-completions ( prefixes search-terms)
   (let ((tag-list
 (with-output-to-string
   (with-current-buffer standard-output
 (apply 'call-process notmuch-command nil t nil "search-tags" 
search-terms)
-(completing-read prompt (split-string tag-list "\n+" t) nil nil nil)))
+(setq tag-list (split-string tag-list "\n+" t))
+(if (null prefixes)
+   tag-list
+  (apply #'append
+(mapcar (lambda (tag)
+  (mapcar (lambda (prefix)
+(concat prefix tag)) prefixes))
+tag-list)
+
+(defun notmuch-select-tag-with-completion (prompt  prefixes  
search-terms)
+  (let ((tag-list (notmuch-tag-completions prefixes search-terms)))
+(completing-read prompt tag-list)))
+
+(defun notmuch-select-tags-with-completion (prompt  prefixes  
search-terms)
+  (let ((tag-list (notmuch-tag-completions prefixes search-terms))
+   (crm-separator " ")
+   (crm-local-completion-map
+(let ((map (make-sparse-keymap)))
+  (set-keymap-parent map crm-local-completion-map)
+  map)))
+;; By default, space is bound to "complete word" function.
+;; Re-bind it to insert a space instead.  Note that  still
+;; does the completion.
+(define-key crm-local-completion-map " " 'self-insert-command)
+(completing-read-multiple prompt tag-list)))

 (defun notmuch-foreach-mime-part (function mm-handle)
   (cond ((stringp (car mm-handle))
@@ -606,7 +631,7 @@ The tag is removed from all messages in the currently 
selected
 thread or threads in the current region."
   (interactive
(list (notmuch-select-tag-with-completion
- "Tag to remove: "
+ "Tag to remove: " nil
  (if (region-active-p)
  (mapconcat 'identity
 (notmuch-search-find-thread-id-region 
(region-beginning) (region-end))
@@ -849,7 +874,7 @@ non-authors is found, assume that all of the authors match."
  (goto-char found-target)))
   (delete-process proc

-(defun notmuch-search-operate-all (action)
+(defun notmuch-search-operate-all ( actions)
   "Add/remove tags from all matching messages.

 This command adds or removes tags from all messages matching the
@@ -860,16 +885,18 @@ will prompt for tags to be added or removed. Tags 
prefixed with
 Each character of the tag name may consist of alphanumeric
 characters as well as `_.+-'.
 "
-  (interactive "sOperation (+add -drop): notmuch tag ")
-  (let ((action-split (split-string action " +")))
-;; Perform some validation
-(let ((words action-split))
-  (when (null words) (error "No operation given"))
-  (while words
-   (unless (string-match-p "^[-+][-+_.[:word:]]+$" (car words))
- (error "Action must be of the form `+thistag -that_tag'"))
-   (setq words (cdr words
-(apply 'notmuch-tag notmuch-search-query-string action-split)))
+  (interactive (notmuch-select-tags-with-completion
+   

[PATCH] emacs: add completion to "tag all" operation ("*" binding)

2012-01-26 Thread Dmitry Kurochkin
On Wed, 25 Jan 2012 20:37:27 -0500, Austin Clements  wrote:
> Neat.  As an aside, I would love to see a prompt like this for + and
> -, allowing multiple tags to be modified at once (and starting out
> with whichever of + or - got you in to the prompt).
> 

Yeah, I was thinking about making "+" and "-" accepting multiple tags
using `notmuch-select-tags-with-completion'.  But that is for another
patch.

> Quoth Dmitry Kurochkin on Jan 26 at  5:12 am:
> > The patch adds  completion to "tag all" operation bound to "*"
> > (`notmuch-search-operate-all' function).
> > ---
> >  emacs/notmuch.el |   48 
> >  1 files changed, 36 insertions(+), 12 deletions(-)
> > 
> > diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> > index e02966f..71b0221 100644
> > --- a/emacs/notmuch.el
> > +++ b/emacs/notmuch.el
> > @@ -48,6 +48,7 @@
> >  ;; required, but is available from http://notmuchmail.org).
> >  
> >  (eval-when-compile (require 'cl))
> > +(require 'crm)
> >  (require 'mm-view)
> >  (require 'message)
> >  
> > @@ -75,12 +76,33 @@ For example:
> >  (defvar notmuch-query-history nil
> >"Variable to store minibuffer history for notmuch queries")
> >  
> > -(defun notmuch-select-tag-with-completion (prompt  search-terms)
> > +(defun notmuch-tag-completions ( search-terms prefixes)
> >(let ((tag-list
> >  (with-output-to-string
> >(with-current-buffer standard-output
> >  (apply 'call-process notmuch-command nil t nil "search-tags" 
> > search-terms)
> > -(completing-read prompt (split-string tag-list "\n+" t) nil nil nil)))
> > +(setq tag-list (split-string tag-list "\n+" t))
> > +(if (null prefixes)
> > +   tag-list
> > +  (apply #'append
> > +(mapcar (lambda (tag)
> > +  (mapcar (lambda (prefix)
> > +(concat prefix tag)) prefixes))
> > +tag-list)
> > +
> > +(defun notmuch-select-tag-with-completion (prompt  search-terms 
> > prefixes)
> 
> This changes the API of notmuch-select-tag-with-completion in a
> non-backwards-compatible way.  I'm pretty sure this breaks
> notmuch-search-remove-tag and notmuch-show-remove-tag, but I haven't
> tested it.
> 

I tested only tag additions.  It works, and I assumed tag removal is no
different.  Will fix.

> > +  (let ((tag-list (notmuch-tag-completions search-terms prefixes)))
> > +(completing-read prompt tag-list)))
> > +
> > +(defun notmuch-select-tags-with-completion (prompt  search-terms 
> > prefixes)
> > +  (let ((tag-list (notmuch-tag-completions search-terms prefixes))
> > +   (crm-separator " ")
> > +   (crm-local-completion-map (copy-keymap crm-local-completion-map)))
> 
> Alternatively, you could create a child keymap.
> crm-local-completion-map is small enough that it probably doesn't
> matter, so whatever makes the code clearer.
> 

Thanks, I will look into it.

> > +;; By default, space is bound to "complete word" function.
> > +;; Re-bind it to insert a space instead.  Note that  still
> > +;; does the completion.
> > +(define-key crm-local-completion-map " " 'self-insert-command)
> > +(completing-read-multiple prompt tag-list)))
> >  
> >  (defun notmuch-foreach-mime-part (function mm-handle)
> >(cond ((stringp (car mm-handle))
> > @@ -860,16 +882,18 @@ will prompt for tags to be added or removed. Tags 
> > prefixed with
> >  Each character of the tag name may consist of alphanumeric
> >  characters as well as `_.+-'.
> >  "
> 
> Technically this changes the API of notmuch-search-operate-all, though
> the new one is better.  Perhaps it should test for (stringp action)
> and be backwards-compatible?
> 

In this case, I do not think there are many users of the function.  So I
would prefer to keep the code clean.

> The argument should probably be called "actions" now and it may even
> make sense to make it a  argument (though then you can't make it
> backwards-compatible).
> 

Makes sense, will do.

> > -  (interactive "sOperation (+add -drop): notmuch tag ")
> > -  (let ((action-split (split-string action " +")))
> > -;; Perform some validation
> > -(let ((words action-split))
> > -  (when (null words) (error "No operation given"))
> > -  (while words
> > -   (unless (string-match-p "^[-+][-+_.[:word:]]+$" (car words))
> > - (error "Action must be of the form `+thistag -that_tag'"))
> > -   (setq words (cdr words
> > -(apply 'notmuch-tag notmuch-search-query-string action-split)))
> > +  (interactive (list (notmuch-select-tags-with-completion
> > + "Operation (+add -drop): notmuch tag " nil
> > + '("+" "-"
> > +  (setq action (delete "" action))
> > +  ;; Perform some validation
> > +  (let ((words action))
> > +(when (null words) (error "No operation given"))
> > +(while words
> > +  (unless (string-match-p "^[-+][-+_.[:word:]]+$" (car words))
> > +   (error "Action must be of the form `+thistag 

[PATCH v2] emacs: add completion to "tag all" operation ("*" binding)

2012-01-26 Thread Dmitry Kurochkin
The patch adds  completion to "tag all" operation bound to "*"
(`notmuch-search-operate-all' function).
---

Changes in v2:

* s/thistag/this_tag/ for consistency with "that_tag", since we touch
  the line anyway

Regards,
  Dmitry

 emacs/notmuch.el |   48 
 1 files changed, 36 insertions(+), 12 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index e02966f..a57bf70 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -48,6 +48,7 @@
 ;; required, but is available from http://notmuchmail.org).

 (eval-when-compile (require 'cl))
+(require 'crm)
 (require 'mm-view)
 (require 'message)

@@ -75,12 +76,33 @@ For example:
 (defvar notmuch-query-history nil
   "Variable to store minibuffer history for notmuch queries")

-(defun notmuch-select-tag-with-completion (prompt  search-terms)
+(defun notmuch-tag-completions ( search-terms prefixes)
   (let ((tag-list
 (with-output-to-string
   (with-current-buffer standard-output
 (apply 'call-process notmuch-command nil t nil "search-tags" 
search-terms)
-(completing-read prompt (split-string tag-list "\n+" t) nil nil nil)))
+(setq tag-list (split-string tag-list "\n+" t))
+(if (null prefixes)
+   tag-list
+  (apply #'append
+(mapcar (lambda (tag)
+  (mapcar (lambda (prefix)
+(concat prefix tag)) prefixes))
+tag-list)
+
+(defun notmuch-select-tag-with-completion (prompt  search-terms 
prefixes)
+  (let ((tag-list (notmuch-tag-completions search-terms prefixes)))
+(completing-read prompt tag-list)))
+
+(defun notmuch-select-tags-with-completion (prompt  search-terms 
prefixes)
+  (let ((tag-list (notmuch-tag-completions search-terms prefixes))
+   (crm-separator " ")
+   (crm-local-completion-map (copy-keymap crm-local-completion-map)))
+;; By default, space is bound to "complete word" function.
+;; Re-bind it to insert a space instead.  Note that  still
+;; does the completion.
+(define-key crm-local-completion-map " " 'self-insert-command)
+(completing-read-multiple prompt tag-list)))

 (defun notmuch-foreach-mime-part (function mm-handle)
   (cond ((stringp (car mm-handle))
@@ -860,16 +882,18 @@ will prompt for tags to be added or removed. Tags 
prefixed with
 Each character of the tag name may consist of alphanumeric
 characters as well as `_.+-'.
 "
-  (interactive "sOperation (+add -drop): notmuch tag ")
-  (let ((action-split (split-string action " +")))
-;; Perform some validation
-(let ((words action-split))
-  (when (null words) (error "No operation given"))
-  (while words
-   (unless (string-match-p "^[-+][-+_.[:word:]]+$" (car words))
- (error "Action must be of the form `+thistag -that_tag'"))
-   (setq words (cdr words
-(apply 'notmuch-tag notmuch-search-query-string action-split)))
+  (interactive (list (notmuch-select-tags-with-completion
+ "Operation (+add -drop): notmuch tag " nil
+ '("+" "-"
+  (setq action (delete "" action))
+  ;; Perform some validation
+  (let ((words action))
+(when (null words) (error "No operation given"))
+(while words
+  (unless (string-match-p "^[-+][-+_.[:word:]]+$" (car words))
+   (error "Action must be of the form `+this_tag -that_tag'"))
+  (setq words (cdr words
+  (apply 'notmuch-tag notmuch-search-query-string action))

 (defun notmuch-search-buffer-title (query)
   "Returns the title for a buffer with notmuch search results."
-- 
1.7.8.3



[PATCH] emacs: add completion to "tag all" operation ("*" binding)

2012-01-26 Thread Dmitry Kurochkin
The patch adds  completion to "tag all" operation bound to "*"
(`notmuch-search-operate-all' function).
---
 emacs/notmuch.el |   48 
 1 files changed, 36 insertions(+), 12 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index e02966f..71b0221 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -48,6 +48,7 @@
 ;; required, but is available from http://notmuchmail.org).

 (eval-when-compile (require 'cl))
+(require 'crm)
 (require 'mm-view)
 (require 'message)

@@ -75,12 +76,33 @@ For example:
 (defvar notmuch-query-history nil
   "Variable to store minibuffer history for notmuch queries")

-(defun notmuch-select-tag-with-completion (prompt  search-terms)
+(defun notmuch-tag-completions ( search-terms prefixes)
   (let ((tag-list
 (with-output-to-string
   (with-current-buffer standard-output
 (apply 'call-process notmuch-command nil t nil "search-tags" 
search-terms)
-(completing-read prompt (split-string tag-list "\n+" t) nil nil nil)))
+(setq tag-list (split-string tag-list "\n+" t))
+(if (null prefixes)
+   tag-list
+  (apply #'append
+(mapcar (lambda (tag)
+  (mapcar (lambda (prefix)
+(concat prefix tag)) prefixes))
+tag-list)
+
+(defun notmuch-select-tag-with-completion (prompt  search-terms 
prefixes)
+  (let ((tag-list (notmuch-tag-completions search-terms prefixes)))
+(completing-read prompt tag-list)))
+
+(defun notmuch-select-tags-with-completion (prompt  search-terms 
prefixes)
+  (let ((tag-list (notmuch-tag-completions search-terms prefixes))
+   (crm-separator " ")
+   (crm-local-completion-map (copy-keymap crm-local-completion-map)))
+;; By default, space is bound to "complete word" function.
+;; Re-bind it to insert a space instead.  Note that  still
+;; does the completion.
+(define-key crm-local-completion-map " " 'self-insert-command)
+(completing-read-multiple prompt tag-list)))

 (defun notmuch-foreach-mime-part (function mm-handle)
   (cond ((stringp (car mm-handle))
@@ -860,16 +882,18 @@ will prompt for tags to be added or removed. Tags 
prefixed with
 Each character of the tag name may consist of alphanumeric
 characters as well as `_.+-'.
 "
-  (interactive "sOperation (+add -drop): notmuch tag ")
-  (let ((action-split (split-string action " +")))
-;; Perform some validation
-(let ((words action-split))
-  (when (null words) (error "No operation given"))
-  (while words
-   (unless (string-match-p "^[-+][-+_.[:word:]]+$" (car words))
- (error "Action must be of the form `+thistag -that_tag'"))
-   (setq words (cdr words
-(apply 'notmuch-tag notmuch-search-query-string action-split)))
+  (interactive (list (notmuch-select-tags-with-completion
+ "Operation (+add -drop): notmuch tag " nil
+ '("+" "-"
+  (setq action (delete "" action))
+  ;; Perform some validation
+  (let ((words action))
+(when (null words) (error "No operation given"))
+(while words
+  (unless (string-match-p "^[-+][-+_.[:word:]]+$" (car words))
+   (error "Action must be of the form `+thistag -that_tag'"))
+  (setq words (cdr words
+  (apply 'notmuch-tag notmuch-search-query-string action))

 (defun notmuch-search-buffer-title (query)
   "Returns the title for a buffer with notmuch search results."
-- 
1.7.8.3



gmime2.6 packaging for debian

2012-01-26 Thread Daniel Kahn Gillmor
hey notmuch folks--

those of you who run debian might be interested in the gmime2.6
packaging which i cobbled together for debian from the existing gmime2.4
packaging:

 http://bugs.debian.org/657426

Those of you developing notmuch with the gmime 2.6 patchsets might be
interested in trying it out.  Please let me know of any problems you
might have with the experimental packaging.

It would be good if we could change the build-deps to

 libgmime2.6-dev | libgmime2.4-dev

Regards,

--dkg
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 965 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20120126/068fb50e/attachment.pgp>


[PATCH v4] emacs: add completion to "tag all" operation ("*" binding)

2012-01-26 Thread Austin Clements
Quoth Dmitry Kurochkin on Jan 26 at  9:06 am:
> The patch adds  completion to "tag all" operation bound to "*"
> (`notmuch-search-operate-all' function).
> ---
> 
> On a second thought, `notmuch-select-tag-with-completion' should never
> need `prefixes' argument at all.  So I reverted the API and related
> changes.
> 
> Changes:
> 
> v4:
> 
> * do not change `notmuch-select-tag-with-completion' API, revert
>   related changes
> 
> v3:
> 
> * fixed comments from Austin's review [1]
> 
> v2:
> 
> * s/thistag/this_tag/ for consistency with "that_tag", since we touch
>   the line anyway
> 
> Regards,
>   Dmitry
> 
> [1] id:"20120126013727.GB1176 at mit.edu"
> 
>  emacs/notmuch.el |   53 -
>  1 files changed, 40 insertions(+), 13 deletions(-)
> 
> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> index e02966f..d2af630 100644
> --- a/emacs/notmuch.el
> +++ b/emacs/notmuch.el
> @@ -48,6 +48,7 @@
>  ;; required, but is available from http://notmuchmail.org).
>  
>  (eval-when-compile (require 'cl))
> +(require 'crm)
>  (require 'mm-view)
>  (require 'message)
>  
> @@ -75,12 +76,36 @@ For example:
>  (defvar notmuch-query-history nil
>"Variable to store minibuffer history for notmuch queries")
>  
> -(defun notmuch-select-tag-with-completion (prompt  search-terms)
> +(defun notmuch-tag-completions ( prefixes search-terms)
>(let ((tag-list
>(with-output-to-string
>  (with-current-buffer standard-output
>(apply 'call-process notmuch-command nil t nil "search-tags" 
> search-terms)
> -(completing-read prompt (split-string tag-list "\n+" t) nil nil nil)))
> +(setq tag-list (split-string tag-list "\n+" t))

Since this setq is unconditional, you can do the split-string right in
the let binding, around the with-output-to-string.

> +(if (null prefixes)
> + tag-list
> +  (apply #'append
> +  (mapcar (lambda (tag)
> +(mapcar (lambda (prefix)
> +  (concat prefix tag)) prefixes))
> +  tag-list)
> +
> +(defun notmuch-select-tag-with-completion (prompt  search-terms)
> +  (let ((tag-list (notmuch-tag-completions nil search-terms)))
> +(completing-read prompt tag-list)))
> +
> +(defun notmuch-select-tags-with-completion (prompt  prefixes  
> search-terms)
> +  (let ((tag-list (notmuch-tag-completions prefixes search-terms))
> + (crm-separator " ")
> + (crm-local-completion-map
> +  (let ((map (make-sparse-keymap)))
> +(set-keymap-parent map crm-local-completion-map)
> +map)))
> +;; By default, space is bound to "complete word" function.
> +;; Re-bind it to insert a space instead.  Note that  still
> +;; does the completion.
> +(define-key crm-local-completion-map " " 'self-insert-command)

You could do the define-key inside the (let ((map ..)) ..) so you get
back the fully formed keymap.  Your call.

> +(completing-read-multiple prompt tag-list)))
>  
>  (defun notmuch-foreach-mime-part (function mm-handle)
>(cond ((stringp (car mm-handle))
> @@ -849,7 +874,7 @@ non-authors is found, assume that all of the authors 
> match."
> (goto-char found-target)))
>(delete-process proc
>  
> -(defun notmuch-search-operate-all (action)
> +(defun notmuch-search-operate-all ( actions)
>"Add/remove tags from all matching messages.
>  
>  This command adds or removes tags from all messages matching the
> @@ -860,16 +885,18 @@ will prompt for tags to be added or removed. Tags 
> prefixed with
>  Each character of the tag name may consist of alphanumeric
>  characters as well as `_.+-'.
>  "
> -  (interactive "sOperation (+add -drop): notmuch tag ")
> -  (let ((action-split (split-string action " +")))
> -;; Perform some validation
> -(let ((words action-split))
> -  (when (null words) (error "No operation given"))
> -  (while words
> - (unless (string-match-p "^[-+][-+_.[:word:]]+$" (car words))
> -   (error "Action must be of the form `+thistag -that_tag'"))
> - (setq words (cdr words
> -(apply 'notmuch-tag notmuch-search-query-string action-split)))
> +  (interactive (notmuch-select-tags-with-completion
> + "Operations (+add -drop): notmuch tag "
> + '("+" "-")))
> +  (setq actions (delete "" actions))

Either this line isn't necessary or
notmuch-select-tags-with-completion can do something funny that it
should take care of internally.

> +  ;; Perform some validation
> +  (let ((words actions))
> +(when (null words) (error "No operations given"))
> +(while words
> +  (unless (string-match-p "^[-+][-+_.[:word:]]+$" (car words))
> + (error "Action must be of the form `+this_tag' or `-that_tag'"))
> +  (setq words (cdr words
> +  (apply 'notmuch-tag notmuch-search-query-string actions))
>  
>  (defun notmuch-search-buffer-title (query)
>"Returns the title for a buffer with notmuch search 

[PATCH 2/2] show: Simplify new text formatter code

2012-01-26 Thread Austin Clements
This makes the text formatter take advantage of the new code
structure.  The previously duplicated header logic is now unified,
several things that we used to compute repeatedly across different
callbacks are now computed once, and the code is simpler overall and
32% shorter.

Unifying the header logic causes this to format some dates slightly
differently, so the two affected test cases are updated.
---
 notmuch-show.c |   88 +--
 test/crypto|2 +-
 test/thread-naming |   16 +-
 3 files changed, 32 insertions(+), 74 deletions(-)

diff --git a/notmuch-show.c b/notmuch-show.c
index 6a890b2..30f6501 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -727,67 +727,48 @@ format_part_text (const void *ctx, mime_node_t *node,
 GMimeObject *meta = node->envelope_part ?
GMIME_OBJECT (node->envelope_part) : node->part;
 GMimeContentType *content_type = g_mime_object_get_content_type (meta);
+const notmuch_bool_t leaf = GMIME_IS_PART (node->part);
+const char *part_type;
 int i;

 if (node->envelope_file) {
notmuch_message_t *message = node->envelope_file;
-   const char *headers[] = {
-   "Subject", "From", "To", "Cc", "Bcc", "Date"
-   };
-   const char *name, *value;
-   unsigned int i;

-   printf ("\fmessage{ ");
-   printf ("id:%s depth:%d match:%d filename:%s\n",
+   part_type = "message";
+   printf ("\f%s{ id:%s depth:%d match:%d filename:%s\n",
+   part_type,
notmuch_message_get_message_id (message),
indent,
notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH),
notmuch_message_get_filename (message));
-
-   printf ("\fheader{\n");
-
-   printf ("%s\n", _get_one_line_summary (ctx, message));
-
-   for (i = 0; i < ARRAY_SIZE (headers); i++) {
-   name = headers[i];
-   value = notmuch_message_get_header (message, name);
-   if (value && strlen (value))
-   printf ("%s: %s\n", name, value);
-   }
-   printf ("\fheader}\n");
 } else {
GMimeContentDisposition *disposition = 
g_mime_object_get_content_disposition (meta);
const char *cid = g_mime_object_get_content_id (meta);
+   const char *filename = leaf ?
+   g_mime_part_get_filename (GMIME_PART (node->part)) : NULL;

if (disposition &&
strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 
0)
-   {
-   printf ("\fattachment{ ID: %d", node->part_num);
-
-   } else {
-
-   printf ("\fpart{ ID: %d", node->part_num);
-   }
-
-   if (GMIME_IS_PART (node->part))
-   {
-   const char *filename = g_mime_part_get_filename (GMIME_PART 
(node->part));
-   if (filename)
-   printf (", Filename: %s", filename);
-   }
+   part_type = "attachment";
+   else
+   part_type = "part";

+   printf ("\f%s{ ID: %d", part_type, node->part_num);
+   if (filename)
+   printf (", Filename: %s", filename);
if (cid)
printf (", Content-id: %s", cid);
-
printf (", Content-type: %s\n", g_mime_content_type_to_string 
(content_type));
 }

-if (node->envelope_part) {
+if (GMIME_IS_MESSAGE (node->part)) {
GMimeMessage *message = GMIME_MESSAGE (node->part);
InternetAddressList *recipients;
const char *recipients_string;

printf ("\fheader{\n");
+   if (node->envelope_file)
+   printf ("%s\n", _get_one_line_summary (ctx, node->envelope_file));
printf ("Subject: %s\n", g_mime_message_get_subject (message));
printf ("From: %s\n", g_mime_message_get_sender (message));
recipients = g_mime_message_get_recipients (message, 
GMIME_RECIPIENT_TYPE_TO);
@@ -800,9 +781,11 @@ format_part_text (const void *ctx, mime_node_t *node,
printf ("Cc: %s\n", recipients_string);
printf ("Date: %s\n", g_mime_message_get_date_as_string (message));
printf ("\fheader}\n");
+
+   printf ("\fbody{\n");
 }

-if (!node->envelope_file) {
+if (leaf) {
if (g_mime_content_type_is_type (content_type, "text", "*") &&
!g_mime_content_type_is_type (content_type, "text", "html"))
{
@@ -810,45 +793,20 @@ format_part_text (const void *ctx, mime_node_t *node,
g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), 
FALSE);
show_text_part_content (node->part, stream_stdout);
g_object_unref(stream_stdout);
-   }
-   else if (g_mime_content_type_is_type (content_type, "multipart", "*") ||
-g_mime_content_type_is_type (content_type, "message", 
"rfc822"))
-   {
-   /* Do nothing for multipart since its content will be printed
-* when recursing. */
-   }
-   else
-   {
+   } else {
printf 

[PATCH 1/2] show: Convert text format to the new self-recursive style

2012-01-26 Thread Austin Clements
This is all code movement and a smidgen of glue.  This moves the
existing text formatter code into one self-recursive function, but
doesn't change any of the logic.  The next patch will actually take
advantage of what the new structure has to offer.

Note that this patch retains format_headers_message_part_text because
it is also used by the raw format.
---
 notmuch-show.c |  270 +---
 1 files changed, 139 insertions(+), 131 deletions(-)

diff --git a/notmuch-show.c b/notmuch-show.c
index dec799c..6a890b2 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -21,40 +21,17 @@
 #include "notmuch-client.h"

 static void
-format_message_text (unused (const void *ctx),
-notmuch_message_t *message,
-int indent);
-static void
-format_headers_text (const void *ctx,
-notmuch_message_t *message);
-
-static void
 format_headers_message_part_text (GMimeMessage *message);

 static void
-format_part_start_text (GMimeObject *part,
-   int *part_count);
-
-static void
-format_part_content_text (GMimeObject *part);
-
-static void
-format_part_end_text (GMimeObject *part);
+format_part_text (const void *ctx, mime_node_t *node,
+ int indent, const notmuch_show_params_t *params);

 static const notmuch_show_format_t format_text = {
-"", NULL,
-   "\fmessage{ ", format_message_text,
-   "\fheader{\n", format_headers_text, 
format_headers_message_part_text, "\fheader}\n",
-   "\fbody{\n",
-   format_part_start_text,
-   NULL,
-   NULL,
-   format_part_content_text,
-   format_part_end_text,
-   "",
-   "\fbody}\n",
-   "\fmessage}\n", "",
-""
+.message_set_start = "",
+.part = format_part_text,
+.message_set_sep = "",
+.message_set_end = ""
 };

 static void
@@ -191,16 +168,6 @@ _get_one_line_summary (const void *ctx, notmuch_message_t 
*message)
 }

 static void
-format_message_text (unused (const void *ctx), notmuch_message_t *message, int 
indent)
-{
-printf ("id:%s depth:%d match:%d filename:%s\n",
-   notmuch_message_get_message_id (message),
-   indent,
-   notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH),
-   notmuch_message_get_filename (message));
-}
-
-static void
 format_message_json (const void *ctx, notmuch_message_t *message, unused (int 
indent))
 {
 notmuch_tags_t *tags;
@@ -338,26 +305,6 @@ format_message_mbox (const void *ctx,
 fclose (file);
 }

-
-static void
-format_headers_text (const void *ctx, notmuch_message_t *message)
-{
-const char *headers[] = {
-   "Subject", "From", "To", "Cc", "Bcc", "Date"
-};
-const char *name, *value;
-unsigned int i;
-
-printf ("%s\n", _get_one_line_summary (ctx, message));
-
-for (i = 0; i < ARRAY_SIZE (headers); i++) {
-   name = headers[i];
-   value = notmuch_message_get_header (message, name);
-   if (value && strlen (value))
-   printf ("%s: %s\n", name, value);
-}
-}
-
 static void
 format_headers_message_part_text (GMimeMessage *message)
 {
@@ -523,78 +470,6 @@ signer_status_to_string (GMimeSignerStatus x)
 #endif

 static void
-format_part_start_text (GMimeObject *part, int *part_count)
-{
-GMimeContentDisposition *disposition = 
g_mime_object_get_content_disposition (part);
-
-if (disposition &&
-   strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 0)
-{
-   printf ("\fattachment{ ID: %d", *part_count);
-
-} else {
-
-   printf ("\fpart{ ID: %d", *part_count);
-}
-}
-
-static void
-format_part_content_text (GMimeObject *part)
-{
-const char *cid = g_mime_object_get_content_id (part);
-GMimeContentType *content_type = g_mime_object_get_content_type 
(GMIME_OBJECT (part));
-
-if (GMIME_IS_PART (part))
-{
-   const char *filename = g_mime_part_get_filename (GMIME_PART (part));
-   if (filename)
-   printf (", Filename: %s", filename);
-}
-
-if (cid)
-   printf (", Content-id: %s", cid);
-
-printf (", Content-type: %s\n", g_mime_content_type_to_string 
(content_type));
-
-if (g_mime_content_type_is_type (content_type, "text", "*") &&
-   !g_mime_content_type_is_type (content_type, "text", "html"))
-{
-   GMimeStream *stream_stdout = g_mime_stream_file_new (stdout);
-   g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE);
-   show_text_part_content (part, stream_stdout);
-   g_object_unref(stream_stdout);
-}
-else if (g_mime_content_type_is_type (content_type, "multipart", "*") ||
-g_mime_content_type_is_type (content_type, "message", "rfc822"))
-{
-   /* Do nothing for multipart since its content will be printed
-* when recursing. */
-}
-else
-{
-   printf ("Non-text part: %s\n",
-   

[PATCH 0/2] Rewrite text show format

2012-01-26 Thread Austin Clements
And now the real fun begins.  This series translates the text
formatter into the new format style in two steps: the first patch is a
big diff but just shuffles code and the second actually takes
advantage of the new structure.

This incorporates Dmitry's comments on the RFC patch series from
id:87lioxna2n.fsf at gmail.com .



[Emacs] Bug?: notmuch-search-show-thread shows several threads; only one containing matching messages

2012-01-26 Thread Gregor Zattler
[sorry for the long and meandering explanation, I do not know how
to express the issue more concise]

Dear notmuch developers,

may someone please enlighten me regarding this behaviour: 

I experienced a situation where the Emacs interface shows three
(3) different threads in one notmuch show buffer.  I thought it
should show only one.  Perhaps this is the result of notmuch show
showing messages which do not match the search pattern and do not
belong to one thread which contains messages which do so.[1]


What I did:

I remembered a thread on the Emacs-orgmode mailing list about
date ranges in various Emacs implementations/compilations and
searched for it with this search expression:

folder:orgmode date 64 bit 32

it resulted in a *notmuch-search-folder:orgmode date 64 bit 32*
buffer containing 5 lines with matching threads, one of it with 7
out of 99 matching messages and the subject "[O]: dates before
1970", I selected this one with RET (notmuch-search-show-thread)
and got a notmuch show mode buffer.

The buffer begins with this thread (which is the one I
remembered: ~20 messages) but contains 2 more totally different
threads ("[O] Slow movement in large buffers" and "[O] The
Org->ODT exporter is now in Org's core") with no matching
messages at all (at least all of the messages are
invisible/folded).  The starting messages of these two additional
threads were shown with no indentation -- because they start a
thread.

I don't know for sure if the broad search pattern really does not
apply to at least some of the messages in the 2 additional
threads.[1]  But even if: why are they part of the same 
buffer resulting from notmuch-search-show-thread?

In order to further investigate this phenomenon I run notmuch from
the command line like:
notmuch show  --entire-thread  --format=mbox   folder:orgmode date 64 bit 32 
>/tmp/date64.mbox

and opened the resulting mbox with mutt.  mutt showed the thread
I was interested in and several other threads which are not part
of this one.  I isolated the thread I was interested in,
extracted the message ids of its messages and greped the rest of
the messages for this message ids: no matches.[2] Therefore no of
the rests messages are part of the thread I was interested in but
some of them were also part of the notmuch show buffer alongside
the one thread I was interested in.

My expectation was to only see one thread: the one with the
matching messages.

So this about the Emacs interface and perhaps about what a
notmuch search matches.

Can somebody please explain this to me?  Since all relevant
messages are public I am able to provide the relevant messages as
one mbox file (2.9 MB).


Ciao, Gregor
-- 
[1] I don't know how to test if messages should show up in an
notmuch serch query with "date bit 64 32" being the serach
pattern.  When I did a rgrep -l -I date
/tmp/unmatched.maildir|xargs egrep -l -I bit |xargs egrep -l
-I 64|xargs egrep -l -I 32 I got many hits but this is to be
expected since every e-mail has a "Date" header and enough
headers to match "64" and "32" and since its a mailing list
discussion software "bit" is also to be expected in these
e-mails.

[2] grep -I "^Message-Id:" /tmp/thread-I-m-interested-in.mbox |sed -e 
"s/Message-Id: $//" >really.mid
grep -I -F really.mid rest.mbox
--> no match


[RFC PATCH 5/5] show: Simplify new text formatter code

2012-01-26 Thread Austin Clements
Quoth Dmitry Kurochkin on Jan 24 at  5:49 am:
> On Wed, 11 Jan 2012 20:49:33 -0500, Austin Clements  
> wrote:
> > This makes the text formatter take advantage of the new code
> > structure.  The previously duplicated header logic is now unified,
> > several things that we used to compute repeatedly across different
> > callbacks are now computed once, and the code is generally simplified.
> > 
> > Unifying the header logic causes this to format some dates slightly
> > differently, so the two affected test cases are updated.
> 
> Thanks for these patches, Austin.  They are a definite improvement for
> notmuch show code.  I hope it would soon get pushed to master.  And I
> hope more patches would follow :)
> 
> Few minor comments below.
> 
> > ---
> >  notmuch-show.c |   84 
> > 
> >  test/crypto|2 +-
> >  test/thread-naming |   16 +-
> >  3 files changed, 28 insertions(+), 74 deletions(-)
> > 
> > diff --git a/notmuch-show.c b/notmuch-show.c
> > index 3241965..1689222 100644
> > --- a/notmuch-show.c
> > +++ b/notmuch-show.c
> > @@ -175,67 +175,42 @@ format_part_text (const void *ctx, mime_node_t *node,
> >  GMimeObject *meta = node->envelope_part ?
> > GMIME_OBJECT (node->envelope_part) : node->part;
> >  GMimeContentType *content_type = g_mime_object_get_content_type (meta);
> > +GMimeContentDisposition *disposition =
> > +   g_mime_object_get_content_disposition (meta);
> > +notmuch_bool_t attachment = disposition &&
> > +   strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 0;
> 
> If I did not miss anything, attachment is used only as following:
> 
>   attachment ? "attachment" : "part"
> 
> Please make it const char[] and set to "attachment" or "part".

Ooh, good catch.  But I'll do you one better.  I introduced a const
char *part_type that's set to "attachment", "part", *or* "message" in
the if structure below.  That eliminates the attachment variable,
moves the disposition variable back down into one of the early if
bodies, and eliminates the entire conditional the figures out what to
print to close the block.

> > +notmuch_bool_t leaf = GMIME_IS_PART (node->part);
> 
> Please add const where possible to local variables (e.g. attachment, leaf).

Generally I consider these overkill on local non-pointer variables,
but okay.  leaf wound up being the only one I had to add it to.

> >  int i;
> >  
> >  if (node->envelope_file) {
> > notmuch_message_t *message = node->envelope_file;
> > -   const char *headers[] = {
> > -   "Subject", "From", "To", "Cc", "Bcc", "Date"
> > -   };
> > -   const char *name, *value;
> > -   unsigned int i;
> >  
> > -   printf ("\fmessage{ ");
> > -   printf ("id:%s depth:%d match:%d filename:%s\n",
> > +   printf ("\fmessage{ id:%s depth:%d match:%d filename:%s\n",
> > notmuch_message_get_message_id (message),
> > indent,
> > notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH),
> > notmuch_message_get_filename (message));
> > -
> > -   printf ("\fheader{\n");
> > -
> > -   printf ("%s\n", _get_one_line_summary (ctx, message));
> > -
> > -   for (i = 0; i < ARRAY_SIZE (headers); i++) {
> > -   name = headers[i];
> > -   value = notmuch_message_get_header (message, name);
> > -   if (value && strlen (value))
> > -   printf ("%s: %s\n", name, value);
> > -   }
> > -   printf ("\fheader}\n");
> 
> Yay!  Only one header-printing code left :)
> 
> >  } else {
> > -   GMimeContentDisposition *disposition = 
> > g_mime_object_get_content_disposition (meta);
> > const char *cid = g_mime_object_get_content_id (meta);
> > +   const char *filename = leaf ?
> > +   g_mime_part_get_filename (GMIME_PART (node->part)) : NULL;
> >  
> > -   if (disposition &&
> > -   strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 
> > 0)
> > -   {
> > -   printf ("\fattachment{ ID: %d", node->part_num);
> > -
> > -   } else {
> > -
> > -   printf ("\fpart{ ID: %d", node->part_num);
> > -   }
> > -
> > -   if (GMIME_IS_PART (node->part))
> > -   {
> > -   const char *filename = g_mime_part_get_filename (GMIME_PART 
> > (node->part));
> > -   if (filename)
> > -   printf (", Filename: %s", filename);
> > -   }
> > -
> > +   printf ("\f%s{ ID: %d", attachment ? "attachment" : "part", 
> > node->part_num);
> > +   if (filename)
> 
> I always forget about it, can we declare variables inside if condition
> like in C++?  I.e.:
> 
>   if (const char *filename = leaf ? g_mime_part_get_filename (GMIME_PART 
> (node->part)) : NULL)
> 
> If yes, I would prefer to use this style where possible.

You can do that in C++?  You definitely can't do that in C.

> > +   printf (", Filename: %s", filename);
> > if (cid)
> > printf (", Content-id: %s", cid);
> > -
> 
> I would revert blank line changes.  But I do not insist :)

Eh.  I'm generally 

[PATCH 1/2] emacs: Re-enable line wrapping in `notmuch-show-mode'.

2012-01-26 Thread David Edmondson
Turn on `visual-line-mode' via a hook, so that those who so choose can
avoid it.
---
 emacs/notmuch-show.el |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index e6a5b31..effd2fd 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -71,9 +71,10 @@ any given message.
   A list of functions called to decorate the headers listed in
 `notmuch-message-headers'.)
 
-(defcustom notmuch-show-hook nil
+(defcustom notmuch-show-hook '(notmuch-show-turn-on-visual-line-mode)
   Functions called after populating a `notmuch-show' buffer.
   :type 'hook
+  :options '(notmuch-show-turn-on-visual-line-mode)
   :group 'notmuch-show
   :group 'notmuch-hooks)
 
@@ -133,6 +134,10 @@ indentation.
,@body)
 (kill-buffer buf)
 
+(defun notmuch-show-turn-on-visual-line-mode ()
+  Enable Visual Line mode.
+  (visual-line-mode t))
+
 (defun notmuch-show-view-all-mime-parts ()
   Use external viewers to view all attachments from the current message.
   (interactive)
-- 
1.7.8.3

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


[PATCH 2/2] emacs: Add more processing of displayed headers.

2012-01-26 Thread David Edmondson
Wrap headers to the width of the window and indent continuations.
---
 emacs/notmuch-show.el |   43 ---
 1 files changed, 36 insertions(+), 7 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index effd2fd..ad286d1 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -67,9 +67,16 @@ any given message.
   :type 'boolean
   :group 'notmuch-show)
 
-(defvar notmuch-show-markup-headers-hook '(notmuch-show-colour-headers)
+(defcustom notmuch-show-markup-headers-hook '(notmuch-show-colour-headers
+ notmuch-show-fill-headers
+ notmuch-show-indent-continuations)
   A list of functions called to decorate the headers listed in
-`notmuch-message-headers'.)
+`notmuch-message-headers'.
+  :type 'hook
+  :options '(notmuch-show-colour-headers
+notmuch-show-fill-headers
+notmuch-show-indent-continuations)
+  :group 'notmuch-show)
 
 (defcustom notmuch-show-hook '(notmuch-show-turn-on-visual-line-mode)
   Functions called after populating a `notmuch-show' buffer.
@@ -268,13 +275,35 @@ operation on the contents of the current buffer.
 (overlay-put (make-overlay (point) (re-search-forward .*$))
 'face face)))
 
-(defun notmuch-show-colour-headers ()
+(defun notmuch-show-colour-headers (depth)
   Apply some colouring to the current headers.
   (goto-char (point-min))
   (while (looking-at ^[A-Za-z][-A-Za-z0-9]*:)
 (notmuch-show-fontify-header)
 (forward-line)))
 
+(defun notmuch-show-fill-headers (depth)
+  Wrap the text of the current headers.
+
+  ;; '-5' to allow for the indentation code.
+  (let ((fill-column (- (window-width) depth 5)))
+(goto-char (point-min))
+(while (not (eobp))
+  (let ((start (point)))
+   (end-of-line)
+   ;; We're left at the start of the next line, so there's no need
+   ;; to move forward after filling.
+   (fill-region-as-paragraph start (point))
+
+(defun notmuch-show-indent-continuations (depth)
+  Indent any continuation lines.
+  (goto-char (point-min))
+  (while (not (eobp))
+(if (not (looking-at ^[A-Za-z][-A-Za-z0-9]*:))
+   ;; Four spaces tends to work well with 'To' and 'Cc' headers.
+   (insert ))
+(forward-line)))
+
 (defun notmuch-show-spaces-n (n)
   Return a string comprised of `n' spaces.
   (make-string n ? ))
@@ -329,7 +358,7 @@ message at DEPTH in the current thread.
   Insert a single header.
   (insert header :  header-value \n))
 
-(defun notmuch-show-insert-headers (headers)
+(defun notmuch-show-insert-headers (headers depth)
   Insert the headers of the current message.
   (let ((start (point)))
 (mapc (lambda (header)
@@ -342,7 +371,7 @@ message at DEPTH in the current thread.
 (save-excursion
   (save-restriction
(narrow-to-region start (point-max))
-   (run-hooks 'notmuch-show-markup-headers-hook)
+   (run-hook-with-args 'notmuch-show-markup-headers-hook depth)
 
 (define-button-type 'notmuch-show-part-button-type
   'action 'notmuch-show-part-button-default
@@ -633,7 +662,7 @@ current buffer, if possible.
 ;; Override `notmuch-message-headers' to force `From' to be
 ;; displayed.
 (let ((notmuch-message-headers '(From Subject To Cc Date)))
-  (notmuch-show-insert-headers (plist-get message :headers)))
+  (notmuch-show-insert-headers (plist-get message :headers) 0))
 
 ;; Blank line after headers to be compatible with the normal
 ;; message display.
@@ -826,7 +855,7 @@ current buffer, if possible.
 ;; Set `headers-start' to point after the 'Subject:' header to be
 ;; compatible with the existing implementation. This just sets it
 ;; to after the first header.
-(notmuch-show-insert-headers headers)
+(notmuch-show-insert-headers headers depth)
 ;; Headers should include a blank line (backwards compatibility).
 (insert \n)
 (save-excursion
-- 
1.7.8.3

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


Re: Emacs: Crypto: How to get automatic encryption?

2012-01-26 Thread David Edmondson
On Wed, 25 Jan 2012 09:45:01 -0800, Jameson Graef Rollins 
jroll...@finestructure.net wrote:
 On Wed, 25 Jan 2012 10:20:26 +, David Edmondson d...@dme.org wrote:
  Isn't it still necessary to ensure that you have encryption keys
  appropriate to the recipient?
 
 I want to ensure that all replies to encrypted to be encrypted.  I
 would rather have the reply fail outright than fall back to
 unencrypted.

That's a policy decision that a user can (and perhaps should) take, but
not something that should be enforced by the tool. Encouraging this
approach is fine, of course. I can think of various situations where I
might send an un-encrypted reply to an encrypted message.

 Here's a behavior that I think would be reasonable:
 
  * notmuch reply outputs JSON encrypted flag
 
  * emacs does a quick check to see if the needed key is available
 
  * if key not available: give a nice mini-buffer prompt, something like:
  
 'encryption key for Foo Bar f...@bar.com not found.  Retrieve?'
 
* if response is yes: call gpg to retrieve the key
 
  * if key available: add encrypt flag
 
else: I feel like this should abort, but maybe there's something to
  be done here.  Allow reply but don't quote the original?

How about:
- notmuch reply outputs JSON encrypted flag,
- emacs inserts the relevant mml to request that the reply is sent
  encrypted if the flag is present.

With this approach the default behaviour is to send an encrypted reply
to an encrypted message, but the user has the chance to change the
behaviour using familiar (well, as familiar as mml can be) tools.

Adding improvements to retrieve keys for outgoing messages would be
generally useful - it's not just an issue for replies.


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


[PATCH 2/2] added support for user-specified directories to exclude

2012-01-26 Thread Tomi Ollila
A new configuration key 'database.exclude' is used to determine
which directories user wants not to be scanned for new mails.

---

Notes (from 2011-09-13):

1) Currently the comments for newly created configuration file are not
updated, so for not this is 'undocumented feature'. Should there be an
empty configuration line as a placeholder ... ?

2) Whenever some already existing directory is added to the exclude list
and the parent directory timestamp has not changed, notmuch new will not
notice the directory has gone (as it still is there), user needs to 'touch'
the parent directory before next 'notmuch new' no make notmuch notice.

2012-01-26: could notmuch track mtime of the configuration file and if
that changes, ignore mail directory timestamps ?

3) count_files() function is not touched. The functionality there has fallen
behind of add_files_recursive (maildir+tmp check and following symlinks).
The question there should it be updated, or attempted to merge with
add_files (as the comment says). count_files() is only called at the beginning
when database is not yet initialised.
---
 notmuch-client.h |3 +++
 notmuch-config.c |   13 +
 notmuch-new.c|   22 --
 3 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/notmuch-client.h b/notmuch-client.h
index e0eb594..78460fc 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -219,6 +219,9 @@ void
 notmuch_config_set_database_path (notmuch_config_t *config,
  const char *database_path);
 
+const char **
+notmuch_config_get_database_exclude (notmuch_config_t *config,
+size_t *length);
 const char *
 notmuch_config_get_user_name (notmuch_config_t *config);
 
diff --git a/notmuch-config.c b/notmuch-config.c
index a124e34..e236114 100644
--- a/notmuch-config.c
+++ b/notmuch-config.c
@@ -99,6 +99,8 @@ struct _notmuch_config {
 GKeyFile *key_file;
 
 char *database_path;
+const char **database_exclude;
+size_t database_exclude_length;
 char *user_name;
 char *user_primary_email;
 const char **user_other_email;
@@ -258,6 +260,8 @@ notmuch_config_open (void *ctx,
 config-key_file = g_key_file_new ();
 
 config-database_path = NULL;
+config-database_exclude = NULL;
+config-database_exclude_length = 0;
 config-user_name = NULL;
 config-user_primary_email = NULL;
 config-user_other_email = NULL;
@@ -537,6 +541,15 @@ notmuch_config_set_database_path (notmuch_config_t *config,
 config-database_path = NULL;
 }
 
+const char **
+notmuch_config_get_database_exclude (notmuch_config_t *config,
+size_t *length)
+{
+return _config_get_list (config, database, exclude,
+(config-database_exclude),
+(config-database_exclude_length), length);
+}
+
 const char *
 notmuch_config_get_user_name (notmuch_config_t *config)
 {
diff --git a/notmuch-new.c b/notmuch-new.c
index a569a54..d607f5b 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -39,6 +39,8 @@ typedef struct {
 int verbose;
 const char **new_tags;
 size_t new_tags_length;
+const char **database_exclude;
+size_t database_exclude_length;
 
 int total_files;
 int processed_files;
@@ -300,6 +302,8 @@ add_files_recursive (notmuch_database_t *notmuch,
 is_maildir = _entries_resemble_maildir (fs_entries, num_fs_entries);
 
 for (i = 0; i  num_fs_entries; i++) {
+   size_t j;
+
if (interrupted)
break;
 
@@ -323,8 +327,6 @@ add_files_recursive (notmuch_database_t *notmuch,
 * Also ignore the .notmuch directory and any tmp directory
 * that appears within a maildir.
 */
-   /* XXX: Eventually we'll want more sophistication to let the
-* user specify files to be ignored. */
if (strcmp (entry-d_name, .) == 0 ||
strcmp (entry-d_name, ..) == 0 ||
(is_maildir  strcmp (entry-d_name, tmp) == 0) ||
@@ -332,6 +334,12 @@ add_files_recursive (notmuch_database_t *notmuch,
{
continue;
}
+   /* Ignore user-specified directories */
+   for (j = 0; j  state-database_exclude_length; j++)
+   if (strcmp(entry-d_name, state-database_exclude[j]) == 0)
+   break;
+   if (j  state-database_exclude_length)
+   continue;
 
next = talloc_asprintf (notmuch, %s/%s, path, entry-d_name);
status = add_files_recursive (notmuch, next, state);
@@ -364,11 +372,20 @@ add_files_recursive (notmuch_database_t *notmuch,
 /* Pass 2: Scan for new files, removed files, and removed directories. */
 for (i = 0; i  num_fs_entries; i++)
 {
+   size_t j;
+
if (interrupted)
break;
 
 entry = fs_entries[i];
 
+   /* Ignore user-specified files  directories */
+   for (j = 0; j  state-database_exclude_length; j++)
+   if (strcmp(entry-d_name, 

Re: [PATCH] emacs: Fix a notmuch-print.el compiler warning.

2012-01-26 Thread David Bremner
On Wed, 25 Jan 2012 08:52:15 +, David Edmondson d...@dme.org wrote:
 `notmuch-show-get-prop' should be declared.

pushed.

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


Re: [PATCH] emacs: Make the part content available to `mm-inlinable-p'.

2012-01-26 Thread David Bremner
On Thu, 19 Jan 2012 09:34:07 +, David Edmondson d...@dme.org wrote:
 The `mm-inlinable-p' function works better if it has access to the
 data of the relevant part, so load that content before calling it.

pushed

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


Re: [PATCH 0/4 v3] more care when hiding regions with buttons

2012-01-26 Thread David Bremner
On Thu, 26 Jan 2012 07:19:36 +, David Edmondson d...@dme.org wrote:
 Address Dmitry's comments.
 
 David Edmondson (4):
   test: `visible-buffer-substring' should not return text properties.
   test: `notmuch-test-run' should protect against buffer switching.
pushed the first two.

   test: Add test for Original Message hiding at point-min.
   emacs: Take more care when hiding regions with buttons.

waiting on review.

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


Re: Bug?: notmuch-search-show-thread shows several threads; only one containing matching messages

2012-01-26 Thread Gregor Zattler
Hi Jamie, Austin,
* Jameson Graef Rollins jroll...@finestructure.net [25. Jan. 2012]:
 On Wed, 25 Jan 2012 20:19:03 -0500, Austin Clements amdra...@mit.edu wrote:
 One very common cause of this is someone using reply to get an
 initial set of recipients, but then replacing the entire message and
 subject (presumably without realizing that the mail is still tracking
 what it was a reply to).  This can also happen if someone
 intentionally replies to multiple messages (though few mail clients
 support this), or if there was a message ID collision.
 
 This is a very common occurrence for me as well.  I would put money down
 that this is what you're seeing.

I thought about this too and this is why I checked for any
occurrence of Message-IDs in the other emails: 

   | I isolated the thread I was interested in,
   | extracted the message ids of its messages and greped the rest of
   | the messages for this message ids: no matches.[2] Therefore no of
   | the rests messages are part of the thread I was interested in

perhaps there was a logic error in how I did this:

   | [2] grep -I ^Message-Id: /tmp/thread-I-m-interested-in.mbox |sed -e 
s/Message-Id: //I -e s/$// really.mid
   | grep -I -F really.mid rest.mbox
   | -- no match

/tmp/thread-I-m-interested-in.mbox  is a mbox with messages
I'minterested in, the real ones.  really.mid is a list of
Message-IDs of these real emails.  rest.mbox is a mbox with the
other emails, Emacs showed in his notmuch show buffer but are
other threads.

Since there is no match I concluded, the threads are not linked.
Perhaps I made a mistake.  I'l retest it and report again.  But
right now I don't have the time to do this.

Ciao, Gregor
-- 
 -... --- .-. . -.. ..--.. ...-.-
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 1/3] emacs: s/buttonise/buttonize/g

2012-01-26 Thread Pieter Praet
On Wed, 25 Jan 2012 07:16:13 -0400, David Bremner da...@tethera.net wrote:
 On Thu, 12 Jan 2012 18:23:43 +0100, Pieter Praet pie...@praet.org wrote:
  Worldwide, -ize endings prevail in scientific writing and are commonly
  used by many international organizations, such as the ISO and the
  WHO. The European Union switched from -ize to -ise some years ago in its
  English language publications, and this resulted in the coexistence of
 
 needs rebasing against master. 
 

Actually, it's been superseded by:
  id:1327222469-29487-1-git-send-email-pie...@praet.org

 d
 
 P.S. Personally think it's a bit silly, [...]

Perhaps it is, but then again, spelling errors may be considered as
being indicative of the quality of the project as a whole, so it
wouldn't hurt to keep them to a minimum.

 [...] but that might be because I'm
 Canadian, and we are all about the inconsistent anglo/american
 spelling. [...]

Exactly!

American and Canadian spelling accepts only -ize endings in
most cases, [...] [1]  :)

 [...] But if the consensus is to follow the UN black helicopter
 spelling police, ok :).

Follow WHO? (lame pun intended...)


Peace

-- 
Pieter

[1] 
http://en.wikipedia.org/wiki/American_and_British_English_spelling_differences#-ise.2C_-ize_.28-isation.2C_-ization.29
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 1/2] moved _notmuch_get_list () and _notmuch_set_list () up in file

2012-01-26 Thread Jani Nikula
On Thu, 26 Jan 2012 12:11:57 +0200, Tomi Ollila tomi.oll...@iki.fi wrote:
 Moved _notmuch_get_list () and _notmuch_set_list () to a location
 in notmuch-config.c so that new functions that will be located 
 before the old location of those functions can also use these.

Parse error. ;)

You mean something along the lines of: Move _notmuch_get_list () and
_notmuch_set_list () earlier in the file to avoid forward declarations
in further work. No functional changes.

I'm sure native speakers can bikeshed that further. ;)

BR,
Jani.


 ---
 
 This patch is independent of the next one (just required by it)
 and can (should) be pushed early.
 
  notmuch-config.c |   84 
 +++---
  1 files changed, 42 insertions(+), 42 deletions(-)
 
 diff --git a/notmuch-config.c b/notmuch-config.c
 index 0ded6d7..a124e34 100644
 --- a/notmuch-config.c
 +++ b/notmuch-config.c
 @@ -467,6 +467,48 @@ notmuch_config_save (notmuch_config_t *config)
  return 0;
  }
  
 +static const char **
 +_config_get_list (notmuch_config_t *config,
 +   const char *section, const char *key,
 +   const char ***outlist, size_t *list_length, size_t 
 *ret_length)
 +{
 +assert(outlist);
 +
 +if (*outlist == NULL) {
 +
 + char **inlist = g_key_file_get_string_list (config-key_file,
 +  section, key, list_length, NULL);
 + if (inlist) {
 + unsigned int i;
 +
 + *outlist = talloc_size (config, sizeof (char *) * (*list_length + 
 1));
 +
 + for (i = 0; i  *list_length; i++)
 + (*outlist)[i] = talloc_strdup (*outlist, inlist[i]);
 +
 + (*outlist)[i] = NULL;
 +
 + g_strfreev (inlist);
 + }
 +}
 +
 +if (ret_length)
 + *ret_length = *list_length;
 +
 +return *outlist;
 +}
 +
 +static void
 +_config_set_list (notmuch_config_t *config,
 +   const char *group, const char *name,
 +   const char *list[],
 +   size_t length, const char ***config_var )
 +{
 +g_key_file_set_string_list (config-key_file, group, name, list, length);
 +talloc_free (*config_var);
 +*config_var = NULL;
 +}
 +
  const char *
  notmuch_config_get_database_path (notmuch_config_t *config)
  {
 @@ -551,37 +593,6 @@ notmuch_config_set_user_primary_email (notmuch_config_t 
 *config,
  config-user_primary_email = NULL;
  }
  
 -static const char **
 -_config_get_list (notmuch_config_t *config,
 -   const char *section, const char *key,
 -   const char ***outlist, size_t *list_length, size_t 
 *ret_length)
 -{
 -assert(outlist);
 -
 -if (*outlist == NULL) {
 -
 - char **inlist = g_key_file_get_string_list (config-key_file,
 -  section, key, list_length, NULL);
 - if (inlist) {
 - unsigned int i;
 -
 - *outlist = talloc_size (config, sizeof (char *) * (*list_length + 
 1));
 -
 - for (i = 0; i  *list_length; i++)
 - (*outlist)[i] = talloc_strdup (*outlist, inlist[i]);
 -
 - (*outlist)[i] = NULL;
 -
 - g_strfreev (inlist);
 - }
 -}
 -
 -if (ret_length)
 - *ret_length = *list_length;
 -
 -return *outlist;
 -}
 -
  const char **
  notmuch_config_get_user_other_email (notmuch_config_t *config,   size_t 
 *length)
  {
 @@ -598,17 +609,6 @@ notmuch_config_get_new_tags (notmuch_config_t *config,   
 size_t *length)
(config-new_tags_length), length);
  }
  
 -static void
 -_config_set_list (notmuch_config_t *config,
 -   const char *group, const char *name,
 -   const char *list[],
 -   size_t length, const char ***config_var )
 -{
 -g_key_file_set_string_list (config-key_file, group, name, list, length);
 -talloc_free (*config_var);
 -*config_var = NULL;
 -}
 -
  void
  notmuch_config_set_user_other_email (notmuch_config_t *config,
const char *list[],
 -- 
 1.7.6.4
 
 ___
 notmuch mailing list
 notmuch@notmuchmail.org
 http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: make `notmuch-show-open-or-close-all' toggle visibility

2012-01-26 Thread Pieter Praet
On Wed, 25 Jan 2012 06:35:33 +, David Edmondson d...@dme.org wrote:
 On Wed, 25 Jan 2012 06:25:39 +0100, Pieter Praet pie...@praet.org wrote:
  * emacs/notmuch-show.el (notmuch-show-open-or-close-all):
Rename to `notmuch-show-toggle-all-messages', and make it toggle
visibility of all messages based on the visibility of the current
message, instead of setting visibility based on whether or not a
prefix arg was supplied.
  
  Same functionality, less effort (reaching for 'C-u' is a pain)...
 
 -1.
 
 The behaviour you've provided is not what I want, from two perspectives:
 - currently it's clear what will happen when I use M-RET or
   C-uM-RET without me having to think about whether the cursor
   is over an open message,
 - often I'll be reading an open message and I want to open all
   of the rest to look at some context. That's a little more
   awkward after this change.

I may be missing something, but wouldn't both issues be solved by simply
pressing M-RET a second time?  I've been using this for a little while
now, and IMO it makes navigating through long and diverging threads a lot
faster, much like zooming in/out on an outline.

How about if C-u M-RET behaved as usual ?


  
  ---
   emacs/notmuch-show.el |   22 --
   1 files changed, 12 insertions(+), 10 deletions(-)
  
  diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
  index e6a5b31..2d17f74 100644
  --- a/emacs/notmuch-show.el
  +++ b/emacs/notmuch-show.el
  @@ -1050,8 +1050,8 @@ thread id.  If a prefix is given, crypto processing 
  is toggled.
  (define-key map p 'notmuch-show-previous-open-message)
  (define-key map (kbd DEL) 'notmuch-show-rewind)
  (define-key map   'notmuch-show-advance-and-archive)
  -   (define-key map (kbd M-RET) 'notmuch-show-open-or-close-all)
  (define-key map (kbd RET) 'notmuch-show-toggle-message)
  +   (define-key map (kbd M-RET) 'notmuch-show-toggle-all-messages)
  (define-key map # 'notmuch-show-print-message)
  map)
 Keymap for \notmuch show\ buffers.)
  @@ -1502,16 +1502,18 @@ the result.
(not (plist-get props :message-visible
 (force-window-update))
   
  -(defun notmuch-show-open-or-close-all ()
  -  Set the visibility all of the messages in the current thread.
  -By default make all of the messages visible. With a prefix
  -argument, hide all of the messages.
  +(defun notmuch-show-toggle-all-messages ()
  +  Toggle the visibility of all messages in the current thread.
  +If the current message is visible, hide all messages -- and vice versa.
 (interactive)
  -  (save-excursion
  -(goto-char (point-min))
  -(loop do (notmuch-show-message-visible 
  (notmuch-show-get-message-properties)
  -  (not current-prefix-arg))
  - until (not (notmuch-show-goto-message-next
  +  (let ((toggle (notmuch-show-message-visible-p)))
  +(save-excursion
  +  (goto-char (point-min))
  +  (loop do (notmuch-show-message-visible
  +   (notmuch-show-get-message-properties)
  +   (not toggle))
  +   until (not (notmuch-show-goto-message-next)
  +  (recenter-top-bottom 1)
 (force-window-update))
   
   (defun notmuch-show-next-button ()
  -- 
  1.7.8.1
  
  ___
  notmuch mailing list
  notmuch@notmuchmail.org
  http://notmuchmail.org/mailman/listinfo/notmuch


Peace

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


Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-26 Thread Pieter Praet
On Wed, 25 Jan 2012 15:00:22 +0200, Tomi Ollila tomi.oll...@iki.fi wrote:
 [...]
 So, 'completing-read' -- or something that does the same thing better (ymmv).
 

Thanks for the suggestion, but `completing-read' will do just fine...  ;D


 Tomi


Peace

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


Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-26 Thread Pieter Praet
On Wed, 25 Jan 2012 06:31:43 +, David Edmondson d...@dme.org wrote:
 On Wed, 25 Jan 2012 01:50:08 +0100, Pieter Praet pie...@praet.org wrote:
  In a perfect world, everyone would be using Notmuch and have a local
  copy of every message ever sent to any ML.  While we're waiting for
  Atlantis to resurface, we'll need an interim solution.
  
  +1 for the idea, but Gmane doesn't archive *all* MLs, so we should leave
  the user some legroom.  Since I've already made the necessary changes,
  I'll just send the patch instead of wasting your time with suggestions.
  Feel free to merge it into yours.
 
 This is definitely a good idea, but...
 
  Peace
  
  ---
   emacs/notmuch-show.el |   40 ++--
   test/emacs|2 +-
   2 files changed, 31 insertions(+), 11 deletions(-)
  
  diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
  index c4d45e7..7f209cd 100644
  --- a/emacs/notmuch-show.el
  +++ b/emacs/notmuch-show.el
  @@ -123,6 +123,24 @@ indentation.
   (const :tag View interactively
  notmuch-show-interactively-view-part)))
   
  +(defcustom notmuch-show-stash-mlarchive-link-pref http://mid.gmane.org/;
  +  Default Mailing List Archive to use when stashing links.
  +  :group 'notmuch-show
  +  ;; TODO: find a working `Message-Id' search arg for all options.
  +  :type '(choice (const :tag Gmane
  +   http://mid.gmane.org/;)
  +;; (const :tag MARC
  +;; http://marc.info/;)
  +(const :tag Mail Archive, The
  +   http://www.mail-archive.com/search?l=midq=;)
  +;; (const :tag MarkMail
  +;; http://markmail.org/;)
  +;; (const :tag opensubscriber
  +;; http://opensubscriber.com/;)
  +;; (const :tag Nabble
  +;; http://nabble.com/;)
  +(string :tag Custom URI)))
 
 ...do we not now how to reference messages by message-id on these other
 services?
 

I've found the missing Message-Id search URI for 'marc.info', but as
for the remaining services:  if they provide search by Message-Id,
they're pretty damn good at hiding it...


 Your point about Gmane not having everything applies equally to any
 service, suggesting that perhaps the user should also have an option to
 choose which service to use at stash time. Thoughts?
 

Definitely.

Patch follows.


  +
   (defmacro with-current-notmuch-show-message (rest body)
 Evaluate body with current buffer set to the text of current message
 `(save-excursion
  @@ -1016,8 +1034,8 @@ thread id.  If a prefix is given, crypto processing 
  is toggled.
   (define-key map s 'notmuch-show-stash-subject)
   (define-key map T 'notmuch-show-stash-tags)
   (define-key map t 'notmuch-show-stash-to)
  -(define-key map g 'notmuch-show-stash-gmane)
  -(define-key map G 'notmuch-show-stash-gmane-and-go)
  +(define-key map l 'notmuch-show-stash-mlarchive-link)
  +(define-key map L 'notmuch-show-stash-mlarchive-link-and-go)
   map)
 Submap for stash commands)
   (fset 'notmuch-show-stash-map notmuch-show-stash-map)
  @@ -1605,20 +1623,22 @@ buffer.
 (interactive)
 (notmuch-common-do-stash (notmuch-show-get-to)))
   
  -(defun notmuch-show-stash-gmane ()
  -  Copy a Gmane URI for the current message to the kill-ring.
  +(defun notmuch-show-stash-mlarchive-link ()
  +  Copy an ML Archive URI for the current message to the kill-ring.
   
  -This presumes that the message is available at Gmane.
  +This presumes that the message is available at the Mailing List Archive
  +configured in `notmuch-show-stash-mlarchive-link-pref'.
 (interactive)
  -  (notmuch-common-do-stash (concat http://mid.gmane.org/;
  +  (notmuch-common-do-stash (concat notmuch-show-stash-mlarchive-link-pref
 (substring (notmuch-show-get-message-id) 4 
  -1
   
  -(defun notmuch-show-stash-gmane-and-go ()
  -  Copy a Gmane URI for the current message to the kill-ring and visit it.
  +(defun notmuch-show-stash-mlarchive-link-and-go ()
  +  Copy an ML Archive URI for the current message to the kill-ring and 
  visit it.
   
  -This presumes that the message is available at Gmane.
  +This presumes that the message is available at the Mailing List Archive
  +configured in `notmuch-show-stash-mlarchive-link-pref'.
 (interactive)
  -  (let ((uri (concat http://mid.gmane.org/;
  +  (let ((uri (concat notmuch-show-stash-mlarchive-link-pref
   (substring (notmuch-show-get-message-id) 4 -1
   (notmuch-common-do-stash uri)
   (browse-url uri)))
  diff --git a/test/emacs b/test/emacs
  index 5f7467d..4e08726 100755
  --- a/test/emacs
  +++ b/test/emacs
  @@ -382,7 +382,7 @@ test_emacs '(notmuch-show id:\bought\)
  (notmuch-show-stash-message-id-stripped)
  (notmuch-show-stash-tags)
  (notmuch-show-stash-filename)
  -   (notmuch-show-stash-gmane)
  +   

Re: [PATCH 2/2] added support for user-specified directories to exclude

2012-01-26 Thread Jani Nikula
On Thu, 26 Jan 2012 12:11:58 +0200, Tomi Ollila tomi.oll...@iki.fi wrote:
 A new configuration key 'database.exclude' is used to determine
 which directories user wants not to be scanned for new mails.
 
 ---
 
 Notes (from 2011-09-13):
 
 1) Currently the comments for newly created configuration file are not
 updated, so for not this is 'undocumented feature'. Should there be an
 empty configuration line as a placeholder ... ?
 
 2) Whenever some already existing directory is added to the exclude list
 and the parent directory timestamp has not changed, notmuch new will not
 notice the directory has gone (as it still is there), user needs to 'touch'
 the parent directory before next 'notmuch new' no make notmuch notice.
 
 2012-01-26: could notmuch track mtime of the configuration file and if
 that changes, ignore mail directory timestamps ?
 
 3) count_files() function is not touched. The functionality there has fallen
 behind of add_files_recursive (maildir+tmp check and following symlinks).
 The question there should it be updated, or attempted to merge with
 add_files (as the comment says). count_files() is only called at the beginning
 when database is not yet initialised.
 ---
  notmuch-client.h |3 +++
  notmuch-config.c |   13 +
  notmuch-new.c|   22 --
  3 files changed, 36 insertions(+), 2 deletions(-)
 
 diff --git a/notmuch-client.h b/notmuch-client.h
 index e0eb594..78460fc 100644
 --- a/notmuch-client.h
 +++ b/notmuch-client.h
 @@ -219,6 +219,9 @@ void
  notmuch_config_set_database_path (notmuch_config_t *config,
 const char *database_path);
  
 +const char **
 +notmuch_config_get_database_exclude (notmuch_config_t *config,
 +  size_t *length);
  const char *
  notmuch_config_get_user_name (notmuch_config_t *config);
  
 diff --git a/notmuch-config.c b/notmuch-config.c
 index a124e34..e236114 100644
 --- a/notmuch-config.c
 +++ b/notmuch-config.c
 @@ -99,6 +99,8 @@ struct _notmuch_config {
  GKeyFile *key_file;
  
  char *database_path;
 +const char **database_exclude;
 +size_t database_exclude_length;
  char *user_name;
  char *user_primary_email;
  const char **user_other_email;
 @@ -258,6 +260,8 @@ notmuch_config_open (void *ctx,
  config-key_file = g_key_file_new ();
  
  config-database_path = NULL;
 +config-database_exclude = NULL;
 +config-database_exclude_length = 0;
  config-user_name = NULL;
  config-user_primary_email = NULL;
  config-user_other_email = NULL;
 @@ -537,6 +541,15 @@ notmuch_config_set_database_path (notmuch_config_t 
 *config,
  config-database_path = NULL;
  }
  
 +const char **
 +notmuch_config_get_database_exclude (notmuch_config_t *config,
 +  size_t *length)
 +{
 +return _config_get_list (config, database, exclude,
 +  (config-database_exclude),
 +  (config-database_exclude_length), length);
 +}
 +
  const char *
  notmuch_config_get_user_name (notmuch_config_t *config)
  {
 diff --git a/notmuch-new.c b/notmuch-new.c
 index a569a54..d607f5b 100644
 --- a/notmuch-new.c
 +++ b/notmuch-new.c
 @@ -39,6 +39,8 @@ typedef struct {
  int verbose;
  const char **new_tags;
  size_t new_tags_length;
 +const char **database_exclude;
 +size_t database_exclude_length;
  
  int total_files;
  int processed_files;
 @@ -300,6 +302,8 @@ add_files_recursive (notmuch_database_t *notmuch,
  is_maildir = _entries_resemble_maildir (fs_entries, num_fs_entries);
  
  for (i = 0; i  num_fs_entries; i++) {
 + size_t j;
 +
   if (interrupted)
   break;
  
 @@ -323,8 +327,6 @@ add_files_recursive (notmuch_database_t *notmuch,
* Also ignore the .notmuch directory and any tmp directory
* that appears within a maildir.
*/
 - /* XXX: Eventually we'll want more sophistication to let the
 -  * user specify files to be ignored. */
   if (strcmp (entry-d_name, .) == 0 ||
   strcmp (entry-d_name, ..) == 0 ||
   (is_maildir  strcmp (entry-d_name, tmp) == 0) ||
 @@ -332,6 +334,12 @@ add_files_recursive (notmuch_database_t *notmuch,
   {
   continue;
   }
 + /* Ignore user-specified directories */
 + for (j = 0; j  state-database_exclude_length; j++)
 + if (strcmp(entry-d_name, state-database_exclude[j]) == 0)
 + break;
 + if (j  state-database_exclude_length)
 + continue;

How about wrapping that in a function you can use here and below?

if (user_wants_this_excluded (...))
continue;

Please also have a look at id:87pqecylon@nikula.org and the
patches Austin posted. Auto ignore?

BR,
Jani.

  
   next = talloc_asprintf (notmuch, %s/%s, path, entry-d_name);
   status = add_files_recursive (notmuch, next, state);
 @@ -364,11 +372,20 @@ add_files_recursive 

[RFC] Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-26 Thread Pieter Praet
---

Depends on id:1327397873-20596-1-git-send-email-...@dme.org

 emacs/notmuch-show.el |   55 ++--
 test/emacs|2 +-
 2 files changed, 40 insertions(+), 17 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index c4d45e7..0acc4cf 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -123,6 +123,20 @@ indentation.
 (const :tag View interactively
notmuch-show-interactively-view-part)))
 
+(defcustom notmuch-show-stash-mlarchive-link-alist
+  '((Gmane . http://mid.gmane.org/;)
+(MARC . http://marc.info/?i=;)
+(Mail Archive, The . http://www.mail-archive.com/search?l=midq=;)
+;; FIXME: can these services be searched by `Message-Id' ?
+;; (MarkMail . http://markmail.org/;)
+;; (Nabble . http://nabble.com/;)
+;; (opensubscriber . http://opensubscriber.com/;)
+)
+  Default Mailing List Archive to use when stashing links.
+  :type '(alist :key-type (string :tag Name)
+   :value-type (string :tag URL))
+  :group 'notmuch-show)
+
 (defmacro with-current-notmuch-show-message (rest body)
   Evaluate body with current buffer set to the text of current message
   `(save-excursion
@@ -1016,8 +1030,8 @@ thread id.  If a prefix is given, crypto processing is 
toggled.
 (define-key map s 'notmuch-show-stash-subject)
 (define-key map T 'notmuch-show-stash-tags)
 (define-key map t 'notmuch-show-stash-to)
-(define-key map g 'notmuch-show-stash-gmane)
-(define-key map G 'notmuch-show-stash-gmane-and-go)
+(define-key map l 'notmuch-show-stash-mlarchive-link)
+(define-key map L 'notmuch-show-stash-mlarchive-link-and-go)
 map)
   Submap for stash commands)
 (fset 'notmuch-show-stash-map notmuch-show-stash-map)
@@ -1605,23 +1619,32 @@ buffer.
   (interactive)
   (notmuch-common-do-stash (notmuch-show-get-to)))
 
-(defun notmuch-show-stash-gmane ()
-  Copy a Gmane URI for the current message to the kill-ring.
+(defun notmuch-show-stash-mlarchive-link ()
+  Copy an ML Archive URI for the current message to the kill-ring.
 
-This presumes that the message is available at Gmane.
-  (interactive)
-  (notmuch-common-do-stash (concat http://mid.gmane.org/;
-  (substring (notmuch-show-get-message-id) 4 
-1
+This presumes that the message is available at the selected Mailing List 
Archive.
 
-(defun notmuch-show-stash-gmane-and-go ()
-  Copy a Gmane URI for the current message to the kill-ring and visit it.
-
-This presumes that the message is available at Gmane.
+Also see `notmuch-show-stash-mlarchive-link-alist'.
+  (interactive)
+  (notmuch-common-do-stash
+   (concat (cdr (assoc
+(let ((completion-ignore-case t))
+  (completing-read
+   ML Archive: 
+   notmuch-show-stash-mlarchive-link-alist
+   nil t nil nil Gmane))
+notmuch-show-stash-mlarchive-link-alist))
+  (substring (notmuch-show-get-message-id) 4 -1
+
+(defun notmuch-show-stash-mlarchive-link-and-go ()
+  Copy an ML Archive URI for the current message to the kill-ring and visit 
it.
+
+This presumes that the message is available at the selected Mailing List 
Archive.
+
+Also see `notmuch-show-stash-mlarchive-link-alist'.
   (interactive)
-  (let ((uri (concat http://mid.gmane.org/;
-(substring (notmuch-show-get-message-id) 4 -1
-(notmuch-common-do-stash uri)
-(browse-url uri)))
+  (notmuch-show-stash-mlarchive-link)
+  (browse-url (current-kill 0 t)))
 
 ;; Commands typically bound to buttons.
 
diff --git a/test/emacs b/test/emacs
index 5f7467d..4e08726 100755
--- a/test/emacs
+++ b/test/emacs
@@ -382,7 +382,7 @@ test_emacs '(notmuch-show id:\bought\)
(notmuch-show-stash-message-id-stripped)
(notmuch-show-stash-tags)
(notmuch-show-stash-filename)
-   (notmuch-show-stash-gmane)
+   (notmuch-show-stash-mlarchive-link)
(switch-to-buffer
  (generate-new-buffer *test-stashing*))
(dotimes (i 10)
-- 
1.7.8.1

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


Re: Bug?: notmuch-search-show-thread shows several threads; only one containing matching messages

2012-01-26 Thread Jani Nikula
On Thu, 26 Jan 2012 13:44:50 +0100, Gregor Zattler telegr...@gmx.net wrote:
 Hi Jamie, Austin,
 * Jameson Graef Rollins jroll...@finestructure.net [25. Jan. 2012]:
  On Wed, 25 Jan 2012 20:19:03 -0500, Austin Clements amdra...@mit.edu 
  wrote:
  One very common cause of this is someone using reply to get an
  initial set of recipients, but then replacing the entire message and
  subject (presumably without realizing that the mail is still tracking
  what it was a reply to).  This can also happen if someone
  intentionally replies to multiple messages (though few mail clients
  support this), or if there was a message ID collision.
  
  This is a very common occurrence for me as well.  I would put money down
  that this is what you're seeing.
 
 I thought about this too and this is why I checked for any
 occurrence of Message-IDs in the other emails: 
 
| I isolated the thread I was interested in,
| extracted the message ids of its messages and greped the rest of
| the messages for this message ids: no matches.[2] Therefore no of
| the rests messages are part of the thread I was interested in
 
 perhaps there was a logic error in how I did this:
 
| [2] grep -I ^Message-Id: /tmp/thread-I-m-interested-in.mbox |sed -e 
 s/Message-Id: //I -e s/$// really.mid
| grep -I -F really.mid rest.mbox
| -- no match
 
 /tmp/thread-I-m-interested-in.mbox  is a mbox with messages
 I'minterested in, the real ones.  really.mid is a list of
 Message-IDs of these real emails.  rest.mbox is a mbox with the
 other emails, Emacs showed in his notmuch show buffer but are
 other threads.
 
 Since there is no match I concluded, the threads are not linked.
 Perhaps I made a mistake.  I'l retest it and report again.  But
 right now I don't have the time to do this.

Do you have an mbox file in the maildir indexed by notmuch? That seems
like the issue.

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


Re: Bug?: notmuch-search-show-thread shows several threads; only one containing matching messages

2012-01-26 Thread Pieter Praet
On Thu, 26 Jan 2012 13:44:50 +0100, Gregor Zattler telegr...@gmx.net wrote:
 Hi Jamie, Austin,
 * Jameson Graef Rollins jroll...@finestructure.net [25. Jan. 2012]:
  On Wed, 25 Jan 2012 20:19:03 -0500, Austin Clements amdra...@mit.edu 
  wrote:
  One very common cause of this is someone using reply to get an
  initial set of recipients, but then replacing the entire message and
  subject (presumably without realizing that the mail is still tracking
  what it was a reply to).  This can also happen if someone
  intentionally replies to multiple messages (though few mail clients
  support this), or if there was a message ID collision.
  
  This is a very common occurrence for me as well.  I would put money down
  that this is what you're seeing.
 
 I thought about this too and this is why I checked for any
 occurrence of Message-IDs in the other emails: 
 
| I isolated the thread I was interested in,
| extracted the message ids of its messages and greped the rest of
| the messages for this message ids: no matches.[2] Therefore no of
| the rests messages are part of the thread I was interested in
 
 perhaps there was a logic error in how I did this:
 
| [2] grep -I ^Message-Id: /tmp/thread-I-m-interested-in.mbox |sed -e 
 s/Message-Id: //I -e s/$// really.mid
| grep -I -F really.mid rest.mbox
| -- no match
 

Did you mean to do case-insensitive grep? ('-i' instead of '-I').

Also, the '-F' option expects input on stdin, not a filename.


Try this (with all individual threads split into separate mboxes):

  #+begin_src sh
for i in $(ls *.mbox) ; do
grep -i '^Message-Id:' ${i} | \
sed -e 's/^.\{13\}//' -e 's/$//' \
 ${i}.mids
done
for i in $(ls *.mids) ; do
echo ## Grepping for ${i}'s Message-Ids
grep -i -F $(cat ${i}) *.mbox
done
  #+end_src


Here's another couple of threads squashed into a single one:
- [O] [Use Question] Capture and long lines
  - id:banlktikof4txunllufrznsd6k2zys7s...@mail.gmail.com
- [O] Worg update
  - id:m1wrfiz3ch@tsdye.com
- [O] Table formula to convert hex to dec
  - id:20110724080054.GB16388@x201
- [O] ICS import?
  - id:20120125173421.GQ3747@x201


AFAICT, none of them share Message-Id's...


 /tmp/thread-I-m-interested-in.mbox  is a mbox with messages
 I'minterested in, the real ones.  really.mid is a list of
 Message-IDs of these real emails.  rest.mbox is a mbox with the
 other emails, Emacs showed in his notmuch show buffer but are
 other threads.
 
 Since there is no match I concluded, the threads are not linked.
 Perhaps I made a mistake.  I'l retest it and report again.  But
 right now I don't have the time to do this.
 
 Ciao, Gregor
 -- 
  -... --- .-. . -.. ..--.. ...-.-
 ___
 notmuch mailing list
 notmuch@notmuchmail.org
 http://notmuchmail.org/mailman/listinfo/notmuch


Peace

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


Re: [PATCH 1/3] emacs: bind s to `notmuch-search' in notmuch-hello buffer

2012-01-26 Thread Pieter Praet
On Tue, 17 Jan 2012 23:22:30 +0200, Jani Nikula j...@nikula.org wrote:
 [...]
 
 After this, what would the user have to do to bind some key to put the
 point in the search box? If someone wants to restore old behaviour for
 themselves.
 

This should work:

  #+begin_src emacs-lisp
(add-hook 'notmuch-hello-mode-hook
  (lambda ()
 (local-set-key (kbd s)
  (lambda() (interactive)
   (re-search-forward Search: )
  #+end_src


Peace

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


Re: [PATCH 1/3] emacs: bind s to `notmuch-search' in notmuch-hello buffer

2012-01-26 Thread Jani Nikula
On Thu, 26 Jan 2012 14:48:44 +0100, Pieter Praet pie...@praet.org wrote:
 On Tue, 17 Jan 2012 23:22:30 +0200, Jani Nikula j...@nikula.org wrote:
  [...]
  
  After this, what would the user have to do to bind some key to put the
  point in the search box? If someone wants to restore old behaviour for
  themselves.
  
 
 This should work:
 
   #+begin_src emacs-lisp
 (add-hook 'notmuch-hello-mode-hook
   (lambda ()
  (local-set-key (kbd s)
   (lambda() (interactive)
(re-search-forward Search: )
   #+end_src

Thanks for the basic idea, iterated into:

(define-key notmuch-hello-mode-map S
  (lambda() (interactive)
(goto-char (point-min))
(re-search-forward Search: )))


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


Re: [RFC] Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-26 Thread David Edmondson
In general, I like this.

- I think that the stash function(s) should take an optional argument
  specifying the archive to use. That will make testing simpler and also
  allow people to produce preferred bindings more easily.

- Message archive:  feels better than ML Archive: , but I don't
  really care.

- Don't base the patch on the thing that I posted, just on master from
  the repository - no need to make David's life harder.


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


Re: [PATCH] emacs: make `notmuch-show-open-or-close-all' toggle visibility

2012-01-26 Thread David Edmondson
On Thu, 26 Jan 2012 14:02:15 +0100, Pieter Praet pie...@praet.org wrote:
 I may be missing something, but wouldn't both issues be solved by simply
 pressing M-RET a second time?  I've been using this for a little while
 now, and IMO it makes navigating through long and diverging threads a lot
 faster, much like zooming in/out on an outline.
 
 How about if C-u M-RET behaved as usual ?

Okay, I used it for a day and I'm happy that the original patch is
good.

+2 (which leaves me at +1).


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


Re: [PATCH] emacs: make `notmuch-show-open-or-close-all' toggle visibility

2012-01-26 Thread Tomi Ollila

+1

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


[PATCH v5 0/2] emacs: add completion to tag all operation

2012-01-26 Thread Dmitry Kurochkin
Changes:

v5:

* fixed comments from Austin's review [2]

* add a second patch with `notmuch-search-operate-all' code cleanup
  suggested by Austin [1]

v4:

* do not change `notmuch-select-tag-with-completion' API, revert
  related changes

v3:

* fixed comments from Austin's review [1]

v2:

* s/thistag/this_tag/ for consistency with that_tag, since we touch
  the line anyway

Regards,
  Dmitry

[1] id:20120126013727.gb1...@mit.edu
[2] id:20120126070439.gc1...@mit.edu

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


[PATCH v5 2/2] emacs: `notmuch-search-operate-all' code cleanup, no functional changes

2012-01-26 Thread Dmitry Kurochkin
---
 emacs/notmuch.el |   11 +--
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 291eca2..72f78ed 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -891,12 +891,11 @@ characters as well as `_.+-'.
Operations (+add -drop): notmuch tag 
'(+ -)))
   ;; Perform some validation
-  (let ((words actions))
-(when (null words) (error No operations given))
-(while words
-  (unless (string-match-p ^[-+][-+_.[:word:]]+$ (car words))
-   (error Action must be of the form `+this_tag' or `-that_tag'))
-  (setq words (cdr words
+  (when (null actions) (error No operations given))
+  (mapc (lambda (action)
+ (unless (string-match-p ^[-+][-+_.[:word:]]+$ action)
+   (error Action must be of the form `+this_tag' or `-that_tag')))
+   actions)
   (apply 'notmuch-tag notmuch-search-query-string actions))
 
 (defun notmuch-search-buffer-title (query)
-- 
1.7.8.3

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


Re: [PATCH] emacs: add completion to tag all operation (* binding)

2012-01-26 Thread Dmitry Kurochkin
On Thu, 26 Jan 2012 08:46:00 +, David Edmondson d...@dme.org wrote:
 On Thu, 26 Jan 2012 05:47:07 +0400, Dmitry Kurochkin 
 dmitry.kuroch...@gmail.com wrote:
+  ;; Perform some validation
+  (let ((words action))
+(when (null words) (error No operation given))
+(while words
+  (unless (string-match-p ^[-+][-+_.[:word:]]+$ (car words))
+   (error Action must be of the form `+thistag -that_tag'))
+  (setq words (cdr words
   
   This should really be a mapc or a dolist, but maybe that's for another
   patch.
  
  Yes, I changed this_tag spelling in v2, but would prefer to leave
  non-trivial changes in this code for another patch.
 
 If you were going to submit another patch then fine, but the chances are
 it will just get forgotten.

No worries, v5 has a cleanup patch added :)

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


Re: [PATCH v5 0/2] emacs: add completion to tag all operation

2012-01-26 Thread David Edmondson
The series look good to me.


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


Re: [PATCH] emacs: add default value to notmuch-search-line-faces

2012-01-26 Thread Jani Nikula
On Thu, 26 Jan 2012 14:41:46 -0500, Austin Clements amdra...@mit.edu wrote:
 Quoth Jani Nikula on Jan 26 at  9:21 pm:
  Add default value to notmuch-search-line-faces to show unread
  messages in bold, and flagged messages in red, to have some visual
  indication of important messages in search results. This should be
  helpful for new users.
  
  unread tag is quite obvious, and handled specially both in the lib
  and emacs ui. flagged is synced to maildir F flag in the lib. If one
  syncs the maildir to IMAP, this also translates to corresponding IMAP
  flag. (This is starred in GMail and Android.)
  
  Signed-off-by: Jani Nikula j...@nikula.org
 
 While I'm sure this can be bikeshod to death, I do have one legitimate
 concern (and one illegitimate).
 
 I completely agree with what you said on IRC, though, that setting
 this to non-nil is more about making this capability more discoverable
 to new users than trying to come up with the perfect faces.

Thanks for repeating that here too before full blown bikeshedding. I'm
just trying to help other people find this option quicker than I and
some others did...

  ---
   emacs/notmuch.el |3 ++-
   1 files changed, 2 insertions(+), 1 deletions(-)
  
  diff --git a/emacs/notmuch.el b/emacs/notmuch.el
  index 6b2c252..551ea9d 100644
  --- a/emacs/notmuch.el
  +++ b/emacs/notmuch.el
  @@ -662,7 +662,8 @@ This function advances the next thread when finished.
(goto-char (point-min))
(forward-line (1- notmuch-search-target-line
   
  -(defcustom notmuch-search-line-faces nil
  +(defcustom notmuch-search-line-faces '((unread :weight bold)
 
 As much as I would like this, many terminals don't visually
 distinguish between the default face and the default face in bold.

Would it really matter, though? People on such terminals are probably
aware they are missing out on a bunch of visual stuff. But please do
suggest an alternative that could be composited with the :foreground
setting below for unread and flagged threads.

  +  (flagged :foreground red))
 
 Red is pretty universally used to indicate danger or a serious
 condition, while flagged is simply supposed to draw attention.  I
 would say blue as a neutral and distinct indicator, but it also has
 poor visibility (I used to use blue, but found that when scanning my
 mail, I would habitually skip over flagged messages because they were
 dark, which was the opposite of what I wanted).  Personally I've
 settled on yellow; it's visually distinct enough to be easily
 noticeable and bright enough that I don't skip over it, though it
 obviously wouldn't work on a light background.

Can be yellow, I don't really care that much. But isn't a light
background the default for emacs in most distros? If that matters,
*shrug*.


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


Re: [PATCH] emacs: add default value to notmuch-search-line-faces

2012-01-26 Thread Jeremy Nickurak
On Thu, Jan 26, 2012 at 12:41, Austin Clements amdra...@mit.edu wrote:
 As much as I would like this, many terminals don't visually
 distinguish between the default face and the default face in bold.

I've taken a shot at this under xterm, gnome-terminal, and a basic
linux VT. I figure that if something is broken in another terminal
that breaks in one of these, it's somebody-elses-problem :)

Xterm/gnome-terminal support bold just fine. With a Linux VT, emacs
just chooses i slightly lighter color, which is totally usable.
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: add default value to notmuch-search-line-faces

2012-01-26 Thread Austin Clements
Quoth Jeremy Nickurak on Jan 26 at  2:59 pm:
 On Thu, Jan 26, 2012 at 12:41, Austin Clements amdra...@mit.edu wrote:
  As much as I would like this, many terminals don't visually
  distinguish between the default face and the default face in bold.
 
 I've taken a shot at this under xterm, gnome-terminal, and a basic
 linux VT. I figure that if something is broken in another terminal
 that breaks in one of these, it's somebody-elses-problem :)
 
 Xterm/gnome-terminal support bold just fine. With a Linux VT, emacs
 just chooses i slightly lighter color, which is totally usable.

Cool.  If this works in those, then I'm happy with the bold.  (Upon
further inspection, it's possible that I'm just full of it and the
font I've been using for the past decade or so is simply too small to
have a bold variant.)
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 0/2] re-enable line wrapping and add some header bling

2012-01-26 Thread David Edmondson
On Thu, 26 Jan 2012 20:17:49 +0400, Dmitry Kurochkin 
dmitry.kuroch...@gmail.com wrote:
 I did not review the code, but here is a general comment for both
 patches (but especially for the first one).  It would be nice to have a
 more detailed documentation for hooks.  Docstring like Enable Visual
 Line mode. for a function named `notmuch-show-turn-on-visual-line-mode'
 is near useless.  It is quite obvious that the function enables
 visual-line-mode from it's name.  And it does not give any information
 on why would someone actually want to use it.  I do not remember what
 visual-line-mode is exactly, so to understand whether this hook is
 actually useful for me, I have to read visual-line-mode docs, think
 about how it helps in notmuch-show, read some code, perhaps, etc.  I
 would argue that since the hook itself is trivial, the main point in
 having it is to provide a clearly documented solution for a common
 problem for those who do not know how to solve this problem right away.
 Currently, those who know what visual-line-mode is do not need this
 hook, because they can easily write their own, and those who do not know
 what visual-line-mode is can not use this hook, because it says nothing
 about why it is actually useful.
 
 Also, in addition to better docs, I would rename
 `notmuch-show-turn-on-visual-line-mode' to something that reflects what
 it does from user POV (like the other two hooks).
 
 Though, the fact that the hook is enabled by default makes the above
 arguments less important, I guess.

I have a bunch of somewhat conflicting thoughts about this:
  - Being able to configure the behaviour without having to change the
core code is good, so implementing behaviour using hook functions is
useful.
  - Things should behave well in the default configuration, so most of
the hook functions are enabled by default.
  - Everything can't be hook functions, so there's a balance to be made
between implementing things as in-line code and via hook functions.
  - Most users shouldn't need to modify any of the hooks.
  - Documentation that explains what a hook function is about is
obviously good.
  - Documenting something that is external to notmuch can be both
wasteful and risky.

Wasteful because such documentation typically already exists and
risky because the precise behaviour of external components is not
under our control.

For example, the documentation for `visual-line-mode' is both
concise and good, so there's little point in repeating it and, of
course, the exact details of what `visual-line-mode' does can be
changed by the Emacs developers. One would expect that they would
update the documentation for `visual-line-mode' in such situations,
which would leave any cloned documentation in an incorrect state.

Hence, I would probably take issue with your statement:

 I would argue that since the hook itself is trivial, the main point in
 having it is to provide a clearly documented solution for a common
 problem for those who do not know how to solve this problem right
 away.

That's not the intention of the hook functions under discussion
here. They are hook functions so that a curious and interested user can
make a change based on some aesthetic preference. The are not about
solving problems with the default configuration.

I think that `turn-on-visual-line-mode' (or the package local derivative
of it that was chosen) is precisely the right name for a function that
enables `visual-line-mode'. It describes perfectly and succinctly what
the function does and provides a pointer to follow to find out more (the
documentation for `visual-line-mode') without a user even having to
examine the documentation of the function itself.

All of that said, I'd agree that the documentation of
`notmuch-show-indent-continuations' could have been better. How about:
  Indent any continuation lines in the current headers.
?


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


Re: gmime2.6 packaging for debian

2012-01-26 Thread Jameson Graef Rollins
On Thu, 26 Jan 2012 02:47:57 -0500, Daniel Kahn Gillmor 
d...@fifthhorseman.net wrote:
 those of you who run debian might be interested in the gmime2.6
 packaging which i cobbled together for debian from the existing gmime2.4
 packaging:
 
  http://bugs.debian.org/657426
 
 Those of you developing notmuch with the gmime 2.6 patchsets might be
 interested in trying it out.  Please let me know of any problems you
 might have with the experimental packaging.
 
 It would be good if we could change the build-deps to
 
  libgmime2.6-dev | libgmime2.4-dev

Hey, folks.  FYI, I build a gmime2.6 debian package from Daniel's new
packaging [0], and it built and installed completely cleanly.  After
reconfiguring notmuch, it picked up the 2.6 library and compiled and
works without issue.

Thanks so much dkg and everyone who got the compatibility working!
Sounds like official packages might be showing up in experimental soon.

jamie.

[0] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=657426#15


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