[PATCH] Rearchitect the way the Received: header is concatenated

2010-04-23 Thread Dirk Hohndel

The previous implementation misunderstood the way the message file
was handled. Under certain circumstances this could cause SEGVs as
we were trying to keep reading from the file after it was closed.

Now we treat the Received: header as special and always concatenate
it when parsing the headers.

Signed-off-by: Dirk Hohndel 
---
 lib/message-file.c|   53 -
 lib/notmuch-private.h |3 +
 lib/notmuch.h |   16 ++
 notmuch-reply.c   |  125 +
 4 files changed, 154 insertions(+), 43 deletions(-)

diff --git a/lib/message-file.c b/lib/message-file.c
index 0c152a3..75b3990 100644
--- a/lib/message-file.c
+++ b/lib/message-file.c
@@ -209,16 +209,23 @@ copy_header_unfolding (header_value_closure_t *value,

 /* As a special-case, a value of NULL for header_desired will force
  * the entire header to be parsed if it is not parsed already. This is
- * used by the _notmuch_message_file_get_headers_end function. */
+ * used by the _notmuch_message_file_get_headers_end function.
+ * Another special case is the Received: header. For this header we
+ * want to concatenate all instances of the header instead of just
+ * hashing the first instance as we use this when analyzing the path
+ * the mail has taken from sender to recipient.
+ */
 const char *
 notmuch_message_file_get_header (notmuch_message_file_t *message,
 const char *header_desired)
 {
 int contains;
-char *header, *decoded_value;
+char *header, *decoded_value, *header_sofar, *combined_header;
 const char *s, *colon;
-int match;
+int match, newhdr, hdrsofar, received;
 static int initialized = 0;
+
+received = (strcmp(header_desired,"received") == 0);

 if (! initialized) {
g_mime_init (0);
@@ -312,22 +319,34 @@ notmuch_message_file_get_header (notmuch_message_file_t 
*message,

NEXT_HEADER_LINE (>value);

-   if (header_desired == 0)
+   if (header_desired == NULL)
match = 0;
else
match = (strcasecmp (header, header_desired) == 0);

decoded_value = g_mime_utils_header_decode_text (message->value.str);
-   if (g_hash_table_lookup (message->headers, header) == NULL) {
-   /* Only insert if we don't have a value for this header, yet.
-* This way we always return the FIRST instance of any header
-* we search for
-* FIXME: we should be returning ALL instances of a header
-*or at least provide a way to iterate over them
-*/
-   g_hash_table_insert (message->headers, header, decoded_value);
+   header_sofar = (char *)g_hash_table_lookup (message->headers, header);
+   if (strcmp(header,"received") == 0) {
+   if (header_sofar == NULL) {
+   /* Only insert if we don't have a value for this header, yet. */
+   g_hash_table_insert (message->headers, header, decoded_value);
+   } else {
+   /* the caller wants them all concatenated */
+   newhdr = strlen(decoded_value);
+   hdrsofar = strlen(header_sofar);
+   combined_header = xmalloc(hdrsofar + newhdr + 2);
+   strncpy(combined_header,header_sofar,hdrsofar);
+   *(combined_header+hdrsofar) = ' ';
+   strncpy(combined_header+hdrsofar+1,decoded_value,newhdr+1);
+   g_hash_table_insert (message->headers, header, combined_header);
+   }
+   } else {
+   if (header_sofar == NULL) {
+   /* Only insert if we don't have a value for this header, yet. */
+   g_hash_table_insert (message->headers, header, decoded_value);
+   }
}
-   if (match)
+   if (match && !received)
return decoded_value;
 }

@@ -347,6 +366,14 @@ notmuch_message_file_get_header (notmuch_message_file_t 
*message,
message->value.len = 0;
 }

+/* For the Received: header we actually might end up here even
+ * though we found the header (as we force continued parsing
+ * in that case). So let's check if that's the header we were
+ * looking for and return the value that we found (if any)
+ */
+if (received)
+   return (char *)g_hash_table_lookup (message->headers, "received");
+
 /* We've parsed all headers and never found the one we're looking
  * for. It's probably just not there, but let's check that we
  * didn't make a mistake preventing us from seeing it. */
diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
index 94cce1b..69298e7 100644
--- a/lib/notmuch-private.h
+++ b/lib/notmuch-private.h
@@ -334,6 +334,9 @@ notmuch_message_file_restrict_headersv 
(notmuch_message_file_t *message,
  *
  * The header name is case insensitive.
  *
+ * The "received" header is special - for it all received headers in
+ * the message are concatenated
+ *
  * The returned value is owned 

[PATCH] emacs: Allow headers to be shown by default in show mode

2010-04-23 Thread David Edmondson
I like the current behaviour, but changing the default would be fine.

On Friday, April 23, 2010, Carl Worth  wrote:
> On Fri, 23 Apr 2010 12:54:21 +0100, David Edmondson  wrote:
>> Add `notmuch-show-headers-visible' which, when set `t', causes headers
>> to be shown by default.
>
> A nice improvement, definitely. But I don't hear anyone actually wanting
> a configuration value here.
>
> Would anyone complain if I just made these all visible by default?
>
> Would anyone complain if I removed the code to allow for th hiding of
> the header?
>
> That's what I'm inclined to do.
>
> Let me know.
>
> -Carl
>


[PATCH 4/4] Integrate notmuch-fcc mechansim

2010-04-23 Thread Sebastian Spaeth
I have gone wild and added a defcustom "notmuch-fcc-dirs".
Depending on the value of that variable we will not do any
maildir fcc at all (nil, the default), or it is of the format
(("defaultsentbox")
 ("full name " . "Work/sentbox")
 ("full name2 " . "Work2/sentbox"))

The outbox name will be concatenated with the message mode
variable "message-directory" which is "~/Mail/" by default.

Signed-off-by: Sebastian Spaeth 
---
 emacs/notmuch-maildir-fcc.el |   84 +
 1 files changed, 59 insertions(+), 25 deletions(-)

diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index 84f4187..9f54dfb 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -12,39 +12,72 @@
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 ;; Boston, MA 02110-1301, USA.
-
-;; Commentary:
-;;
-;; This is the beginning of a solution for storing sent mail in a
-;; maildir in emacs message mode, presented because some people might
-;; find it useful. It is *not* fully tested, it *may* overwrite files,
-;; and any directories you point this at may no longer be there
-;; afterwards. Use at your own risk.
-;;
-;; To use this as the fcc handler for message-mode, put
-;; one of the following in your init file:
-;;
-;; if you want Fcc'd messages to be marked as read:
-;;
-;; (setq message-fcc-handler-function
-;;  '(lambda (destdir)
-;;  (notmuch-maildir-fcc-write-buffer-to-maildir destdir t)))
-;;
-;; if you want Fcc'd messages to be marked as new:
 ;;
-;; (setq message-fcc-handler-function
-;;  '(lambda (destdir)
-;;  (notmuch-maildir-fcc-write-buffer-to-maildir destdir nil)))
+;; To use this as the fcc handler for message-mode,
+;; customize the notmuch-fcc-dirs variable

+(require 'message)

 (defvar notmuch-maildir-fcc-count 0)

+(defcustom notmuch-fcc-dirs nil
+ "If set to non-nil, this will cause message mode to file (fcc) your mail in 
the specified directory, depending on your From address.
+
+ The first entry (a list) is used as a default fallback
+ when nothing matches. So in the easiest case notmuch-fcc-dirs is
+ just something like ((\"INBOX.Sent\"))
+
+ If you need a more fancy setup, where you want different Outboxes depending
+ on your From address, you use something like this:
+
+ (   (\"defaultinbox\")
+ (\"Sebastian Spaeth \" . \"privat\")
+ (\"Sebastian Spaeth \" . \"uni\")
+ )
+ 
+ This will constructs a path, concatenating the content of the
+ variable 'message-directory' (a message mode variable
+ customizable via m-x
+ customize-variablemessage-directory) and the second
+ part in the alist."
+ :require 'notmuch-fcc-initialization
+ :group 'notmuch
+)
+
+(defun notmuch-fcc-initialization ()
+  "If notmuch-fcc-directories is set, 
+   hook them into the message-fcc-handler-function"
+(if (not (eq notmuch-fcc-dirs nil)) (progn
+;Set up the message-fcc-handler to move mails to the maildir in Fcc
+;The parameter is hardcoded to mark messages as "seen"
+(setq message-fcc-handler-function
+  '(lambda (destdir)
+ (notmuch-maildir-fcc-write-buffer-to-maildir destdir t)))
+;add a hook to actually insert the Fcc header when sending
+;(preferrably we would use message-header-setup-up, but notmuch-reply 
+; munges headers after that is run, so it won't work for replies within
+; notmuch)
+(add-hook 'message-send-hook 'notmuch-fcc-header-setup
+
+(defun notmuch-fcc-header-setup ()
+  "Can be added to message-send-hook and will set the FCC header
+  based on the values of notmuch-fcc-directories (see the
+  variable customization there for examples). It uses the
+  first entry as default fallback if no From address
+  matches."
+  ; only do something if notmuch-fcc-dirs is set
+  (if notmuch-fcc-dirs
+   (let ((subdir (cdr (assoc (message-fetch-field "from") notmuch-fcc-dirs
+ (if (eq subdir nil) (setq subdir (car (car notmuch-fcc-dirs
+ (message-remove-header "Fcc")
+ (message-add-header (concat "Fcc: " message-directory subdir)
+
 (defun notmuch-maildir-fcc-host-fixer (hostname)
   (replace-regexp-in-string "/\\|:"
'(lambda (s)
-(cond ((string-equal s "/") "\\057")
-  ((string-equal s ":") "\\072")
-  (t s)))
+   (cond ((string-equal s "/") "\\057")
+ ((string-equal s ":") "\\072")
+ (t s)))
hostname
t
t))
@@ -114,4 +147,5 @@ return t if successful, and nil otherwise."
  (delete-file (concat destdir "/tmp/" msg-id
   t)))

+(notmuch-fcc-initialization)
 (provide 

[PATCH 3/4] notmuch-maildir-fcc: elisp syntax fixes

2010-04-23 Thread Sebastian Spaeth
1)use insert-buffer-substring

Rather than the insert-buffer. Emacs complains that it is for interactive use
and not for use within elisp. So use insert-buffer-substring which does the
same thing when not handed any 'begin' 'end' parameters.

2)replace caddr with (car (cdr (cdr)))

The former requires 'cl to be loaded and during make install emacs complained
about not knowing it.

Signed-off-by: Sebastian Spaeth 
---
 emacs/notmuch-maildir-fcc.el |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index 2117f54..84f4187 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -52,7 +52,7 @@
 (defun notmuch-maildir-fcc-make-uniq-maildir-id ()
(let* ((ct (current-time))
  (timeid (+ (* (car ct) 65536) (cadr ct)))
- (microseconds (caddr ct))
+ (microseconds (car (cdr (cdr ct
  (hostname (notmuch-maildir-fcc-host-fixer system-name)))
  (setq notmuch-maildir-fcc-count (+ notmuch-maildir-fcc-count 1))
  (format "%d.%d_%d_%d.%s"
@@ -97,7 +97,7 @@ non-nil, it will write it to cur/, and mark it as read. It 
should
 return t if successful, and nil otherwise."
   (let ((orig-buffer (buffer-name)))
 (with-temp-buffer
-  (insert-buffer orig-buffer)
+  (insert-buffer-substring orig-buffer)
   (catch 'link-error
(let ((msg-id (notmuch-maildir-fcc-save-buffer-to-tmp destdir)))
  (when msg-id
-- 
1.7.0.4



[PATCH 2/4] Integrate notmuch-maildir-fcc into notmuch

2010-04-23 Thread Sebastian Spaeth
Require notmuch-maildir-fcc and also install it.
Rename all jkr/* functions to notmuch-maildir-fcc-*

Signed-off-by: Sebastian Spaeth 
---
 emacs/Makefile.local |3 ++-
 emacs/notmuch-maildir-fcc.el |   42 ++
 emacs/notmuch.el |1 +
 3 files changed, 25 insertions(+), 21 deletions(-)

diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index f759c0d..c80e0e3 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -6,7 +6,8 @@ emacs_sources := \
$(dir)/notmuch.el \
$(dir)/notmuch-query.el \
$(dir)/notmuch-show.el \
-   $(dir)/notmuch-wash.el
+   $(dir)/notmuch-wash.el \
+   $(dir)/notmuch-maildir-fcc.el

 emacs_bytecode := $(subst .el,.elc,$(emacs_sources))

diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index 979428e..2117f54 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -28,18 +28,18 @@
 ;;
 ;; (setq message-fcc-handler-function
 ;;  '(lambda (destdir)
-;;  (jkr/maildir-write-buffer-to-maildir destdir t)))
+;;  (notmuch-maildir-fcc-write-buffer-to-maildir destdir t)))
 ;;
 ;; if you want Fcc'd messages to be marked as new:
 ;;
 ;; (setq message-fcc-handler-function
 ;;  '(lambda (destdir)
-;;  (jkr/maildir-write-buffer-to-maildir destdir nil)))
+;;  (notmuch-maildir-fcc-write-buffer-to-maildir destdir nil)))


-(defvar jkr/maildir-count 0)
+(defvar notmuch-maildir-fcc-count 0)

-(defun jkr/maildir-host-fixer (hostname)
+(defun notmuch-maildir-fcc-host-fixer (hostname)
   (replace-regexp-in-string "/\\|:"
'(lambda (s)
 (cond ((string-equal s "/") "\\057")
@@ -49,31 +49,31 @@
t
t))

-(defun jkr/maildir-make-uniq-maildir-id ()
+(defun notmuch-maildir-fcc-make-uniq-maildir-id ()
(let* ((ct (current-time))
  (timeid (+ (* (car ct) 65536) (cadr ct)))
  (microseconds (caddr ct))
- (hostname (jkr/maildir-host-fixer system-name)))
- (setq jkr/maildir-count (+ jkr/maildir-count 1))
+ (hostname (notmuch-maildir-fcc-host-fixer system-name)))
+ (setq notmuch-maildir-fcc-count (+ notmuch-maildir-fcc-count 1))
  (format "%d.%d_%d_%d.%s"
 timeid
 (emacs-pid)
 microseconds
-jkr/maildir-count
+notmuch-maildir-fcc-count
 hostname)))

-(defun jkr/maildir-dir-is-maildir-p (dir)
+(defun notmuch-maildir-fcc-dir-is-maildir-p (dir)
   (and (file-exists-p (concat dir "/cur/"))
(file-exists-p (concat dir "/new/"))
(file-exists-p (concat dir "/tmp/"

-(defun jkr/maildir-save-buffer-to-tmp (destdir)
+(defun notmuch-maildir-fcc-save-buffer-to-tmp (destdir)
   "Returns the msg id of the message written to the temp directory
 if successful, nil if not."
-  (let ((msg-id (jkr/maildir-make-uniq-maildir-id)))
+  (let ((msg-id (notmuch-maildir-fcc-make-uniq-maildir-id)))
 (while (file-exists-p (concat destdir "/tmp/" msg-id))
-  (setq msg-id (jkr/maildir-make-uniq-maildir-id)))
-(cond ((jkr/maildir-dir-is-maildir-p destdir)
+  (setq msg-id (notmuch-maildir-fcc-make-uniq-maildir-id)))
+(cond ((notmuch-maildir-fcc-dir-is-maildir-p destdir)
   (write-file (concat destdir "/tmp/" msg-id))
   msg-id)
  (t
@@ -81,17 +81,17 @@ if successful, nil if not."
 destdir))
   nil

-(defun jkr/maildir-move-tmp-to-new (destdir msg-id)
+(defun notmuch-maildir-fcc-move-tmp-to-new (destdir msg-id)
   (add-name-to-file
(concat destdir "/tmp/" msg-id)
(concat destdir "/new/" msg-id ":2,")))

-(defun jkr/maildir-move-tmp-to-cur (destdir msg-id  mark-seen)
+(defun notmuch-maildir-fcc-move-tmp-to-cur (destdir msg-id  mark-seen)
   (add-name-to-file
(concat destdir "/tmp/" msg-id)
(concat destdir "/cur/" msg-id ":2," (when mark-seen "S"

-(defun jkr/maildir-write-buffer-to-maildir (destdir  mark-seen)
+(defun notmuch-maildir-fcc-write-buffer-to-maildir (destdir  
mark-seen)
   "Writes the current buffer to maildir destdir. If mark-seen is
 non-nil, it will write it to cur/, and mark it as read. It should
 return t if successful, and nil otherwise."
@@ -99,17 +99,19 @@ return t if successful, and nil otherwise."
 (with-temp-buffer
   (insert-buffer orig-buffer)
   (catch 'link-error
-   (let ((msg-id (jkr/maildir-save-buffer-to-tmp destdir)))
+   (let ((msg-id (notmuch-maildir-fcc-save-buffer-to-tmp destdir)))
  (when msg-id
(cond (mark-seen
   (condition-case err
-  (jkr/maildir-move-tmp-to-cur destdir msg-id t)
+  (notmuch-maildir-fcc-move-tmp-to-cur destdir msg-id t)
 (file-already-exists
  (throw 'link-error nil
  (t
   

[PATCH 1/4] Add elisp file for FCC to maildir solution

2010-04-23 Thread Sebastian Spaeth
From: Jesse Rosenthal 

File grabbed from http://jkr.acm.jhu.edu/jkr-maildir.el
but not integrated yet.

Signed-off-by: Sebastian Spaeth 
---
As stated by Dirk, patches are preferred by mail. So here is the updated 
patch series of 4 patches by mail again.

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

diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
new file mode 100644
index 000..979428e
--- /dev/null
+++ b/emacs/notmuch-maildir-fcc.el
@@ -0,0 +1,115 @@
+;; This file 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 2, or (at your
+;; option) any later version.
+
+;; This program 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 GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+
+;; Commentary:
+;;
+;; This is the beginning of a solution for storing sent mail in a
+;; maildir in emacs message mode, presented because some people might
+;; find it useful. It is *not* fully tested, it *may* overwrite files,
+;; and any directories you point this at may no longer be there
+;; afterwards. Use at your own risk.
+;;
+;; To use this as the fcc handler for message-mode, put
+;; one of the following in your init file:
+;;
+;; if you want Fcc'd messages to be marked as read:
+;;
+;; (setq message-fcc-handler-function
+;;  '(lambda (destdir)
+;;  (jkr/maildir-write-buffer-to-maildir destdir t)))
+;;
+;; if you want Fcc'd messages to be marked as new:
+;;
+;; (setq message-fcc-handler-function
+;;  '(lambda (destdir)
+;;  (jkr/maildir-write-buffer-to-maildir destdir nil)))
+
+
+(defvar jkr/maildir-count 0)
+
+(defun jkr/maildir-host-fixer (hostname)
+  (replace-regexp-in-string "/\\|:"
+   '(lambda (s)
+(cond ((string-equal s "/") "\\057")
+  ((string-equal s ":") "\\072")
+  (t s)))
+   hostname
+   t
+   t))
+
+(defun jkr/maildir-make-uniq-maildir-id ()
+   (let* ((ct (current-time))
+ (timeid (+ (* (car ct) 65536) (cadr ct)))
+ (microseconds (caddr ct))
+ (hostname (jkr/maildir-host-fixer system-name)))
+ (setq jkr/maildir-count (+ jkr/maildir-count 1))
+ (format "%d.%d_%d_%d.%s"
+timeid
+(emacs-pid)
+microseconds
+jkr/maildir-count
+hostname)))
+
+(defun jkr/maildir-dir-is-maildir-p (dir)
+  (and (file-exists-p (concat dir "/cur/"))
+   (file-exists-p (concat dir "/new/"))
+   (file-exists-p (concat dir "/tmp/"
+
+(defun jkr/maildir-save-buffer-to-tmp (destdir)
+  "Returns the msg id of the message written to the temp directory
+if successful, nil if not."
+  (let ((msg-id (jkr/maildir-make-uniq-maildir-id)))
+(while (file-exists-p (concat destdir "/tmp/" msg-id))
+  (setq msg-id (jkr/maildir-make-uniq-maildir-id)))
+(cond ((jkr/maildir-dir-is-maildir-p destdir)
+  (write-file (concat destdir "/tmp/" msg-id))
+  msg-id)
+ (t
+  (message (format "Can't write to %s. Not a maildir."
+destdir))
+  nil
+
+(defun jkr/maildir-move-tmp-to-new (destdir msg-id)
+  (add-name-to-file
+   (concat destdir "/tmp/" msg-id)
+   (concat destdir "/new/" msg-id ":2,")))
+
+(defun jkr/maildir-move-tmp-to-cur (destdir msg-id  mark-seen)
+  (add-name-to-file
+   (concat destdir "/tmp/" msg-id)
+   (concat destdir "/cur/" msg-id ":2," (when mark-seen "S"
+
+(defun jkr/maildir-write-buffer-to-maildir (destdir  mark-seen)
+  "Writes the current buffer to maildir destdir. If mark-seen is
+non-nil, it will write it to cur/, and mark it as read. It should
+return t if successful, and nil otherwise."
+  (let ((orig-buffer (buffer-name)))
+(with-temp-buffer
+  (insert-buffer orig-buffer)
+  (catch 'link-error
+   (let ((msg-id (jkr/maildir-save-buffer-to-tmp destdir)))
+ (when msg-id
+   (cond (mark-seen
+  (condition-case err
+  (jkr/maildir-move-tmp-to-cur destdir msg-id t)
+(file-already-exists
+ (throw 'link-error nil
+ (t
+  (condition-case err
+  (jkr/maildir-move-tmp-to-new destdir 

[PATCH] emacs: Fix i-search to open up invisible citations as necessary

2010-04-23 Thread David Edmondson
Add an `isearch-open-invisible' property to the overlays used to hide
citations and signatures, together with an appropriate function to
leave the invisible text visible should that be required.
---
 emacs/notmuch-wash.el |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el
index fe33819..dd5d0a1 100644
--- a/emacs/notmuch-wash.el
+++ b/emacs/notmuch-wash.el
@@ -83,6 +83,9 @@ collapse the remaining lines into a button.")
   'help-echo "mouse-1, RET: Show signature"
   :supertype 'notmuch-wash-button-invisibility-toggle-type)

+(defun notmuch-wash-region-isearch-show (overlay)
+  (remove-from-invisibility-spec (overlay-get overlay 'invisible)))
+
 (defun notmuch-wash-region-to-button (beg end type prefix button-text)
   "Auxilary function to do the actual making of overlays and buttons

@@ -102,6 +105,7 @@ is what to put on the button."
  type "-toggle-type"
 (add-to-invisibility-spec invis-spec)
 (overlay-put overlay 'invisible invis-spec)
+(overlay-put overlay 'isearch-open-invisible 
#'notmuch-wash-region-isearch-show)
 (goto-char (1+ end))
 (save-excursion
   (goto-char (1- beg))
-- 
1.7.0



[PATCH] removed unused variables

2010-04-23 Thread Carl Worth
On Thu, 22 Apr 2010 20:26:46 -0700, Dirk Hohndel  
wrote:
> 
> trivial compiler warning fix

Thanks. I finally caught up to this.

I had seen this patch from you earlier, when I didn't have a convenient
working-directory for just applying it---so I've been religiously
ignoring those warnings ever since rather than just fixing them. ;-)

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100423/b7b6629e/attachment.pgp>


[PATCH] Fix linker error from insufficient LDFLAGS

2010-04-23 Thread Carl Worth
On Thu, 22 Apr 2010 18:20:27 -0400, Ben Gamari  
wrote:
> It seems that LDFLAGS have recently been reorganized, along with the
> introduction of a notmuch-shared rule. Unfortunately, the LDFLAGS used
> in notmuch-shared don't include CONFIGURE_LDFLAGS. This caused linking
> to fail with the following,

What system is this on?

> -FINAL_NOTMUCH_LDFLAGS = $(LDFLAGS) -Llib -lnotmuch
> +FINAL_NOTMUCH_LDFLAGS = $(LDFLAGS) -Llib -lnotmuch $(CONFIGURE_LDFLAGS)
>  FINAL_NOTMUCH_LINKER = CC
>  ifneq ($(LINKER_RESOLVES_LIBRARY_DEPENDENCIES),1)
>  FINAL_NOTMUCH_LDFLAGS += $(CONFIGURE_LDFLAGS)

Note that CONFIGURE_LDFLAGS *is* conditionally added a couple of lines
later.

In my testing on Linux, these flags aren't needed/wanted for linking
notmuch-shared. And I believe I tested the conditional assignment such
that it gets enabled on OS X at least, where these additional flags are
needed.

So perhaps you've just got a system where we need to detect that
LINKER_RESOLVES_LIBRARY_DEPENDENCIES should be set to 0?

Let me know,

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100423/78ab1b90/attachment.pgp>


[PATCH] emacs: Add notmuch-address.el for address completion using notmuch

2010-04-23 Thread Carl Worth
On Thu, 22 Apr 2010 10:03:43 +0100, David Edmondson  wrote:
> A tool `notmuch-addresses' is required to produce addresses which
> match a query string. An example of a suitable script can be found in
> the git repository at
> http://jkr.acm.jhu.edu/git/notmuch_addresses.git
> There are no doubt others.

I applied this, but I've had some difficulty figuring out how to use it
given just the above instructions.

I did install the above-referenced python script[*] as notmuch-addresses
on my path. And I tested it at the command line and it seemed to act
reasonably.

But hitting TAB in message-mode continued to frobnicate BBDB instead.

I finally hit on doing (require 'notmuch-address) in .emacs. As noted
previously, can we please make (require 'notmuch) pull in all notmuch
functionality rather than having it separated like this?

Finally, though, I haven't figured out how to get more than a single
match from this. If the first match isn't what I want, how do I see and
choose later matches?

In the meantime, I've pushed this already.

-Carl

[*] Which also made me figure out how to install our python bindings. I
found "sudo python ./setup.py install" eventually, but it would be quite
nice if "sudo make install" took care of that.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100423/e4355c28/attachment-0001.pgp>


[PATCH] emacs/notmuch-show.el: Add `notmuch-show-toggle-all' bound to M-RET

2010-04-23 Thread Carl Worth
On Thu, 22 Apr 2010 09:24:03 +0100, David Edmondson  wrote:
> `notmuch-show-toggle-all' changes the visibility all of the messages
> in the current thread. By default it makes all of the messages
> visible. With a prefix argument, it makes them all not visible.

I pushed this now, (with a rename of the function as I mentioned
before).

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100423/7546b404/attachment.pgp>


[PATCH] Reordering of thread authors to list matching authors first

2010-04-23 Thread Carl Worth
On Wed, 21 Apr 2010 20:58:27 -0700, Dirk Hohndel  
wrote:
> When displaying threads as result of a search it makes sense to list those
> authors first who match the search. The matching authors are separated from 
> the
> non-matching ones with a '|' instead of a ','

It seems a reasonable feature to me.

Some notes on the patch:

> +void
> +notmuch_message_set_author (notmuch_message_t *message,
> + const char *author)
> +{
> +message->author = talloc_strdup(message, author);
> +return;
> +}

This is leaking any previously set author value, (admittedly, it's only
a "talloc leak" so it will still get cleaned up when the message is
cleaned up, but still.

> +/* Set the author member of 'message' - this is the representation used
> + * when displaying the message
> + */
> +void
> +notmuch_message_set_author (notmuch_message_t *message, const char *author);
> +
> +/* Get the author member of 'message'
> + */
> +const char *
> +notmuch_message_get_author (notmuch_message_t *message);

The notmuch.h file is our publicly installed header file for the library
interface. I don't think the feature here requires any new library
interface. Even if it did, we wouldn't want a public function like
set_author that could simply scramble internal state and change the
result of future calls to get_author.

> +/*
> + * move authors of matched messages in the thread to 
> + * the front of the authors list, but keep them in
> + * existing order within their group
> + */
> +static void
> +_thread_move_matched_author (notmuch_thread_t *thread,
> +  const char *author)

The implementation here seems a bit fiddly.

We already have two passes over the messages, (first all messages, and
then all matched messages). And we're currently calling add_author from
the first pass.

How about simply calling a new add_matched_author from the second pass
which would look very much like the existing add_author. Then we could
change add_author to accumulate authors into an array rather than a
string. Then, finally, we would append any of these authors not already
in the matched_authors hash tabled onto the final string.

That should be less code and easier to understand I think.

I can take a whack at that later if you don't beat me to it.

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100423/dda8f466/attachment.pgp>


test suite for fancy From guessing

2010-04-23 Thread Carl Worth
On Wed, 21 Apr 2010 14:55:56 -0700, Dirk Hohndel  
wrote:
> This adds five tests for the five main cases in the fancy from guessing.
> It assumes that you have applied
> id:1271451102-11336-1-git-send-email-hohndel at infradead.org which will get 
> you
> the latest fancy From guessing.

Thanks very much for these tests! (I somehow had missed them when I
first collected my 0.3 merge-window commits.)

I've pushed these out now. And that's even before the feature of
interest, (because with the latest patches, these tests cause "notmuch
reply" to segfault). I'm not getting a segfault with the test suite
based on the code in master now, (just failures as expected since the
feature isn't implemented yet).

Looking forward to more.

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100423/63b8027a/attachment.pgp>


[PATCH] RFC: Add From guessing when forwarding email

2010-04-23 Thread Dirk Hohndel

This adds a new "guess-from" option to notmuch and modifies the
emacs UI to use this to use the best guess from address when
forwarding email.

Given how little elisp I know I'm quite interested in feedback
and better implementations

Signed-off-by: Dirk Hohndel 
---
 emacs/notmuch-show.el |8 +++-
 notmuch-client.h  |3 +
 notmuch-reply.c   |  110 +
 notmuch.c |8 
 4 files changed, 127 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 53af301..8cec9e8 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -809,8 +809,12 @@ any effects from previous calls to
 (defun notmuch-show-forward-message ()
   "Forward the current message."
   (interactive)
-  (with-current-notmuch-show-message
-   (notmuch-mua-forward-message)))
+  (progn
+(let ((message-id (notmuch-show-get-message-id)))
+  (with-current-notmuch-show-message
+   (progn
+(setq user-mail-address (shell-command-to-string (concat "notmuch 
guess-from " message-id)))
+(notmuch-mua-forward-message))

 (defun notmuch-show-next-message ()
   "Show the next message."
diff --git a/notmuch-client.h b/notmuch-client.h
index 20be43b..ba5b002 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -93,6 +93,9 @@ int
 notmuch_reply_command (void *ctx, int argc, char *argv[]);

 int
+notmuch_guess_from_command (void *ctx, int argc, char *argv[]);
+
+int
 notmuch_restore_command (void *ctx, int argc, char *argv[]);

 int
diff --git a/notmuch-reply.c b/notmuch-reply.c
index 230cacc..e9c8449 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -364,6 +364,55 @@ guess_from_received_header (notmuch_config_t *config, 
notmuch_message_t *message
 return NULL;
 }

+/*
+ * simply figure out the best from address to use without creating
+ * a reply buffer or anything else
+ */
+static const char *
+notmuch_guess_from(notmuch_config_t *config, notmuch_query_t *query)
+{
+notmuch_messages_t *messages;
+notmuch_message_t *message;
+InternetAddressList *list;
+InternetAddressMailbox *mailbox;
+InternetAddress *address;
+char *recipients;
+const char *addr;
+const char *from_addr = NULL;
+int i;
+
+for (messages = notmuch_query_search_messages (query);
+notmuch_messages_valid (messages);
+notmuch_messages_move_to_next (messages))
+{
+   message = notmuch_messages_get (messages);
+   if ((asprintf (, "%s,%s", notmuch_message_get_header 
(message, "to"),
+  notmuch_message_get_header (message, "cc")) == -1) || 
recipients == NULL) {
+   fprintf (stderr, "Out of memory\n");
+   return NULL;
+   }
+   list = internet_address_list_parse_string (recipients);
+   for (i = 0; i < internet_address_list_length (list); i++) {
+   address = internet_address_list_get_address (list, i);
+   if (! INTERNET_ADDRESS_IS_GROUP (address)) {
+   mailbox = INTERNET_ADDRESS_MAILBOX (address);
+   addr = internet_address_mailbox_get_addr (mailbox);
+   if (address_is_users (addr, config) && !from_addr) {
+   from_addr = addr;
+   break;
+   }
+   }
+   }
+   free (recipients);
+   if (from_addr == NULL)
+   from_addr = guess_from_received_header (config, message);
+
+   if (from_addr == NULL)
+   from_addr = notmuch_config_get_user_primary_email (config);
+}
+return from_addr;
+}
+
 static int
 notmuch_reply_format_default(void *ctx, notmuch_config_t *config, 
notmuch_query_t *query)
 {
@@ -567,3 +616,64 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])

 return ret;
 }
+
+int
+notmuch_guess_from_command (void *ctx, int argc, char *argv[])
+{
+notmuch_config_t *config;
+notmuch_database_t *notmuch;
+notmuch_query_t *query;
+char *query_string;
+char const *addr;
+int i, ret = 0;
+
+for (i = 0; i < argc && argv[i][0] == '-'; i++) {
+   if (strcmp (argv[i], "--") == 0) {
+   i++;
+   break;
+   }
+   fprintf (stderr, "Unrecognized option: %s\n", argv[i]);
+   return 1;
+}
+
+argc -= i;
+argv += i;
+
+config = notmuch_config_open (ctx, NULL, NULL);
+if (config == NULL)
+   return 1;
+
+query_string = query_string_from_args (ctx, argc, argv);
+if (query_string == NULL) {
+   fprintf (stderr, "Out of memory\n");
+   return 1;
+}
+
+if (*query_string == '\0') {
+   fprintf (stderr, "Error: notmuch reply requires at least one search 
term.\n");
+   return 1;
+}
+
+notmuch = notmuch_database_open (notmuch_config_get_database_path (config),
+NOTMUCH_DATABASE_MODE_READ_ONLY);
+if (notmuch == NULL)
+   return 1;
+
+query = notmuch_query_create (notmuch, query_string);
+if (query == NULL) {
+ 

[PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch

2010-04-23 Thread Carl Worth
On Fri, 23 Apr 2010 13:13:01 -0700, Carl Worth  wrote:
>   * I'd like the saved searches to appear before the recent searches I
> think.

Actually, this might be OK since the recent searches go away when
restarting emacs.

>   * I would *love* a simple way to import my existing notmuch-folder
> configuration into notmuch-hello. Bonus points if this happens
> automatically.

This is as simple as editing my .emacs file to set the
notmuch-hello-saved-searches variable instead of notmuch-folders. So
that's nice.

Though we might want to remove the "-hello" from the name there. It
doesn't really add anything.

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100423/4e19b2bc/attachment.pgp>


[PATCH] emacs: Allow headers to be shown by default in show mode

2010-04-23 Thread Jameson Rollins
On Fri, 23 Apr 2010 12:26:43 -0700, Carl Worth  wrote:
> A nice improvement, definitely. But I don't hear anyone actually wanting
> a configuration value here.
> 
> Would anyone complain if I just made these all visible by default?
> 
> Would anyone complain if I removed the code to allow for th hiding of
> the header?

Oh yeah that makes much more sense to me.  I definitely don't want the
headers hidden, so not having a config value for it certainly works for
me.  I just assumed that the header hiding was implemented because some
people wanted it.  If no one really wants to hide headers, then I would
definitely vote for just removing all of that code and just displaying
them.

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/20100423/4c64a3fe/attachment.pgp>


notmuch segfault

2010-04-23 Thread Michal Sojka
On Fri, 23 Apr 2010, Sebastian Spaeth wrote:
> Can it be that in thread.cc in _thread_add_matched_message ()
> ...
> subject = notmuch_message_get_header (message, "subject");
> 
> if ((strncasecmp (subject, "Re: ", 4) == 0) ||
> ...
> 
> If the underlying message disappeared, get_header will return NULL and
> we pass strncasecmp NULL as first parameter. Could that be?

Yes, it is very likely the problem. The fix is obvious (see bellow), but
the question is how will be this "missing message" presented to the user
e.g. in notmuch show. It may be that we will need some other checks to
not break other things.

diff --git a/lib/thread.cc b/lib/thread.cc
index 5bf8354..29b8336 100644
--- a/lib/thread.cc
+++ b/lib/thread.cc
@@ -148,6 +148,9 @@ _thread_add_matched_message (notmuch_thread_t *thread,

 subject = notmuch_message_get_header (message, "subject");

+if (!subject)
+   return;
+
 if ((strncasecmp (subject, "Re: ", 4) == 0) ||
(strncasecmp (subject, "Aw: ", 4) == 0) ||
(strncasecmp (subject, "Vs: ", 4) == 0) ||


notmuch segfault

2010-04-23 Thread Sebastian Spaeth
It happened again. Both times I had pressed "G" which calls offlineimap
and which removed messages that the notmuch database still thought are there.


Program received signal SIGSEGV, Segmentation fault.
0x7602bb14 in strncasecmp () from /lib/libc.so.6
(gdb) bt
#0  0x7602bb14 in strncasecmp () from /lib/libc.so.6
#1  0x00418521 in _thread_add_matched_message(_notmuch_thread*, 
_notmuch_message*, notmuch_sort_t) ()
#2  0x00418b17 in _notmuch_thread_create ()
#3  0x0040e33c in notmuch_show_command ()
#4  0x00408436 in main ()

-
spaetz at spaetz-macbook:~/src/notmuch$ notmuch show tag:inbox
Error opening 
/home/spaetz/mail/INBOX.Junk/new/1272025029_0.17175.spaetz-macbook,U=3608,FMD5=22888fa7f8daa670f25d806e9b4ae4df:2,:
 No such file or directory
Error opening 
/home/spaetz/mail/INBOX.Junk/new/1272025029_0.17175.spaetz-macbook,U=3608,FMD5=22888fa7f8daa670f25d806e9b4ae4df:2,:
 No such file or directory
Error opening 
/home/spaetz/mail/INBOX.Junk/new/1272025029_0.17175.spaetz-macbook,U=3608,FMD5=22888fa7f8daa670f25d806e9b4ae4df:2,:
 No such file or directory
Segmentation fault (core dumped)

--
Coredump is here:
http://sspaeth.de/uploads/tmp/core.bin
-


Can it be that in thread.cc in _thread_add_matched_message ()
...
subject = notmuch_message_get_header (message, "subject");

if ((strncasecmp (subject, "Re: ", 4) == 0) ||
...

If the underlying message disappeared, get_header will return NULL and
we pass strncasecmp NULL as first parameter. Could that be?



[notmuch] Bulk message tagging

2010-04-23 Thread Mark Anderson
On Wed, 21 Apr 2010 18:02:59 -0500, Carl Worth  wrote:
> On Sat, 17 Apr 2010 20:32:27 +0200, Arian Kuschki  googlemail.com> wrote:
> > So one could query with sysconf and break things up into multiple
> > commands as needed.
> > 
> > Doesn't xargs do exactly this?
> 
> Almost.
> 
> The arguments being passed to the "notmuch tag" command in this case
> look like:
> 
>   notmuch tag -inbox thread:foo or thread:bar or ...
> 
> To break that up, we'd have to be careful to neither leave a trailing
> 'or' at the end of a command line nor to have an 'or' at the beginning
> of a command line.

Perhaps this hints at an opportunity to create a new operator, that you
can pass as part of the notmuch commandline.

Something like:
cat idlist.txt | xargs notmuch tag -inbox tag:inbox and oneof: 

Then the list of arguments can break anywhere it wants. It's not as
general as having notmuch take search terms from stdin or a file, but it
seems like a long list of ID's is going to be a common case.

Another problem with passing options to xarg is that any parentheses are
going to break easily.

Actually, looking at this random proposal, you can see the invented
operator has an implicit grouping semantic, which leads to all kinds of
confusion.

-Mark



[PATCH] emacs: Allow headers to be shown by default in show mode

2010-04-23 Thread Servilio Afre Puentes
On 23 April 2010 13:13, Dirk Hohndel  wrote:
> On Fri, 23 Apr 2010 12:54:21 +0100, David Edmondson  wrote:
>> Add `notmuch-show-headers-visible' which, when set `t', causes headers
>> to be shown by default.
>
> Excellent - Carl, can you pull this into 0.3, please?

+1

Servilio


[PATCH] test: Set fixed time zone

2010-04-23 Thread Carl Worth
On Fri, 23 Apr 2010 09:36:45 +0200, Michal Sojka  wrote:
> When the test suite is run in a different time zone that where Carl
> lives, some tests may fail depending on the time when the test suite is
> run. For example, just now I get:
...
> By setting a fixed time zone in the test script, these problems should
> be eliminated.

Sorry about leaking that part of my environment into the codified test
suite.

I've pushed this fix for now, (though please follow up with some of the
text from the commit message as a comment next to that assignment in the
test-suite script which otherwise seems a bit out-of-place).

Thanks,

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100423/34249f1b/attachment.pgp>


[PATCH] emacs: Push the cursor to point-max on `n' or `N' at the end of a thread

2010-04-23 Thread Carl Worth
On Thu, 22 Apr 2010 12:20:16 +0100, David Edmondson  wrote:
> Sebastian pointed out that the pre-JSON UI would move the cursor to
> the end of the buffer if `n' or `N' is hit when on the last (unread)
> message. Mimic that behaviour in the new UI.

Quite a lovely improvement. Thanks! This is pushed.

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100423/1397cdf7/attachment.pgp>


[PATCH] emacs: Re-arrange message sending code

2010-04-23 Thread Carl Worth
On Thu, 22 Apr 2010 10:03:32 +0100, David Edmondson  wrote:
> Define a new `mail-user-agent' (`notmuch-user-agent') and use it by
> default. Re-arrange various routines that send mail to use this
> (compose, reply, forward). Insert a `User-Agent:' header by default.

Very nice! I've pushed this out now.

And I'm hoping that this new support makes it easier for people to hook
in the Fcc code. Does this mean there's now a single place to add that
that will make it work for messages composed from 'm', 'f', or 'r'?

The one unpleasantry I've noticed is that in the case of 'm' the headers
are being put into the buffer in the following order:

User-Agent:
To:
Subject:
From:

where I would prefer them in the following order:

From:
To:
Subject:
User-Agent:

Thanks,

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100423/92f5c904/attachment.pgp>


[PATCH] emacs: Remove `notmuch-search-authors-width' and fix the use of `notmuch-search-result-format' accordingly

2010-04-23 Thread Jameson Rollins
On Fri, 23 Apr 2010 11:24:09 +0100, David Edmondson  wrote:
> Jamie, could you test this patch please? My main concern is that it
> makes a small assumption about the value of
> `notmuch-search-result-format' - namely that the `authors' field ends
> with a space.

Tested, and it works.  Thanks so much for fixing this, David.  Very much
appreciated.

So this patch gets rid of the notmuch-search-authors-width variable
entirely.  That variable was somewhat convenient (for me at least, since
that was the only thing in the format i wanted to adjust), but I think
the new configuration is more straightforward.  Just set
notmuch-search-result-format how you want it to be, and it Just Works.
I think we should go with this solution...

Approved-By: Jameson Rollins 

(I was going to try to resend the patch with the "Approved-By" bit
added, but I was sure I was going to mess it up.  If someone can point
me to a message where that was done correctly, that'd be great.)

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/20100423/a8aa01e8/attachment.pgp>


Unhandled Xapian exception

2010-04-23 Thread Sebastian Spaeth
Hi Carl,

dme complained that my python bindings abort with
Xapian::DatabaseModifiedException when doing a
Database.find_message('id'). But libnotmuch.so terminates before python
has even a chance to catch an execption, and I think it boils down to this:

http://git.notmuchmail.org/git/notmuch/blob/ec6d78acf12d5c8fe6d10d091adee6516bf48d8a:/lib/database.cc#l276

find_message() which calls:
find_doc_ids_for_term() in lib/database.cc which contains:

 *begin = notmuch->xapian_db->postlist_begin (term);
   *end = notmuch->xapian_db->postlist_end (term);

without doing any catching. According to Olly Betts this can possibly
throw such an exception when the Database has been modified.

I propose to try..catch this code block and rather than returning VOID
it could return NOTMUCH_STATUS_SUCCESS or NOTMUCH_XAPIAN_EXCEPTION.
Not sure how "notmuch_database_find_message" would notify the caller of
such an exception situation though. The only possible failure value is
NULL (which also means did not find such a message).

Sebastian


[PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch

2010-04-23 Thread Carl Worth
On Thu, 22 Apr 2010 09:27:33 +0100, David Edmondson  wrote:
[no commit message paragraph]

Hi David,

This is really great stuff. I just merged this, and restricted mysefl to
following up with only a very tiny patch to clean up some warnings from
the emacs compilation.

Here is some quick feedback;

  * This should be integrated such that (require 'notmuch) provides the
notmuch-hello functionality. That's our documented access point for
getting at notmuch functionality.

  * The logo background is gray on my white-background emacs. That looks odd.

  * It would be great if point were in the search bar right when this
mode started.

  * I'd like the saved searches to appear before the recent searches I
think.

  * I'm not sure how useful the numbered shortcuts are for the recent
searches. We want to encourage people to move to saved searches
instead, (and the recent searches are quite transient anyway). So do
we really need these? [I mistook them for message counts at first.]

  * Repeating a recent search by pressing RET on it creates a new
identical search which doesn't seem all that useful.

  * I would *love* a simple way to import my existing notmuch-folder
configuration into notmuch-hello. Bonus points if this happens
automatically.

Finally, I'm quite inclined to make `notmuch' invoke this mode, so think
about that.

That's the feedback I have from a very quick, first look. I'm sure I'll
have more later.

Thanks again! This is really slick.

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100423/a341e1d3/attachment.pgp>


pull request

2010-04-23 Thread David Edmondson
On Wed, 21 Apr 2010 15:47:12 -0400, Jameson Rollins  wrote:
> On Wed, 21 Apr 2010 12:15:48 -0700, Carl Worth  wrote:
> > [*] Even more simplification is possible if we stop trying to hide
> > header components. Several people have requested that To and Cc be
> > visible all the time.
> 
> Hey, Carl.  I had actually been meaning to bring this up.  I actually
> don't like having the headers collapsed at all, so I am definitely in
> favor of the idea of doing away with this "feature".  At the very least,
> I would like to see header hiding/collapsing be an option, so that I
> could turn it off.  As is, I'm having to hit 'h' for every message I
> view, so I can just see who the message was sent to (not to mention to
> recover the unfortunately missing blank line between the header and the
> body, which is visually useful).

See id:1272023661-14038-1-git-send-email-dme at dme.org.

dme.
-- 
David Edmondson, http://dme.org


[PATCH] emacs: Allow headers to be shown by default in show mode

2010-04-23 Thread David Edmondson
Add `notmuch-show-headers-visible' which, when set `t', causes headers
to be shown by default.
---
 emacs/notmuch-show.el |9 +++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index cd859f0..3ea07c8 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -42,6 +42,11 @@
 that if this order is changed the headers shown when a message is
 collapsed will change.")

+(defcustom notmuch-show-headers-visible nil
+  "Should the headers be visible by default?"
+  :group 'notmuch
+  :type 'boolean)
+
 (defvar notmuch-show-markup-headers-hook '(notmuch-show-colour-headers)
   "A list of functions called to decorate the headers listed in
 `notmuch-show-headers'.")
@@ -433,8 +438,8 @@ current buffer, if possible."
 ;; the content).
 (notmuch-show-set-message-properties msg)

-;; Headers are hidden by default.
-(notmuch-show-headers-visible msg nil)
+;; Set header visibility.
+(notmuch-show-headers-visible msg notmuch-show-headers-visible)

 ;; Message visibility depends on whether it matched the search
 ;; criteria.
-- 
1.7.0



pull request

2010-04-23 Thread Carl Worth
On Thu, 22 Apr 2010 07:59:36 +0100, David Edmondson  wrote:
> Your concerns appear to be about `notmuch-wash-wrap-long-lines'. I agree
> that it can generate unfortunate results in the "deep thread, narrow
> terminal" case. Are the other two functions okay?

If they had come in as separate patches, I would have reviewed them
separately and would have applied any I was OK with.

I'm not sure about the other two, as I really haven't played with
them. I don't think I'd get a lot of benefit from them as I don't recall
seeing a lot of accidental duplicate lines anywhere.

I still do have some concerns about munging the original message,
though. I can easily imagine that suppressing duplicate blank lines
could destroy some ASCII (or UTF-8!) art for example.

So I think things that do this kind of munging really should be on an
opt-in basis.

> One of the reasons that I chose a hook-based approach is to allow the
> user to decide which body cleaning should be applied. If you don't want
> the line-wrapping to be enabled by default we can leave it out but
> include the definition so that a user can enable it. The inline-patch
> formatting is similar (I'll say more about that in response to your
> comments on it).

I do appreciate the way the hook works such that users can select which
ones they want. Let's make all of these available but any that could
possibly "corrupt" a message be off by default. And let's be sure to
find a way to easily advertise the list of available washing functions
to the user, (perhaps in the documentation of the customize option for
this).

> Aside from the need to test, this particular patch will benefit only
> minimally from testing - there will always be false positive cases
> however good the analysis used. Are you saying that we can not tolerate
> any false-positives, or that we just need to demonstrate that it is down
> to some acceptable level? (Though I've no idea how I would achieve the
> latter.)

I may have overreacted to a misreading of the commit message. I read it
almost like "Here's some code that is known to be buggy" which is
something I don't ever want to accept. If the meaning is instead, "some
users might find this handy while others find it unacceptable", then
that would be more acceptable.

I think it would be useful to define exactly what the implemented
conditions are so that users can easily decide whether they trust the
heuristic.

(Personally, even when correctly identified, the coloring of patch
output is distracting to me.)

The remainder of the discussion about future improvements to mime part
handling and, multipart support, and HTML rendering is all very
encouraging. I look forward to the future!

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100423/2919d1d6/attachment.pgp>


[PATCH] emacs/notmuch-show.el: Add `notmuch-show-toggle-all' bound to M-RET

2010-04-23 Thread Carl Worth
On Thu, 22 Apr 2010 09:24:03 +0100, David Edmondson  wrote:
> `notmuch-show-toggle-all' changes the visibility all of the messages
> in the current thread. By default it makes all of the messages
> visible. With a prefix argument, it makes them all not visible.

This is a better default, definitely.

The only complaint I have left is that the function name is wrong. It's
not toggling the visibility of all messages, (which would be a totally
insane thing to do of course).

The positive-sense operation would be something like
notmuch-show-open-all. So maybe a function that does both would be
something like notmuch-show-open-or-close-all ?

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100423/d0c25766/attachment.pgp>


[PATCH] emacs: Allow headers to be shown by default in show mode

2010-04-23 Thread Carl Worth
On Fri, 23 Apr 2010 12:54:21 +0100, David Edmondson  wrote:
> Add `notmuch-show-headers-visible' which, when set `t', causes headers
> to be shown by default.

A nice improvement, definitely. But I don't hear anyone actually wanting
a configuration value here.

Would anyone complain if I just made these all visible by default?

Would anyone complain if I removed the code to allow for th hiding of
the header?

That's what I'm inclined to do.

Let me know.

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100423/342c3ede/attachment.pgp>


[PATCH] emacs: Remove `notmuch-search-authors-width' and fix the use of `notmuch-search-result-format' accordingly

2010-04-23 Thread Carl Worth
On Fri, 23 Apr 2010 13:22:24 -0400, Jameson Rollins  wrote:
> On Fri, 23 Apr 2010 11:24:09 +0100, David Edmondson  wrote:
> > Jamie, could you test this patch please? My main concern is that it
> > makes a small assumption about the value of
> > `notmuch-search-result-format' - namely that the `authors' field ends
> > with a space.
> 
> Tested, and it works.  Thanks so much for fixing this, David.  Very much
> appreciated.

Thanks to both of you! This is pushed now.

> Approved-By: Jameson Rollins 
> 
> (I was going to try to resend the patch with the "Approved-By" bit
> added, but I was sure I was going to mess it up.  If someone can point
> me to a message where that was done correctly, that'd be great.)

Just putting the above line in an email message is fine. In fact, it's
simpler in that I don't have to analyze two submissions of a patch to
see if there's anything different other than the commit message.

All I have to do for the above is a quick "git commit --amend".

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100423/20393f8e/attachment.pgp>


Updated elisp FCC patches (was: Fcc, Maildir, and Emacs message-mode)

2010-04-23 Thread Sebastian Spaeth
My last mail on this issue: I squashed the recent 7 patch series into 4 nicer
ones.

Rather than resending the patch series, here are the 4 commits from my
repo at git at github.com:spaetz/notmuch-all-feature.git (let me know if I
should mail them too).
(These 4 are in the feature/elisp feature branch based on current cworth)

9e27ea17e9cb2ec69f90f8b5288bd9fe29946356
Add (unchanged) elisp file for FCC to maildir solution

bdcccb5faa86233f0afd66001b566054ffdb6be3
Integrate notmuch-maildir-fcc into notmuch

e6d7456094431959f8621d3cf36e1862bfdbbf62
notmuch-maildir-fcc: elisp syntax fixes

b339830a8b2853a0c683773e2bdb03e0f6df2de7
Integrate notmuch-fcc mechansim

I don't know how to test the emacs interaction or I would have provided
some tests with it. Also, I am not sure if the error message still
shows up when the user configures a non-existing maildir. But other than
that it works nice and reliably here. I have now dumped my python
script. I feel pretty confident that this can go in.


[PATCH 1/2] Add 'cat' subcommand

2010-04-23 Thread Carl Worth
On Thu, 22 Apr 2010 08:38:54 +0200, Michal Sojka  wrote:
> If a filename:dir/file term is present in the query, it will be
> necessary to first query the database for directory:dir to find the
>  and then put in the query
> file-direntry::file. This conversion is already
> implemented in _notmuch_database_filename_to_direntry(). Right?

Yes.

> _notmuch_database_filename_to_direntry() requires writable database as
> it creates the directory document if it doesn't exist. This is probably
> not what we want for filename: queries - if the user types the filename
> incorrectly, the nonexisting directory document could be added to the
> database. So I think that _notmuch_database_find_directory_id() should
> be modified to not modify the database. The directory documents should
> be created somewhere else in notmuch new path. Do you agree?

Yes. Good job anticipating that failure mode before we ran into it.

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100423/397abbc6/attachment.pgp>


Notmuch success: Xapian database corrupt

2010-04-23 Thread Carl Worth
On Thu, 22 Apr 2010 07:19:58 +, John Fremlin  wrote:
> After the encouraging message from Sebastian. I deleted the
> .notmuch/xapian dir and started again.
> 
> It went off a good rate (300+ files/sec) and here was the final score
> 
> Processed 494764 total files in 2h 54m 41s (47 files/sec.). 
> Added 226817 new messages to the database.

Nice. That's much more like what I'm accustomed to getting.

> This is much faster than before. As I haven't changed the storage or the
> filesystem (ext4,data=ordered over encrypted aes-xts-plain), I just
> don't know what made the difference. My kernel is now 2.6.32-21-generic
> #32-Ubuntu and I had an older one the first try a month or so ago.

Thanks for the details at least. Maybe other people having performance
problems can start finding correlations.

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100423/f7e738e3/attachment-0001.pgp>


[PATCH] Reintroduce patch to quote args in notmuch-show to facilitate remote use

2010-04-23 Thread Carl Worth
On Wed, 21 Apr 2010 17:22:08 -0400, Jesse Rosenthal  
wrote:
> This reintroduces the patch committed in 9193455fa1, which was
> reverted during the upgrade to the JSON emacs UI.

Thanks. This is pushed.

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100423/3d06fc9b/attachment.pgp>


add delete keybinding

2010-04-23 Thread Carl Worth
On Wed, 21 Apr 2010 16:16:02 -0700, Dirk Hohndel  
wrote:
> I'm sending this mostly as an RFC - I use this and like it, but
> people seem to have strong feelings as to how they want to deal 
> with deleting email (or for some people, how they don't want to
> do that at all).

I like the idea of adding the deleted tag with a 'd' keybinding.

I also agree with the comments that suggest that this should be
independent of the archiving operation. (That is, 'd' should just add
the deleted tag and do nothing else.)

With sup, there was the idea to not make the user add "add not
tag:deleted" to all searches. The way that worked was basically that sup
would append "and not tag:deleted" to all searches except for those that
already had "tag:deleted" in them. This allows deleted messages to give
every appearance of being deleted, (they would not show up in searches),
but a user *could* still find them[*] by explicitly saying "and
tag:deleted" in the search.

I don't think it makes sense to add a delete keybinding without some
support along the lines of what's described above.

It does seem out of character for the library or even the command-line
to do interpretation of tag names and munging of search strings like
this. So I think all of the above should be implemented within emacs
code. It's the emacs code that is adding the "deleted" tag so it should
be interpreting its behavior as well.

-Carl

[*] Until the user did some sort of external expunge operation that
actually deleted the files, of course.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100423/b840e74b/attachment.pgp>


improve from-header guessing

2010-04-23 Thread Carl Worth
On Fri, 16 Apr 2010 13:51:40 -0700, Dirk Hohndel  
wrote:
> The following two patches should address most of the concerns raised 
> to my previous series. 

Allow me to raise new concerns then. ;-)

> The first patch simply adds an interface to obtain a concatenation of
> all instances of a specific header from an email.

I was hoping to see the "special-case value of NULL" go away with this
change.

And I like that there's a new function to get the concatenated header,
(I would prefer an unabbreviated name of get_concatenated_header than
get_header_concat), but I don't like seeing all the existing callers of
get_header updated to pass an extra 0. Instead, I'd prefer to see those
calls unchanged, and a tiny new get_header that passes the 0 and then
make the actual implementing function be static and named something like
notmuch_message_file_get_header_internal.

Both patches have some trailing whitespace. I see these easily wince I
have the following in my ~/.gitconfig:

[core]
whitespace = trailing-space,space-before-tab

I'm sure there's a way to make git refuse to let you commit changes with
trailing whitespace, but I don't know offhand what it is.

Finally, I'd like to see some tests for this feature. (But we do have
the feature already without tests, so I won't strictly block on that).

If you can fix up any of the above before I make another pass through ym
queue, that would be great.

Thanks,

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100423/6853514b/attachment.pgp>


[PATCH 7/7] Integrate notmuch-fcc mechansim

2010-04-23 Thread Sebastian Spaeth
I have gone wild and added a defcustom "notmuch-fcc-dirs".
Depending on the value of that variable we will not do any
maildir fcc at all (nil, the default), or it is of the format
(("defaultsentbox")
 ("full name " . "Work/sentbox")
 ("full name2 " . "Work2/sentbox"))

The outbox name will be concatenated with the message mode
variable "message-directory" which is "~/Mail/" by default.

With this solution, no customization of a user's .emacs file
is needed at all.

Signed-off-by: Sebastian Spaeth 
---
I went wild and did a proper notmuch integration including customizations.
Maildir FCC is turned off by default and can be turned on to some universal
SENTBOX or to Dirk's sepcial use case with multiple outboxes depending on 
the from address. Some testing would be appreciated before it is merged.
It seems to work nicely here. And be lenient, remember I am an elisp noob.

 emacs/notmuch-maildir-fcc.el |   86 --
 1 files changed, 57 insertions(+), 29 deletions(-)

diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index b7e1fb3..9f54dfb 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -12,39 +12,66 @@
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 ;; Boston, MA 02110-1301, USA.
-
-;; Commentary:
-;;
-;; This is the beginning of a solution for storing sent mail in a
-;; maildir in emacs message mode, presented because some people might
-;; find it useful. It is *not* fully tested, it *may* overwrite files,
-;; and any directories you point this at may no longer be there
-;; afterwards. Use at your own risk.
-;;
-;; To use this as the fcc handler for message-mode, put
-;; one of the following in your init file:
-;;
-;; if you want Fcc'd messages to be marked as read:
-;;
-;; (setq message-fcc-handler-function
-;;  '(lambda (destdir)
-;;  (notmuch-maildir-fcc-write-buffer-to-maildir destdir t)))
-;;
-;; if you want Fcc'd messages to be marked as new:
-;;
-;; (setq message-fcc-handler-function
-;;  '(lambda (destdir)
-;;  (notmuch-maildir-fcc-write-buffer-to-maildir destdir nil)))
-;;
-;; It will then honor the Fcc header that you set in your mail. They can
-;; be set up automatically via:
 ;;
-;; (add-hook 'message-send-hook
-;;  '(lambda ()
-;; (message-add-header "Fcc: ~/mail/INBOX.Sent")))
+;; To use this as the fcc handler for message-mode,
+;; customize the notmuch-fcc-dirs variable
+
+(require 'message)

 (defvar notmuch-maildir-fcc-count 0)

+(defcustom notmuch-fcc-dirs nil
+ "If set to non-nil, this will cause message mode to file (fcc) your mail in 
the specified directory, depending on your From address.
+
+ The first entry (a list) is used as a default fallback
+ when nothing matches. So in the easiest case notmuch-fcc-dirs is
+ just something like ((\"INBOX.Sent\"))
+
+ If you need a more fancy setup, where you want different Outboxes depending
+ on your From address, you use something like this:
+
+ (   (\"defaultinbox\")
+ (\"Sebastian Spaeth \" . \"privat\")
+ (\"Sebastian Spaeth \" . \"uni\")
+ )
+ 
+ This will constructs a path, concatenating the content of the
+ variable 'message-directory' (a message mode variable
+ customizable via m-x
+ customize-variablemessage-directory) and the second
+ part in the alist."
+ :require 'notmuch-fcc-initialization
+ :group 'notmuch
+)
+
+(defun notmuch-fcc-initialization ()
+  "If notmuch-fcc-directories is set, 
+   hook them into the message-fcc-handler-function"
+(if (not (eq notmuch-fcc-dirs nil)) (progn
+;Set up the message-fcc-handler to move mails to the maildir in Fcc
+;The parameter is hardcoded to mark messages as "seen"
+(setq message-fcc-handler-function
+  '(lambda (destdir)
+ (notmuch-maildir-fcc-write-buffer-to-maildir destdir t)))
+;add a hook to actually insert the Fcc header when sending
+;(preferrably we would use message-header-setup-up, but notmuch-reply 
+; munges headers after that is run, so it won't work for replies within
+; notmuch)
+(add-hook 'message-send-hook 'notmuch-fcc-header-setup
+
+(defun notmuch-fcc-header-setup ()
+  "Can be added to message-send-hook and will set the FCC header
+  based on the values of notmuch-fcc-directories (see the
+  variable customization there for examples). It uses the
+  first entry as default fallback if no From address
+  matches."
+  ; only do something if notmuch-fcc-dirs is set
+  (if notmuch-fcc-dirs
+   (let ((subdir (cdr (assoc (message-fetch-field "from") notmuch-fcc-dirs
+ (if (eq subdir nil) (setq subdir (car (car notmuch-fcc-dirs
+ (message-remove-header "Fcc")
+ (message-add-header (concat "Fcc: " message-directory subdir)
+
 (defun notmuch-maildir-fcc-host-fixer (hostname)
   (replace-regexp-in-string "/\\|:"
 

[PATCH] emacs: Remove `notmuch-search-authors-width' and fix the use of `notmuch-search-result-format' accordingly

2010-04-23 Thread David Edmondson
The width of the authors field in search output was previously
specified in two places:
 - `notmuch-search-authors-width': the limit beyond which the authors
   names are truncated,
 - `notmuch-search-result-format': the layout of the search results.

Changing the configuration of one of these may have required the user
to know about and adapt the other accordingly. This led to confusion.

Instead, remove `notmuch-search-authors-width' and perform truncation
based on the relevant field in `notmuch-search-result-format'.
---

Jamie, could you test this patch please? My main concern is that it
makes a small assumption about the value of
`notmuch-search-result-format' - namely that the `authors' field ends
with a space.

 emacs/notmuch.el |   16 ++--
 1 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index f96394a..d40c36e 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -55,15 +55,10 @@
 (require 'notmuch-show)
 (require 'notmuch-mua)

-(defcustom notmuch-search-authors-width 20
-  "Number of columns to use to display authors in a notmuch-search buffer."
-  :type 'integer
-  :group 'notmuch)
-
 (defcustom notmuch-search-result-format
   `(("date" . "%s ")
 ("count" . "%-7s ")
-("authors" . ,(format "%%-%ds " notmuch-search-authors-width))
+("authors" . "%-20s ")
 ("subject" . "%s ")
 ("tags" . "(%s)"))
   "Search result formating. Supported fields are:
@@ -585,7 +580,11 @@ matching will be applied."
((string-equal field "count")
 (insert (format (cdr (assoc field notmuch-search-result-format)) count)))
((string-equal field "authors")
-(insert (format (cdr (assoc field notmuch-search-result-format)) authors)))
+(insert (let ((sample (format (cdr (assoc field 
notmuch-search-result-format)) "")))
+ (if (> (length authors)
+(length sample))
+ (concat (substring authors 0 (- (length sample) 4)) "... ")
+   (format (cdr (assoc field notmuch-search-result-format)) 
authors)
((string-equal field "subject")
 (insert (format (cdr (assoc field notmuch-search-result-format)) subject)))
((string-equal field "tags")
@@ -614,12 +613,9 @@ matching will be applied."
   (date (match-string 2 string))
   (count (match-string 3 string))
   (authors (match-string 4 string))
-  (authors-length (length authors))
   (subject (match-string 5 string))
   (tags (match-string 6 string))
   (tag-list (if tags (save-match-data (split-string 
tags)
- (if (> authors-length notmuch-search-authors-width)
- (set 'authors (concat (substring authors 0 (- 
notmuch-search-authors-width 3)) "...")))
  (goto-char (point-max))
  (let ((beg (point-marker)))
(notmuch-search-show-result date count authors subject 
tags)
-- 
1.7.0



[Announce] notmuch release 0.2 now available

2010-04-23 Thread Carl Worth
On Sat, 17 Apr 2010 09:49:01 +1000, Alex Ghitza  wrote:
> notmuch-0.2 built fine, but one test failed during 'make test'.  I have
> put the indicated directory up at
> 
> http://aghitza.org/files/test.16707

Hi Alex,

Thanks for reporting this.

Unfortunately, at the time, the test suite didn't capture everything
necessary to investigate the problem in the directory. In particular,
the actual vs. expected output only appeared on stdout.

If you could provide that output, then we could perhaps investigate the
problem.

Alternately, upgrading to a more recent version of notmuch, (either from
git now, or using 0.3 when it appears in the future), will give you a
test suite that does capture the essential information in that
directory.

Thanks,

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100423/0d0eaac1/attachment.pgp>


[PATCH] notmuch new --new-tags=tags...

2010-04-23 Thread Carl Worth
On Mon, 12 Apr 2010 07:59:14 -0400, Jameson Rollins  wrote:
> On Mon, 12 Apr 2010 10:00:37 +0200, "Sebastian Spaeth"  SSpaeth.de> wrote:
> > On 2010-04-10, Anthony Towns wrote:
> > > The attached patch makes "notmuch new --new-tags=unread,new" set the
> > > "unread" and "new" tags on any new mail it finds rather than "unread"
> > > and "inbox". Or whatever other tags you happen to specify.

Thanks very much for the patch, AJ. It's definitely a useful feature.

> > Thanks for the patch. I can't comment on the code quality, but rather
> > than having to specify the set of new tags on the command line every
> > time, I think it would make more sense to put them in the notmuch config
> > file as this patch does:
> > id:1268432006-24333-2-git-send-email-bgamari.foss at gmail.com

I ended up taking that version instead, (using a configuration setting
for this instead of a command-line option to "notmuch new".

One could imagine accepting the command-line option as well, but I don't
think that would actually be useful. Let me know if you disagree.

> I was thinking about this, and it seems to me that we really need is a
> way to just specify which tags should be applied to new messages based
> on search terms.

Yes, I agree.

Many of us are (or will soon be) achieving the feature based on the
following recipe:

  * Configuring new.tags to add a "new" tag.

  * Writing a notmuch-poll script that does the following:

  * Performs "notmuch tag" searches to add tags to "new" messages.

  * Clears the "new" tag from all messages.

  * Configuring notmuch-poll-script inside emacs to invoke our
notmuch-poll script.

If we added support for configuring search-based tagging directly into
notmuch, then the above recipe could be reduced to a single block of
configuration settings, which sounds much nicer.

So I'll look forward to any implementation to provide that. In the
meantime, we can muddle along with the functionality we want, (but a
little more manual effort to achieve it).

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100423/02786018/attachment.pgp>


[PATCH] Add NEWS updates for my last batch of patches

2010-04-23 Thread Dirk Hohndel

in the future I'll include those with my patches. Hope it's ok to do
this as one single patch for this series.

Signed-off-by: Dirk Hohndel 
---
 NEWS |   35 +++
 1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/NEWS b/NEWS
index eba0fd5..5586386 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,38 @@
+
+Even Better guessing of From: header.
+
+  Notmuch now looks at a number of headers when trying to figure out
+  the best From: header to use in a reply. First it checks whether one
+  of the user's emails is in To: or Cc:, then it checks Envelope-To:
+  and X-Original-To: headers, then it analyses the Received headers
+  checking for a Received: by .. from .. for user at add.res clause. And
+  finally it matches domains in the received path.
+
+Visualization of author names that match a search
+
+  When notmuch displays threads as the result of a search, it now
+  lists the authors that match the search before listing the other
+  authors in the thread. It inserts a pipe '|' symbol between the last
+  matching and first non-matching author. This is especially useful in
+  a search that includes tag:unread. Now the authors of the unread
+  messages in the thread are listed first.
+
+Provide 'd' key binding to add the 'deleted' tag to messages and threads
+
+  The 'd' key works wherever 'a'rchive works - it performs the same
+  actions but additionally sets the deleted tag.
+
+Provide 'G' key binding to trigger mail refresh
+
+  The 'G' key works wherever '=' works. Before refreshing the screen
+  it calls an external program that can be used to poll email servers,
+  run notmuch new and setup specific tags for the new emails. The
+  script to be called can be customized with. Use the customize screen
+  to set the notmuch-poll-script variable to the program that you want
+  to execute when pressing 'G'. Note that this is synchronous - emacs
+  will wait until this program finishes.
+
+
 Notmuch 0.2 (2010-04-16)
 
 This is the second release of the notmuch mail system, with actual
-- 
1.6.6.1


-- 
Dirk Hohndel
Intel Open Source Technology Center


[notmuch] [PATCH] notmuch-config: make new message tags configurable

2010-04-23 Thread Carl Worth
On Fri, 12 Mar 2010 17:13:26 -0500, Ben Gamari  
wrote:
> Add a new_tags option in the [messages] section of the configuration
> file to allow the user to specify which tags should be added to new
> messages by notmuch new.

Thanks, Ben!

I finally broke down and decided I needed this feature.

Previously I've done all of my automatic tagging as global searches,
(and it's those tags that I want to switch to just search macros as I've
talked about many times in the past).

But I'm now doing things like a "merge window" tag where I want it
applied to new messages as they come in, but I also want to be able to
manually remove the tag from messages where it doesn't make sense. So a
global search doesn't do what I want here at all.

For me, I'll probably go the route of having "notmuch new" add a "new"
tag in addition to "inbox" and "unread" and then I'll have my
notmuch-poll script act on that, then remove the "new" tag from all
tagged messages. I wouldn't want to impose a "new" tag on everyone since
most people won't have a notmuch-poll removing "new" by default so that
tag would just build up.

Meanwhile, I know that Keith Packard and Eric Anholt are already having
their notmuch-poll scripts remove the "unread" tag from all message,
since they don't find that tag useful at all. This new configuration
will help them as well.

So I've now merged this patch, and as usual, I followed up with some
changes as well. Here's what I did in addition:

  * Fixed the compiler warning.

  * Fixed "notmuch setup" to add the documentation block to the
configuration file when adding new options there.

  * Renamed the new configuration option from:

[messages]
new_tags=inbox;unread;

to instead be:

[new]
tags=inbox;unread;

  * Fixed "notmuch setup" to prompt for this new setting.

Thanks again,

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100423/0aee934a/attachment.pgp>


sort order regression

2010-04-23 Thread Michal Sojka
On Fri, 23 Apr 2010, Sebastian Spaeth wrote:
> Ohh, that is a good point. Maybe I should write some :-). Is the test
> suite going to be changed any day now or does it still make sense to
> write tests for the "monolitic" test suite?

I do not have a plan to modularize the test suite in a near future.

I guess that currently we are not able to relicense the test library
from git. There is still one missing ack. I've just sent a mail to Junio
about his opinion.

Michal


[PATCH] Add 'G' keybinding to folder and search view that triggers external poll

2010-04-23 Thread Dirk Hohndel
On Fri, 23 Apr 2010 08:20:40 -0700, Carl Worth  wrote:
> On Fri, 23 Apr 2010 10:09:03 +0200, "Sebastian Spaeth"  SSpaeth.de> wrote:
> > Hehe. Very useful indeed. There is one more thing: Would it be possible to 
> > provide user
> > feedback while this is running (synchronously, I guess)? Like having
> > some message in the minibuffer saying "Calling all stations" and
> > "Polling finished, please move along..." ?
> 
> Anything is possible, of course. It just always seems to mean someone
> learning a bit more elisp. ;-)

I'm working on that. Check back in a few months :-)

> In the meantime, I've found it handy to put my mouse pointer over the
> emacs window when I run this command. Then I get a nice "busy" mouse
> cursor during this operation instead of the standard text-edit bar.

That's what I'm doing as well.

/D

-- 
Dirk Hohndel
Intel Open Source Technology Center


[PATCH] emacs: Allow headers to be shown by default in show mode

2010-04-23 Thread Dirk Hohndel
On Fri, 23 Apr 2010 12:54:21 +0100, David Edmondson  wrote:
> Add `notmuch-show-headers-visible' which, when set `t', causes headers
> to be shown by default.

Excellent - Carl, can you pull this into 0.3, please?

/D

-- 
Dirk Hohndel
Intel Open Source Technology Center


[PATCH] Add 'G' keybinding to folder and search view that triggers external poll

2010-04-23 Thread Sebastian Spaeth
On 2010-04-22, Dirk Hohndel wrote:
> I appreciate how nicely you can say "I liked the idea and then
> completely rewrote the crap elisp that you submitted" :-)

Hehe. Very useful indeed. There is one more thing: Would it be possible to 
provide user
feedback while this is running (synchronously, I guess)? Like having
some message in the minibuffer saying "Calling all stations" and
"Polling finished, please move along..." ?


notmuch segfault

2010-04-23 Thread Sebastian Spaeth
Sorry, I won't be able to offer much debug info, but the current stock
cworth/master segfaulted for me with only the "tag:inbox" search.

Output:
/home/spaetz/mail/INBOX/new/...2c57e:2,: No such file or directory
Segmentation fault (core dumped)

A "notmuch new" fixed the segfault, something is not as robust as it
should be (or used to be), it seems. I'll dig deeper if it occurs again.

Sebastian


[PATCH] test: Set fixed time zone

2010-04-23 Thread Michal Sojka
When the test suite is run in a different time zone that where Carl
lives, some tests may fail depending on the time when the test suite is
run. For example, just now I get:

 Search for all messages ("*"):...  FAIL
--- test-031.expected   2010-04-23 09:33:47.898634822 +0200
+++ test-031.output 2010-04-23 09:33:47.898634822 +0200
@@ -1,5 +1,5 @@
-thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Test message #6 (inbox 
unread)
-thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Test message #14 (inbox 
unread)
+thread:XXX   2001-01-06 [1/1] Notmuch Test Suite; Test message #6 (inbox 
unread)
+thread:XXX   2001-01-06 [1/1] Notmuch Test Suite; Test message #14 (inbox 
unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; body search (inbox 
unread)
 thread:XXX   2000-01-01 [1/1] searchbyfrom; search by from (inbox unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by to (inbox 
unread)

By setting a fixed time zone in the test script, these problems should
be eliminated.

Signed-off-by: Michal Sojka 
---
 test/notmuch-test |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/test/notmuch-test b/test/notmuch-test
index 2b76f04..f0741e1 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -1,6 +1,8 @@
 #!/bin/bash
 set -e

+export TZ=UTC+8
+
 find_notmuch_binary ()
 {
 dir=$1
-- 
1.7.0.4



sort order regression

2010-04-23 Thread Sebastian Spaeth
On 2010-04-22, Carl Worth wrote:
> On 22 Apr 2010, Sebastian Spaeth wrote:
> > 
> > jkr and I noticed that patch series are shown in reverse order now, in
> > fact threads seem to display messages at the same depth in reverse
> > chronological order now.
> 
> My fault! Sorry about that.

No harm done, no need to be sorry. We are pre-1.0 in a development
branch, what should we expect :) ? 

> So in my defense, it wasn't my fault[*] I didn't notice the
> regression. It was the test suite's fault for not testing "notmuch show"
> at all.

Ohh, that is a good point. Maybe I should write some :-). Is the test
suite going to be changed any day now or does it still make sense to
write tests for the "monolitic" test suite?

Sebastian


[notmuch] Fcc, Maildir, and Emacs message-mode -- a bit of code

2010-04-23 Thread Sebastian Spaeth
On 2010-04-22, Dirk Hohndel wrote:
> ;; This is the list of alternatives that should be configurable as
> ;; defcustom (or simply set in .emacs for now)
> (setq notmuch-fcc-dirs '(
>   ("Dirk Hohndel " . "Maildir/Sent Items")
>   ("Dirk Hohndel " . "MaildirInfradead/Sent")))
> 
> ;This constructs a path, concatenating the content of the variable
> ;"message-directory" and the second part in the alist:
> (defun my-fcc-header-setup ()
> (let ((subdir (cdr (assoc (message-fetch-field "from") notmuch-fcc-dirs
>  (message-add-header (concat "Fcc: " message-directory subdir
> (add-hook 'message-send-hook 'my-fcc-header-setup)

> The disadvantage is that with the message-send-hook I don't get to see /
> correct the FCC line in the message buffer - but since I trust the logic
> here (and tested it quite a bit), I'm less concerned about this.

Another disadvantage is that this does not provide a fallback, so if you
type "dirk" rather than "Dirk" in your from, the fcc dir will be nil, so
it tries to deliver just to "message-directory". The user should be able
to configure a default FCC dir, I think.

Sebastian


pull request

2010-04-23 Thread Jameson Rollins
On Fri, 23 Apr 2010 12:57:42 +0100, David Edmondson  wrote:
> > Hey, Carl.  I had actually been meaning to bring this up.  I actually
> > don't like having the headers collapsed at all, so I am definitely in
> > favor of the idea of doing away with this "feature".  At the very least,
> > I would like to see header hiding/collapsing be an option, so that I
> > could turn it off.  As is, I'm having to hit 'h' for every message I
> > view, so I can just see who the message was sent to (not to mention to
> > recover the unfortunately missing blank line between the header and the
> > body, which is visually useful).
> 
> See id:1272023661-14038-1-git-send-email-dme at dme.org.

Yes!  +1!  Thank you very much, David.

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/20100423/edccab98/attachment.pgp>


[PATCH] Add 'G' keybinding to folder and search view that triggers external poll

2010-04-23 Thread Carl Worth
On Fri, 23 Apr 2010 10:09:03 +0200, "Sebastian Spaeth"  wrote:
> Hehe. Very useful indeed. There is one more thing: Would it be possible to 
> provide user
> feedback while this is running (synchronously, I guess)? Like having
> some message in the minibuffer saying "Calling all stations" and
> "Polling finished, please move along..." ?

Anything is possible, of course. It just always seems to mean someone
learning a bit more elisp. ;-)

In the meantime, I've found it handy to put my mouse pointer over the
emacs window when I run this command. Then I get a nice "busy" mouse
cursor during this operation instead of the standard text-edit bar.

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100423/65fe21a6/attachment.pgp>


sort order regression

2010-04-23 Thread Carl Worth
On Fri, 23 Apr 2010 10:15:22 +0200, Michal Sojka  wrote:
> On Fri, 23 Apr 2010, Sebastian Spaeth wrote:
> > Ohh, that is a good point. Maybe I should write some :-). Is the test
> > suite going to be changed any day now or does it still make sense to
> > write tests for the "monolitic" test suite?

I would still like to make things more modular in the future. That is,
I'd like the tests to be categorized and grouped so that one can run a
single group of tests, (or even a single test). I'd also like to have
some dependencies between tests so that when an early test fails, later
tests that depend on that functionality will simply report UNTESTED due
to the earlier failure.

But there's certainly no need to wait for that before adding additional
tests.

> I do not have a plan to modularize the test suite in a near future.

Michal, thanks for all your effort to modularize based on the git test
suite. I know you've had to put continual effort to keep your patches up
to date as things have changed. Sorry that you got blocked by some
relicensing that hasn't quite worked out.

> I guess that currently we are not able to relicense the test library
> from git. There is still one missing ack. I've just sent a mail to Junio
> about his opinion.

Want to replay all the git test-suite commits other than any from the
person with the missing ack? That should get us pretty close to the
current state in git, would give us code we could use, and might even
make it possible for us to submit improvements directly to the upstream
git repository.

Should be a pretty simple "git rebase -i" or so and edit out the lines


[PATCH] Add 'G' keybinding to folder and search view that triggers external poll

2010-04-23 Thread Dirk Hohndel
On Fri, 23 Apr 2010 10:09:03 +0200, "Sebastian Spaeth"  wrote:
> On 2010-04-22, Dirk Hohndel wrote:
> > I appreciate how nicely you can say "I liked the idea and then
> > completely rewrote the crap elisp that you submitted" :-)
> 
> Hehe. Very useful indeed. There is one more thing: Would it be possible to 
> provide user
> feedback while this is running (synchronously, I guess)? Like having
> some message in the minibuffer saying "Calling all stations" and
> "Polling finished, please move along..." ?

Right now all you get is the busy cursor. The problem with the updates
is that notmuch/emacs calls just one script. I don't know how to display
(progress-) output from that script in the mininuffer...

/D

-- 
Dirk Hohndel
Intel Open Source Technology Center


Updated elisp FCC patches (was: Fcc, Maildir, and Emacs message-mode)

2010-04-23 Thread Dirk Hohndel
On Fri, 23 Apr 2010 12:08:31 +0200, "Sebastian Spaeth"  wrote:
> My last mail on this issue: I squashed the recent 7 patch series into 4 nicer
> ones.
> 
> Rather than resending the patch series, here are the 4 commits from my
> repo at git at github.com:spaetz/notmuch-all-feature.git (let me know if I
> should mail them too).

I had talked to Carl about this yesterday - I think we both would prefer
that patches be emailed, too. The git trees are great for pulling
patches from, but it seems easier to review them here in email...

> I don't know how to test the emacs interaction or I would have provided
> some tests with it. Also, I am not sure if the error message still
> shows up when the user configures a non-existing maildir. But other than
> that it works nice and reliably here. I have now dumped my python
> script. I feel pretty confident that this can go in.

I will play with it later today.

/D

-- 
Dirk Hohndel
Intel Open Source Technology Center


[PATCH] Makefile.local: Fix LDFLAGS for notmuch-shared

2010-04-23 Thread Adrien Bustany
This commit adds GMIME_LDFLAGS and TALLOC_LDFLAGS to the linker flags
when linking notmuch-shared. Without these flags, linking fails because
of undefined symbols.
---
 Makefile.local |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Makefile.local b/Makefile.local
index 5bb570b..37dd745 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -31,7 +31,7 @@ GPG_FILE=$(SHA1_FILE).asc
 # Smash together user's values with our extra values
 FINAL_CFLAGS = -DNOTMUCH_VERSION=$(VERSION) $(CFLAGS) $(WARN_CFLAGS) 
$(CONFIGURE_CFLAGS) $(extra_cflags)
 FINAL_CXXFLAGS = $(CXXFLAGS) $(WARN_CXXFLAGS) $(CONFIGURE_CXXFLAGS) 
$(extra_cflags) $(extra_cxxflags)
-FINAL_NOTMUCH_LDFLAGS = $(LDFLAGS) -Llib -lnotmuch
+FINAL_NOTMUCH_LDFLAGS = $(LDFLAGS) $(GMIME_LDFLAGS) $(TALLOC_LDFLAGS) -Llib 
-lnotmuch
 FINAL_NOTMUCH_LINKER = CC
 ifneq ($(LINKER_RESOLVES_LIBRARY_DEPENDENCIES),1)
 FINAL_NOTMUCH_LDFLAGS += $(CONFIGURE_LDFLAGS)
-- 
1.7.0.1



Re: [notmuch] Fcc, Maildir, and Emacs message-mode -- a bit of code

2010-04-23 Thread Sebastian Spaeth
On 2010-04-22, Dirk Hohndel wrote:
 ;; This is the list of alternatives that should be configurable as
 ;; defcustom (or simply set in .emacs for now)
 (setq notmuch-fcc-dirs '(
   (Dirk Hohndel dirk.hohn...@intel.com . Maildir/Sent Items)
   (Dirk Hohndel hohn...@infradead.org . MaildirInfradead/Sent)))
 
 ;This constructs a path, concatenating the content of the variable
 ;message-directory and the second part in the alist:
 (defun my-fcc-header-setup ()
 (let ((subdir (cdr (assoc (message-fetch-field from) notmuch-fcc-dirs
  (message-add-header (concat Fcc:  message-directory subdir
 (add-hook 'message-send-hook 'my-fcc-header-setup)

 The disadvantage is that with the message-send-hook I don't get to see /
 correct the FCC line in the message buffer - but since I trust the logic
 here (and tested it quite a bit), I'm less concerned about this.

Another disadvantage is that this does not provide a fallback, so if you
type dirk rather than Dirk in your from, the fcc dir will be nil, so
it tries to deliver just to message-directory. The user should be able
to configure a default FCC dir, I think.

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


[PATCH] test: Set fixed time zone

2010-04-23 Thread Michal Sojka
When the test suite is run in a different time zone that where Carl
lives, some tests may fail depending on the time when the test suite is
run. For example, just now I get:

 Search for all messages (*):...  FAIL
--- test-031.expected   2010-04-23 09:33:47.898634822 +0200
+++ test-031.output 2010-04-23 09:33:47.898634822 +0200
@@ -1,5 +1,5 @@
-thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Test message #6 (inbox 
unread)
-thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Test message #14 (inbox 
unread)
+thread:XXX   2001-01-06 [1/1] Notmuch Test Suite; Test message #6 (inbox 
unread)
+thread:XXX   2001-01-06 [1/1] Notmuch Test Suite; Test message #14 (inbox 
unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; body search (inbox 
unread)
 thread:XXX   2000-01-01 [1/1] searchbyfrom; search by from (inbox unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by to (inbox 
unread)

By setting a fixed time zone in the test script, these problems should
be eliminated.

Signed-off-by: Michal Sojka sojk...@fel.cvut.cz
---
 test/notmuch-test |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/test/notmuch-test b/test/notmuch-test
index 2b76f04..f0741e1 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -1,6 +1,8 @@
 #!/bin/bash
 set -e
 
+export TZ=UTC+8
+
 find_notmuch_binary ()
 {
 dir=$1
-- 
1.7.0.4

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


notmuch segfault

2010-04-23 Thread Sebastian Spaeth
Sorry, I won't be able to offer much debug info, but the current stock
cworth/master segfaulted for me with only the tag:inbox search.

Output:
/home/spaetz/mail/INBOX/new/...2c57e:2,: No such file or directory
Segmentation fault (core dumped)

A notmuch new fixed the segfault, something is not as robust as it
should be (or used to be), it seems. I'll dig deeper if it occurs again.

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


Re: [PATCH] Add 'G' keybinding to folder and search view that triggers external poll

2010-04-23 Thread Sebastian Spaeth
On 2010-04-22, Dirk Hohndel wrote:
 I appreciate how nicely you can say I liked the idea and then
 completely rewrote the crap elisp that you submitted :-)

Hehe. Very useful indeed. There is one more thing: Would it be possible to 
provide user
feedback while this is running (synchronously, I guess)? Like having
some message in the minibuffer saying Calling all stations and
Polling finished, please move along... ?
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: sort order regression

2010-04-23 Thread Michal Sojka
On Fri, 23 Apr 2010, Sebastian Spaeth wrote:
 Ohh, that is a good point. Maybe I should write some :-). Is the test
 suite going to be changed any day now or does it still make sense to
 write tests for the monolitic test suite?

I do not have a plan to modularize the test suite in a near future.

I guess that currently we are not able to relicense the test library
from git. There is still one missing ack. I've just sent a mail to Junio
about his opinion.

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


[PATCH 7/7] Integrate notmuch-fcc mechansim

2010-04-23 Thread Sebastian Spaeth
I have gone wild and added a defcustom notmuch-fcc-dirs.
Depending on the value of that variable we will not do any
maildir fcc at all (nil, the default), or it is of the format
((defaultsentbox)
 (full name em...@address . Work/sentbox)
 (full name2 ema...@address2 . Work2/sentbox))

The outbox name will be concatenated with the message mode
variable message-directory which is ~/Mail/ by default.

With this solution, no customization of a user's .emacs file
is needed at all.

Signed-off-by: Sebastian Spaeth sebast...@sspaeth.de
---
I went wild and did a proper notmuch integration including customizations.
Maildir FCC is turned off by default and can be turned on to some universal
SENTBOX or to Dirk's sepcial use case with multiple outboxes depending on 
the from address. Some testing would be appreciated before it is merged.
It seems to work nicely here. And be lenient, remember I am an elisp noob.

 emacs/notmuch-maildir-fcc.el |   86 --
 1 files changed, 57 insertions(+), 29 deletions(-)

diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index b7e1fb3..9f54dfb 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -12,39 +12,66 @@
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 ;; Boston, MA 02110-1301, USA.
-
-;; Commentary:
-;;
-;; This is the beginning of a solution for storing sent mail in a
-;; maildir in emacs message mode, presented because some people might
-;; find it useful. It is *not* fully tested, it *may* overwrite files,
-;; and any directories you point this at may no longer be there
-;; afterwards. Use at your own risk.
-;;
-;; To use this as the fcc handler for message-mode, put
-;; one of the following in your init file:
-;;
-;; if you want Fcc'd messages to be marked as read:
-;;
-;; (setq message-fcc-handler-function
-;;  '(lambda (destdir)
-;;  (notmuch-maildir-fcc-write-buffer-to-maildir destdir t)))
-;;
-;; if you want Fcc'd messages to be marked as new:
-;;
-;; (setq message-fcc-handler-function
-;;  '(lambda (destdir)
-;;  (notmuch-maildir-fcc-write-buffer-to-maildir destdir nil)))
-;;
-;; It will then honor the Fcc header that you set in your mail. They can
-;; be set up automatically via:
 ;;
-;; (add-hook 'message-send-hook
-;;  '(lambda ()
-;; (message-add-header Fcc: ~/mail/INBOX.Sent)))
+;; To use this as the fcc handler for message-mode,
+;; customize the notmuch-fcc-dirs variable
+
+(require 'message)
 
 (defvar notmuch-maildir-fcc-count 0)
 
+(defcustom notmuch-fcc-dirs nil
+ If set to non-nil, this will cause message mode to file (fcc) your mail in 
the specified directory, depending on your From address.
+
+ The first entry (a list) is used as a default fallback
+ when nothing matches. So in the easiest case notmuch-fcc-dirs is
+ just something like ((\INBOX.Sent\))
+
+ If you need a more fancy setup, where you want different Outboxes depending
+ on your From address, you use something like this:
+
+ (   (\defaultinbox\)
+ (\Sebastian Spaeth sebast...@sspaeth.de\ . \privat\)
+ (\Sebastian Spaeth sspa...@ethz.ch\ . \uni\)
+ )
+ 
+ This will constructs a path, concatenating the content of the
+ variable 'message-directory' (a message mode variable
+ customizable via m-x
+ customize-variableRETmessage-directoryRET) and the second
+ part in the alist.
+ :require 'notmuch-fcc-initialization
+ :group 'notmuch
+)
+
+(defun notmuch-fcc-initialization ()
+  If notmuch-fcc-directories is set, 
+   hook them into the message-fcc-handler-function
+(if (not (eq notmuch-fcc-dirs nil)) (progn
+;Set up the message-fcc-handler to move mails to the maildir in Fcc
+;The parameter is hardcoded to mark messages as seen
+(setq message-fcc-handler-function
+  '(lambda (destdir)
+ (notmuch-maildir-fcc-write-buffer-to-maildir destdir t)))
+;add a hook to actually insert the Fcc header when sending
+;(preferrably we would use message-header-setup-up, but notmuch-reply 
+; munges headers after that is run, so it won't work for replies within
+; notmuch)
+(add-hook 'message-send-hook 'notmuch-fcc-header-setup
+
+(defun notmuch-fcc-header-setup ()
+  Can be added to message-send-hook and will set the FCC header
+  based on the values of notmuch-fcc-directories (see the
+  variable customization there for examples). It uses the
+  first entry as default fallback if no From address
+  matches.
+  ; only do something if notmuch-fcc-dirs is set
+  (if notmuch-fcc-dirs
+   (let ((subdir (cdr (assoc (message-fetch-field from) notmuch-fcc-dirs
+ (if (eq subdir nil) (setq subdir (car (car notmuch-fcc-dirs
+ (message-remove-header Fcc)
+ (message-add-header (concat Fcc:  message-directory subdir)
+
 (defun notmuch-maildir-fcc-host-fixer 

[PATCH] emacs: Remove `notmuch-search-authors-width' and fix the use of `notmuch-search-result-format' accordingly

2010-04-23 Thread David Edmondson
The width of the authors field in search output was previously
specified in two places:
 - `notmuch-search-authors-width': the limit beyond which the authors
   names are truncated,
 - `notmuch-search-result-format': the layout of the search results.

Changing the configuration of one of these may have required the user
to know about and adapt the other accordingly. This led to confusion.

Instead, remove `notmuch-search-authors-width' and perform truncation
based on the relevant field in `notmuch-search-result-format'.
---

Jamie, could you test this patch please? My main concern is that it
makes a small assumption about the value of
`notmuch-search-result-format' - namely that the `authors' field ends
with a space.

 emacs/notmuch.el |   16 ++--
 1 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index f96394a..d40c36e 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -55,15 +55,10 @@
 (require 'notmuch-show)
 (require 'notmuch-mua)
 
-(defcustom notmuch-search-authors-width 20
-  Number of columns to use to display authors in a notmuch-search buffer.
-  :type 'integer
-  :group 'notmuch)
-
 (defcustom notmuch-search-result-format
   `((date . %s )
 (count . %-7s )
-(authors . ,(format %%-%ds  notmuch-search-authors-width))
+(authors . %-20s )
 (subject . %s )
 (tags . (%s)))
   Search result formating. Supported fields are:
@@ -585,7 +580,11 @@ matching will be applied.
((string-equal field count)
 (insert (format (cdr (assoc field notmuch-search-result-format)) count)))
((string-equal field authors)
-(insert (format (cdr (assoc field notmuch-search-result-format)) authors)))
+(insert (let ((sample (format (cdr (assoc field 
notmuch-search-result-format)) )))
+ (if ( (length authors)
+(length sample))
+ (concat (substring authors 0 (- (length sample) 4)) ... )
+   (format (cdr (assoc field notmuch-search-result-format)) 
authors)
((string-equal field subject)
 (insert (format (cdr (assoc field notmuch-search-result-format)) subject)))
((string-equal field tags)
@@ -614,12 +613,9 @@ matching will be applied.
   (date (match-string 2 string))
   (count (match-string 3 string))
   (authors (match-string 4 string))
-  (authors-length (length authors))
   (subject (match-string 5 string))
   (tags (match-string 6 string))
   (tag-list (if tags (save-match-data (split-string 
tags)
- (if ( authors-length notmuch-search-authors-width)
- (set 'authors (concat (substring authors 0 (- 
notmuch-search-authors-width 3)) ...)))
  (goto-char (point-max))
  (let ((beg (point-marker)))
(notmuch-search-show-result date count authors subject 
tags)
-- 
1.7.0

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


Unhandled Xapian exception

2010-04-23 Thread Sebastian Spaeth
Hi Carl,

dme complained that my python bindings abort with
Xapian::DatabaseModifiedException when doing a
Database.find_message('id'). But libnotmuch.so terminates before python
has even a chance to catch an execption, and I think it boils down to this:

http://git.notmuchmail.org/git/notmuch/blob/ec6d78acf12d5c8fe6d10d091adee6516bf48d8a:/lib/database.cc#l276

find_message() which calls:
find_doc_ids_for_term() in lib/database.cc which contains:

 *begin = notmuch-xapian_db-postlist_begin (term);
   *end = notmuch-xapian_db-postlist_end (term);

without doing any catching. According to Olly Betts this can possibly
throw such an exception when the Database has been modified.

I propose to try..catch this code block and rather than returning VOID
it could return NOTMUCH_STATUS_SUCCESS or NOTMUCH_XAPIAN_EXCEPTION.
Not sure how notmuch_database_find_message would notify the caller of
such an exception situation though. The only possible failure value is
NULL (which also means did not find such a message).

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


Re: pull request

2010-04-23 Thread David Edmondson
On Wed, 21 Apr 2010 15:47:12 -0400, Jameson Rollins 
jroll...@finestructure.net wrote:
 On Wed, 21 Apr 2010 12:15:48 -0700, Carl Worth cwo...@cworth.org wrote:
  [*] Even more simplification is possible if we stop trying to hide
  header components. Several people have requested that To and Cc be
  visible all the time.
 
 Hey, Carl.  I had actually been meaning to bring this up.  I actually
 don't like having the headers collapsed at all, so I am definitely in
 favor of the idea of doing away with this feature.  At the very least,
 I would like to see header hiding/collapsing be an option, so that I
 could turn it off.  As is, I'm having to hit 'h' for every message I
 view, so I can just see who the message was sent to (not to mention to
 recover the unfortunately missing blank line between the header and the
 body, which is visually useful).

See id:1272023661-14038-1-git-send-email-...@dme.org.

dme.
-- 
David Edmondson, http://dme.org
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: pull request

2010-04-23 Thread Jameson Rollins
On Fri, 23 Apr 2010 12:57:42 +0100, David Edmondson d...@dme.org wrote:
  Hey, Carl.  I had actually been meaning to bring this up.  I actually
  don't like having the headers collapsed at all, so I am definitely in
  favor of the idea of doing away with this feature.  At the very least,
  I would like to see header hiding/collapsing be an option, so that I
  could turn it off.  As is, I'm having to hit 'h' for every message I
  view, so I can just see who the message was sent to (not to mention to
  recover the unfortunately missing blank line between the header and the
  body, which is visually useful).
 
 See id:1272023661-14038-1-git-send-email-...@dme.org.

Yes!  +1!  Thank you very much, David.

jamie.


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


Re: notmuch segfault

2010-04-23 Thread Sebastian Spaeth
It happened again. Both times I had pressed G which calls offlineimap
and which removed messages that the notmuch database still thought are there.


Program received signal SIGSEGV, Segmentation fault.
0x7602bb14 in strncasecmp () from /lib/libc.so.6
(gdb) bt
#0  0x7602bb14 in strncasecmp () from /lib/libc.so.6
#1  0x00418521 in _thread_add_matched_message(_notmuch_thread*, 
_notmuch_message*, notmuch_sort_t) ()
#2  0x00418b17 in _notmuch_thread_create ()
#3  0x0040e33c in notmuch_show_command ()
#4  0x00408436 in main ()

-
spa...@spaetz-macbook:~/src/notmuch$ notmuch show tag:inbox
Error opening 
/home/spaetz/mail/INBOX.Junk/new/1272025029_0.17175.spaetz-macbook,U=3608,FMD5=22888fa7f8daa670f25d806e9b4ae4df:2,:
 No such file or directory
Error opening 
/home/spaetz/mail/INBOX.Junk/new/1272025029_0.17175.spaetz-macbook,U=3608,FMD5=22888fa7f8daa670f25d806e9b4ae4df:2,:
 No such file or directory
Error opening 
/home/spaetz/mail/INBOX.Junk/new/1272025029_0.17175.spaetz-macbook,U=3608,FMD5=22888fa7f8daa670f25d806e9b4ae4df:2,:
 No such file or directory
Segmentation fault (core dumped)

--
Coredump is here:
http://sspaeth.de/uploads/tmp/core.bin
-


Can it be that in thread.cc in _thread_add_matched_message ()
...
subject = notmuch_message_get_header (message, subject);

if ((strncasecmp (subject, Re: , 4) == 0) ||
...

If the underlying message disappeared, get_header will return NULL and
we pass strncasecmp NULL as first parameter. Could that be?

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


Re: notmuch segfault

2010-04-23 Thread Michal Sojka
On Fri, 23 Apr 2010, Sebastian Spaeth wrote:
 Can it be that in thread.cc in _thread_add_matched_message ()
 ...
 subject = notmuch_message_get_header (message, subject);
 
 if ((strncasecmp (subject, Re: , 4) == 0) ||
 ...
 
 If the underlying message disappeared, get_header will return NULL and
 we pass strncasecmp NULL as first parameter. Could that be?

Yes, it is very likely the problem. The fix is obvious (see bellow), but
the question is how will be this missing message presented to the user
e.g. in notmuch show. It may be that we will need some other checks to
not break other things.

diff --git a/lib/thread.cc b/lib/thread.cc
index 5bf8354..29b8336 100644
--- a/lib/thread.cc
+++ b/lib/thread.cc
@@ -148,6 +148,9 @@ _thread_add_matched_message (notmuch_thread_t *thread,
 
 subject = notmuch_message_get_header (message, subject);
 
+if (!subject)
+   return;
+
 if ((strncasecmp (subject, Re: , 4) == 0) ||
(strncasecmp (subject, Aw: , 4) == 0) ||
(strncasecmp (subject, Vs: , 4) == 0) ||
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: sort order regression

2010-04-23 Thread Carl Worth
On Fri, 23 Apr 2010 10:15:22 +0200, Michal Sojka sojk...@fel.cvut.cz wrote:
 On Fri, 23 Apr 2010, Sebastian Spaeth wrote:
  Ohh, that is a good point. Maybe I should write some :-). Is the test
  suite going to be changed any day now or does it still make sense to
  write tests for the monolitic test suite?

I would still like to make things more modular in the future. That is,
I'd like the tests to be categorized and grouped so that one can run a
single group of tests, (or even a single test). I'd also like to have
some dependencies between tests so that when an early test fails, later
tests that depend on that functionality will simply report UNTESTED due
to the earlier failure.

But there's certainly no need to wait for that before adding additional
tests.

 I do not have a plan to modularize the test suite in a near future.

Michal, thanks for all your effort to modularize based on the git test
suite. I know you've had to put continual effort to keep your patches up
to date as things have changed. Sorry that you got blocked by some
relicensing that hasn't quite worked out.

 I guess that currently we are not able to relicense the test library
 from git. There is still one missing ack. I've just sent a mail to Junio
 about his opinion.

Want to replay all the git test-suite commits other than any from the
person with the missing ack? That should get us pretty close to the
current state in git, would give us code we could use, and might even
make it possible for us to submit improvements directly to the upstream
git repository.

Should be a pretty simple git rebase -i or so and edit out the lines
From the author of interest. (Simple, assuming it doesn't fall over
completely due to conflicts.)

Just an idea anyway. I also understand if you don't have motivation to
pursue this further. And we can just do our own modularization as we
want new features.

-Carl


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


Re: [PATCH] Add 'G' keybinding to folder and search view that triggers external poll

2010-04-23 Thread Carl Worth
On Fri, 23 Apr 2010 10:09:03 +0200, Sebastian Spaeth sebast...@sspaeth.de 
wrote:
 Hehe. Very useful indeed. There is one more thing: Would it be possible to 
 provide user
 feedback while this is running (synchronously, I guess)? Like having
 some message in the minibuffer saying Calling all stations and
 Polling finished, please move along... ?

Anything is possible, of course. It just always seems to mean someone
learning a bit more elisp. ;-)

In the meantime, I've found it handy to put my mouse pointer over the
emacs window when I run this command. Then I get a nice busy mouse
cursor during this operation instead of the standard text-edit bar.

-Carl


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


Re: [PATCH] emacs: Allow headers to be shown by default in show mode

2010-04-23 Thread Dirk Hohndel
On Fri, 23 Apr 2010 12:54:21 +0100, David Edmondson d...@dme.org wrote:
 Add `notmuch-show-headers-visible' which, when set `t', causes headers
 to be shown by default.

Excellent - Carl, can you pull this into 0.3, please?

/D

-- 
Dirk Hohndel
Intel Open Source Technology Center
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] Add 'G' keybinding to folder and search view that triggers external poll

2010-04-23 Thread Dirk Hohndel
On Fri, 23 Apr 2010 08:20:40 -0700, Carl Worth cwo...@cworth.org wrote:
 On Fri, 23 Apr 2010 10:09:03 +0200, Sebastian Spaeth sebast...@sspaeth.de 
 wrote:
  Hehe. Very useful indeed. There is one more thing: Would it be possible to 
  provide user
  feedback while this is running (synchronously, I guess)? Like having
  some message in the minibuffer saying Calling all stations and
  Polling finished, please move along... ?
 
 Anything is possible, of course. It just always seems to mean someone
 learning a bit more elisp. ;-)

I'm working on that. Check back in a few months :-)
 
 In the meantime, I've found it handy to put my mouse pointer over the
 emacs window when I run this command. Then I get a nice busy mouse
 cursor during this operation instead of the standard text-edit bar.

That's what I'm doing as well.

/D

-- 
Dirk Hohndel
Intel Open Source Technology Center
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: Remove `notmuch-search-authors-width' and fix the use of `notmuch-search-result-format' accordingly

2010-04-23 Thread Jameson Rollins
On Fri, 23 Apr 2010 11:24:09 +0100, David Edmondson d...@dme.org wrote:
 Jamie, could you test this patch please? My main concern is that it
 makes a small assumption about the value of
 `notmuch-search-result-format' - namely that the `authors' field ends
 with a space.

Tested, and it works.  Thanks so much for fixing this, David.  Very much
appreciated.

So this patch gets rid of the notmuch-search-authors-width variable
entirely.  That variable was somewhat convenient (for me at least, since
that was the only thing in the format i wanted to adjust), but I think
the new configuration is more straightforward.  Just set
notmuch-search-result-format how you want it to be, and it Just Works.
I think we should go with this solution...

Approved-By: Jameson Rollins jroll...@finestructure.net

(I was going to try to resend the patch with the Approved-By bit
added, but I was sure I was going to mess it up.  If someone can point
me to a message where that was done correctly, that'd be great.)

jamie.


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


Re: [PATCH] emacs: Allow headers to be shown by default in show mode

2010-04-23 Thread Jameson Rollins
On Fri, 23 Apr 2010 10:13:37 -0700, Dirk Hohndel hohn...@infradead.org wrote:
 On Fri, 23 Apr 2010 12:54:21 +0100, David Edmondson d...@dme.org wrote:
  Add `notmuch-show-headers-visible' which, when set `t', causes headers
  to be shown by default.
 
 Excellent - Carl, can you pull this into 0.3, please?

Agreed.  Again, thanks so much David.  This is exactly what I wanted.
Tested and ...

Approved-By: Jameson Rollins jroll...@finestructure.net

jamie.


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


Re: [PATCH] test: Set fixed time zone

2010-04-23 Thread Dirk Hohndel
On Fri, 23 Apr 2010 09:36:45 +0200, Michal Sojka sojk...@fel.cvut.cz wrote:
 When the test suite is run in a different time zone that where Carl
 lives, some tests may fail depending on the time when the test suite is
 run. For example, just now I get:
 
 By setting a fixed time zone in the test script, these problems should
 be eliminated.

The correct fix is of course that all of you need to move to Portland...

:-)

/D

-- 
Dirk Hohndel
Intel Open Source Technology Center
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: Allow headers to be shown by default in show mode

2010-04-23 Thread Servilio Afre Puentes
On 23 April 2010 13:13, Dirk Hohndel hohn...@infradead.org wrote:
 On Fri, 23 Apr 2010 12:54:21 +0100, David Edmondson d...@dme.org wrote:
 Add `notmuch-show-headers-visible' which, when set `t', causes headers
 to be shown by default.

 Excellent - Carl, can you pull this into 0.3, please?

+1

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


Re: [notmuch] [PATCH] notmuch-config: make new message tags configurable

2010-04-23 Thread Carl Worth
On Fri, 12 Mar 2010 17:13:26 -0500, Ben Gamari bgamari.f...@gmail.com wrote:
 Add a new_tags option in the [messages] section of the configuration
 file to allow the user to specify which tags should be added to new
 messages by notmuch new.

Thanks, Ben!

I finally broke down and decided I needed this feature.

Previously I've done all of my automatic tagging as global searches,
(and it's those tags that I want to switch to just search macros as I've
talked about many times in the past).

But I'm now doing things like a merge window tag where I want it
applied to new messages as they come in, but I also want to be able to
manually remove the tag from messages where it doesn't make sense. So a
global search doesn't do what I want here at all.

For me, I'll probably go the route of having notmuch new add a new
tag in addition to inbox and unread and then I'll have my
notmuch-poll script act on that, then remove the new tag from all
tagged messages. I wouldn't want to impose a new tag on everyone since
most people won't have a notmuch-poll removing new by default so that
tag would just build up.

Meanwhile, I know that Keith Packard and Eric Anholt are already having
their notmuch-poll scripts remove the unread tag from all message,
since they don't find that tag useful at all. This new configuration
will help them as well.

So I've now merged this patch, and as usual, I followed up with some
changes as well. Here's what I did in addition:

  * Fixed the compiler warning.

  * Fixed notmuch setup to add the documentation block to the
configuration file when adding new options there.

  * Renamed the new configuration option from:

[messages]
new_tags=inbox;unread;

to instead be:

[new]
tags=inbox;unread;

  * Fixed notmuch setup to prompt for this new setting.

Thanks again,

-Carl


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


Re: [PATCH] Add 'G' keybinding to folder and search view that triggers external poll

2010-04-23 Thread Dirk Hohndel
On Fri, 23 Apr 2010 10:09:03 +0200, Sebastian Spaeth sebast...@sspaeth.de 
wrote:
 On 2010-04-22, Dirk Hohndel wrote:
  I appreciate how nicely you can say I liked the idea and then
  completely rewrote the crap elisp that you submitted :-)
 
 Hehe. Very useful indeed. There is one more thing: Would it be possible to 
 provide user
 feedback while this is running (synchronously, I guess)? Like having
 some message in the minibuffer saying Calling all stations and
 Polling finished, please move along... ?

Right now all you get is the busy cursor. The problem with the updates
is that notmuch/emacs calls just one script. I don't know how to display
(progress-) output from that script in the mininuffer...

/D

-- 
Dirk Hohndel
Intel Open Source Technology Center
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: Updated elisp FCC patches (was: Fcc, Maildir, and Emacs message-mode)

2010-04-23 Thread Dirk Hohndel
On Fri, 23 Apr 2010 12:08:31 +0200, Sebastian Spaeth sebast...@sspaeth.de 
wrote:
 My last mail on this issue: I squashed the recent 7 patch series into 4 nicer
 ones.
 
 Rather than resending the patch series, here are the 4 commits from my
 repo at g...@github.com:spaetz/notmuch-all-feature.git (let me know if I
 should mail them too).

I had talked to Carl about this yesterday - I think we both would prefer
that patches be emailed, too. The git trees are great for pulling
patches from, but it seems easier to review them here in email...

 I don't know how to test the emacs interaction or I would have provided
 some tests with it. Also, I am not sure if the error message still
 shows up when the user configures a non-existing maildir. But other than
 that it works nice and reliably here. I have now dumped my python
 script. I feel pretty confident that this can go in.

I will play with it later today.

/D

-- 
Dirk Hohndel
Intel Open Source Technology Center
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] Add NEWS updates for my last batch of patches

2010-04-23 Thread Dirk Hohndel

in the future I'll include those with my patches. Hope it's ok to do
this as one single patch for this series.

Signed-off-by: Dirk Hohndel hohn...@infradead.org
---
 NEWS |   35 +++
 1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/NEWS b/NEWS
index eba0fd5..5586386 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,38 @@
+
+Even Better guessing of From: header.
+
+  Notmuch now looks at a number of headers when trying to figure out
+  the best From: header to use in a reply. First it checks whether one
+  of the user's emails is in To: or Cc:, then it checks Envelope-To:
+  and X-Original-To: headers, then it analyses the Received headers
+  checking for a Received: by .. from .. for u...@add.res clause. And
+  finally it matches domains in the received path.
+
+Visualization of author names that match a search
+
+  When notmuch displays threads as the result of a search, it now
+  lists the authors that match the search before listing the other
+  authors in the thread. It inserts a pipe '|' symbol between the last
+  matching and first non-matching author. This is especially useful in
+  a search that includes tag:unread. Now the authors of the unread
+  messages in the thread are listed first.
+
+Provide 'd' key binding to add the 'deleted' tag to messages and threads
+
+  The 'd' key works wherever 'a'rchive works - it performs the same
+  actions but additionally sets the deleted tag.
+
+Provide 'G' key binding to trigger mail refresh
+
+  The 'G' key works wherever '=' works. Before refreshing the screen
+  it calls an external program that can be used to poll email servers,
+  run notmuch new and setup specific tags for the new emails. The
+  script to be called can be customized with. Use the customize screen
+  to set the notmuch-poll-script variable to the program that you want
+  to execute when pressing 'G'. Note that this is synchronous - emacs
+  will wait until this program finishes.
+
+
 Notmuch 0.2 (2010-04-16)
 
 This is the second release of the notmuch mail system, with actual
-- 
1.6.6.1


-- 
Dirk Hohndel
Intel Open Source Technology Center
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] notmuch new --new-tags=tags...

2010-04-23 Thread Carl Worth
On Mon, 12 Apr 2010 07:59:14 -0400, Jameson Rollins 
jroll...@finestructure.net wrote:
 On Mon, 12 Apr 2010 10:00:37 +0200, Sebastian Spaeth sebast...@sspaeth.de 
 wrote:
  On 2010-04-10, Anthony Towns wrote:
   The attached patch makes notmuch new --new-tags=unread,new set the
   unread and new tags on any new mail it finds rather than unread
   and inbox. Or whatever other tags you happen to specify.

Thanks very much for the patch, AJ. It's definitely a useful feature.

  Thanks for the patch. I can't comment on the code quality, but rather
  than having to specify the set of new tags on the command line every
  time, I think it would make more sense to put them in the notmuch config
  file as this patch does:
  id:1268432006-24333-2-git-send-email-bgamari.f...@gmail.com

I ended up taking that version instead, (using a configuration setting
for this instead of a command-line option to notmuch new.

One could imagine accepting the command-line option as well, but I don't
think that would actually be useful. Let me know if you disagree.

 I was thinking about this, and it seems to me that we really need is a
 way to just specify which tags should be applied to new messages based
 on search terms.

Yes, I agree.

Many of us are (or will soon be) achieving the feature based on the
following recipe:

  * Configuring new.tags to add a new tag.

  * Writing a notmuch-poll script that does the following:

  * Performs notmuch tag searches to add tags to new messages.

  * Clears the new tag from all messages.

  * Configuring notmuch-poll-script inside emacs to invoke our
notmuch-poll script.

If we added support for configuring search-based tagging directly into
notmuch, then the above recipe could be reduced to a single block of
configuration settings, which sounds much nicer.

So I'll look forward to any implementation to provide that. In the
meantime, we can muddle along with the functionality we want, (but a
little more manual effort to achieve it).

-Carl


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


Re: [Announce] notmuch release 0.2 now available

2010-04-23 Thread Carl Worth
On Sat, 17 Apr 2010 09:49:01 +1000, Alex Ghitza aghi...@gmail.com wrote:
 notmuch-0.2 built fine, but one test failed during 'make test'.  I have
 put the indicated directory up at
 
 http://aghitza.org/files/test.16707

Hi Alex,

Thanks for reporting this.

Unfortunately, at the time, the test suite didn't capture everything
necessary to investigate the problem in the directory. In particular,
the actual vs. expected output only appeared on stdout.

If you could provide that output, then we could perhaps investigate the
problem.

Alternately, upgrading to a more recent version of notmuch, (either from
git now, or using 0.3 when it appears in the future), will give you a
test suite that does capture the essential information in that
directory.

Thanks,

-Carl


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


Re: [PATCH] Reintroduce patch to quote args in notmuch-show to facilitate remote use

2010-04-23 Thread Carl Worth
On Wed, 21 Apr 2010 17:22:08 -0400, Jesse Rosenthal jrosent...@jhu.edu wrote:
 This reintroduces the patch committed in 9193455fa1, which was
 reverted during the upgrade to the JSON emacs UI.

Thanks. This is pushed.

-Carl


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


[PATCH 1/4] Add elisp file for FCC to maildir solution

2010-04-23 Thread Sebastian Spaeth
From: Jesse Rosenthal jrosent...@jhu.edu

File grabbed from http://jkr.acm.jhu.edu/jkr-maildir.el
but not integrated yet.

Signed-off-by: Sebastian Spaeth sebast...@sspaeth.de
---
As stated by Dirk, patches are preferred by mail. So here is the updated 
patch series of 4 patches by mail again.

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

diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
new file mode 100644
index 000..979428e
--- /dev/null
+++ b/emacs/notmuch-maildir-fcc.el
@@ -0,0 +1,115 @@
+;; This file 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 2, or (at your
+;; option) any later version.
+
+;; This program 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 GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+
+;; Commentary:
+;;
+;; This is the beginning of a solution for storing sent mail in a
+;; maildir in emacs message mode, presented because some people might
+;; find it useful. It is *not* fully tested, it *may* overwrite files,
+;; and any directories you point this at may no longer be there
+;; afterwards. Use at your own risk.
+;;
+;; To use this as the fcc handler for message-mode, put
+;; one of the following in your init file:
+;;
+;; if you want Fcc'd messages to be marked as read:
+;;
+;; (setq message-fcc-handler-function
+;;  '(lambda (destdir)
+;;  (jkr/maildir-write-buffer-to-maildir destdir t)))
+;;
+;; if you want Fcc'd messages to be marked as new:
+;;
+;; (setq message-fcc-handler-function
+;;  '(lambda (destdir)
+;;  (jkr/maildir-write-buffer-to-maildir destdir nil)))
+
+
+(defvar jkr/maildir-count 0)
+
+(defun jkr/maildir-host-fixer (hostname)
+  (replace-regexp-in-string /\\|:
+   '(lambda (s)
+(cond ((string-equal s /) \\057)
+  ((string-equal s :) \\072)
+  (t s)))
+   hostname
+   t
+   t))
+
+(defun jkr/maildir-make-uniq-maildir-id ()
+   (let* ((ct (current-time))
+ (timeid (+ (* (car ct) 65536) (cadr ct)))
+ (microseconds (caddr ct))
+ (hostname (jkr/maildir-host-fixer system-name)))
+ (setq jkr/maildir-count (+ jkr/maildir-count 1))
+ (format %d.%d_%d_%d.%s
+timeid
+(emacs-pid)
+microseconds
+jkr/maildir-count
+hostname)))
+
+(defun jkr/maildir-dir-is-maildir-p (dir)
+  (and (file-exists-p (concat dir /cur/))
+   (file-exists-p (concat dir /new/))
+   (file-exists-p (concat dir /tmp/
+
+(defun jkr/maildir-save-buffer-to-tmp (destdir)
+  Returns the msg id of the message written to the temp directory
+if successful, nil if not.
+  (let ((msg-id (jkr/maildir-make-uniq-maildir-id)))
+(while (file-exists-p (concat destdir /tmp/ msg-id))
+  (setq msg-id (jkr/maildir-make-uniq-maildir-id)))
+(cond ((jkr/maildir-dir-is-maildir-p destdir)
+  (write-file (concat destdir /tmp/ msg-id))
+  msg-id)
+ (t
+  (message (format Can't write to %s. Not a maildir.
+destdir))
+  nil
+
+(defun jkr/maildir-move-tmp-to-new (destdir msg-id)
+  (add-name-to-file
+   (concat destdir /tmp/ msg-id)
+   (concat destdir /new/ msg-id :2,)))
+
+(defun jkr/maildir-move-tmp-to-cur (destdir msg-id optional mark-seen)
+  (add-name-to-file
+   (concat destdir /tmp/ msg-id)
+   (concat destdir /cur/ msg-id :2, (when mark-seen S
+
+(defun jkr/maildir-write-buffer-to-maildir (destdir optional mark-seen)
+  Writes the current buffer to maildir destdir. If mark-seen is
+non-nil, it will write it to cur/, and mark it as read. It should
+return t if successful, and nil otherwise.
+  (let ((orig-buffer (buffer-name)))
+(with-temp-buffer
+  (insert-buffer orig-buffer)
+  (catch 'link-error
+   (let ((msg-id (jkr/maildir-save-buffer-to-tmp destdir)))
+ (when msg-id
+   (cond (mark-seen
+  (condition-case err
+  (jkr/maildir-move-tmp-to-cur destdir msg-id t)
+(file-already-exists
+ (throw 'link-error nil
+ (t
+  (condition-case err
+  (jkr/maildir-move-tmp-to-new destdir msg-id)
+ 

[PATCH 4/4] Integrate notmuch-fcc mechansim

2010-04-23 Thread Sebastian Spaeth
I have gone wild and added a defcustom notmuch-fcc-dirs.
Depending on the value of that variable we will not do any
maildir fcc at all (nil, the default), or it is of the format
((defaultsentbox)
 (full name em...@address . Work/sentbox)
 (full name2 ema...@address2 . Work2/sentbox))

The outbox name will be concatenated with the message mode
variable message-directory which is ~/Mail/ by default.

Signed-off-by: Sebastian Spaeth sebast...@sspaeth.de
---
 emacs/notmuch-maildir-fcc.el |   84 +
 1 files changed, 59 insertions(+), 25 deletions(-)

diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index 84f4187..9f54dfb 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -12,39 +12,72 @@
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 ;; Boston, MA 02110-1301, USA.
-
-;; Commentary:
-;;
-;; This is the beginning of a solution for storing sent mail in a
-;; maildir in emacs message mode, presented because some people might
-;; find it useful. It is *not* fully tested, it *may* overwrite files,
-;; and any directories you point this at may no longer be there
-;; afterwards. Use at your own risk.
-;;
-;; To use this as the fcc handler for message-mode, put
-;; one of the following in your init file:
-;;
-;; if you want Fcc'd messages to be marked as read:
-;;
-;; (setq message-fcc-handler-function
-;;  '(lambda (destdir)
-;;  (notmuch-maildir-fcc-write-buffer-to-maildir destdir t)))
-;;
-;; if you want Fcc'd messages to be marked as new:
 ;;
-;; (setq message-fcc-handler-function
-;;  '(lambda (destdir)
-;;  (notmuch-maildir-fcc-write-buffer-to-maildir destdir nil)))
+;; To use this as the fcc handler for message-mode,
+;; customize the notmuch-fcc-dirs variable
 
+(require 'message)
 
 (defvar notmuch-maildir-fcc-count 0)
 
+(defcustom notmuch-fcc-dirs nil
+ If set to non-nil, this will cause message mode to file (fcc) your mail in 
the specified directory, depending on your From address.
+
+ The first entry (a list) is used as a default fallback
+ when nothing matches. So in the easiest case notmuch-fcc-dirs is
+ just something like ((\INBOX.Sent\))
+
+ If you need a more fancy setup, where you want different Outboxes depending
+ on your From address, you use something like this:
+
+ (   (\defaultinbox\)
+ (\Sebastian Spaeth sebast...@sspaeth.de\ . \privat\)
+ (\Sebastian Spaeth sspa...@ethz.ch\ . \uni\)
+ )
+ 
+ This will constructs a path, concatenating the content of the
+ variable 'message-directory' (a message mode variable
+ customizable via m-x
+ customize-variableRETmessage-directoryRET) and the second
+ part in the alist.
+ :require 'notmuch-fcc-initialization
+ :group 'notmuch
+)
+
+(defun notmuch-fcc-initialization ()
+  If notmuch-fcc-directories is set, 
+   hook them into the message-fcc-handler-function
+(if (not (eq notmuch-fcc-dirs nil)) (progn
+;Set up the message-fcc-handler to move mails to the maildir in Fcc
+;The parameter is hardcoded to mark messages as seen
+(setq message-fcc-handler-function
+  '(lambda (destdir)
+ (notmuch-maildir-fcc-write-buffer-to-maildir destdir t)))
+;add a hook to actually insert the Fcc header when sending
+;(preferrably we would use message-header-setup-up, but notmuch-reply 
+; munges headers after that is run, so it won't work for replies within
+; notmuch)
+(add-hook 'message-send-hook 'notmuch-fcc-header-setup
+
+(defun notmuch-fcc-header-setup ()
+  Can be added to message-send-hook and will set the FCC header
+  based on the values of notmuch-fcc-directories (see the
+  variable customization there for examples). It uses the
+  first entry as default fallback if no From address
+  matches.
+  ; only do something if notmuch-fcc-dirs is set
+  (if notmuch-fcc-dirs
+   (let ((subdir (cdr (assoc (message-fetch-field from) notmuch-fcc-dirs
+ (if (eq subdir nil) (setq subdir (car (car notmuch-fcc-dirs
+ (message-remove-header Fcc)
+ (message-add-header (concat Fcc:  message-directory subdir)
+
 (defun notmuch-maildir-fcc-host-fixer (hostname)
   (replace-regexp-in-string /\\|:
'(lambda (s)
-(cond ((string-equal s /) \\057)
-  ((string-equal s :) \\072)
-  (t s)))
+   (cond ((string-equal s /) \\057)
+ ((string-equal s :) \\072)
+ (t s)))
hostname
t
t))
@@ -114,4 +147,5 @@ return t if successful, and nil otherwise.
  (delete-file (concat destdir /tmp/ msg-id
   t)))
 
+(notmuch-fcc-initialization)
 

[PATCH 2/4] Integrate notmuch-maildir-fcc into notmuch

2010-04-23 Thread Sebastian Spaeth
Require notmuch-maildir-fcc and also install it.
Rename all jkr/* functions to notmuch-maildir-fcc-*

Signed-off-by: Sebastian Spaeth sebast...@sspaeth.de
---
 emacs/Makefile.local |3 ++-
 emacs/notmuch-maildir-fcc.el |   42 ++
 emacs/notmuch.el |1 +
 3 files changed, 25 insertions(+), 21 deletions(-)

diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index f759c0d..c80e0e3 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -6,7 +6,8 @@ emacs_sources := \
$(dir)/notmuch.el \
$(dir)/notmuch-query.el \
$(dir)/notmuch-show.el \
-   $(dir)/notmuch-wash.el
+   $(dir)/notmuch-wash.el \
+   $(dir)/notmuch-maildir-fcc.el
 
 emacs_bytecode := $(subst .el,.elc,$(emacs_sources))
 
diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index 979428e..2117f54 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -28,18 +28,18 @@
 ;;
 ;; (setq message-fcc-handler-function
 ;;  '(lambda (destdir)
-;;  (jkr/maildir-write-buffer-to-maildir destdir t)))
+;;  (notmuch-maildir-fcc-write-buffer-to-maildir destdir t)))
 ;;
 ;; if you want Fcc'd messages to be marked as new:
 ;;
 ;; (setq message-fcc-handler-function
 ;;  '(lambda (destdir)
-;;  (jkr/maildir-write-buffer-to-maildir destdir nil)))
+;;  (notmuch-maildir-fcc-write-buffer-to-maildir destdir nil)))
 
 
-(defvar jkr/maildir-count 0)
+(defvar notmuch-maildir-fcc-count 0)
 
-(defun jkr/maildir-host-fixer (hostname)
+(defun notmuch-maildir-fcc-host-fixer (hostname)
   (replace-regexp-in-string /\\|:
'(lambda (s)
 (cond ((string-equal s /) \\057)
@@ -49,31 +49,31 @@
t
t))
 
-(defun jkr/maildir-make-uniq-maildir-id ()
+(defun notmuch-maildir-fcc-make-uniq-maildir-id ()
(let* ((ct (current-time))
  (timeid (+ (* (car ct) 65536) (cadr ct)))
  (microseconds (caddr ct))
- (hostname (jkr/maildir-host-fixer system-name)))
- (setq jkr/maildir-count (+ jkr/maildir-count 1))
+ (hostname (notmuch-maildir-fcc-host-fixer system-name)))
+ (setq notmuch-maildir-fcc-count (+ notmuch-maildir-fcc-count 1))
  (format %d.%d_%d_%d.%s
 timeid
 (emacs-pid)
 microseconds
-jkr/maildir-count
+notmuch-maildir-fcc-count
 hostname)))
 
-(defun jkr/maildir-dir-is-maildir-p (dir)
+(defun notmuch-maildir-fcc-dir-is-maildir-p (dir)
   (and (file-exists-p (concat dir /cur/))
(file-exists-p (concat dir /new/))
(file-exists-p (concat dir /tmp/
 
-(defun jkr/maildir-save-buffer-to-tmp (destdir)
+(defun notmuch-maildir-fcc-save-buffer-to-tmp (destdir)
   Returns the msg id of the message written to the temp directory
 if successful, nil if not.
-  (let ((msg-id (jkr/maildir-make-uniq-maildir-id)))
+  (let ((msg-id (notmuch-maildir-fcc-make-uniq-maildir-id)))
 (while (file-exists-p (concat destdir /tmp/ msg-id))
-  (setq msg-id (jkr/maildir-make-uniq-maildir-id)))
-(cond ((jkr/maildir-dir-is-maildir-p destdir)
+  (setq msg-id (notmuch-maildir-fcc-make-uniq-maildir-id)))
+(cond ((notmuch-maildir-fcc-dir-is-maildir-p destdir)
   (write-file (concat destdir /tmp/ msg-id))
   msg-id)
  (t
@@ -81,17 +81,17 @@ if successful, nil if not.
 destdir))
   nil
 
-(defun jkr/maildir-move-tmp-to-new (destdir msg-id)
+(defun notmuch-maildir-fcc-move-tmp-to-new (destdir msg-id)
   (add-name-to-file
(concat destdir /tmp/ msg-id)
(concat destdir /new/ msg-id :2,)))
 
-(defun jkr/maildir-move-tmp-to-cur (destdir msg-id optional mark-seen)
+(defun notmuch-maildir-fcc-move-tmp-to-cur (destdir msg-id optional mark-seen)
   (add-name-to-file
(concat destdir /tmp/ msg-id)
(concat destdir /cur/ msg-id :2, (when mark-seen S
 
-(defun jkr/maildir-write-buffer-to-maildir (destdir optional mark-seen)
+(defun notmuch-maildir-fcc-write-buffer-to-maildir (destdir optional 
mark-seen)
   Writes the current buffer to maildir destdir. If mark-seen is
 non-nil, it will write it to cur/, and mark it as read. It should
 return t if successful, and nil otherwise.
@@ -99,17 +99,19 @@ return t if successful, and nil otherwise.
 (with-temp-buffer
   (insert-buffer orig-buffer)
   (catch 'link-error
-   (let ((msg-id (jkr/maildir-save-buffer-to-tmp destdir)))
+   (let ((msg-id (notmuch-maildir-fcc-save-buffer-to-tmp destdir)))
  (when msg-id
(cond (mark-seen
   (condition-case err
-  (jkr/maildir-move-tmp-to-cur destdir msg-id t)
+  (notmuch-maildir-fcc-move-tmp-to-cur destdir msg-id t)
 (file-already-exists
  (throw 'link-error nil
 

Re: Notmuch success: Xapian database corrupt

2010-04-23 Thread Carl Worth
On Thu, 22 Apr 2010 07:19:58 +, John Fremlin j...@fremlin.org wrote:
 After the encouraging message from Sebastian. I deleted the
 .notmuch/xapian dir and started again.
 
 It went off a good rate (300+ files/sec) and here was the final score
 
 Processed 494764 total files in 2h 54m 41s (47 files/sec.). 
 Added 226817 new messages to the database.

Nice. That's much more like what I'm accustomed to getting.

 This is much faster than before. As I haven't changed the storage or the
 filesystem (ext4,data=ordered over encrypted aes-xts-plain), I just
 don't know what made the difference. My kernel is now 2.6.32-21-generic
 #32-Ubuntu and I had an older one the first try a month or so ago.

Thanks for the details at least. Maybe other people having performance
problems can start finding correlations.

-Carl


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


Re: add delete keybinding

2010-04-23 Thread Carl Worth
On Wed, 21 Apr 2010 16:16:02 -0700, Dirk Hohndel hohn...@infradead.org wrote:
 I'm sending this mostly as an RFC - I use this and like it, but
 people seem to have strong feelings as to how they want to deal 
 with deleting email (or for some people, how they don't want to
 do that at all).

I like the idea of adding the deleted tag with a 'd' keybinding.

I also agree with the comments that suggest that this should be
independent of the archiving operation. (That is, 'd' should just add
the deleted tag and do nothing else.)

With sup, there was the idea to not make the user add add not
tag:deleted to all searches. The way that worked was basically that sup
would append and not tag:deleted to all searches except for those that
already had tag:deleted in them. This allows deleted messages to give
every appearance of being deleted, (they would not show up in searches),
but a user *could* still find them[*] by explicitly saying and
tag:deleted in the search.

I don't think it makes sense to add a delete keybinding without some
support along the lines of what's described above.

It does seem out of character for the library or even the command-line
to do interpretation of tag names and munging of search strings like
this. So I think all of the above should be implemented within emacs
code. It's the emacs code that is adding the deleted tag so it should
be interpreting its behavior as well.

-Carl

[*] Until the user did some sort of external expunge operation that
actually deleted the files, of course.


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


Re: [PATCH] emacs: Remove `notmuch-search-authors-width' and fix the use of `notmuch-search-result-format' accordingly

2010-04-23 Thread Carl Worth
On Fri, 23 Apr 2010 13:22:24 -0400, Jameson Rollins 
jroll...@finestructure.net wrote:
 On Fri, 23 Apr 2010 11:24:09 +0100, David Edmondson d...@dme.org wrote:
  Jamie, could you test this patch please? My main concern is that it
  makes a small assumption about the value of
  `notmuch-search-result-format' - namely that the `authors' field ends
  with a space.
 
 Tested, and it works.  Thanks so much for fixing this, David.  Very much
 appreciated.

Thanks to both of you! This is pushed now.

 Approved-By: Jameson Rollins jroll...@finestructure.net
 
 (I was going to try to resend the patch with the Approved-By bit
 added, but I was sure I was going to mess it up.  If someone can point
 me to a message where that was done correctly, that'd be great.)

Just putting the above line in an email message is fine. In fact, it's
simpler in that I don't have to analyze two submissions of a patch to
see if there's anything different other than the commit message.

All I have to do for the above is a quick git commit --amend.

-Carl


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


Re: [PATCH] emacs: Allow headers to be shown by default in show mode

2010-04-23 Thread Carl Worth
On Fri, 23 Apr 2010 12:54:21 +0100, David Edmondson d...@dme.org wrote:
 Add `notmuch-show-headers-visible' which, when set `t', causes headers
 to be shown by default.

A nice improvement, definitely. But I don't hear anyone actually wanting
a configuration value here.

Would anyone complain if I just made these all visible by default?

Would anyone complain if I removed the code to allow for th hiding of
the header?

That's what I'm inclined to do.

Let me know.

-Carl


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


Re: [PATCH] emacs/notmuch-show.el: Add `notmuch-show-toggle-all' bound to M-RET

2010-04-23 Thread Carl Worth
On Thu, 22 Apr 2010 09:24:03 +0100, David Edmondson d...@dme.org wrote:
 `notmuch-show-toggle-all' changes the visibility all of the messages
 in the current thread. By default it makes all of the messages
 visible. With a prefix argument, it makes them all not visible.

This is a better default, definitely.

The only complaint I have left is that the function name is wrong. It's
not toggling the visibility of all messages, (which would be a totally
insane thing to do of course).

The positive-sense operation would be something like
notmuch-show-open-all. So maybe a function that does both would be
something like notmuch-show-open-or-close-all ?

-Carl


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


Re: [PATCH] emacs: Allow headers to be shown by default in show mode

2010-04-23 Thread Jameson Rollins
On Fri, 23 Apr 2010 12:26:43 -0700, Carl Worth cwo...@cworth.org wrote:
 A nice improvement, definitely. But I don't hear anyone actually wanting
 a configuration value here.
 
 Would anyone complain if I just made these all visible by default?
 
 Would anyone complain if I removed the code to allow for th hiding of
 the header?

Oh yeah that makes much more sense to me.  I definitely don't want the
headers hidden, so not having a config value for it certainly works for
me.  I just assumed that the header hiding was implemented because some
people wanted it.  If no one really wants to hide headers, then I would
definitely vote for just removing all of that code and just displaying
them.

jamie.


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


RE: [notmuch] Bulk message tagging

2010-04-23 Thread Mark Anderson
On Wed, 21 Apr 2010 18:02:59 -0500, Carl Worth cwo...@cworth.org wrote:
 On Sat, 17 Apr 2010 20:32:27 +0200, Arian Kuschki 
 arian.kusc...@googlemail.com wrote:
  So one could query with sysconf and break things up into multiple
  commands as needed.
  
  Doesn't xargs do exactly this?
 
 Almost.
 
 The arguments being passed to the notmuch tag command in this case
 look like:
 
   notmuch tag -inbox thread:foo or thread:bar or ...
 
 To break that up, we'd have to be careful to neither leave a trailing
 'or' at the end of a command line nor to have an 'or' at the beginning
 of a command line.

Perhaps this hints at an opportunity to create a new operator, that you
can pass as part of the notmuch commandline.

Something like:
cat idlist.txt | xargs notmuch tag -inbox tag:inbox and oneof: 

Then the list of arguments can break anywhere it wants. It's not as
general as having notmuch take search terms from stdin or a file, but it
seems like a long list of ID's is going to be a common case.

Another problem with passing options to xarg is that any parentheses are
going to break easily.

Actually, looking at this random proposal, you can see the invented
operator has an implicit grouping semantic, which leads to all kinds of
confusion.

-Mark

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


Re: [PATCH] emacs: Allow headers to be shown by default in show mode

2010-04-23 Thread David Edmondson
I like the current behaviour, but changing the default would be fine.

On Friday, April 23, 2010, Carl Worth cwo...@cworth.org wrote:
 On Fri, 23 Apr 2010 12:54:21 +0100, David Edmondson d...@dme.org wrote:
 Add `notmuch-show-headers-visible' which, when set `t', causes headers
 to be shown by default.

 A nice improvement, definitely. But I don't hear anyone actually wanting
 a configuration value here.

 Would anyone complain if I just made these all visible by default?

 Would anyone complain if I removed the code to allow for th hiding of
 the header?

 That's what I'm inclined to do.

 Let me know.

 -Carl

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


Re: [PATCH] emacs: Re-arrange message sending code

2010-04-23 Thread Carl Worth
On Thu, 22 Apr 2010 10:03:32 +0100, David Edmondson d...@dme.org wrote:
 Define a new `mail-user-agent' (`notmuch-user-agent') and use it by
 default. Re-arrange various routines that send mail to use this
 (compose, reply, forward). Insert a `User-Agent:' header by default.

Very nice! I've pushed this out now.

And I'm hoping that this new support makes it easier for people to hook
in the Fcc code. Does this mean there's now a single place to add that
that will make it work for messages composed from 'm', 'f', or 'r'?

The one unpleasantry I've noticed is that in the case of 'm' the headers
are being put into the buffer in the following order:

User-Agent:
To:
Subject:
From:

where I would prefer them in the following order:

From:
To:
Subject:
User-Agent:

Thanks,

-Carl


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


Re: [PATCH] emacs: Push the cursor to point-max on `n' or `N' at the end of a thread

2010-04-23 Thread Carl Worth
On Thu, 22 Apr 2010 12:20:16 +0100, David Edmondson d...@dme.org wrote:
 Sebastian pointed out that the pre-JSON UI would move the cursor to
 the end of the buffer if `n' or `N' is hit when on the last (unread)
 message. Mimic that behaviour in the new UI.

Quite a lovely improvement. Thanks! This is pushed.

-Carl


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


Re: [PATCH] test: Set fixed time zone

2010-04-23 Thread Carl Worth
On Fri, 23 Apr 2010 09:36:45 +0200, Michal Sojka sojk...@fel.cvut.cz wrote:
 When the test suite is run in a different time zone that where Carl
 lives, some tests may fail depending on the time when the test suite is
 run. For example, just now I get:
...
 By setting a fixed time zone in the test script, these problems should
 be eliminated.

Sorry about leaking that part of my environment into the codified test
suite.

I've pushed this fix for now, (though please follow up with some of the
text from the commit message as a comment next to that assignment in the
test-suite script which otherwise seems a bit out-of-place).

Thanks,

-Carl


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


Re: [PATCH] emacs: Add notmuch-hello.el, a friendly frontend to notmuch

2010-04-23 Thread Carl Worth
On Fri, 23 Apr 2010 13:13:01 -0700, Carl Worth cwo...@cworth.org wrote:
   * I'd like the saved searches to appear before the recent searches I
 think.

Actually, this might be OK since the recent searches go away when
restarting emacs.

   * I would *love* a simple way to import my existing notmuch-folder
 configuration into notmuch-hello. Bonus points if this happens
 automatically.

This is as simple as editing my .emacs file to set the
notmuch-hello-saved-searches variable instead of notmuch-folders. So
that's nice.

Though we might want to remove the -hello from the name there. It
doesn't really add anything.

-Carl


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


  1   2   >