[PATCH 5/7] py3k: the basestring and unicode types are removed in python 3

2012-01-04 Thread Tomi Ollila
On Mon, 02 Jan 2012 16:15:58 +0100, Sebastian Spaeth  
wrote:
> Happy new year. Pushed patches 1-4 of this series so far. Looking fine,
> but ugh, the below seems like a rather ugly hack in a function that is
> probably called quite often.
> 
> Isn't there a more pretty variant avoiding these sys.version_info checks
> all over the place?
> 
> > @@ -200,9 +201,9 @@ def _str(value):
> >  
> >  C++ code expects strings to be well formatted and
> >  unicode strings to have no null bytes."""
> > -if not isinstance(value, basestring):
> > +if not isinstance(value, basestring if sys.version_info[0] == 2 else 
> > str):
> >  raise TypeError("Expected str or unicode, got %s" % 
> > str(type(value)))
> > -if isinstance(value, unicode):
> > +if sys.version_info[0] == 3 or isinstance(value, unicode):
> >  return value.encode('UTF-8')
> >  return value

Does the Python3StringMixIn stuff in later patches already handle this
patch -- and making this obsolete ?

Tomi


[PATCH] emacs: call "notmuch tag" only once when archiving a thread

2012-01-04 Thread Tomi Ollila
On Tue,  3 Jan 2012 20:29:06 +0200, Jani Nikula  wrote:
> Optimize thread archiving by combining all the -inbox tagging operations to
> a single "notmuch tag" call. Also skip redisplay of tag changes in current
> buffer, as it is immediately killed by the archiving functions.
> 
> For threads in the order of tens or a hundred inbox tagged messages, this
> gives a noticeable speedup.
> 
> On the downside, IIRC Xapian does not perform very well if the query (in
> this case a lot of message-ids OR'd together) is very big. It is unknown to
> me at which point this approach would become slower than the original one
> by one tagging approach, if ever.
> 
> Also, this introduces a limitation to the number of messages that can be
> archived at the same time (through ARG_MAX limiting the command line). At
> least on Linux this seems more like a theoretical limitation than a real
> one.

IIRC some systems have like 32768 byte command line limit.
If the change did tagging in like 100-message batches then this limit is
hardly exceeded (if message-id's max 80 characters then command line is
8000+ bytes)...
Hmm -- is there a length limit for message-id. If not maybe when appending 
message id's keep counting length and tag in batches based on that lenght
value.

Hundreds of messages per tagging operation instead of one is good
improvements.

> Signed-off-by: Jani Nikula 

Tomi


Info about notmuch database

2012-01-04 Thread boyska
Hello!
I like notmuch a lot, so I'm writing a (conceptually) similar software
about addressbook: it will scan all your emails, storing email 
addresses
in a xapian database (you can think of it as little brother database[1] 
on
steroids)
The part that I'd like to re-implement is "notmuch new": it seems that
in the xapian db there is not only informations about each mail, but
also the mtime of each directory. My impression is this being 
"chaotic",
but probably I am just missing the point.

So, here's the question: how is the db "structured"? is there any
documentation to look at?

[1] http://www.spinnaker.de/lbdb/

-- 
boyska
GPG: 0x520CE393


[PATCH] NEWS: consistent 2-space indentation

2012-01-04 Thread Tomi Ollila
In NEWS file, indentation for item descriptions is generally 2 spaces
but in a few cases there were 3 or 4 (4 caused different markdown
handling) space indentations. Indentation in those lines are brought
to consistent 2-space indentation.
Note that this patch touches spacing in "historical" content --
content of released versions 0.10.2, 0.10 and 0.6 -- in NEWS file.
---
This patch is submitted on release branch.
 NEWS |   16 
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/NEWS b/NEWS
index 6650126..7c0b991 100644
--- a/NEWS
+++ b/NEWS
@@ -66,8 +66,8 @@ Bug-fix release.

 Fix crash in python bindings.

-The python bindings did not call g_type_init, which caused crashes
-for some, but not all users.
+  The python bindings did not call g_type_init, which caused crashes
+  for some, but not all users.

 Notmuch 0.10.1 (2011-11-25)
 ===
@@ -137,8 +137,8 @@ Add keybinding ('c I') for stashing Message-ID's without an 
id: prefix

 Do not query on notmuch-search exit

-   It is harmless to kill the external notmuch process, so the user
-   is no longer interrogated when they interrupt a search.
+  It is harmless to kill the external notmuch process, so the user
+  is no longer interrogated when they interrupt a search.

 Performance
 ---
@@ -167,9 +167,9 @@ mailing list.

 nmbug - share tags with a given prefix

-   nmbug helps maintain a git repo containing all tags with a given
-   prefix (by default "notmuch::"). Tags can be shared by commiting
-   them to git in one location and restoring in another.
+  nmbug helps maintain a git repo containing all tags with a given
+  prefix (by default "notmuch::"). Tags can be shared by commiting
+  them to git in one location and restoring in another.

 Notmuch 0.9 (2011-10-01)
 
@@ -554,7 +554,7 @@ Ruby bindings are now much more complete
s1.union(s2)
s2 -= s1

-   Removed:
+  Removed:
  - len(Messages()) as it exhausted the iterator.
Use len(list(Messages())) or
Query.count_messages() to get the length.
-- 
1.7.7.3



Python bindings for adoption

2012-01-04 Thread Patrick Totzke
Sebastian,

I'm sorry to hear of your decision to finally hand over the maintainership of 
the bindings
but of course I fully understand that you want to focus on other stuff.
Thanks for your great work! Your bindings were certainly one of the most 
important reasons for me to
switch to notmuch.

This said, I'd have to decline the offer to take over the bindings myself. 
Although it's tempting,
I don't feel confident enough to actually develop or competently review 
libnotmuch-level code
and having a lot on my plate with advancing alot I draw my line just here.
Of course this will not stop me from whining about bugs or occasionally sending 
in patches :).

I wish you good luck with all future projects and all the best for this new 
year.
Patrick




[PATCH] emacs: call "notmuch tag" only once when archiving a thread

2012-01-04 Thread David Edmondson
This seems like a good idea.

On Tue,  3 Jan 2012 20:29:06 +0200, Jani Nikula  wrote:
> On the downside, IIRC Xapian does not perform very well if the query
> (in this case a lot of message-ids OR'd together) is very big. It is
> unknown to me at which point this approach would become slower than
> the original one by one tagging approach, if ever.

Unless this limit is quite small (<1000), I'd be inclined not to worry
about it.

> Also, this introduces a limitation to the number of messages that can
> be archived at the same time (through ARG_MAX limiting the command
> line). At least on Linux this seems more like a theoretical limitation
> than a real one.

What's the failure mode when this does happen?

> +  (let ((message-ids))

No need for both sets of brackets:

   (let (message-ids)

is sufficient.

> +(loop do
> +   (let* ((current-tags (notmuch-show-get-tags))
> +  (new-tags (notmuch-show-del-tags-worker current-tags 
> toremove)))
> + (unless (equal current-tags new-tags)
> +   (add-to-list 'message-ids (notmuch-show-get-message-id
> +   until (not (notmuch-show-goto-message-next)))

`loop' has the ability to accumulate results, which would probably be
cleaner than `add-to-list'. See 'Accumulation Clauses' in the emacs cl
info.
-- 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/20120104/6b6bc8f6/attachment.pgp>


[PATCH] emacs: Helpers for notmuch developers.

2012-01-04 Thread David Edmondson
---

I've been using this for a few days and decided to share it to get
feedback. Reviewing patches can be tedious, so I tried to make things
a little simpler.

To use this, load the file and then from `notmuch-show-mode' invoke
`notmuch-dev-show-review-patch'. It assumes that any open messages
contain patches and attempts to build a repository with the patches
applied.

General management (i.e. keeping up to date) of the repository it uses
is your responsibility, as is cleaning out old branches. You can, of
course, just delete the temporary repository after using it - the code
will re-create it next time.

If you have a slow network connection then a local copy of the main
repository can be specified by changing
`notmuch-dev-master-repository'.

Comments?

 emacs/notmuch-dev.el |  121 ++
 1 files changed, 121 insertions(+), 0 deletions(-)
 create mode 100644 emacs/notmuch-dev.el

diff --git a/emacs/notmuch-dev.el b/emacs/notmuch-dev.el
new file mode 100644
index 000..63ee490
--- /dev/null
+++ b/emacs/notmuch-dev.el
@@ -0,0 +1,121 @@
+;; notmuch-dev.el --- help for notmuch developers
+;;
+;; Copyright ? David Edmondson
+;;
+;; This file is part of Notmuch.
+;;
+;; Notmuch is free software: you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; Notmuch is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with Notmuch.  If not, see .
+;;
+;; Authors: David Edmondson 
+
+(require 'notmuch-lib)
+(require 'notmuch-show)
+(require 'magit)
+
+(defgroup notmuch-dev nil
+  "Helpers for notmuch developers."
+  :group 'notmuch)
+
+(defcustom notmuch-dev-master-repository "git://notmuchmail.org/git/notmuch"
+  "The URI of the master notmuch repository."
+  :group 'notmuch-dev
+  :type 'string)
+
+(defcustom notmuch-dev-temporary-directory temporary-file-directory
+  "A directory in which to place temporary repositories."
+  :group 'notmuch-dev
+  :type 'string)
+
+;;
+
+(defvar notmuch-dev-temporary-repository-name (concat "notmuch-dev-" 
(user-login-name))
+  "The name of the temporary repository.")
+
+(defvar notmuch-dev-temporary-repository-path
+  (file-name-as-directory (file-truename (concat 
notmuch-dev-temporary-directory "/"
+
notmuch-dev-temporary-repository-name)))
+  "The path of the temporary repository.")
+
+(defun notmuch-dev-make-temporary-repository ()
+  (unless (file-directory-p notmuch-dev-temporary-repository-path)
+(message "Cloning %s into %s..." 
+notmuch-dev-master-repository 
notmuch-dev-temporary-repository-path)
+(magit-run* (list magit-git-executable "clone"
+ notmuch-dev-master-repository
+ notmuch-dev-temporary-repository-path))
+
+(unless (file-directory-p notmuch-dev-temporary-repository-path)
+  (error "git clone failed.")))
+
+  ;; Causes us to switch to the magit buffer - is that unfortunate in
+  ;; some situations?
+  (magit-status notmuch-dev-temporary-repository-path))
+
+(defun notmuch-dev-checkout-master ()
+  (magit-checkout "master"))
+
+(defun notmuch-dev-delete-branch (name)
+  (magit-delete-branch name))
+
+(defun notmuch-dev-create-branch (name)
+  ;; Switches to the new branch automatically.
+  (magit-create-branch name "master"))
+
+(defun notmuch-dev-title-to-branch (title)
+  (let* ((s (downcase title))
+(s (replace-regexp-in-string "[ \t]+" "-" s))
+(s (replace-regexp-in-string "[\]\[\":]" "" s))
+(s (replace-regexp-in-string ".$" "" s))
+)
+s))
+
+;;
+
+(defun notmuch-dev-show-review-patch ()
+  "Call this from `notmuch-show-mode'."
+  (interactive)
+
+  (notmuch-dev-review-patch (notmuch-show-get-subject)
+   (mapconcat 'identity
+  
(notmuch-show-get-message-ids-for-open-messages)
+  " | ")))
+
+(defun notmuch-dev-review-patch (title search-terms)
+  (let ((patch-name (notmuch-dev-title-to-branch title)))
+
+(notmuch-dev-make-temporary-repository)
+
+;; Switch to the repository directory.
+(let ((default-directory notmuch-dev-temporary-repository-path))
+
+  (notmuch-dev-checkout-master)
+  ;; Delete the branch if it exists.
+  (condition-case nil
+ (notmuch-dev-delete-branch patch-name)
+   (error nil))
+  (notmuch-dev-create-branch patch-name)
+
+  ;; Have notmuch generate mailbox format output for the search
+  ;; terms and feed that to git-am.
+  

[PATCH] Update NEWS for Emacs changes

2012-01-04 Thread Thomas Jost
---
Hello world,

Here's my part. (Also describes Ivy Foster's patch for notmuch-hello-mode-hook.)

Regards,
Thomas

 NEWS |   19 +++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/NEWS b/NEWS
index 6650126..8a3ff5a 100644
--- a/NEWS
+++ b/NEWS
@@ -34,6 +34,25 @@ Improvements in saved search management
   not inserted in front. It's also possible to define a sort function
   for displaying saved searches; alphabetical sort is provided.

+Hooks for notmuch-hello
+
+  Two new hooks have been added: "notmuch-hello-mode-hook" (called after
+  entering notmuch-hello-mode) and "notmuch-hello-refresh-hook" (called
+  after updating a notmuch-hello buffer).
+
+New face for crypto parts headers
+
+  Crypto parts used to be displayed with a hardcoded color. A new face
+  has been introduced to fix this: notmuch-crypto-part-header. It
+  defaults to the same value as before, but can be customized to match
+  other color themes.
+
+Use space as default thousands separator
+
+  Big numbers in notmuch-hello are now displayed using a space as
+  thousands separator (e.g. "123 456" instead of "123,456"). This can be
+  changed by customizing "notmuch-hello-thousands-separator".
+
 Performance
 ---

-- 
1.7.8.1



[ANNOUNCE] mutt with notmuch support

2012-01-04 Thread Jameson Graef Rollins
On Tue, 3 Jan 2012 20:59:51 +0100, Karel Zak  wrote:
> > I had to tweak your use of notmuch_database_find_message (I'm using
> > 0.11_rc2) but otherwise it compiles fine.
> 
> Unfortunately, the latest package for Fedora is notmuch-0.5-4.fc15 ;-(
> 
> But I'm ready to accept patches to make it compatible with other
> distros and the latest upstream.

Hey, Karel.  I know there are a lot of people out here that are
interested in playing with mutt-kz.  However, notmuch 0.5 is really old
and is unfortunately an API version ago.  Until we can get notmuch
working with gmime 2.6, and get a much-needed update to the Fedora
package, would you mind developing against a compiled-from-source
version of notmuch from the latest release?  I think you could get a lot
of users in short order if mutt-kz could work on systems other than
Fedora.

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


[PATCH] NEWS: consistent 2-space indentation

2012-01-04 Thread Jameson Graef Rollins
On Wed,  4 Jan 2012 15:26:52 +0200, Tomi Ollila  wrote:
> In NEWS file, indentation for item descriptions is generally 2 spaces
> but in a few cases there were 3 or 4 (4 caused different markdown
> handling) space indentations. Indentation in those lines are brought
> to consistent 2-space indentation.
> Note that this patch touches spacing in "historical" content --
> content of released versions 0.10.2, 0.10 and 0.6 -- in NEWS file.

Hey, Tomi.  I don't see that as being a big deal.

I also suggest we move to a NEWS directory, with each release getting a
separate file named after the release.  If we also formated the NEWS
entries in proper markdown it would make it trivial to sync the NEWS to
the wiki.

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


[PATCH 1/2] add notmuch keybinding 'd'

2012-01-04 Thread David Edmondson
On Tue, 03 Jan 2012 14:56:50 +, David Edmondson  wrote:
> On Sat, 16 Jul 2011 14:39:59 -0400, Antoine Beaupr?  
> wrote:
> > It adds a tag 'deleted' and removes the tags 'inbox' and 'unread'. It
> > works in show as well as in search mode
> 
> Various people have asked for a keybinding to add a 'delete' tag. Is
> this version the right one to choose?

No-one has spoken up in favour of this particular change (and the removal
of "unread" seems questionable) so I plan to mark it 'obsolete'. If
anyone would like to bring it back, please post an updated version of
the patch and argue for it.
-- 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/20120104/5fd84dc6/attachment.pgp>


Emacs: Crypto: How to get automatic encryption?

2012-01-04 Thread David Edmondson
On Wed, 04 Jan 2012 08:36:39 +, David Edmondson  wrote:
>   (if (and encrypt (dme:message-determine-encryption))

Oops. `encrypt' is set to `t' earlier if the code decides that I want to
encrypt outgoing mail (it's not set for work purposes, in essence).
-- 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/20120104/9b57c0a2/attachment.pgp>


Emacs: Crypto: How to get automatic encryption?

2012-01-04 Thread David Edmondson
On Tue, 03 Jan 2012 13:45:14 -0800, Jameson Graef Rollins  wrote:
> Any other suggestions?

In the function that I add to `message-send-hook' I do the following:

(message-goto-body)
;; If already set, don't override.
(if (not (looking-at (regexp-quote "<#secure ")))
;; If we can encrypt, do so, else just sign.
(if (and encrypt (dme:message-determine-encryption))
(insert "<#secure method=pgpmime mode=signencrypt>\n")
  (insert "<#secure method=pgpmime mode=sign>\n"

Where `dme:message-determine-encryption' is:

(defun dme:message-determine-encryption ()
  "Return `t' if we have gpg public keys for all recipients of
this message."
  (require 'pgg)
  (if (not (message-news-p)) ; No encryption for news.
  (catch :exit
(mapc
 (lambda (addr)
   (if (not (pgg-lookup-key (downcase (mail-strip-quoted-names addr
   (throw :exit nil)))
 (message-tokenize-header (concat
   (message-fetch-field "to")
   ","
   (message-fetch-field "cc"
t)
nil))

(I'd probably re-write that to use a cl loop now - it's very old.)
-- 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/20120104/afd87b4c/attachment-0001.pgp>


[PATCH 1/2] add notmuch keybinding 'd'

2012-01-04 Thread Jani Nikula
On Tue, 03 Jan 2012 13:35:23 -0800, Jameson Graef Rollins  wrote:
> There really can't be an "easier" solution to add a key binding other
> than just adding the above to your .emacs, and I really don't think it
> would be worth it to try to make one.

I guess you're right. Thanks for the example too.

> The fact that it's already so easy to customize the key bindings is why
> I've been reluctant (or even against) getting into protracted
> discussions about what the default key bindings should be.  Everyone is
> going to want a different behavior, and since it's easy enough to
> customize, just let users define what they want.

This is what I was basically after too: provide elementary functions
that make it easy for users to do what they want. (Just in this case
nothing more is really needed.)

As a side note, GNU Global has an interesting approach of not binding
any keys, unless you have done:
(setq gtags-suggested-key-mapping t)


BR,
Jani.


Emacs: Crypto: How to get automatic encryption?

2012-01-04 Thread Gregor Zattler
Hi Jamie, notmuch developers,
On Tue, 03 Jan 2012 13:45:14 -0800, Jameson Graef Rollins  wrote:
> On Tue, 3 Jan 2012 20:56:51 +0100, Gregor Zattler  
> wrote:
> > I replied to a PGP/MIME signed and encrypted e-mail and was
> > astonished to realise that my reply was sent unencrypted (and
> > unsigened for that matter).
> 
> Yikes!  Sorry this happened, and I hope nothing too sensitive was
> exposed.

No :-)

> Auto signing of outgoing mail can be enabled by the following [0]:
> 
> (add-hook 'message-setup-hook mml-secure-message-sign-pgpmime)
> 
> You can configure the message-setup-hook with the customization UI as
> well.

I tried this and enabled mml-secure-message-encrypt-pgpmime too.
I did a test with an address I have no public key for.  I was
informed of the fact and asked if I want to skip this key.  The
result was an email encrypted only to me (I suppose it's a
sensible default to include the key of the sender in the list of
key to encrypt to), so it would be unreadable for the recipient :-(

> Unfortunately, auto encrypting of replies to encrypted emails is not yet
> implemented.  It is desperately needed, though, obviously.  So this is a
> good excuse to start a discussion about how we could achieve this.
> 
> It just occurs to me that a way to do this would be to have notmuch
> reply add the appropriate mml #secure tag for encryption to the output
> reply template, maybe with something like a --emacs option.  That would
> be pretty easy to implement, although it would obviously be very UI
> specific.
> 
> Another possibility would be for notmuch reply to add some sort of
> header to the reply message to indicate that the original was encrypted,
> and then do something in emacs to try to read that header and add the
> appropriate mml #secure tag.  That would also be easy to implement in
> the notmuch CLI, and it would be more UI agnostic, but it would require
> a lot more elisp.
> 
> Or maybe we could support both?
> 
> Any other suggestions?

I'm no developer; your second suggestion sounds more plausible
me since notmuch is a frontend-agnostic mail system.

> > Actually the message buffer in which I write replies has Auto
> > Encryption Mode enabled, but nothing happens.  
> 
> That's unfortunate.  Can you explain exactly how you set this up, and
> how it didn't work?

Actually I did not set it up.  I tested this again with emacs23
-q ...  It has something to do with EasyPG and therefore I assume
it only works on the level of file encryption if the file
associated with the buffer ends in .pgp  But that's a guess.


[...]
> It's actually usually mml that is used with message-mode to
> sign/encrypt message, not epg.

Thanks for your info.  Actually I'm a mutt user and I customised
mutt to opportunistically encrypt emails if I/gpg have/has public
keys for all recipients of an email.  I have no clue how to
achieve this with Emacs.

Ciao; Gregor


[ANNOUNCE] mutt with notmuch support

2012-01-04 Thread Jan Pobrislo
On Tue, 3 Jan 2012 13:39:38 +0100
Karel Zak  wrote:

> 
> This is not another curses front-end for notmuch, this is mutt :-)
> 
> I have forked mutt to seriously integrate notmuch to this excellent
> e-mail client. I don't want to use symlinks or any other hacks to
> emulate virtual folders. My wish is mutt linked with libnotmuch.

Good to hear!

First, I'll shamelessly plug in my set of scripts that do the dirty work by
using symlinked maildirs to interact with any maildir capable mail reader.
It's mainly intended to be interface from shell, calling out to mutt or any
mail reader only when necessary, so it's somewhat reverse paradigm to yours.

view @ http://webprojekty.cz/ccx/loggerhead/zmuch/files
bzr branch http://webprojekty.cz/ccx/bzr/zmuch

Sadly I had to take hiatus mid-rewrite of it, but several interesting points
came up when I was talking about it with cworth and others.

We agreed that we wanted to standardize several features currently present in
emacs UI, so we can share configuration among several implementations. Most
important of these were:

saved searches
--

This is the feature I started writing my scripts for. I wanted to refer by a
simple shorthand to complex queries. I know emacs UI has some notion of
remembered queries, but I haven't really bothered trying it out. I assume you
will want to represent these as separate mailboxes, maybe shown using the
sidebar patch, so one has quick overview what's new in which ML.

The way I do this is that command:

$ zmuch search :foss and not :notmuch

will expand to:

$ notmuch search ( to:lists.xmms.se or ( to:cairo-announce at cairographics.org
or to:cairo at cairographics.org ) or ( to:notmuch at notmuchmail.org or
to:notmuch-request at notmuchmail.org ) ) and not (
to:notmuch at notmuchmail.org or to:notmuch-request at notmuchmail.org )

Which would be bit too much to type by hand, even for so few lists.
This would be using .notmuch-config with something like this:

[zmuch_searches]
xmms2=to:lists.xmms.se
cairo=to:cairo-announce at cairographics.org or to:cairo at cairographics.org
foss=:xmms2 or :cairo or :notmuch

Subset of this issue is the question: How to display overview of such saved
queries in a sensible manner? Mutt probably can't go beyond unread/total
number of messages for each query and that's actually what I have currently
implemented. Given the config:

[interesting]
query=is:unread and not ( is:spam or is:mute )

[zmuch_show]
selected=twisted;notmuch;gentoo-cs;cajovna;system;inbox

it would show number of interesting/total messages for each of the listed
saved query. Much nicer generalisation was then discussed on IRC, where you
could use regular saved search instead of separate [interesting] entry,
allowing you to have several such queries, eg. for displaying
unread/flagged/muted/total or anything your heart desires.

way to call notmuch
---

This might be feature you'll be probably missing due to using libnotmuch
directly instead of calling out executable as emacs UI does, but I find it
really useful to be able to layer functionality unix-style. Not only you can
run remote notmuch via ssh, but also my saved search implementation does this
by expanding arguments passed to the notmuch executable and as such is usable
from any UI that has configurable executable to call instead of "notmuch".

colors
--

Again dunno how much this applies to mutt, as it has it's own coloring
paradigm, but I find it neat to be able to do something like this globally:

[tag_colors]
flagged=%F{red}
mute=%B%F{black}
spam=%F{magenta}
unread=%F{cyan}
replied=%F{yellow}
sent=%F{green}
attachment=%B

This is syntax that zsh uses for it's print/prompt formatting and is obviously
ANSI VT specific (%B is for bold/standout). GUI lovers will probably want #RGB
scheme too.


HTH bring up some good ideas and discussion.


Re: [PATCH 1/2] add notmuch keybinding 'd'

2012-01-04 Thread Jani Nikula
On Tue, 03 Jan 2012 13:35:23 -0800, Jameson Graef Rollins 
jroll...@finestructure.net wrote:
 There really can't be an easier solution to add a key binding other
 than just adding the above to your .emacs, and I really don't think it
 would be worth it to try to make one.

I guess you're right. Thanks for the example too.

 The fact that it's already so easy to customize the key bindings is why
 I've been reluctant (or even against) getting into protracted
 discussions about what the default key bindings should be.  Everyone is
 going to want a different behavior, and since it's easy enough to
 customize, just let users define what they want.

This is what I was basically after too: provide elementary functions
that make it easy for users to do what they want. (Just in this case
nothing more is really needed.)

As a side note, GNU Global has an interesting approach of not binding
any keys, unless you have done:
(setq gtags-suggested-key-mapping t)


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


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

2012-01-04 Thread David Edmondson
On Tue, 03 Jan 2012 13:45:14 -0800, Jameson Graef Rollins 
jroll...@finestructure.net wrote:
 Any other suggestions?

In the function that I add to `message-send-hook' I do the following:

(message-goto-body)
;; If already set, don't override.
(if (not (looking-at (regexp-quote #secure )))
;; If we can encrypt, do so, else just sign.
(if (and encrypt (dme:message-determine-encryption))
(insert #secure method=pgpmime mode=signencrypt\n)
  (insert #secure method=pgpmime mode=sign\n

Where `dme:message-determine-encryption' is:

(defun dme:message-determine-encryption ()
  Return `t' if we have gpg public keys for all recipients of
this message.
  (require 'pgg)
  (if (not (message-news-p)) ; No encryption for news.
  (catch :exit
(mapc
 (lambda (addr)
   (if (not (pgg-lookup-key (downcase (mail-strip-quoted-names addr
   (throw :exit nil)))
 (message-tokenize-header (concat
   (message-fetch-field to)
   ,
   (message-fetch-field cc
t)
nil))

(I'd probably re-write that to use a cl loop now - it's very old.)


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


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

2012-01-04 Thread David Edmondson
On Wed, 04 Jan 2012 08:36:39 +, David Edmondson d...@dme.org wrote:
   (if (and encrypt (dme:message-determine-encryption))

Oops. `encrypt' is set to `t' earlier if the code decides that I want to
encrypt outgoing mail (it's not set for work purposes, in essence).


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


Re: [PATCH 1/2] add notmuch keybinding 'd'

2012-01-04 Thread David Edmondson
On Tue, 03 Jan 2012 14:56:50 +, David Edmondson d...@dme.org wrote:
 On Sat, 16 Jul 2011 14:39:59 -0400, Antoine Beaupré anar...@koumbit.org 
 wrote:
  It adds a tag 'deleted' and removes the tags 'inbox' and 'unread'. It
  works in show as well as in search mode
 
 Various people have asked for a keybinding to add a 'delete' tag. Is
 this version the right one to choose?

No-one has spoken up in favour of this particular change (and the removal
of unread seems questionable) so I plan to mark it 'obsolete'. If
anyone would like to bring it back, please post an updated version of
the patch and argue for it.


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


[PATCH] Update NEWS for Emacs changes

2012-01-04 Thread Thomas Jost
---
Hello world,

Here's my part. (Also describes Ivy Foster's patch for notmuch-hello-mode-hook.)

Regards,
Thomas

 NEWS |   19 +++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/NEWS b/NEWS
index 6650126..8a3ff5a 100644
--- a/NEWS
+++ b/NEWS
@@ -34,6 +34,25 @@ Improvements in saved search management
   not inserted in front. It's also possible to define a sort function
   for displaying saved searches; alphabetical sort is provided.
 
+Hooks for notmuch-hello
+
+  Two new hooks have been added: notmuch-hello-mode-hook (called after
+  entering notmuch-hello-mode) and notmuch-hello-refresh-hook (called
+  after updating a notmuch-hello buffer).
+
+New face for crypto parts headers
+
+  Crypto parts used to be displayed with a hardcoded color. A new face
+  has been introduced to fix this: notmuch-crypto-part-header. It
+  defaults to the same value as before, but can be customized to match
+  other color themes.
+
+Use space as default thousands separator
+
+  Big numbers in notmuch-hello are now displayed using a space as
+  thousands separator (e.g. 123 456 instead of 123,456). This can be
+  changed by customizing notmuch-hello-thousands-separator.
+
 Performance
 ---
 
-- 
1.7.8.1

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


[PATCH] NEWS: consistent 2-space indentation

2012-01-04 Thread Tomi Ollila
In NEWS file, indentation for item descriptions is generally 2 spaces
but in a few cases there were 3 or 4 (4 caused different markdown
handling) space indentations. Indentation in those lines are brought
to consistent 2-space indentation.
Note that this patch touches spacing in historical content --
content of released versions 0.10.2, 0.10 and 0.6 -- in NEWS file.
---
This patch is submitted on release branch.
 NEWS |   16 
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/NEWS b/NEWS
index 6650126..7c0b991 100644
--- a/NEWS
+++ b/NEWS
@@ -66,8 +66,8 @@ Bug-fix release.
 
 Fix crash in python bindings.
 
-The python bindings did not call g_type_init, which caused crashes
-for some, but not all users.
+  The python bindings did not call g_type_init, which caused crashes
+  for some, but not all users.
 
 Notmuch 0.10.1 (2011-11-25)
 ===
@@ -137,8 +137,8 @@ Add keybinding ('c I') for stashing Message-ID's without an 
id: prefix
 
 Do not query on notmuch-search exit
 
-   It is harmless to kill the external notmuch process, so the user
-   is no longer interrogated when they interrupt a search.
+  It is harmless to kill the external notmuch process, so the user
+  is no longer interrogated when they interrupt a search.
 
 Performance
 ---
@@ -167,9 +167,9 @@ mailing list.
 
 nmbug - share tags with a given prefix
 
-   nmbug helps maintain a git repo containing all tags with a given
-   prefix (by default notmuch::). Tags can be shared by commiting
-   them to git in one location and restoring in another.
+  nmbug helps maintain a git repo containing all tags with a given
+  prefix (by default notmuch::). Tags can be shared by commiting
+  them to git in one location and restoring in another.
 
 Notmuch 0.9 (2011-10-01)
 
@@ -554,7 +554,7 @@ Ruby bindings are now much more complete
s1.union(s2)
s2 -= s1
 
-   Removed:
+  Removed:
  - len(Messages()) as it exhausted the iterator.
Use len(list(Messages())) or
Query.count_messages() to get the length.
-- 
1.7.7.3

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


[PATCH] emacs: Helpers for notmuch developers.

2012-01-04 Thread David Edmondson
---

I've been using this for a few days and decided to share it to get
feedback. Reviewing patches can be tedious, so I tried to make things
a little simpler.

To use this, load the file and then from `notmuch-show-mode' invoke
`notmuch-dev-show-review-patch'. It assumes that any open messages
contain patches and attempts to build a repository with the patches
applied.

General management (i.e. keeping up to date) of the repository it uses
is your responsibility, as is cleaning out old branches. You can, of
course, just delete the temporary repository after using it - the code
will re-create it next time.

If you have a slow network connection then a local copy of the main
repository can be specified by changing
`notmuch-dev-master-repository'.

Comments?

 emacs/notmuch-dev.el |  121 ++
 1 files changed, 121 insertions(+), 0 deletions(-)
 create mode 100644 emacs/notmuch-dev.el

diff --git a/emacs/notmuch-dev.el b/emacs/notmuch-dev.el
new file mode 100644
index 000..63ee490
--- /dev/null
+++ b/emacs/notmuch-dev.el
@@ -0,0 +1,121 @@
+;; notmuch-dev.el --- help for notmuch developers
+;;
+;; Copyright © David Edmondson
+;;
+;; This file is part of Notmuch.
+;;
+;; Notmuch is free software: you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; Notmuch is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with Notmuch.  If not, see http://www.gnu.org/licenses/.
+;;
+;; Authors: David Edmondson d...@dme.org
+
+(require 'notmuch-lib)
+(require 'notmuch-show)
+(require 'magit)
+
+(defgroup notmuch-dev nil
+  Helpers for notmuch developers.
+  :group 'notmuch)
+
+(defcustom notmuch-dev-master-repository git://notmuchmail.org/git/notmuch
+  The URI of the master notmuch repository.
+  :group 'notmuch-dev
+  :type 'string)
+
+(defcustom notmuch-dev-temporary-directory temporary-file-directory
+  A directory in which to place temporary repositories.
+  :group 'notmuch-dev
+  :type 'string)
+
+;;
+
+(defvar notmuch-dev-temporary-repository-name (concat notmuch-dev- 
(user-login-name))
+  The name of the temporary repository.)
+
+(defvar notmuch-dev-temporary-repository-path
+  (file-name-as-directory (file-truename (concat 
notmuch-dev-temporary-directory /
+
notmuch-dev-temporary-repository-name)))
+  The path of the temporary repository.)
+
+(defun notmuch-dev-make-temporary-repository ()
+  (unless (file-directory-p notmuch-dev-temporary-repository-path)
+(message Cloning %s into %s... 
+notmuch-dev-master-repository 
notmuch-dev-temporary-repository-path)
+(magit-run* (list magit-git-executable clone
+ notmuch-dev-master-repository
+ notmuch-dev-temporary-repository-path))
+
+(unless (file-directory-p notmuch-dev-temporary-repository-path)
+  (error git clone failed.)))
+
+  ;; Causes us to switch to the magit buffer - is that unfortunate in
+  ;; some situations?
+  (magit-status notmuch-dev-temporary-repository-path))
+
+(defun notmuch-dev-checkout-master ()
+  (magit-checkout master))
+
+(defun notmuch-dev-delete-branch (name)
+  (magit-delete-branch name))
+
+(defun notmuch-dev-create-branch (name)
+  ;; Switches to the new branch automatically.
+  (magit-create-branch name master))
+
+(defun notmuch-dev-title-to-branch (title)
+  (let* ((s (downcase title))
+(s (replace-regexp-in-string [ \t]+ - s))
+(s (replace-regexp-in-string [\]\[\:]  s))
+(s (replace-regexp-in-string .$  s))
+)
+s))
+
+;;
+
+(defun notmuch-dev-show-review-patch ()
+  Call this from `notmuch-show-mode'.
+  (interactive)
+
+  (notmuch-dev-review-patch (notmuch-show-get-subject)
+   (mapconcat 'identity
+  
(notmuch-show-get-message-ids-for-open-messages)
+   | )))
+
+(defun notmuch-dev-review-patch (title search-terms)
+  (let ((patch-name (notmuch-dev-title-to-branch title)))
+
+(notmuch-dev-make-temporary-repository)
+
+;; Switch to the repository directory.
+(let ((default-directory notmuch-dev-temporary-repository-path))
+
+  (notmuch-dev-checkout-master)
+  ;; Delete the branch if it exists.
+  (condition-case nil
+ (notmuch-dev-delete-branch patch-name)
+   (error nil))
+  (notmuch-dev-create-branch patch-name)
+
+  ;; Have notmuch generate mailbox format output for the search
+  ;; terms and feed that to git-am.
+  (shell-command
+   (concat
+   

Re: [PATCH] emacs: call notmuch tag only once when archiving a thread

2012-01-04 Thread David Edmondson
This seems like a good idea.

On Tue,  3 Jan 2012 20:29:06 +0200, Jani Nikula j...@nikula.org wrote:
 On the downside, IIRC Xapian does not perform very well if the query
 (in this case a lot of message-ids OR'd together) is very big. It is
 unknown to me at which point this approach would become slower than
 the original one by one tagging approach, if ever.

Unless this limit is quite small (1000), I'd be inclined not to worry
about it.

 Also, this introduces a limitation to the number of messages that can
 be archived at the same time (through ARG_MAX limiting the command
 line). At least on Linux this seems more like a theoretical limitation
 than a real one.

What's the failure mode when this does happen?

 +  (let ((message-ids))

No need for both sets of brackets:

   (let (message-ids)

is sufficient.

 +(loop do
 +   (let* ((current-tags (notmuch-show-get-tags))
 +  (new-tags (notmuch-show-del-tags-worker current-tags 
 toremove)))
 + (unless (equal current-tags new-tags)
 +   (add-to-list 'message-ids (notmuch-show-get-message-id
 +   until (not (notmuch-show-goto-message-next)))

`loop' has the ability to accumulate results, which would probably be
cleaner than `add-to-list'. See 'Accumulation Clauses' in the emacs cl
info.


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


Re: Python bindings for adoption

2012-01-04 Thread Patrick Totzke
Sebastian,

I'm sorry to hear of your decision to finally hand over the maintainership of 
the bindings
but of course I fully understand that you want to focus on other stuff.
Thanks for your great work! Your bindings were certainly one of the most 
important reasons for me to
switch to notmuch.

This said, I'd have to decline the offer to take over the bindings myself. 
Although it's tempting,
I don't feel confident enough to actually develop or competently review 
libnotmuch-level code
and having a lot on my plate with advancing alot I draw my line just here.
Of course this will not stop me from whining about bugs or occasionally sending 
in patches :).

I wish you good luck with all future projects and all the best for this new 
year.
Patrick


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