[notmuch] notmuch.el: Prefix arg inverts the sort order of notmuch-search.

2010-02-11 Thread ra...@free.fr
>On Thu, 11 Feb 2010 15:20:54 +0100 (CET), racin at free.fr wrote:
>
>> Using a prefix arg to invert search order would conflict with my patch
>> http://notmuchmail.org/pipermail/notmuch/2009/000914.html in which the
>> prefix arg is used to show deleted messages. I don't known which
>> behaviour for prefix patch would be best.
>
>I always understood a prefix arg to invert the original (or provide a
>numeric repetition), but I do not have a wide sample to tell if this is
>how most elisp implements it. 

Gnus uses a C-u prefix to display old messages, for instance. 

Note that the only advantage of the prefix over the toggle is that it makes one 
call to notmuch search instead of one. I don't think that it matters from a 
performance point of view, as the second search is always much faster than the 
second. Maybe we should just reserve the prefix for a later use.



[notmuch] [PATCH 2/2] notmuch.el: add a submap (on "z" for "ztash") to stash things.

2010-02-11 Thread da...@tethera.net
From: David Bremner 

Provide key bindings for stuffing various RFC822 header fields and other 
metadata
into the emacs kill-ring as text. The bindings are as follows:

z F notmuch-show-stash-filename
z T notmuch-show-stash-tags
z c notmuch-show-stash-cc
z d notmuch-show-stash-date
z f notmuch-show-stash-from
z m notmuch-show-stash-message-id
z s notmuch-show-stash-subject
z t notmuch-show-stash-to
---
 notmuch.el |   61 
 1 files changed, 61 insertions(+), 0 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 60ef592..faca26d 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -51,6 +51,22 @@
 (require 'mm-view)
 (require 'message)

+(defvar notmuch-show-stash-map
+  (let ((map (make-sparse-keymap)))
+(define-key map "c" 'notmuch-show-stash-cc)
+(define-key map "d" 'notmuch-show-stash-date)
+(define-key map "F" 'notmuch-show-stash-filename)
+(define-key map "f" 'notmuch-show-stash-from)
+(define-key map "m" 'notmuch-show-stash-message-id)
+(define-key map "s" 'notmuch-show-stash-subject)
+(define-key map "T" 'notmuch-show-stash-tags)
+(define-key map "t" 'notmuch-show-stash-to)
+map)
+  "Submap for stash commands"
+  )
+
+(fset 'notmuch-show-stash-map notmuch-show-stash-map)
+
 (defvar notmuch-show-mode-map
   (let ((map (make-sparse-keymap)))
 (define-key map "?" 'notmuch-help)
@@ -80,6 +96,7 @@
 (define-key map "n" 'notmuch-show-next-message)
 (define-key map (kbd "DEL") 'notmuch-show-rewind)
 (define-key map " " 'notmuch-show-advance-marking-read-and-archiving)
+(define-key map "z" 'notmuch-show-stash-map)
 map)
   "Keymap for \"notmuch show\" buffers.")
 (fset 'notmuch-show-mode-map notmuch-show-mode-map)
@@ -1074,6 +1091,50 @@ All currently available key bindings:
   :options '(hl-line-mode)
   :group 'notmuch)

+(defun notmuch-show-do-stash (text)
+(kill-new text)
+(message (concat "Saved: " text)))
+
+(defun notmuch-show-stash-cc ()
+  "Copy CC field of current message to kill-ring."
+  (interactive)
+  (notmuch-show-do-stash (notmuch-show-get-cc)))
+
+(defun notmuch-show-stash-date ()
+  "Copy date of current message to kill-ring."
+  (interactive)
+  (notmuch-show-do-stash (notmuch-show-get-date)))
+
+(defun notmuch-show-stash-filename ()
+  "Copy filename of current message to kill-ring."
+  (interactive)
+  (notmuch-show-do-stash (notmuch-show-get-filename)))
+
+(defun notmuch-show-stash-from ()
+  "Copy From address of current message to kill-ring."
+  (interactive)
+  (notmuch-show-do-stash (notmuch-show-get-from)))
+
+(defun notmuch-show-stash-message-id ()
+  "Copy message-id of current message to kill-ring."
+  (interactive)
+  (notmuch-show-do-stash (notmuch-show-get-message-id)))
+
+(defun notmuch-show-stash-subject ()
+  "Copy Subject field of current message to kill-ring."
+  (interactive)
+  (notmuch-show-do-stash (notmuch-show-get-subject)))
+
+(defun notmuch-show-stash-tags ()
+  "Copy tags of current message to kill-ring as a comma separated list."
+  (interactive)
+  (notmuch-show-do-stash (mapconcat 'identity (notmuch-show-get-tags) ",")))
+
+(defun notmuch-show-stash-to ()
+  "Copy To address of current message to kill-ring."
+  (interactive)
+  (notmuch-show-do-stash (notmuch-show-get-to)))
+
 ; Make show mode a bit prettier, highlighting URLs and using word wrap

 (defun notmuch-show-pretty-hook ()
-- 
1.6.5



[notmuch] [PATCH 1/2] notmuch.el: convert sparse keymap to a list in notmuch-substitute-one-command-key-with-prefix

2010-02-11 Thread da...@tethera.net
From: David Bremner 

The previous version would crash when a key was bound to a sparse
keymap, since apparently these are not straightforward lists.  The
usage of map-keymap is a bit obscure: it only has side-effects, no
return value.
---
 notmuch.el |8 ++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index d2a3b1b..60ef592 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -984,8 +984,12 @@ For a mouse binding, return nil."
 (if (mouse-event-p key)
nil
   (if (keymapp action)
- (let ((substitute (apply-partially 
'notmuch-substitute-one-command-key-with-prefix (notmuch-prefix-key-description 
key
-   (mapconcat substitute (cdr action) "\n"))
+ (let ((substitute (apply-partially 
'notmuch-substitute-one-command-key-with-prefix (notmuch-prefix-key-description 
key)))
+   (as-list))
+   (map-keymap (lambda (a b)
+ (push (cons a b) as-list))
+   action)
+   (mapconcat substitute as-list "\n"))
(concat prefix (format-kbd-macro (vector key))
"\t"
(notmuch-documentation-first-line action))
-- 
1.6.5



[notmuch] Rebased and updated stash patches.

2010-02-11 Thread da...@tethera.net
These patches let you header fields and similar into the emacs kill-ring
(and the X11 clipboard/selection, if things are setup right).

Patch 1/2 is actually a bug fix to master, unchanged since last time.
The bug didn't manifest because no submaps were used.

Patch 2/2 is rebased against current master and several more commands are 
provided.



[notmuch] [PATCH 2/2] notmuch.el: add a submap (on "z" for "ztash") to stash things.

2010-02-11 Thread Jameson Rollins
On Thu, 11 Feb 2010 23:01:08 -0400, david at tethera.net wrote:
> From: David Bremner 
> 
> Provide key bindings for stuffing various RFC822 header fields and other 
> metadata
> into the emacs kill-ring as text. The bindings are as follows:
> 
> z F   notmuch-show-stash-filename
> z T   notmuch-show-stash-tags
> z c   notmuch-show-stash-cc
> z d   notmuch-show-stash-date
> z f   notmuch-show-stash-from
> z m   notmuch-show-stash-message-id
> z s   notmuch-show-stash-subject
> z t   notmuch-show-stash-to

Great new emacs UI feature.  Love it.

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/20100211/dde98171/attachment.pgp>


[notmuch] [PATCH -V3] notmuch.el: Support for customizing search result display

2010-02-11 Thread Aneesh Kumar K. V
On Thu, 11 Feb 2010 22:11:46 +0530, "Aneesh Kumar K.V"  wrote:
> From: Aneesh Kumar K.V 
> 
> This patch helps in customizing search result display
> similar to mutt's index_format. The customization is done
> by defining an alist as below
> 
> (setq notmuch-search-result-format '(("date" . "%s ")
>("authors" . "%-40s ")
>("subject" . "%s ")
>("tags" . "(%s)")))
> 
> The supported keywords are date, count, authors, subject and tags.
> 
> Signed-off-by: Aneesh Kumar K.V 
> ---
>  notmuch.el |   56 +++-
>  1 files changed, 39 insertions(+), 17 deletions(-)
> 
> diff --git a/notmuch.el b/notmuch.el
> index 040997e..a4a89ac 100644
> --- a/notmuch.el
> +++ b/notmuch.el
> @@ -141,6 +141,19 @@ remaining lines into a button.")
>  (defvar notmuch-show-body-read-visible nil)
>  (defvar notmuch-show-citations-visible nil)
>  (defvar notmuch-show-signatures-visible nil)
> +(defcustom notmuch-search-result-format
> +  '(("date" . "%s")
> +("count" . "%-7s")
> +("authors" . "%-40s")
> +("subject" . "%s")
> +("tags" . "%s"))

I missed a '(' around tags. So the last line should be

("tags" . "(%s)"))

-aneesh


[notmuch] [PATCH v2] Add functions notmuch-show-get-(bcc, cc, date, from, subject, to).

2010-02-11 Thread da...@tethera.net
From: David Bremner 

Return the corresponding header field for the current message as a
string.  These are thin wrappers around notmuch-show-get-header, which
means they each cause a full parse of the RFC822 header. The main idea
is to fix an api.
---
Sorry, resending with fixed commit message.

 notmuch.el |   32 
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index c96fd94..d2a3b1b 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -225,6 +225,38 @@ Unlike builtin `previous-line' this version accepts no 
arguments."
 (re-search-forward notmuch-show-tags-regexp)
 (split-string (buffer-substring (match-beginning 1) (match-end 1)

+(defun notmuch-show-get-bcc ()
+  "Return To address of current message"
+  (notmuch-show-get-header-field 'bcc))
+
+(defun notmuch-show-get-cc ()
+  "Return To address of current message"
+  (notmuch-show-get-header-field 'cc))
+
+(defun notmuch-show-get-date ()
+  "Return To address of current message"
+  (notmuch-show-get-header-field 'date))
+
+(defun notmuch-show-get-from ()
+  "Return From address of current message"
+  (notmuch-show-get-header-field 'from))
+
+(defun notmuch-show-get-subject ()
+  "Return subject of current message"
+  (notmuch-show-get-header-field 'subject))
+
+(defun notmuch-show-get-to ()
+  "Return To address of current message"
+  (notmuch-show-get-header-field 'to))
+
+(defun notmuch-show-get-header-field (name) 
+  "Retrieve the header field NAME from the current message.
+NAME should be a symbol, in lower case, as returned by 
+mail-header-extract-no-properties" 
+  (let* ((result (assoc name (notmuch-show-get-header)))
+(val (and result (cdr result
+val))
+
 (defun notmuch-show-get-header ()
   "Retrieve and parse the header from the current message. Returns an alist 
with of (header . value) 
 where header is a symbol and value is a string.  The summary from notmuch-show 
is returned as the 
-- 
1.6.5



[notmuch] [PATCH 2/2] Add functions notmuch-show-get-(bcc, cc, date, from, subject, to) to return the corresponding header field for the current message as a string. These are thin wrappers around not

2010-02-11 Thread da...@tethera.net
From: David Bremner 

---
 notmuch.el |   32 
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index c96fd94..d2a3b1b 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -225,6 +225,38 @@ Unlike builtin `previous-line' this version accepts no 
arguments."
 (re-search-forward notmuch-show-tags-regexp)
 (split-string (buffer-substring (match-beginning 1) (match-end 1)

+(defun notmuch-show-get-bcc ()
+  "Return To address of current message"
+  (notmuch-show-get-header-field 'bcc))
+
+(defun notmuch-show-get-cc ()
+  "Return To address of current message"
+  (notmuch-show-get-header-field 'cc))
+
+(defun notmuch-show-get-date ()
+  "Return To address of current message"
+  (notmuch-show-get-header-field 'date))
+
+(defun notmuch-show-get-from ()
+  "Return From address of current message"
+  (notmuch-show-get-header-field 'from))
+
+(defun notmuch-show-get-subject ()
+  "Return subject of current message"
+  (notmuch-show-get-header-field 'subject))
+
+(defun notmuch-show-get-to ()
+  "Return To address of current message"
+  (notmuch-show-get-header-field 'to))
+
+(defun notmuch-show-get-header-field (name) 
+  "Retrieve the header field NAME from the current message.
+NAME should be a symbol, in lower case, as returned by 
+mail-header-extract-no-properties" 
+  (let* ((result (assoc name (notmuch-show-get-header)))
+(val (and result (cdr result
+val))
+
 (defun notmuch-show-get-header ()
   "Retrieve and parse the header from the current message. Returns an alist 
with of (header . value) 
 where header is a symbol and value is a string.  The summary from notmuch-show 
is returned as the 
-- 
1.6.5



[notmuch] [PATCH 1/2] notmuch-show-get-header: new function; return alist of parsed header fields.

2010-02-11 Thread da...@tethera.net
From: David Bremner 

This function parses the displayed message to recover header
fields. It uses mailheader.el to do the actual header parsing, after
preprocessing to remove indentation.  It relies on the variables
notmuch-show-message-begin-regexp, notmuch-show-header-begin-regexp,
and notmuch-show-message-end-regexp.
---
 notmuch.el |   24 
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index c0bb552..c96fd94 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -225,6 +225,30 @@ Unlike builtin `previous-line' this version accepts no 
arguments."
 (re-search-forward notmuch-show-tags-regexp)
 (split-string (buffer-substring (match-beginning 1) (match-end 1)

+(defun notmuch-show-get-header ()
+  "Retrieve and parse the header from the current message. Returns an alist 
with of (header . value) 
+where header is a symbol and value is a string.  The summary from notmuch-show 
is returned as the 
+pseudoheader summary"
+  (require 'mailheader)
+  (save-excursion
+(beginning-of-line)
+(if (not (looking-at notmuch-show-message-begin-regexp))
+   (re-search-backward notmuch-show-message-begin-regexp))
+(re-search-forward (concat notmuch-show-header-begin-regexp 
"\n[[:space:]]*\\(.*\\)\n"))
+(let* ((summary (buffer-substring-no-properties (match-beginning 1) 
(match-end 1)))
+ (beg (point)))
+  (re-search-forward notmuch-show-header-end-regexp)
+  (let ((text (buffer-substring beg (match-beginning 0
+   (with-temp-buffer
+ (insert text)
+ (goto-char (point-min))
+ (while (looking-at "\\([[:space:]]*\\)[A-Za-z][-A-Za-z0-9]*:")
+   (delete-region (match-beginning 1) (match-end 1))
+   (forward-line)
+   )
+ (goto-char (point-min))
+ (cons (cons 'summary summary) 
(mail-header-extract-no-properties)))
+  
 (defun notmuch-show-add-tag (&rest toadd)
   "Add a tag to the current message."
   (interactive
-- 
1.6.5



[notmuch] Updated notmuch-show-get-* functions

2010-02-11 Thread da...@tethera.net
I have rebased the patch for notmuch-show-get-header,and added functions 
for each of the header fields (I think) parsed by mailheader.el.  

There is a corresponding updated stash patch series that uses these functions 
to provide
convenient access to various fields, even if not currently displayed.



[notmuch] [PATCH -V3] notmuch.el: Support for customizing search result display

2010-02-11 Thread Aneesh Kumar K.V
From: Aneesh Kumar K.V 

This patch helps in customizing search result display
similar to mutt's index_format. The customization is done
by defining an alist as below

(setq notmuch-search-result-format '(("date" . "%s ")
 ("authors" . "%-40s ")
 ("subject" . "%s ")
 ("tags" . "(%s)")))

The supported keywords are date, count, authors, subject and tags.

Signed-off-by: Aneesh Kumar K.V 
---
 notmuch.el |   56 +++-
 1 files changed, 39 insertions(+), 17 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 040997e..a4a89ac 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -141,6 +141,19 @@ remaining lines into a button.")
 (defvar notmuch-show-body-read-visible nil)
 (defvar notmuch-show-citations-visible nil)
 (defvar notmuch-show-signatures-visible nil)
+(defcustom notmuch-search-result-format
+  '(("date" . "%s")
+("count" . "%-7s")
+("authors" . "%-40s")
+("subject" . "%s")
+("tags" . "%s"))
+  "Search result formating. Supported fields are
+   date, count, authors, subject, tags
+ex: (setq notmuch-search-result-format \(\(\"authors\" . \"%-40s\"\)
+   \(\"subject\" . \"%s\"\)\)\)"
+:type '(alist :key-type (string) :value-type (string))
+:group 'notmuch)
+
 (defvar notmuch-show-headers-visible nil)

 ; XXX: This should be a generic function in emacs somewhere, not here
@@ -1175,11 +1188,6 @@ matching this search term are shown if non-nil. "
   "Notmuch search mode face used to highligh tags."
   :group 'notmuch)

-(defvar notmuch-tag-face-alist nil
-  "List containing the tag list that need to be highlighed")
-
-(defvar notmuch-search-font-lock-keywords  nil)
-
 ;;;###autoload
 (defun notmuch-search-mode ()
   "Major mode displaying results of a notmuch search.
@@ -1215,17 +1223,7 @@ Complete list of currently available key bindings:
   (setq truncate-lines t)
   (setq major-mode 'notmuch-search-mode
mode-name "notmuch-search")
-  (setq buffer-read-only t)
-  (if (not notmuch-tag-face-alist)
-  (add-to-list 'notmuch-search-font-lock-keywords (list
-   "(\\([^)]*\\))$" '(1  'notmuch-tag-face)))
-(let ((notmuch-search-tags (mapcar 'car notmuch-tag-face-alist)))
-  (loop for notmuch-search-tag  in notmuch-search-tags
-   do (add-to-list 'notmuch-search-font-lock-keywords (list
-   (concat "([^)]*\\(" notmuch-search-tag "\\)[^)]*)$")
-   `(1  ,(cdr (assoc notmuch-search-tag 
notmuch-tag-face-alist
-  (set (make-local-variable 'font-lock-defaults)
- '(notmuch-search-font-lock-keywords t)))
+  (setq buffer-read-only t))

 (defun notmuch-search-find-thread-id ()
   "Return the thread for the current thread"
@@ -1340,6 +1338,30 @@ This function advances the next thread when finished."
(insert (format " (process returned %d)" 
exit-status)))
(insert "\n"))

+(defun insert-tags (tags)
+  (insert (concat "(" (propertize tags
+'font-lock-face 'notmuch-tag-face) ")")))
+
+(defun insert-field (field date count authors subject tags)
+(if (string-equal field "date")
+(insert (format (cdr (assoc field notmuch-search-result-format)) date))
+  (if (string-equal field "count")
+(insert (format (cdr (assoc field notmuch-search-result-format)) count))
+  (if (string-equal field "authors")
+(insert (format (cdr (assoc field notmuch-search-result-format)) authors))
+  (if (string-equal field "subject")
+  (insert (format (cdr (assoc field notmuch-search-result-format)) 
subject))
+  (if (string-equal field "tags")
+  (insert-tags (format (cdr (assoc field notmuch-search-result-format)) 
tags)))
+)
+
+(defun notmuch-search-show-result (date count authors subject tags)
+(let ((fields) (field))
+  (setq fields (mapcar 'car notmuch-search-result-format))
+  (loop for field in  fields
+   do (insert-field field date count authors subject tags)))
+(insert "\n"))
+
 (defun notmuch-search-process-filter (proc string)
   "Process and filter the output of \"notmuch search\""
   (let ((buffer (process-buffer proc)))
@@ -1362,7 +1384,7 @@ This function advances the next thread when finished."
  (set 'authors (concat (substring authors 0 (- 40 3)) 
"...")))
  (goto-char (point-max))
  (let ((beg (point-marker)))
-   (insert (format "%s %-7s %-40s %s (%s)\n" date count 
authors subject tags))
+   (notmuch-search-show-result date count authors subject 
tags)
(put-text-property beg (point-marker) 
'notmuch-search-thread-id thread-id)
(put-text-property beg (point-marker) 
'notmuch-search-authors authors)
(put-text-property beg (point-marker) 
'notmuch-search-subject subjec

Re: [notmuch] [PATCH 2/2] notmuch.el: add a submap (on "z" for "ztash") to stash things.

2010-02-11 Thread Jameson Rollins
On Thu, 11 Feb 2010 23:01:08 -0400, da...@tethera.net wrote:
> From: David Bremner 
> 
> Provide key bindings for stuffing various RFC822 header fields and other 
> metadata
> into the emacs kill-ring as text. The bindings are as follows:
> 
> z F   notmuch-show-stash-filename
> z T   notmuch-show-stash-tags
> z c   notmuch-show-stash-cc
> z d   notmuch-show-stash-date
> z f   notmuch-show-stash-from
> z m   notmuch-show-stash-message-id
> z s   notmuch-show-stash-subject
> z t   notmuch-show-stash-to

Great new emacs UI feature.  Love it.

jamie.


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


[notmuch] [PATCH 2/2] notmuch.el: add a submap (on "z" for "ztash") to stash things.

2010-02-11 Thread david
From: David Bremner 

Provide key bindings for stuffing various RFC822 header fields and other 
metadata
into the emacs kill-ring as text. The bindings are as follows:

z F notmuch-show-stash-filename
z T notmuch-show-stash-tags
z c notmuch-show-stash-cc
z d notmuch-show-stash-date
z f notmuch-show-stash-from
z m notmuch-show-stash-message-id
z s notmuch-show-stash-subject
z t notmuch-show-stash-to
---
 notmuch.el |   61 
 1 files changed, 61 insertions(+), 0 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 60ef592..faca26d 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -51,6 +51,22 @@
 (require 'mm-view)
 (require 'message)
 
+(defvar notmuch-show-stash-map
+  (let ((map (make-sparse-keymap)))
+(define-key map "c" 'notmuch-show-stash-cc)
+(define-key map "d" 'notmuch-show-stash-date)
+(define-key map "F" 'notmuch-show-stash-filename)
+(define-key map "f" 'notmuch-show-stash-from)
+(define-key map "m" 'notmuch-show-stash-message-id)
+(define-key map "s" 'notmuch-show-stash-subject)
+(define-key map "T" 'notmuch-show-stash-tags)
+(define-key map "t" 'notmuch-show-stash-to)
+map)
+  "Submap for stash commands"
+  )
+
+(fset 'notmuch-show-stash-map notmuch-show-stash-map)
+
 (defvar notmuch-show-mode-map
   (let ((map (make-sparse-keymap)))
 (define-key map "?" 'notmuch-help)
@@ -80,6 +96,7 @@
 (define-key map "n" 'notmuch-show-next-message)
 (define-key map (kbd "DEL") 'notmuch-show-rewind)
 (define-key map " " 'notmuch-show-advance-marking-read-and-archiving)
+(define-key map "z" 'notmuch-show-stash-map)
 map)
   "Keymap for \"notmuch show\" buffers.")
 (fset 'notmuch-show-mode-map notmuch-show-mode-map)
@@ -1074,6 +1091,50 @@ All currently available key bindings:
   :options '(hl-line-mode)
   :group 'notmuch)
 
+(defun notmuch-show-do-stash (text)
+(kill-new text)
+(message (concat "Saved: " text)))
+
+(defun notmuch-show-stash-cc ()
+  "Copy CC field of current message to kill-ring."
+  (interactive)
+  (notmuch-show-do-stash (notmuch-show-get-cc)))
+
+(defun notmuch-show-stash-date ()
+  "Copy date of current message to kill-ring."
+  (interactive)
+  (notmuch-show-do-stash (notmuch-show-get-date)))
+
+(defun notmuch-show-stash-filename ()
+  "Copy filename of current message to kill-ring."
+  (interactive)
+  (notmuch-show-do-stash (notmuch-show-get-filename)))
+
+(defun notmuch-show-stash-from ()
+  "Copy From address of current message to kill-ring."
+  (interactive)
+  (notmuch-show-do-stash (notmuch-show-get-from)))
+
+(defun notmuch-show-stash-message-id ()
+  "Copy message-id of current message to kill-ring."
+  (interactive)
+  (notmuch-show-do-stash (notmuch-show-get-message-id)))
+
+(defun notmuch-show-stash-subject ()
+  "Copy Subject field of current message to kill-ring."
+  (interactive)
+  (notmuch-show-do-stash (notmuch-show-get-subject)))
+
+(defun notmuch-show-stash-tags ()
+  "Copy tags of current message to kill-ring as a comma separated list."
+  (interactive)
+  (notmuch-show-do-stash (mapconcat 'identity (notmuch-show-get-tags) ",")))
+
+(defun notmuch-show-stash-to ()
+  "Copy To address of current message to kill-ring."
+  (interactive)
+  (notmuch-show-do-stash (notmuch-show-get-to)))
+
 ; Make show mode a bit prettier, highlighting URLs and using word wrap
 
 (defun notmuch-show-pretty-hook ()
-- 
1.6.5

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


[notmuch] [PATCH 1/2] notmuch.el: convert sparse keymap to a list in notmuch-substitute-one-command-key-with-prefix

2010-02-11 Thread david
From: David Bremner 

The previous version would crash when a key was bound to a sparse
keymap, since apparently these are not straightforward lists.  The
usage of map-keymap is a bit obscure: it only has side-effects, no
return value.
---
 notmuch.el |8 ++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index d2a3b1b..60ef592 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -984,8 +984,12 @@ For a mouse binding, return nil."
 (if (mouse-event-p key)
nil
   (if (keymapp action)
- (let ((substitute (apply-partially 
'notmuch-substitute-one-command-key-with-prefix (notmuch-prefix-key-description 
key
-   (mapconcat substitute (cdr action) "\n"))
+ (let ((substitute (apply-partially 
'notmuch-substitute-one-command-key-with-prefix (notmuch-prefix-key-description 
key)))
+   (as-list))
+   (map-keymap (lambda (a b)
+ (push (cons a b) as-list))
+   action)
+   (mapconcat substitute as-list "\n"))
(concat prefix (format-kbd-macro (vector key))
"\t"
(notmuch-documentation-first-line action))
-- 
1.6.5

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


[notmuch] Rebased and updated stash patches.

2010-02-11 Thread david
These patches let you header fields and similar into the emacs kill-ring
(and the X11 clipboard/selection, if things are setup right).

Patch 1/2 is actually a bug fix to master, unchanged since last time.
The bug didn't manifest because no submaps were used.

Patch 2/2 is rebased against current master and several more commands are 
provided.

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


[notmuch] [PATCH v2] Add functions notmuch-show-get-(bcc, cc, date, from, subject, to).

2010-02-11 Thread david
From: David Bremner 

Return the corresponding header field for the current message as a
string.  These are thin wrappers around notmuch-show-get-header, which
means they each cause a full parse of the RFC822 header. The main idea
is to fix an api.
---
Sorry, resending with fixed commit message.

 notmuch.el |   32 
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index c96fd94..d2a3b1b 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -225,6 +225,38 @@ Unlike builtin `previous-line' this version accepts no 
arguments."
 (re-search-forward notmuch-show-tags-regexp)
 (split-string (buffer-substring (match-beginning 1) (match-end 1)
 
+(defun notmuch-show-get-bcc ()
+  "Return To address of current message"
+  (notmuch-show-get-header-field 'bcc))
+
+(defun notmuch-show-get-cc ()
+  "Return To address of current message"
+  (notmuch-show-get-header-field 'cc))
+
+(defun notmuch-show-get-date ()
+  "Return To address of current message"
+  (notmuch-show-get-header-field 'date))
+
+(defun notmuch-show-get-from ()
+  "Return From address of current message"
+  (notmuch-show-get-header-field 'from))
+
+(defun notmuch-show-get-subject ()
+  "Return subject of current message"
+  (notmuch-show-get-header-field 'subject))
+
+(defun notmuch-show-get-to ()
+  "Return To address of current message"
+  (notmuch-show-get-header-field 'to))
+
+(defun notmuch-show-get-header-field (name) 
+  "Retrieve the header field NAME from the current message.
+NAME should be a symbol, in lower case, as returned by 
+mail-header-extract-no-properties" 
+  (let* ((result (assoc name (notmuch-show-get-header)))
+(val (and result (cdr result
+val))
+
 (defun notmuch-show-get-header ()
   "Retrieve and parse the header from the current message. Returns an alist 
with of (header . value) 
 where header is a symbol and value is a string.  The summary from notmuch-show 
is returned as the 
-- 
1.6.5

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


[notmuch] [PATCH 2/2] Add functions notmuch-show-get-(bcc, cc, date, from, subject, to) to return the corresponding header field for the current message as a string. These are thin wrappers around not

2010-02-11 Thread david
From: David Bremner 

---
 notmuch.el |   32 
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index c96fd94..d2a3b1b 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -225,6 +225,38 @@ Unlike builtin `previous-line' this version accepts no 
arguments."
 (re-search-forward notmuch-show-tags-regexp)
 (split-string (buffer-substring (match-beginning 1) (match-end 1)
 
+(defun notmuch-show-get-bcc ()
+  "Return To address of current message"
+  (notmuch-show-get-header-field 'bcc))
+
+(defun notmuch-show-get-cc ()
+  "Return To address of current message"
+  (notmuch-show-get-header-field 'cc))
+
+(defun notmuch-show-get-date ()
+  "Return To address of current message"
+  (notmuch-show-get-header-field 'date))
+
+(defun notmuch-show-get-from ()
+  "Return From address of current message"
+  (notmuch-show-get-header-field 'from))
+
+(defun notmuch-show-get-subject ()
+  "Return subject of current message"
+  (notmuch-show-get-header-field 'subject))
+
+(defun notmuch-show-get-to ()
+  "Return To address of current message"
+  (notmuch-show-get-header-field 'to))
+
+(defun notmuch-show-get-header-field (name) 
+  "Retrieve the header field NAME from the current message.
+NAME should be a symbol, in lower case, as returned by 
+mail-header-extract-no-properties" 
+  (let* ((result (assoc name (notmuch-show-get-header)))
+(val (and result (cdr result
+val))
+
 (defun notmuch-show-get-header ()
   "Retrieve and parse the header from the current message. Returns an alist 
with of (header . value) 
 where header is a symbol and value is a string.  The summary from notmuch-show 
is returned as the 
-- 
1.6.5

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


[notmuch] [PATCH 1/2] notmuch-show-get-header: new function; return alist of parsed header fields.

2010-02-11 Thread david
From: David Bremner 

This function parses the displayed message to recover header
fields. It uses mailheader.el to do the actual header parsing, after
preprocessing to remove indentation.  It relies on the variables
notmuch-show-message-begin-regexp, notmuch-show-header-begin-regexp,
and notmuch-show-message-end-regexp.
---
 notmuch.el |   24 
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index c0bb552..c96fd94 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -225,6 +225,30 @@ Unlike builtin `previous-line' this version accepts no 
arguments."
 (re-search-forward notmuch-show-tags-regexp)
 (split-string (buffer-substring (match-beginning 1) (match-end 1)
 
+(defun notmuch-show-get-header ()
+  "Retrieve and parse the header from the current message. Returns an alist 
with of (header . value) 
+where header is a symbol and value is a string.  The summary from notmuch-show 
is returned as the 
+pseudoheader summary"
+  (require 'mailheader)
+  (save-excursion
+(beginning-of-line)
+(if (not (looking-at notmuch-show-message-begin-regexp))
+   (re-search-backward notmuch-show-message-begin-regexp))
+(re-search-forward (concat notmuch-show-header-begin-regexp 
"\n[[:space:]]*\\(.*\\)\n"))
+(let* ((summary (buffer-substring-no-properties (match-beginning 1) 
(match-end 1)))
+ (beg (point)))
+  (re-search-forward notmuch-show-header-end-regexp)
+  (let ((text (buffer-substring beg (match-beginning 0
+   (with-temp-buffer
+ (insert text)
+ (goto-char (point-min))
+ (while (looking-at "\\([[:space:]]*\\)[A-Za-z][-A-Za-z0-9]*:")
+   (delete-region (match-beginning 1) (match-end 1))
+   (forward-line)
+   )
+ (goto-char (point-min))
+ (cons (cons 'summary summary) 
(mail-header-extract-no-properties)))
+  
 (defun notmuch-show-add-tag (&rest toadd)
   "Add a tag to the current message."
   (interactive
-- 
1.6.5

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


[notmuch] Updated notmuch-show-get-* functions

2010-02-11 Thread david
I have rebased the patch for notmuch-show-get-header,and added functions 
for each of the header fields (I think) parsed by mailheader.el.  

There is a corresponding updated stash patch series that uses these functions 
to provide
convenient access to various fields, even if not currently displayed.

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


[notmuch] notmuch.el: Prefix arg inverts the sort order of notmuch-search.

2010-02-11 Thread ra...@free.fr
Using a prefix arg to invert search order would conflict with my patch 
http://notmuchmail.org/pipermail/notmuch/2009/000914.html
in which the prefix arg is used to show deleted messages. I don't known which 
behaviour for prefix patch would be best.

Though we can also add "toggle keys" that toggle search order, or toggle 
display of deleted messages, which would solve the problem.

Matthieu

- Mail Original -
De: "Sebastian Spaeth" 
?: notmuch at notmuchmail.org
Envoy?: Jeudi 11 F?vrier 2010 14h05:28 GMT +00:00 GMT - Grande-Bretagne, 
Irlande, Portugal
Objet: Re: [notmuch] notmuch.el: Prefix arg inverts the sort order of 
notmuch-search.

On Thu, 11 Feb 2010 14:01:14 +, David Edmondson  wrote:
>   (let ((proc (start-process-shell-command
>"notmuch-search" buffer notmuch-command "search"
>(if oldest-first "--sort=oldest-first" 
> "--sort=newest-first")

Doh, I should shut up when I haven't actually looked at the code. 
The only thing to my defense is that looking at elisp makes me feel
dizzy.

Sorry,
Sebastian
___
notmuch mailing list
notmuch at notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[notmuch] notmuch.el: Prefix arg inverts the sort order of notmuch-search.

2010-02-11 Thread Sebastian Spaeth
On Thu, 11 Feb 2010 14:01:14 +, David Edmondson  wrote:
>   (let ((proc (start-process-shell-command
>"notmuch-search" buffer notmuch-command "search"
>(if oldest-first "--sort=oldest-first" 
> "--sort=newest-first")

Doh, I should shut up when I haven't actually looked at the code. 
The only thing to my defense is that looking at elisp makes me feel
dizzy.

Sorry,
Sebastian


Re: [notmuch] notmuch reply template

2010-02-11 Thread martin f krafft
also sprach Sebastian Spaeth  [2010.02.12.0254 +1300]:
> I've had enough of the 
> 
>  On a sunny Sunday the 30th in timezone , male human  with mail
>  address  hit the reply button  microseconds after 1970 while being 
> at latitude :
> 
> type of reply template in notmuch. :-)
> 
> May I suggest to use a simpler:
> 
>  "On 11 Feb 2010, David Edmondson wrote:" 

This should be configurable so everyone can set their own.

-- 
martin | http://madduck.net/ | http://two.sentenc.es/
 
if god had meant for us to be naked,
we would have been born that way.
 
spamtraps: madduck.bo...@madduck.net


digital_signature_gpg.asc
Description: Digital signature (see http://martin-krafft.net/gpg/)
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[notmuch] notmuch reply template

2010-02-11 Thread Sebastian Spaeth
I've had enough of the 

 On a sunny Sunday the 30th in timezone , male human  with mail
 address  hit the reply button  microseconds after 1970 while being at 
latitude :

type of reply template in notmuch. :-)

May I suggest to use a simpler:

 "On 11 Feb 2010, David Edmondson wrote:" 

(using the email address if there is no real name). I am really not
interested in the rest of the information or can reconstruct it.

Sebastian


[notmuch] notmuch.el: Prefix arg inverts the sort order of notmuch-search.

2010-02-11 Thread Sebastian Spaeth
On Thu, 11 Feb 2010 12:19:12 +, David Edmondson  wrote:
...

I think the correct thing here would be to let notmuch return search is
inverse sort order rather than reverting this later in the client
(unneccessary work). 

 --sort=oldest|newest|relevance 

seems to be what xapian can easily provide us with.


Re: [notmuch] notmuch.el: Prefix arg inverts the sort order of notmuch-search.

2010-02-11 Thread racin
>On Thu, 11 Feb 2010 15:20:54 +0100 (CET), ra...@free.fr wrote:
>
>> Using a prefix arg to invert search order would conflict with my patch
>> http://notmuchmail.org/pipermail/notmuch/2009/000914.html in which the
>> prefix arg is used to show deleted messages. I don't known which
>> behaviour for prefix patch would be best.
>
>I always understood a prefix arg to invert the original (or provide a
>numeric repetition), but I do not have a wide sample to tell if this is
>how most elisp implements it. 

Gnus uses a C-u prefix to display old messages, for instance. 

Note that the only advantage of the prefix over the toggle is that it makes one 
call to notmuch search instead of one. I don't think that it matters from a 
performance point of view, as the second search is always much faster than the 
second. Maybe we should just reserve the prefix for a later use.

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


[notmuch] notmuch.el: Prefix arg inverts the sort order of notmuch-search.

2010-02-11 Thread David Edmondson
On Thu, 11 Feb 2010 14:42:40 +0100, "Sebastian Spaeth"  wrote:
> On Thu, 11 Feb 2010 12:19:12 +, David Edmondson  wrote:
> ...
> 
> I think the correct thing here would be to let notmuch return search is
> inverse sort order rather than reverting this later in the client
> (unneccessary work). 
> 
>  --sort=oldest|newest|relevance 
> 
> seems to be what xapian can easily provide us with.

That's what happens:

(let ((proc (start-process-shell-command
 "notmuch-search" buffer notmuch-command "search"
 (if oldest-first "--sort=oldest-first" 
"--sort=newest-first")
 (shell-quote-argument query

Isn't it?

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


Re: [notmuch] A functional (but rudimentary) test suite for notmuch

2010-02-11 Thread Carl Worth
Hi Michal,

I found myself today *really* needing to add a test that exercises some
code in our emacs client. (Eric found that a message that includes a ":"
in the From: address breaks things due to a buggy regexp.) And I
wanted to see if I could merge your conversion of the test suite before
I added a feature as big as that. See below for my feedback.

-Carl

On Mon, 8 Feb 2010 16:14:24 +0100, Michal Sojka  wrote:
> I converted the actual version of notmuch-test to git test framework.
> The result is in the followup patches.

Interesting. My only real concern at this point is that some of the new files
have a copyright header identifying Junio as the copyright holder, but
no license information. Meanwhile, the implicit license of git (GPLv2
only) is incompatible with that of notmuch (GPLv3+).

So if you'd like to ask Junio for permission to re-use the files under
the GPLv3+ then we could see what he says.

In the meantime, you've done some nice modularization work here which we
should be able to take right away, (and I can write tiny implementations
of the functions we need so that we can just drop in git's test-lib.sh
if we get permission).

So we won't yet have any of the fancy features of the framework,
(expected failures, reports of fixed tests, pre-requisites for tests),
but we're not *using* any of those features yet so it shouldn't matter.

> The conversion was not as straightforward as I expected mainly because
> of problems with quoting. There are several sources of quotation problems
> one being Carl's hashed array parameters. I thing it would be
> sufficient to use plain variables for passing additional parameters.
> Instead of:
> add_message [from]="\"Sender \"" \
> [to]=test_su...@notmuchmail.org \
...
> I'd do:
> msg_from="Sender "
> msg_to=test_su...@notmuchmail.org 
> add_message

Yeah. I almost wrote it that way, but named parameters (even if faked)
seemed so much nicer. I'll agree that the quoting was quite nasty
though.

> A possible additional improvement is elimination of
> execute_expecting(). Combination of action (running notmuch) and
> testing of a result in a single function makes it hard to distinguish
> whether the problem is in the action or in the output.

A fair point. It also caused problems when I wanted to do tests that
didn't directly test the output of notmuch, (such as a test that uses
diff to compare a result against the contents in a file).

-Carl


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


[notmuch] A functional (but rudimentary) test suite for notmuch

2010-02-11 Thread Carl Worth
Hi Michal,

I found myself today *really* needing to add a test that exercises some
code in our emacs client. (Eric found that a message that includes a ":"
in the From: address breaks things due to a buggy regexp.) And I
wanted to see if I could merge your conversion of the test suite before
I added a feature as big as that. See below for my feedback.

-Carl

On Mon, 8 Feb 2010 16:14:24 +0100, Michal Sojka  wrote:
> I converted the actual version of notmuch-test to git test framework.
> The result is in the followup patches.

Interesting. My only real concern at this point is that some of the new files
have a copyright header identifying Junio as the copyright holder, but
no license information. Meanwhile, the implicit license of git (GPLv2
only) is incompatible with that of notmuch (GPLv3+).

So if you'd like to ask Junio for permission to re-use the files under
the GPLv3+ then we could see what he says.

In the meantime, you've done some nice modularization work here which we
should be able to take right away, (and I can write tiny implementations
of the functions we need so that we can just drop in git's test-lib.sh
if we get permission).

So we won't yet have any of the fancy features of the framework,
(expected failures, reports of fixed tests, pre-requisites for tests),
but we're not *using* any of those features yet so it shouldn't matter.

> The conversion was not as straightforward as I expected mainly because
> of problems with quoting. There are several sources of quotation problems
> one being Carl's hashed array parameters. I thing it would be
> sufficient to use plain variables for passing additional parameters.
> Instead of:
> add_message [from]="\"Sender \"" \
> [to]=test_suite at notmuchmail.org \
...
> I'd do:
> msg_from="Sender "
> msg_to=test_suite at notmuchmail.org 
> add_message

Yeah. I almost wrote it that way, but named parameters (even if faked)
seemed so much nicer. I'll agree that the quoting was quite nasty
though.

> A possible additional improvement is elimination of
> execute_expecting(). Combination of action (running notmuch) and
> testing of a result in a single function makes it hard to distinguish
> whether the problem is in the action or in the output.

A fair point. It also caused problems when I wanted to do tests that
didn't directly test the output of notmuch, (such as a test that uses
diff to compare a result against the contents in a file).

-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/20100211/4bed5de7/attachment.pgp>


[notmuch] notmuch.el: Prefix arg inverts the sort order of notmuch-search.

2010-02-11 Thread micah anderson
On Thu, 11 Feb 2010 15:20:54 +0100 (CET), racin at free.fr wrote:

> Using a prefix arg to invert search order would conflict with my patch
> http://notmuchmail.org/pipermail/notmuch/2009/000914.html in which the
> prefix arg is used to show deleted messages. I don't known which
> behaviour for prefix patch would be best.

I always understood a prefix arg to invert the original (or provide a
numeric repetition), but I do not have a wide sample to tell if this is
how most elisp implements it. 

> Though we can also add "toggle keys" that toggle search order, or
> toggle display of deleted messages, which would solve the problem.

There is the 'o' key now which toggles the search order, isn't there? 

m
-- 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/20100211/e57c9cc7/attachment.pgp>


[notmuch] [PATCH] notmuch.el: Prefix arg inverts the sort order of notmuch-search.

2010-02-11 Thread David Edmondson
---
 notmuch.el |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 8f50abe..de9ddf8 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -1398,7 +1398,8 @@ characters as well as `_.+-'.
 (defun notmuch-search (query &optional oldest-first)
   "Run \"notmuch search\" with the given query string and display results."
   (interactive "sNotmuch search: ")
-  (let ((buffer (get-buffer-create (concat "*notmuch-search-" query "*"
+  (let ((buffer (get-buffer-create (concat "*notmuch-search-" query "*")))
+   (oldest-first (if current-prefix-arg (not oldest-first) oldest-first)))
 (switch-to-buffer buffer)
 (notmuch-search-mode)
 (set 'notmuch-search-query-string query)
-- 
1.6.6.1



[notmuch] [PATCH] notmuch.el: 'F' in search mode takes us to a list of folders.

2010-02-11 Thread David Edmondson
---
 notmuch.el |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 040997e..8f50abe 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -1104,6 +1104,7 @@ matching this search term are shown if non-nil. "
 (define-key map "-" 'notmuch-search-remove-tag)
 (define-key map "+" 'notmuch-search-add-tag)
 (define-key map (kbd "RET") 'notmuch-search-show-thread)
+(define-key map "F" 'notmuch-folder)
 map)
   "Keymap for \"notmuch search\" buffers.")
 (fset 'notmuch-search-mode-map notmuch-search-mode-map)
-- 
1.6.6.1



[notmuch] patchwork test instance

2010-02-11 Thread martin f krafft
also sprach Sebastian Spaeth  [2010.02.10.2225 +1300]:
> "notmuch dump tag:notmuch and tag:patch" could be used to construct a
> list of "accepted", "willnottakeit","superseded" and "pending" lists or
> whatever. If that list were made accessible somewhere, this would be
> super useful. At least it would help me see whether Carl just hasn't
> gotten around to including my "press 'd' for delete" patch or whether he
> is not interested in merging it. :)

Carl, would you consider bouncing messages to addresses like
patchwork+rejected at patchwork.notmuchmail.org? That would make it
trivial for me to write glue to update patchwork automatically.

-- 
martin | http://madduck.net/ | http://two.sentenc.es/

"es ist gut, eine sache doppelt auszudr?cken und ihr einen
 rechten und linken fu? zu geben. auf einem bein kann die wahrheit
 zwar stehen; mit zweien aber wird sie gehen und herumkommen."
-- friedrich nietzsche

spamtraps: madduck.bogus at madduck.net


[notmuch] Broken display of a message in emacs

2010-02-11 Thread Michal Sojka
Hi,

recently, I got a message (attached) which is diplayed incorrectly in
emacs GUI. Instead of the message I see direct output of notmuch show
(with ^L characters). I wonder whether it is a porblem of notmuch or it
is because the message does not comform to standards. What do you think?

Michal


-- next part --
An embedded and charset-unspecified text was scrubbed...
Name: broken-mail-in-notmuch-emacs
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100211/18d14330/attachment.txt>


[notmuch] patchwork test instance

2010-02-11 Thread martin f krafft
also sprach David Bremner  [2010.02.10.2149 +1300]:
> I'm not sure what merging patches means here; some kind of squash
> operation?  Anyway it seemed to me that every every patch series
> that I looked at was broken into individual patches. Maybe I am
> just unlucky, or does patchwork really not understand the concept
> of series of patches in a thread?

I don't think it does, this is what bundles are for, but these need
to be created manually at the moment. Patch series are pretty easy
to detect, so maybe the bundle could be automatically generated.

http://lists.ozlabs.org/pipermail/patchwork/2010-February/000226.html

-- 
martin | http://madduck.net/ | http://two.sentenc.es/

because light travels faster than sound,
some people appear to be intelligent,
until you hear them speak.

spamtraps: madduck.bogus at madduck.net


Re: [notmuch] notmuch.el: Prefix arg inverts the sort order of notmuch-search.

2010-02-11 Thread micah anderson
On Thu, 11 Feb 2010 15:20:54 +0100 (CET), ra...@free.fr wrote:

> Using a prefix arg to invert search order would conflict with my patch
> http://notmuchmail.org/pipermail/notmuch/2009/000914.html in which the
> prefix arg is used to show deleted messages. I don't known which
> behaviour for prefix patch would be best.

I always understood a prefix arg to invert the original (or provide a
numeric repetition), but I do not have a wide sample to tell if this is
how most elisp implements it. 

> Though we can also add "toggle keys" that toggle search order, or
> toggle display of deleted messages, which would solve the problem.

There is the 'o' key now which toggles the search order, isn't there? 

m


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


Re: [notmuch] [PATCH -V3] notmuch.el: Support for customizing search result display

2010-02-11 Thread Aneesh Kumar K. V
On Thu, 11 Feb 2010 22:11:46 +0530, "Aneesh Kumar K.V" 
 wrote:
> From: Aneesh Kumar K.V 
> 
> This patch helps in customizing search result display
> similar to mutt's index_format. The customization is done
> by defining an alist as below
> 
> (setq notmuch-search-result-format '(("date" . "%s ")
>("authors" . "%-40s ")
>("subject" . "%s ")
>("tags" . "(%s)")))
> 
> The supported keywords are date, count, authors, subject and tags.
> 
> Signed-off-by: Aneesh Kumar K.V 
> ---
>  notmuch.el |   56 +++-
>  1 files changed, 39 insertions(+), 17 deletions(-)
> 
> diff --git a/notmuch.el b/notmuch.el
> index 040997e..a4a89ac 100644
> --- a/notmuch.el
> +++ b/notmuch.el
> @@ -141,6 +141,19 @@ remaining lines into a button.")
>  (defvar notmuch-show-body-read-visible nil)
>  (defvar notmuch-show-citations-visible nil)
>  (defvar notmuch-show-signatures-visible nil)
> +(defcustom notmuch-search-result-format
> +  '(("date" . "%s")
> +("count" . "%-7s")
> +("authors" . "%-40s")
> +("subject" . "%s")
> +("tags" . "%s"))

I missed a '(' around tags. So the last line should be

("tags" . "(%s)"))

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


[notmuch] [PATCH -V3] notmuch.el: Support for customizing search result display

2010-02-11 Thread Aneesh Kumar K.V
From: Aneesh Kumar K.V 

This patch helps in customizing search result display
similar to mutt's index_format. The customization is done
by defining an alist as below

(setq notmuch-search-result-format '(("date" . "%s ")
 ("authors" . "%-40s ")
 ("subject" . "%s ")
 ("tags" . "(%s)")))

The supported keywords are date, count, authors, subject and tags.

Signed-off-by: Aneesh Kumar K.V 
---
 notmuch.el |   56 +++-
 1 files changed, 39 insertions(+), 17 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 040997e..a4a89ac 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -141,6 +141,19 @@ remaining lines into a button.")
 (defvar notmuch-show-body-read-visible nil)
 (defvar notmuch-show-citations-visible nil)
 (defvar notmuch-show-signatures-visible nil)
+(defcustom notmuch-search-result-format
+  '(("date" . "%s")
+("count" . "%-7s")
+("authors" . "%-40s")
+("subject" . "%s")
+("tags" . "%s"))
+  "Search result formating. Supported fields are
+   date, count, authors, subject, tags
+ex: (setq notmuch-search-result-format \(\(\"authors\" . \"%-40s\"\)
+   \(\"subject\" . \"%s\"\)\)\)"
+:type '(alist :key-type (string) :value-type (string))
+:group 'notmuch)
+
 (defvar notmuch-show-headers-visible nil)
 
 ; XXX: This should be a generic function in emacs somewhere, not here
@@ -1175,11 +1188,6 @@ matching this search term are shown if non-nil. "
   "Notmuch search mode face used to highligh tags."
   :group 'notmuch)
 
-(defvar notmuch-tag-face-alist nil
-  "List containing the tag list that need to be highlighed")
-
-(defvar notmuch-search-font-lock-keywords  nil)
-
 ;;;###autoload
 (defun notmuch-search-mode ()
   "Major mode displaying results of a notmuch search.
@@ -1215,17 +1223,7 @@ Complete list of currently available key bindings:
   (setq truncate-lines t)
   (setq major-mode 'notmuch-search-mode
mode-name "notmuch-search")
-  (setq buffer-read-only t)
-  (if (not notmuch-tag-face-alist)
-  (add-to-list 'notmuch-search-font-lock-keywords (list
-   "(\\([^)]*\\))$" '(1  'notmuch-tag-face)))
-(let ((notmuch-search-tags (mapcar 'car notmuch-tag-face-alist)))
-  (loop for notmuch-search-tag  in notmuch-search-tags
-   do (add-to-list 'notmuch-search-font-lock-keywords (list
-   (concat "([^)]*\\(" notmuch-search-tag "\\)[^)]*)$")
-   `(1  ,(cdr (assoc notmuch-search-tag 
notmuch-tag-face-alist
-  (set (make-local-variable 'font-lock-defaults)
- '(notmuch-search-font-lock-keywords t)))
+  (setq buffer-read-only t))
 
 (defun notmuch-search-find-thread-id ()
   "Return the thread for the current thread"
@@ -1340,6 +1338,30 @@ This function advances the next thread when finished."
(insert (format " (process returned %d)" 
exit-status)))
(insert "\n"))
 
+(defun insert-tags (tags)
+  (insert (concat "(" (propertize tags
+'font-lock-face 'notmuch-tag-face) ")")))
+
+(defun insert-field (field date count authors subject tags)
+(if (string-equal field "date")
+(insert (format (cdr (assoc field notmuch-search-result-format)) date))
+  (if (string-equal field "count")
+(insert (format (cdr (assoc field notmuch-search-result-format)) count))
+  (if (string-equal field "authors")
+(insert (format (cdr (assoc field notmuch-search-result-format)) authors))
+  (if (string-equal field "subject")
+  (insert (format (cdr (assoc field notmuch-search-result-format)) 
subject))
+  (if (string-equal field "tags")
+  (insert-tags (format (cdr (assoc field notmuch-search-result-format)) 
tags)))
+)
+
+(defun notmuch-search-show-result (date count authors subject tags)
+(let ((fields) (field))
+  (setq fields (mapcar 'car notmuch-search-result-format))
+  (loop for field in  fields
+   do (insert-field field date count authors subject tags)))
+(insert "\n"))
+
 (defun notmuch-search-process-filter (proc string)
   "Process and filter the output of \"notmuch search\""
   (let ((buffer (process-buffer proc)))
@@ -1362,7 +1384,7 @@ This function advances the next thread when finished."
  (set 'authors (concat (substring authors 0 (- 40 3)) 
"...")))
  (goto-char (point-max))
  (let ((beg (point-marker)))
-   (insert (format "%s %-7s %-40s %s (%s)\n" date count 
authors subject tags))
+   (notmuch-search-show-result date count authors subject 
tags)
(put-text-property beg (point-marker) 
'notmuch-search-thread-id thread-id)
(put-text-property beg (point-marker) 
'notmuch-search-authors authors)
(put-text-property beg (point-marker) 
'notmuch-search-subject su

[notmuch] emacs: On getting support for inline images

2010-02-11 Thread David Edmondson
> PS. I know that attaching the output of "git format-patch" to a message
> like this isn't the "git way". (That is, you won't get the right result
> by simply piping this message to "git am".) But I really wish it
> were. It seems I often write code in response to an email message and I
> often want to reply to that *message* and incidentally provide a
> patch. The git way, with the commit message in the subject and the first
> part of the body seems backwards to me, (as far as the conversation is
> concerned).

How about attaching a message/rfc822 part which contains the patch?


Re: [notmuch] notmuch.el: Prefix arg inverts the sort order of notmuch-search.

2010-02-11 Thread racin
Using a prefix arg to invert search order would conflict with my patch 
http://notmuchmail.org/pipermail/notmuch/2009/000914.html
in which the prefix arg is used to show deleted messages. I don't known which 
behaviour for prefix patch would be best.

Though we can also add "toggle keys" that toggle search order, or toggle 
display of deleted messages, which would solve the problem.

Matthieu

- Mail Original -
De: "Sebastian Spaeth" 
À: notmuch@notmuchmail.org
Envoyé: Jeudi 11 Février 2010 14h05:28 GMT +00:00 GMT - Grande-Bretagne, 
Irlande, Portugal
Objet: Re: [notmuch] notmuch.el: Prefix arg inverts the sort order of 
notmuch-search.

On Thu, 11 Feb 2010 14:01:14 +, David Edmondson  wrote:
>   (let ((proc (start-process-shell-command
>"notmuch-search" buffer notmuch-command "search"
>(if oldest-first "--sort=oldest-first" 
> "--sort=newest-first")

Doh, I should shut up when I haven't actually looked at the code. 
The only thing to my defense is that looking at elisp makes me feel
dizzy.

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


Re: [notmuch] notmuch.el: Prefix arg inverts the sort order of notmuch-search.

2010-02-11 Thread Sebastian Spaeth
On Thu, 11 Feb 2010 14:01:14 +, David Edmondson  wrote:
>   (let ((proc (start-process-shell-command
>"notmuch-search" buffer notmuch-command "search"
>(if oldest-first "--sort=oldest-first" 
> "--sort=newest-first")

Doh, I should shut up when I haven't actually looked at the code. 
The only thing to my defense is that looking at elisp makes me feel
dizzy.

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


Re: [notmuch] notmuch.el: Prefix arg inverts the sort order of notmuch-search.

2010-02-11 Thread David Edmondson
On Thu, 11 Feb 2010 14:42:40 +0100, "Sebastian Spaeth"  
wrote:
> On Thu, 11 Feb 2010 12:19:12 +, David Edmondson  wrote:
> ...
> 
> I think the correct thing here would be to let notmuch return search is
> inverse sort order rather than reverting this later in the client
> (unneccessary work). 
> 
>  --sort=oldest|newest|relevance 
> 
> seems to be what xapian can easily provide us with.

That's what happens:

(let ((proc (start-process-shell-command
 "notmuch-search" buffer notmuch-command "search"
 (if oldest-first "--sort=oldest-first" 
"--sort=newest-first")
 (shell-quote-argument query

Isn't it?

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


[notmuch] notmuch reply template

2010-02-11 Thread Sebastian Spaeth
I've had enough of the 

 On a sunny Sunday the 30th in timezone , male human  with mail
 address  hit the reply button  microseconds after 1970 while being at 
latitude :

type of reply template in notmuch. :-)

May I suggest to use a simpler:

 "On 11 Feb 2010, David Edmondson wrote:" 

(using the email address if there is no real name). I am really not
interested in the rest of the information or can reconstruct it.

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


Re: [notmuch] notmuch.el: Prefix arg inverts the sort order of notmuch-search.

2010-02-11 Thread Sebastian Spaeth
On Thu, 11 Feb 2010 12:19:12 +, David Edmondson  wrote:
...

I think the correct thing here would be to let notmuch return search is
inverse sort order rather than reverting this later in the client
(unneccessary work). 

 --sort=oldest|newest|relevance 

seems to be what xapian can easily provide us with.
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[notmuch] [PATCH] notmuch.el: Prefix arg inverts the sort order of notmuch-search.

2010-02-11 Thread David Edmondson
---
 notmuch.el |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 8f50abe..de9ddf8 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -1398,7 +1398,8 @@ characters as well as `_.+-'.
 (defun notmuch-search (query &optional oldest-first)
   "Run \"notmuch search\" with the given query string and display results."
   (interactive "sNotmuch search: ")
-  (let ((buffer (get-buffer-create (concat "*notmuch-search-" query "*"
+  (let ((buffer (get-buffer-create (concat "*notmuch-search-" query "*")))
+   (oldest-first (if current-prefix-arg (not oldest-first) oldest-first)))
 (switch-to-buffer buffer)
 (notmuch-search-mode)
 (set 'notmuch-search-query-string query)
-- 
1.6.6.1

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


[notmuch] [PATCH] notmuch.el: 'F' in search mode takes us to a list of folders.

2010-02-11 Thread David Edmondson
---
 notmuch.el |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 040997e..8f50abe 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -1104,6 +1104,7 @@ matching this search term are shown if non-nil. "
 (define-key map "-" 'notmuch-search-remove-tag)
 (define-key map "+" 'notmuch-search-add-tag)
 (define-key map (kbd "RET") 'notmuch-search-show-thread)
+(define-key map "F" 'notmuch-folder)
 map)
   "Keymap for \"notmuch search\" buffers.")
 (fset 'notmuch-search-mode-map notmuch-search-mode-map)
-- 
1.6.6.1

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


[notmuch] Broken display of a message in emacs

2010-02-11 Thread Michal Sojka
Hi,

recently, I got a message (attached) which is diplayed incorrectly in
emacs GUI. Instead of the message I see direct output of notmuch show
(with ^L characters). I wonder whether it is a porblem of notmuch or it
is because the message does not comform to standards. What do you think?

Michal


Return-Path: 
Received: from max.feld.cvut.cz ([192.168.200.1])
 by aimap (Cyrus v2.3.16) with LMTPA;
 Wed, 10 Feb 2010 15:17:10 +0100
X-Sieve: CMU Sieve 2.3
Received: from localhost (unknown [192.168.200.4])
by max.feld.cvut.cz (Postfix) with ESMTP id 0B08219F3411
for ; Wed, 10 Feb 2010 15:16:57 +0100 (CET)
X-Virus-Scanned: IMAP AMAVIS
Received: from max.feld.cvut.cz ([192.168.200.1])
by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new, port 
10044)
with ESMTP id mG3QV0Ez+PzQ for ;
Wed, 10 Feb 2010 15:16:33 +0100 (CET)
Received: from smtp.su.se (smtp3.su.se [130.237.93.228])
by max.feld.cvut.cz (Postfix) with ESMTP id 5766D19F33B4
for ; Wed, 10 Feb 2010 15:15:57 +0100 (CET)
Received: from localhost (localhost [127.0.0.1])
by smtp.su.se (Postfix) with ESMTP id 6F6663C07A;
Wed, 10 Feb 2010 15:15:57 +0100 (CET)
Received: from smtp.su.se ([127.0.0.1])
 by localhost (smtp3.su.se [127.0.0.1]) (amavisd-new, port 10024) with LMTP
 id 08197-01-41; Wed, 10 Feb 2010 15:15:56 +0100 (CET)
Received: from doppio.foo-projects.org (unknown [130.237.188.210])
by smtp.su.se (Postfix) with ESMTP id 763383C2AF;
Wed, 10 Feb 2010 15:15:50 +0100 (CET)
Received: from doppio.foo-projects.org (localhost [127.0.0.1])
by doppio.foo-projects.org (Postfix) with ESMTP id 3FD629B231;
Wed, 10 Feb 2010 15:15:50 +0100 (CET)
X-Original-To: x...@xfce.org
Delivered-To: x...@xfce.org
Received: from av-in6.su.se (av-in6.su.se [130.237.164.122])
by doppio.foo-projects.org (Postfix) with ESMTP id 9FA0F9B22B
for ; Wed, 10 Feb 2010 15:15:47 +0100 (CET)
Received: from localhost (localhost [127.0.0.1])
by av-in6.su.se (Postfix) with ESMTP id 703A87D33
for ; Wed, 10 Feb 2010 15:15:47 +0100 (CET)
Received: from av-in6.su.se ([127.0.0.1])
by localhost (av-in6.su.se [127.0.0.1]) (amavisd-new, port 10024)
with LMTP id bm0BbyejsODw for ;
Wed, 10 Feb 2010 15:15:45 +0100 (CET)
Received: from mx3.su.se (mx3.su.se [130.237.164.23])
by av-in6.su.se (Postfix) with ESMTP id 5AC1E7CE0
for ; Wed, 10 Feb 2010 15:15:44 +0100 (CET)
Received: from QMTA11.westchester.pa.mail.comcast.net
(qmta11.westchester.pa.mail.comcast.net [76.96.59.211])
by mx3.su.se (Postfix) with ESMTP id 6AF9E7C74
for ; Wed, 10 Feb 2010 15:15:44 +0100 (CET)
Received: from omta13.westchester.pa.mail.comcast.net ([76.96.62.52])
by QMTA11.westchester.pa.mail.comcast.net with comcast
id gDQA1d00317dt5G5BEEgze; Wed, 10 Feb 2010 14:14:40 +
Received: from [192.168.1.100] ([71.230.5.191])
by omta13.westchester.pa.mail.comcast.net with comcast
id gEEg1d00447HBun3ZEEgcn; Wed, 10 Feb 2010 14:14:40 +
Message-ID: <4b72bf4f.7060...@comcast.net>
Date: Wed, 10 Feb 2010 09:14:39 -0500
From: Snood 
User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090706)
MIME-Version: 1.0
To: x...@xfce.org
Subject: Possible to Use Orage on Remote Systems?
X-BeenThere: x...@xfce.org
X-Mailman-Version: 2.1.11
Precedence: list
Reply-To: XFCE general discussion list 
List-Id: XFCE general discussion list 
List-Unsubscribe: ,

List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,

Content-Type: multipart/mixed; boundary="===2073583833=="
Sender: xfce-boun...@xfce.org
Errors-To: xfce-boun...@xfce.org

--===2073583833==
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit






Orage 4.6.1
Debian Squeeze with Xfce (No other DE installed.)

I'm trying to set up and use Orage on a couple of remote systems. I
establish an X session via SSH on them, but if I now type "orage &"
in the terminal window for the remote session, the instance of Orage
running on my local system pops up.


Thinking that the application might not like having two instances of
itself in the local notification tray, I tried turning its notification
tray feature off -- locally and remotely (actually went to the remote
machine). It didn't help. If I try to start orage in a remote terminal,
the local orage application always comes up. If I completely quit the
local Orage instance and try again in the remote terminal, the same
thing happens. The local instance of Orage starts.


First time I've ever seen something like this. I do use other apps like
keepassx that ru

[notmuch] emacs: On getting support for inline images

2010-02-11 Thread Michal Sojka
On Wed, 10 Feb 2010 12:54:52 -0800, Carl Worth  wrote:
> PS. I know that attaching the output of "git format-patch" to a message
> like this isn't the "git way". (That is, you won't get the right result
> by simply piping this message to "git am".) But I really wish it
> were. It seems I often write code in response to an email message and I
> often want to reply to that *message* and incidentally provide a
> patch. The git way, with the commit message in the subject and the first
> part of the body seems backwards to me, (as far as the conversation is
> concerned).

Hi Carl,

this is what scissors line was designed for. At least according to
git-mailinfo(1). "git am -c" should take it into account as well.

I wanted to test this with my previous patch I sent this way, but I get
fatal: corrupt patch at line 27. So I do not know whether it really works.

> PPS. If I did want to construct this message in the "git way", but
> without using git-send-mail, I know how to construct the subject line
> and how to put explanatory text like this below the separator. But what
> am I supposed to do with the commit identifier that appears in an mbox
> "From" line in the format-patch output? I assume this is required for
> "git am -3" to work, but where can I put it in an email message?

I'm not sure whether From line is used for 3 way merge. It seems that
mails produced by git send-email do not contain it. I think that the
index lines just after diff --git could be sufficient for 3 way merge.
Is it correct?

Michal


Re: [notmuch] emacs: On getting support for inline images

2010-02-11 Thread David Edmondson
> PS. I know that attaching the output of "git format-patch" to a message
> like this isn't the "git way". (That is, you won't get the right result
> by simply piping this message to "git am".) But I really wish it
> were. It seems I often write code in response to an email message and I
> often want to reply to that *message* and incidentally provide a
> patch. The git way, with the commit message in the subject and the first
> part of the body seems backwards to me, (as far as the conversation is
> concerned).

How about attaching a message/rfc822 part which contains the patch?
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch