[PATCH] fix typo in Tags.__len__

2011-08-03 Thread Cédric Cabessa
Here is a sample that trigger the bug :
"""
import notmuch
db = notmuch.Database()
query = db.create_query("tag:inbox")

for m in query.search_messages():
len(m.get_tags())

"""
---
 bindings/python/notmuch/tag.py |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/bindings/python/notmuch/tag.py b/bindings/python/notmuch/tag.py
index 65a9118..2f82c1a 100644
--- a/bindings/python/notmuch/tag.py
+++ b/bindings/python/notmuch/tag.py
@@ -116,8 +116,8 @@ class Tags(object):
 raise NotmuchError(STATUS.NOT_INITIALIZED)

 i=0
-while nmlib.notmuch_tags_valid(self._msgs):
-nmlib.notmuch_tags_move_to_next(self._msgs)
+while nmlib.notmuch_tags_valid(self._tags):
+nmlib.notmuch_tags_move_to_next(self._tags)
 i += 1
 self._tags = None
 return i
-- 
1.7.6



[PATCH] configure: add options to disable emacs/zsh/bash and choose install dir.

2011-01-24 Thread Cédric Cabessa
On Monday 24 January 2011 08:10:20 Xavier Maillard wrote:
> 
> Why not just try to detect whether bash/zsh or even emacs is available
> on the system and install the dependent files when it is the case ?

Hi Xavier,

I think it is better to let user explicitly choose what he want to install
or not. 
For the story, I am a gentoo user, in gentoo you can choose what
you want to install from a package with the USE flag mechanism.
(for example a ncurse client will depend of notmuch but without emacs support, 
another user will install the same notmuch package but with emacs support).

So the with/without options make the packaging very easy.

I think we can do autodetection if needed, but the user should be able to 
override the automatic behavior.


-- 
C?dric



[PATCH] configure: add options to disable emacs/zsh/bash and choose install dir.

2011-01-23 Thread Cédric Cabessa
add --bashcompletiondir and --zshcompletiondir (like --emacslispdir) to choose
installation dir for bash/zsh completion files

Make some features optional:
  --without-emacs / --with-emacs=no do not install lisp file
  --without-bash-completion / --with-bash-completion=no  do not install bash
files
  --without-zsh-completion / --with-zsh-completion=no do not install zsh files
By default, everything is enabled. You can reenable something with
  --with-feature=yes
---
 Makefile.local|2 +
 completion/Makefile.local |4 +++
 configure |   53 +++-
 emacs/Makefile.local  |2 +
 4 files changed, 59 insertions(+), 2 deletions(-)

diff --git a/Makefile.local b/Makefile.local
index f9b5a9b..3c6151c 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -277,6 +277,7 @@ ifeq ($(MAKECMDGOALS), install)
@echo "through the process of configuring notmuch and creating"
@echo "a database of existing email messages. The \"notmuch\""
@echo "command will also offer some sample search commands."
+ifeq ($(WITH_EMACS), 1)
@echo ""
@echo "Beyond the command-line interface, notmuch also offers"
@echo "a full-featured interface for reading and writing mail"
@@ -288,6 +289,7 @@ ifeq ($(MAKECMDGOALS), install)
@echo "And then run emacs as \"emacs -f notmuch\" or invoke"
@echo "the command \"M-x notmuch\" from within emacs."
 endif
+endif

 .PHONY: install-desktop
 install-desktop:
diff --git a/completion/Makefile.local b/completion/Makefile.local
index 6a6012d..0b74c06 100644
--- a/completion/Makefile.local
+++ b/completion/Makefile.local
@@ -12,7 +12,11 @@ install: install-$(dir)

 install-$(dir):
@echo $@
+ifeq ($(WITH_BASH),1)
mkdir -p $(DESTDIR)$(bash_completion_dir)
install -m0644 $(bash_script) $(DESTDIR)$(bash_completion_dir)/notmuch
+endif
+ifeq ($(WITH_ZSH),1)
mkdir -p $(DESTDIR)$(zsh_completion_dir)
install -m0644 $(zsh_script) $(DESTDIR)$(zsh_completion_dir)/notmuch
+endif
diff --git a/configure b/configure
index c58dd0f..c7ec414 100755
--- a/configure
+++ b/configure
@@ -28,6 +28,9 @@ XAPIAN_CONFIG=${XAPIAN_CONFIG:-xapian-config}
 # options.
 PREFIX=/usr/local
 LIBDIR=
+WITH_EMACS=1
+WITH_BASH=1
+WITH_ZSH=1

 usage ()
 {
@@ -81,6 +84,15 @@ Fine tuning of some installation directories is available:
--mandir=DIRInstall man pages to DIR [PREFIX/share/man]
--sysconfdir=DIRRead-only single-machine data [PREFIX/etc]
--emacslispdir=DIR  Emacs code [PREFIX/share/emacs/site-lisp]
+   --bashcompletiondir=DIR Bash completions files 
[SYSCONFDIR/bash_completion.d]
+   --zshcompletiondir=DIR  Zsh completions files 
[PREFIX/share/zsh/functions/Completion/Unix]
+
+Some features can be disabled (--with-feature=no is equivalent to
+--without-feature) :
+
+   --without-emacs Do not install lisp file
+   --without-bash-completion   Do not install bash completions files
+   --without-zsh-completionDo not install zsh completions files

 Additional options are accepted for compatibility with other
 configure-script calling conventions, but don't do anything yet:
@@ -114,6 +126,34 @@ for option; do
SYSCONFDIR="${option#*=}"
 elif [ "${option%%=*}" = '--emacslispdir' ] ; then
EMACSLISPDIR="${option#*=}"
+elif [ "${option%%=*}" = '--bashcompletiondir' ] ; then
+   BASHCOMPLETIONDIR="${option#*=}"
+elif [ "${option%%=*}" = '--zshcompletiondir' ] ; then
+   ZSHCOMLETIONDIR="${option#*=}"
+elif [ "${option%%=*}" = '--with-emacs' ]; then
+   if [ "${option#*=}" = 'no' ]; then
+   WITH_EMACS=0
+   else
+   WITH_EMACS=1
+   fi
+elif [ "${option}" = '--without-emacs' ] ; then
+   WITH_EMACS=0
+elif [ "${option%%=*}" = '--with-bash-completion' ]; then
+   if [ "${option#*=}" = 'no' ]; then
+   WITH_BASH=0
+   else
+   WITH_BASH=1
+   fi
+elif [ "${option}" = '--without-bash-completion' ] ; then
+   WITH_BASH=0
+elif [ "${option%%=*}" = '--with-zsh-completion' ]; then
+   if [ "${option#*=}" = 'no' ]; then
+   WITH_ZSH=0
+   else
+   WITH_ZSH=1
+   fi
+elif [ "${option}" = '--without-zsh-completion' ] ; then
+   WITH_ZSH=0
 elif [ "${option%%=*}" = '--build' ] ; then
build_option="${option#*=}"
case ${build_option} in
@@ -527,10 +567,10 @@ HAVE_EMACS = ${have_emacs}
 desktop_dir = \$(prefix)/share/applications

 # The directory to which bash completions files should be installed
-bash_completion_dir = \$(sysconfdir)/bash_completion.d
+bash_completion_dir = ${BASHCOMPLETIONDIR:=\$(sysconfdir)/bash_completion.d}

 # The directory to which zsh completions files should be installed
-zsh_completion_dir = \$(prefix)/share/zsh/functions/Completion/Unix
+zsh_completion_dir = 

[PATCH] How to improve the mail handling workflow?

2010-11-13 Thread Cédric Cabessa
On Friday 12 November 2010 16:23:58 Matthieu Lemerre wrote:
>  - Processing mails which do not have any automatically added tag is
>boring, because I need to press several keys to archive them: "+" to
>add a tag, and then "a". If I forget about +, then my mail is
>impossible to find.

I feel the same !
I do not know if notmuch/xapian can find mail with 0 tag or only "attachment" 
tag for exemple ?

The dirty solution I found is to create a virtual folder called "orphan" that 
contains none of all the other tags (ie not tag:foo and not tag:bar and not 
...)


I do not considere "attachment" as a real tag. I should now do the same for 
"replied" and all other new stuff

"""
(require 'cl)

(defun tagreduce(a b)
  (if (or (string= a "attachment") (string= b "attachment"))
  (if (string= a "attachment")
b
a
)
(if (not (string-match "and not" a))
(concat "not tag:" a " and not tag:" b)
  (concat a " and not tag:" b)
  )
)
  )


(defun orphan() 
  (reduce 'tagreduce (split-string (with-output-to-string
 (with-current-buffer standard-output
   (apply 'call-process notmuch-command nil 
t nil 
"search-tags" nil))) "\n+" t))
)

(setq pnotmuch-orphans (append '("orphan") (orphan)))
(setq notmuch-folders (append notmuch-folders (list pnotmuch-orphans)))

"""

(excuse my lisp ...)

-- 
C?dric


Re: [PATCH] How to improve the mail handling workflow?

2010-11-13 Thread Cédric Cabessa
On Friday 12 November 2010 16:23:58 Matthieu Lemerre wrote:
  - Processing mails which do not have any automatically added tag is
boring, because I need to press several keys to archive them: + to
add a tag, and then a. If I forget about +, then my mail is
impossible to find.

I feel the same !
I do not know if notmuch/xapian can find mail with 0 tag or only attachment 
tag for exemple ?

The dirty solution I found is to create a virtual folder called orphan that 
contains none of all the other tags (ie not tag:foo and not tag:bar and not 
...)


I do not considere attachment as a real tag. I should now do the same for 
replied and all other new stuff


(require 'cl)

(defun tagreduce(a b)
  (if (or (string= a attachment) (string= b attachment))
  (if (string= a attachment)
b
a
)
(if (not (string-match and not a))
(concat not tag: a  and not tag: b)
  (concat a  and not tag: b)
  )
)
  )


(defun orphan() 
  (reduce 'tagreduce (split-string (with-output-to-string
 (with-current-buffer standard-output
   (apply 'call-process notmuch-command nil 
t nil 
search-tags nil))) \n+ t))
)

(setq pnotmuch-orphans (append '(orphan) (orphan)))
(setq notmuch-folders (append notmuch-folders (list pnotmuch-orphans)))



(excuse my lisp ...)

-- 
Cédric
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


opening attachment

2010-10-09 Thread Cédric Cabessa
On Wednesday 06 October 2010 08:47:18 Michal Sojka wrote:
> It would be nice if a user could override this, but I do not know how to
> do it. Perhaps some elisp guru can tell us.

Without lisp, you can customize your ~/.mailcap file (or /etc/mailcap)

see: 
http://www.gnus.org/manual/emacs-mime_30.html
http://tools.ietf.org/html/rfc1524

-- 
C?dric


[PATCH] configure: add ignored options for compatibility.

2010-04-25 Thread Cédric Cabessa
gentoo's ebuild script expects 2 more options for configure:
  --host (same format as --build)
  --datadir
---
 configure |   20 
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/configure b/configure
index ec8c3fd..c522ad8 100755
--- a/configure
+++ b/configure
@@ -77,7 +77,9 @@ Additional options are accepted for compatibility with other
 configure-script calling conventions, but don't do anything yet:

--build=-- Currently ignored
+   --host=--  Currently ignored
--infodir=DIR   Currently ignored
+   --datadir=DIR   Currently ignored
--localstatedir=DIR Currently ignored
--libexecdir=DIRCurrently ignored
--disable-maintainer-mode   Currently ignored
@@ -119,8 +121,26 @@ for option; do
build_option=${build_option#*-}
build_vendor=${build_option%%-*}
build_os=${build_option#*-}
+elif [ "${option%%=*}" = '--host' ] ; then
+   host_option="${option#*=}"
+   case ${host_option} in
+   *-*-*) ;;
+   *)
+   echo "Unrecognized value for --host option: ${host_option}"
+   echo "Should be: --"
+   echo "See:"
+   echo "  $0 --help"
+   echo ""
+   exit 1
+   esac
+   host_cpu=${host_option%%-*}
+   host_option=${host_option#*-}
+   host_vendor=${host_option%%-*}
+   host_os=${host_option#*-}
 elif [ "${option%%=*}" = '--infodir' ] ; then
true
+elif [ "${option%%=*}" = '--datadir' ] ; then
+   true
 elif [ "${option%%=*}" = '--localstatedir' ] ; then
true
 elif [ "${option%%=*}" = '--libexecdir' ] ; then
-- 
1.7.0.4



[PATCH] configure: add ignored options for compatibility.

2010-04-24 Thread Cédric Cabessa
gentoo's ebuild script expects 2 more options for configure:
  --host (same format as --build)
  --datadir
---
 configure |   20 
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/configure b/configure
index ec8c3fd..c522ad8 100755
--- a/configure
+++ b/configure
@@ -77,7 +77,9 @@ Additional options are accepted for compatibility with other
 configure-script calling conventions, but don't do anything yet:
 
--build=cpu-vendor-os Currently ignored
+   --host=cpu-vendor-os  Currently ignored
--infodir=DIR   Currently ignored
+   --datadir=DIR   Currently ignored
--localstatedir=DIR Currently ignored
--libexecdir=DIRCurrently ignored
--disable-maintainer-mode   Currently ignored
@@ -119,8 +121,26 @@ for option; do
build_option=${build_option#*-}
build_vendor=${build_option%%-*}
build_os=${build_option#*-}
+elif [ ${option%%=*} = '--host' ] ; then
+   host_option=${option#*=}
+   case ${host_option} in
+   *-*-*) ;;
+   *)
+   echo Unrecognized value for --host option: ${host_option}
+   echo Should be: cpu-vendor-os
+   echo See:
+   echo   $0 --help
+   echo 
+   exit 1
+   esac
+   host_cpu=${host_option%%-*}
+   host_option=${host_option#*-}
+   host_vendor=${host_option%%-*}
+   host_os=${host_option#*-}
 elif [ ${option%%=*} = '--infodir' ] ; then
true
+elif [ ${option%%=*} = '--datadir' ] ; then
+   true
 elif [ ${option%%=*} = '--localstatedir' ] ; then
true
 elif [ ${option%%=*} = '--libexecdir' ] ; then
-- 
1.7.0.4

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


[notmuch] cnotmuch 0.1.1 release

2010-04-03 Thread Cédric Cabessa


spaetz wrote:
> 
> It needs to have a libnotmuch.so or libnotmuch.so.1 available in some
> library folder or will raise an exception when loading.
> "OSError: libnotmuch.so.1: cannot open shared object file: No such file or
> directory"
> 

libnotmuch.so is in my personal folder, I'd like to use LD_LIBRARY_PATH for
that.
The problem is that find_library does not read this variable, but hopefully
CDLL does.

I suggest to not use find_library. If the library do not exist, we just have
to catch the exception.
The other advantage is that CDLL allow us to choose a library version
(find_library will always take the latest).

Here is a patch
http://n3.nabble.com/file/n695408/ld_library_path.patch
ld_library_path.patch 

-- 
C?dric

-- 
View this message in context: 
http://n3.nabble.com/cnotmuch-0-1-1-release-tp466611p695408.html
Sent from the notmuch mailing list archive at Nabble.com.


Re: [notmuch] cnotmuch 0.1.1 release

2010-04-03 Thread Cédric Cabessa


spaetz wrote:
 
 It needs to have a libnotmuch.so or libnotmuch.so.1 available in some
 library folder or will raise an exception when loading.
 OSError: libnotmuch.so.1: cannot open shared object file: No such file or
 directory
 

libnotmuch.so is in my personal folder, I'd like to use LD_LIBRARY_PATH for
that.
The problem is that find_library does not read this variable, but hopefully
CDLL does.

I suggest to not use find_library. If the library do not exist, we just have
to catch the exception.
The other advantage is that CDLL allow us to choose a library version
(find_library will always take the latest).

Here is a patch
http://n3.nabble.com/file/n695408/ld_library_path.patch
ld_library_path.patch 

-- 
Cédric

-- 
View this message in context: 
http://n3.nabble.com/cnotmuch-0-1-1-release-tp466611p695408.html
Sent from the notmuch mailing list archive at Nabble.com.
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch