[PATCH] emacs: Show cleaner addresses during message display.

2010-11-05 Thread David Edmondson
Remove double quotes and flatten "foo at bar.com " to
"foo at bar.com".
---
 emacs/notmuch-show.el |   30 --
 1 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 07cf846..2838968 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -26,6 +26,7 @@
 (require 'message)
 (require 'mm-decode)
 (require 'mailcap)
+(require 'mail-parse)

 (require 'notmuch-lib)
 (require 'notmuch-query)
@@ -204,12 +205,26 @@ same as that of the previous message."
 'face 'notmuch-tag-face)
 ")"))

+(defun notmuch-show-clean-address (parsed-address)
+  "Clean a single email address for display."
+  (let ((address (car parsed-address))
+   (name (cdr parsed-address)))
+;; If the address is 'foo at bar.com ' then show just
+;; 'foo at bar.com'.
+(when (string= name address)
+  (setq name nil))
+
+(if (not name)
+   address
+  (concat name " <" address ">"
+
 (defun notmuch-show-insert-headerline (headers date tags depth)
   "Insert a notmuch style headerline based on HEADERS for a
 message at DEPTH in the current thread."
   (let ((start (point)))
 (insert (notmuch-show-spaces-n depth)
-   (plist-get headers :From)
+   (notmuch-show-clean-address
+(mail-header-parse-address (plist-get headers :From)))
" ("
date
") ("
@@ -220,7 +235,18 @@ message at DEPTH in the current thread."

 (defun notmuch-show-insert-header (header header-value)
   "Insert a single header."
-  (insert header ": " header-value "\n"))
+  (insert header ": "
+ (cond
+  ((or (string= "To" header)
+   (string= "Cc" header)
+   (string= "Bcc" header)
+   (string= "From" header))
+   (mapconcat 'notmuch-show-clean-address
+  (mail-header-parse-addresses header-value)
+  ", "))
+  (t
+   header-value))
+ "\n"))

 (defun notmuch-show-insert-headers (headers)
   "Insert the headers of the current message."
-- 
1.7.2.3



[PATCH] emacs: Add `notmuch-show-elide-same-subject', controlling the appearance of collapsed messages in notmuch-show mode.

2010-11-05 Thread Carl Worth
On Fri,  5 Nov 2010 09:50:15 +, David Edmondson  wrote:
> If `notmuch-show-elide-same-subject' is set to `t' then collapsed
> messages do not show a "Subject:" line if the subject is the same as
> that of the previous message.

Sounds cool. Thanks! (Will test and merge later.)

> +(defcustom notmuch-show-elide-same-subject nil
> +  "Do not show the subject of a collapsed message if it is the
> +same as that of the previous message."

There seems to be a compulsion on the part of some patch submitters to
not change the status quo of the interface. Let's stop doing that
please. Almost all new features that are proposed are strict
improvements, and as such they should be enabled by default, (and
perhaps even unconditional in some cases).

I really want to avoid the situation of "Oh, default notmuch-emacs is a
piece of junk---but if you tune a dozen knobs in the configuration, then
it starts to work well".

So lets start turning more improvements on by default.

Thanks,

-Carl

-- 
carl.d.worth at intel.com
-- 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/20101105/4a83b953/attachment.pgp>


Emacs UI improvement suggestion

2010-11-05 Thread Carl Worth
On Fri, 05 Nov 2010 10:36:32 +0100, Sebastian Spaeth  
wrote:
> But thanks for the key hint, it's not listed on the '?' page...

Oops. I need to fix that.

> C-u often appears as black magic to this emacs user.

I've got some strange plans for our emacs interface. The idea is to
support things that emacs users would expect (like C-u), but to also do
things in a way that would be perhaps more natural, (for users who don't
use emacs except for notmuch).

For example, in this specific case I plan to make the '*' keybinding act
as a prefix modifier to make the following command operate on all
messages. So, for example, you would have:

|   Pipe the current message to an external command
* | Pipe all open messages to an external command
RET Hide/show the current message
* RET   Hide/show all messages

I think this will fit in well with existing uses of '*' in the
interface, and also bring in some missing functionality in some cases.

-Carl

-- 
carl.d.worth at intel.com
-- 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/20101105/02b45c7e/attachment.pgp>


Emacs UI improvement suggestion

2010-11-05 Thread Sebastian Spaeth
> Does `C-u M-RET' help?

mmh, that "closes" all open mails in this thread. pressing the same keys
does not open them again. Not sure if that would help me a lot :)

But thanks for the key hint, it's not listed on the '?' page...

C-u often appears as black magic to this emacs user.
Sebastian
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20101105/2e498e11/attachment.pgp>


[PATCH] emacs: Add `notmuch-show-elide-same-subject', controlling the appearance of collapsed messages in notmuch-show mode.

2010-11-05 Thread David Edmondson
If `notmuch-show-elide-same-subject' is set to `t' then collapsed
messages do not show a "Subject:" line if the subject is the same as
that of the previous message.
---
 emacs/notmuch-show.el |   38 --
 1 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 7ec6aa5..07cf846 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -58,6 +58,12 @@ any given message."
   :group 'notmuch
   :type 'boolean)

+(defcustom notmuch-show-elide-same-subject nil
+  "Do not show the subject of a collapsed message if it is the
+same as that of the previous message."
+  :group 'notmuch
+  :type 'boolean)
+
 (defcustom notmuch-show-relative-dates t
   "Display relative dates in the message summary line."
   :group 'notmuch
@@ -381,17 +387,24 @@ current buffer, if possible."
 (defun notmuch-show-make-symbol (type)
   (make-symbol (concat "notmuch-show-" type)))

+(defun notmuch-show-strip-re (string)
+  (replace-regexp-in-string "^\\([Rr]e: *\\)+" "" string))
+
+(defvar notmuch-show-previous-subject "")
+(make-variable-buffer-local 'notmuch-show-previous-subject)
+
 (defun notmuch-show-insert-msg (msg depth)
   "Insert the message MSG at depth DEPTH in the current thread."
-  (let ((headers (plist-get msg :headers))
-   ;; Indentation causes the buffer offset of the start/end
-   ;; points to move, so we must use markers.
-   message-start message-end
-   content-start content-end
-   headers-start headers-end
-   body-start body-end
-   (headers-invis-spec (notmuch-show-make-symbol "header"))
-   (message-invis-spec (notmuch-show-make-symbol "message")))
+  (let* ((headers (plist-get msg :headers))
+;; Indentation causes the buffer offset of the start/end
+;; points to move, so we must use markers.
+message-start message-end
+content-start content-end
+headers-start headers-end
+body-start body-end
+(headers-invis-spec (notmuch-show-make-symbol "header"))
+(message-invis-spec (notmuch-show-make-symbol "message"))
+(bare-subject (notmuch-show-strip-re (plist-get headers :Subject

 ;; Set `buffer-invisibility-spec' to `nil' (a list), otherwise
 ;; removing items from `buffer-invisibility-spec' (which is what
@@ -428,10 +441,15 @@ current buffer, if possible."
 (insert "\n")
 (save-excursion
   (goto-char content-start)
-  (forward-line 1)
+  (when (and notmuch-show-elide-same-subject
+(not (string= notmuch-show-previous-subject
+  bare-subject)))
+   (forward-line 1))
   (setq headers-start (point-marker)))
 (setq headers-end (point-marker))

+(setq notmuch-show-previous-subject bare-subject)
+
 (setq body-start (point-marker))
 (notmuch-show-insert-body msg (plist-get msg :body) depth)
 ;; Ensure that the body ends with a newline.
-- 
1.7.2.3



[PATCH] emacs: Do not color non-matching authors by tag

2010-11-05 Thread Michal Sojka
On Fri, 05 Nov 2010, Michal Sojka wrote:
> On Thu, 04 Nov 2010, David Edmondson wrote:
> > On Thu, 04 Nov 2010 15:12:53 +0100, Michal Sojka  
> > wrote:
> > > > Michal, was this addressed by the patch that Carl recently merged?
> > > > (Commit f99ad42da03afd638bfdfdea92d1cbdd3b510b8f in my copy of the
> > > > repository.)
> > > 
> > > Unfortunately not. In your patch, the overlay changes the color/face of 
> > > the
> > > whole line while my patch change the color/face of all parts of the line
> > > except for non-matching authors. With my patch non-matched autors were
> > 
> > I understand now.
> 
> > 
> > This seems somewhat like a policy decision, though. If I indicate that I
> > want the foreground text for a particular line to be red, should the
> > formatting of non-matching authors override that?
> > 
> > (My own approach has been to have `notmuch-search-line-faces' always
> > specify a background colour whereas
> > `notmuch-search-non-matching-authors' (or any of the columnar faces)
> > specify a foreground colour and/or slant.)
> 
> And now I even understand your patch. That's exactly what I wanted.
> Nice. I thought that overlays change completely the face of the line,
> hiding any faces "under" the overlay. Now I see, that
> notmuch-search-line-faces faces are combined with what was there
> before.

However, it seems that chaning :background in notmuch-search-line-faces
collides somewhat with hl-line-mode. If I move the point down to the
line with changed background, the line is not highlited. Only if I move
the point upwards, I see the line in green.

-Michal


[PATCH] emacs: Do not color non-matching authors by tag

2010-11-05 Thread Michal Sojka
On Thu, 04 Nov 2010, David Edmondson wrote:
> On Thu, 04 Nov 2010 15:12:53 +0100, Michal Sojka  
> wrote:
> > > Michal, was this addressed by the patch that Carl recently merged?
> > > (Commit f99ad42da03afd638bfdfdea92d1cbdd3b510b8f in my copy of the
> > > repository.)
> > 
> > Unfortunately not. In your patch, the overlay changes the color/face of the
> > whole line while my patch change the color/face of all parts of the line
> > except for non-matching authors. With my patch non-matched autors were
> 
> I understand now.

> 
> This seems somewhat like a policy decision, though. If I indicate that I
> want the foreground text for a particular line to be red, should the
> formatting of non-matching authors override that?
> 
> (My own approach has been to have `notmuch-search-line-faces' always
> specify a background colour whereas
> `notmuch-search-non-matching-authors' (or any of the columnar faces)
> specify a foreground colour and/or slant.)

And now I even understand your patch. That's exactly what I wanted.
Nice. I thought that overlays change completely the face of the line,
hiding any faces "under" the overlay. Now I see, that
notmuch-search-line-faces faces are combined with what was there before.

-Michal



Emacs UI improvement suggestion

2010-11-05 Thread David Edmondson
On Fri, 05 Nov 2010 08:45:27 +0100, Sebastian Spaeth  
wrote:
> One UI improvement I would love is to see the number of unread 
> emails in a thread in notmuch-show view. I often reply to a 
> mail in a thread just to see that there are followup mails that 
> resolve the issue already.
> 
> If I had seen that there are more unread mails in that thread 
> (or at least that branch of the thread), I would read those first 
> before hitting reply.
> 
> What do others think?

Does `C-u M-RET' help?


[PATCH] emacs: Do not color non-matching authors by tag

2010-11-05 Thread David Edmondson
On Fri, 05 Nov 2010 09:17:00 +0100, Michal Sojka  wrote:
> However, it seems that chaning :background in notmuch-search-line-faces
> collides somewhat with hl-line-mode. If I move the point down to the
> line with changed background, the line is not highlited. Only if I move
> the point upwards, I see the line in green.

My `highlight' face uses only underlining :-)

If another way of merging the faces improves things, please do post
another patch.


Emacs UI improvement suggestion

2010-11-05 Thread Sebastian Spaeth
One UI improvement I would love is to see the number of unread 
emails in a thread in notmuch-show view. I often reply to a 
mail in a thread just to see that there are followup mails that 
resolve the issue already.

If I had seen that there are more unread mails in that thread 
(or at least that branch of the thread), I would read those first 
before hitting reply.

What do others think?

Sebastian
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20101105/a68ca8ee/attachment.pgp>


[PATCH 0/4] Maildir synchronization

2010-11-05 Thread Sebastian Spaeth
On Wed, 09 Jun 2010 20:01:15 -0700, Dirk Hohndel wrote:
> I've been using them for a while as well and love the feature, but I
> keep running into situations where notmuch seems to get out of sync
> regarding file names on disk. I haven't done a lot of searching on what
> exactly causes this - but the symptom is that you'll open a message,
> read it and then try to do something on it (like, save an attachment)
> and suddenly are told that the message file on disk can't be found.
> Or that you reply to a message and just as you are trying to send the
> reply things fail for the same reason.

But didn't Michal say that it gets the messages by id rather than
filename now? In that case, this might have gone away...

Sebastian
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20101105/9653c57a/attachment-0001.pgp>


RFC: [PATCH] emacs: Improve the definition and use of `notmuch-fcc-dirs'.

2010-11-05 Thread David Edmondson
On Thu, 04 Nov 2010 18:03:11 -0500, Rob Browning  
wrote:
> If you're going to go that far, you might want to allow a function (or
> form) too (a-la gnus).

Please, feel free. I'm a bcc-kinda-guy myself.


[PATCH] emacs: Improve the definition and use of `notmuch-fcc-dirs'.

2010-11-05 Thread David Edmondson
Re-work the declaration and definition of `notmuch-fcc-dirs'. The
variable now allows three types of values:

- nil: no Fcc header is added,

- a string: the value of `notmuch-fcc-dirs' is the name of the
  folder to use,

- a list: the folder is chosen based on the From address of the
  current message using a list of regular expressions and
  corresponding folders:

 ((\"Sebastian at SSpaeth.de\" . \"privat\")
  (\"spaetz at sspaeth.de\" . \"OUTBOX.OSS\")
  (\".*\" . \"defaultinbox\"))

  If none of the regular expressions match the From address, no
  Fcc header will be added.
---

Fix the detection of old style settings.

 emacs/notmuch-maildir-fcc.el |  138 --
 1 files changed, 79 insertions(+), 59 deletions(-)

diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index 693d8d4..8a93d24 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -16,6 +16,7 @@
 ;; To use this as the fcc handler for message-mode,
 ;; customize the notmuch-fcc-dirs variable

+(require 'cl-seq)
 (require 'message)

 (require 'notmuch-lib)
@@ -23,41 +24,40 @@
 (defvar notmuch-maildir-fcc-count 0)

 (defcustom notmuch-fcc-dirs "sent"
- "Determines the maildir directory to save outgoing mails in.
+ "Determines the maildir directory in which to save outgoing mail.

- If set to non-nil, this will cause message mode to file your
- mail in the specified directory (fcc).
+Three types of values are permitted:

- It is either a string if you only need one fcc directory or a
- list if they depend on your From address (see example).
+- nil: no Fcc header is added,

- In the former case it is a string such as \"INBOX.Sent\".
+- a string: the value of `notmuch-fcc-dirs' is the name of the
+  folder to use,

- In the fancy setup, where you want different outboxes depending
- on your From address, you supply a list like this:
+- a list: the folder is chosen based on the From address of the
+  current message using a list of regular expressions and
+  corresponding folders:

- ((\"defaultinbox\")
-  (\"Sebastian Spaeth \" . \"privat\")
-  (\"Sebastian Spaeth \" . \"OUTBOX.OSS\")
- )
+ ((\"Sebastian at SSpaeth.de\" . \"privat\")
+  (\"spaetz at sspaeth.de\" . \"OUTBOX.OSS\")
+  (\".*\" . \"defaultinbox\"))

- The outbox that matches a key (case insensitive) will be
- used. The first entry is used as a default fallback when nothing
- else matches.
+  If none of the regular expressions match the From address, no
+  Fcc header will be added.

- In all cases, a relative FCC directory will be understood to
- specify a directory within the notmuch mail store, (as set by
- the database.path option in the notmuch configuration file).
+In all cases, a relative FCC directory will be understood to
+specify a directory within the notmuch mail store, (as set by
+the database.path option in the notmuch configuration file).

- You will be prompted to create the directory if it does not exist yet when 
- sending a mail.
-
- This function will not modify the headers if there is a FCC
- header, but will check that the target directory exists."
+You will be prompted to create the directory if it does not exist
+yet when sending a mail."

  :require 'notmuch-fcc-initialization
  :group 'notmuch
-)
+ :type '(choice
+(const :tag "No FCC header" nil)
+(string :tag "A single folder")
+(repeat :tag "A folder based on the From header"
+(cons regexp (string :tag "Folder")

 (defun notmuch-fcc-initialization ()
   "If notmuch-fcc-directories is set,
@@ -67,44 +67,64 @@
 (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
+;; add a hook to actually insert the Fcc header when sending
 (add-hook 'message-header-setup-hook 'notmuch-fcc-header-setup))

 (defun notmuch-fcc-header-setup ()
-  "Adds an appropriate fcc header to the current mail buffer
-
-   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
-  (when notmuch-fcc-dirs
-(let (subdir)
-  (if (stringp notmuch-fcc-dirs)
-  ;; notmuch-fcc-dirs is a string, just use it as subdir
-  (setq subdir notmuch-fcc-dirs)
-;; else: it's a list of alists (("sent") ("name1" . "sent1"))
-(setq subdir (cdr (assoc-string (message-fetch-field "from") 
notmuch-fcc-dirs t)))
- ;; if we found no hit, use the first entry as default fallback
- (unless subdir (setq subdir (car (car notmuch-fcc-dirs)
-
-  ;; if there is no fcc header yet, add ours
-  (unless (message-fetch-field "fcc")
-(message-add-header 

Python bindings and Xapian exceptions

2010-11-05 Thread Sebastian Spaeth
On Thu, 04 Nov 2010 12:31:48 -0700, Carl Worth  wrote:
> On Tue, 15 Jun 2010 11:03:55 +0200, "Sebastian Spaeth" wrote:
> > >   A Xapian exception occurred finding message: The revision being read
> > >   has been discarded - you should call Xapian::Database::reopen() and
> > >   retry the operation.
> > > It makes the Python bindings almost useless to me.

> > The proper fix, and a reason why I am not immediately hacking around in
> > the python bindings is that notmuch the library would actually return a
> > proper error value rather than print to stderr and quit.
> 
> For this particular case, I think the correct thing is for the library
> to simply do the reopen() itself.

That would already help a lot. But if there is for example a background
task running that modifies the database a lot, reopening once might
still not suffice. So we should try to reopen, yes. But if it still does
not work after a reopen, we still need the possibility to fail
gracefully while notifying the user about the failure.

> But for exceptions in general, yes the notmuch library does need to be
> fixed to allow the caller of functions to distinguish between things
> like "no matches found" and "an exception occurred, so it's unknown if
> any messages match the search". That's a general class of library
> interface bugs that all need to be fixed.

It does return a status for many operations already which is good. THere
are only a few cases where it does not and the only one I know off-hand
is find_message() which is useless at the moment as its result cannot be
trusted. 

What would probably also be good if notmuchlib could export a
database.reopen() command so bindings can reopen the database in case
they need to, without having to have xapian development headers
installed and linking to it directly. Of course if libnotmuch reopens
itself, that would not be required.

Sebastian
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20101105/2b943e42/attachment.pgp>


[PATCH] emacs: Do not color non-matching authors by tag

2010-11-05 Thread Jameson Rollins
On Fri, 05 Nov 2010 09:17:00 +0100, Michal Sojka  wrote:
> However, it seems that chaning :background in notmuch-search-line-faces
> collides somewhat with hl-line-mode. If I move the point down to the
> line with changed background, the line is not highlited. Only if I move
> the point upwards, I see the line in green.

Hey, Michal.  I and some others have noticed this as well.  Not sure
what's going on, though.

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/20101105/01dc06c5/attachment.pgp>


Emacs UI improvement suggestion

2010-11-05 Thread Jameson Rollins
On Fri, 05 Nov 2010 08:45:27 +0100, Sebastian Spaeth  
wrote:
> One UI improvement I would love is to see the number of unread 
> emails in a thread in notmuch-show view. I often reply to a 
> mail in a thread just to see that there are followup mails that 
> resolve the issue already.
> 
> If I had seen that there are more unread mails in that thread 
> (or at least that branch of the thread), I would read those first 
> before hitting reply.
> 
> What do others think?

Hey, Sebastian.  Try looking at notmuch-search-line-faces (not very well
named, my fault) which sets the face of search lines based on tags.
I've been using the following setting:

(setq notmuch-search-line-faces
  '(("delete" . '(:background "grey8"))
("unread" . '(:weight bold

Threads with unread messages show up in bold, which makes them pretty
easy to identify.  I also bind a key to filter

"tag:unread and not tag:delete"

which allows me to easily pop view the unread messages.

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/20101105/146dc2bd/attachment.pgp>


Re: Python bindings and Xapian exceptions

2010-11-05 Thread Sebastian Spaeth
On Thu, 04 Nov 2010 12:31:48 -0700, Carl Worth cwo...@cworth.org wrote:
 On Tue, 15 Jun 2010 11:03:55 +0200, Sebastian Spaeth wrote:
 A Xapian exception occurred finding message: The revision being read
 has been discarded - you should call Xapian::Database::reopen() and
 retry the operation.
   It makes the Python bindings almost useless to me.

  The proper fix, and a reason why I am not immediately hacking around in
  the python bindings is that notmuch the library would actually return a
  proper error value rather than print to stderr and quit.
 
 For this particular case, I think the correct thing is for the library
 to simply do the reopen() itself.

That would already help a lot. But if there is for example a background
task running that modifies the database a lot, reopening once might
still not suffice. So we should try to reopen, yes. But if it still does
not work after a reopen, we still need the possibility to fail
gracefully while notifying the user about the failure.

 But for exceptions in general, yes the notmuch library does need to be
 fixed to allow the caller of functions to distinguish between things
 like no matches found and an exception occurred, so it's unknown if
 any messages match the search. That's a general class of library
 interface bugs that all need to be fixed.

It does return a status for many operations already which is good. THere
are only a few cases where it does not and the only one I know off-hand
is find_message() which is useless at the moment as its result cannot be
trusted. 

What would probably also be good if notmuchlib could export a
database.reopen() command so bindings can reopen the database in case
they need to, without having to have xapian development headers
installed and linking to it directly. Of course if libnotmuch reopens
itself, that would not be required.

Sebastian


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


Re: [PATCH 0/4] Maildir synchronization

2010-11-05 Thread Sebastian Spaeth
On Wed, 09 Jun 2010 20:01:15 -0700, Dirk Hohndel wrote:
 I've been using them for a while as well and love the feature, but I
 keep running into situations where notmuch seems to get out of sync
 regarding file names on disk. I haven't done a lot of searching on what
 exactly causes this - but the symptom is that you'll open a message,
 read it and then try to do something on it (like, save an attachment)
 and suddenly are told that the message file on disk can't be found.
 Or that you reply to a message and just as you are trying to send the
 reply things fail for the same reason.

But didn't Michal say that it gets the messages by id rather than
filename now? In that case, this might have gone away...

Sebastian


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


Emacs UI improvement suggestion

2010-11-05 Thread Sebastian Spaeth
One UI improvement I would love is to see the number of unread 
emails in a thread in notmuch-show view. I often reply to a 
mail in a thread just to see that there are followup mails that 
resolve the issue already.

If I had seen that there are more unread mails in that thread 
(or at least that branch of the thread), I would read those first 
before hitting reply.

What do others think?

Sebastian


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


Re: [PATCH] emacs: Do not color non-matching authors by tag

2010-11-05 Thread Michal Sojka
On Fri, 05 Nov 2010, Michal Sojka wrote:
 On Thu, 04 Nov 2010, David Edmondson wrote:
  On Thu, 04 Nov 2010 15:12:53 +0100, Michal Sojka sojk...@fel.cvut.cz 
  wrote:
Michal, was this addressed by the patch that Carl recently merged?
(Commit f99ad42da03afd638bfdfdea92d1cbdd3b510b8f in my copy of the
repository.)
   
   Unfortunately not. In your patch, the overlay changes the color/face of 
   the
   whole line while my patch change the color/face of all parts of the line
   except for non-matching authors. With my patch non-matched autors were
  
  I understand now.
 
  
  This seems somewhat like a policy decision, though. If I indicate that I
  want the foreground text for a particular line to be red, should the
  formatting of non-matching authors override that?
  
  (My own approach has been to have `notmuch-search-line-faces' always
  specify a background colour whereas
  `notmuch-search-non-matching-authors' (or any of the columnar faces)
  specify a foreground colour and/or slant.)
 
 And now I even understand your patch. That's exactly what I wanted.
 Nice. I thought that overlays change completely the face of the line,
 hiding any faces under the overlay. Now I see, that
 notmuch-search-line-faces faces are combined with what was there
 before.

However, it seems that chaning :background in notmuch-search-line-faces
collides somewhat with hl-line-mode. If I move the point down to the
line with changed background, the line is not highlited. Only if I move
the point upwards, I see the line in green.

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


[PATCH] emacs: Improve the definition and use of `notmuch-fcc-dirs'.

2010-11-05 Thread David Edmondson
Re-work the declaration and definition of `notmuch-fcc-dirs'. The
variable now allows three types of values:

- nil: no Fcc header is added,

- a string: the value of `notmuch-fcc-dirs' is the name of the
  folder to use,

- a list: the folder is chosen based on the From address of the
  current message using a list of regular expressions and
  corresponding folders:

 ((\sebast...@sspaeth.de\ . \privat\)
  (\spa...@sspaeth.de\ . \OUTBOX.OSS\)
  (\.*\ . \defaultinbox\))

  If none of the regular expressions match the From address, no
  Fcc header will be added.
---

Fix the detection of old style settings.

 emacs/notmuch-maildir-fcc.el |  138 --
 1 files changed, 79 insertions(+), 59 deletions(-)

diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index 693d8d4..8a93d24 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -16,6 +16,7 @@
 ;; To use this as the fcc handler for message-mode,
 ;; customize the notmuch-fcc-dirs variable
 
+(require 'cl-seq)
 (require 'message)
 
 (require 'notmuch-lib)
@@ -23,41 +24,40 @@
 (defvar notmuch-maildir-fcc-count 0)
 
 (defcustom notmuch-fcc-dirs sent
- Determines the maildir directory to save outgoing mails in.
+ Determines the maildir directory in which to save outgoing mail.
 
- If set to non-nil, this will cause message mode to file your
- mail in the specified directory (fcc).
+Three types of values are permitted:
 
- It is either a string if you only need one fcc directory or a
- list if they depend on your From address (see example).
+- nil: no Fcc header is added,
 
- In the former case it is a string such as \INBOX.Sent\.
+- a string: the value of `notmuch-fcc-dirs' is the name of the
+  folder to use,
 
- In the fancy setup, where you want different outboxes depending
- on your From address, you supply a list like this:
+- a list: the folder is chosen based on the From address of the
+  current message using a list of regular expressions and
+  corresponding folders:
 
- ((\defaultinbox\)
-  (\Sebastian Spaeth sebast...@sspaeth.de\ . \privat\)
-  (\Sebastian Spaeth spa...@sspaeth.de\ . \OUTBOX.OSS\)
- )
+ ((\sebast...@sspaeth.de\ . \privat\)
+  (\spa...@sspaeth.de\ . \OUTBOX.OSS\)
+  (\.*\ . \defaultinbox\))
 
- The outbox that matches a key (case insensitive) will be
- used. The first entry is used as a default fallback when nothing
- else matches.
+  If none of the regular expressions match the From address, no
+  Fcc header will be added.
 
- In all cases, a relative FCC directory will be understood to
- specify a directory within the notmuch mail store, (as set by
- the database.path option in the notmuch configuration file).
+In all cases, a relative FCC directory will be understood to
+specify a directory within the notmuch mail store, (as set by
+the database.path option in the notmuch configuration file).
 
- You will be prompted to create the directory if it does not exist yet when 
- sending a mail.
-
- This function will not modify the headers if there is a FCC
- header, but will check that the target directory exists.
+You will be prompted to create the directory if it does not exist
+yet when sending a mail.
 
  :require 'notmuch-fcc-initialization
  :group 'notmuch
-)
+ :type '(choice
+(const :tag No FCC header nil)
+(string :tag A single folder)
+(repeat :tag A folder based on the From header
+(cons regexp (string :tag Folder)
 
 (defun notmuch-fcc-initialization ()
   If notmuch-fcc-directories is set,
@@ -67,44 +67,64 @@
 (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
+;; add a hook to actually insert the Fcc header when sending
 (add-hook 'message-header-setup-hook 'notmuch-fcc-header-setup))
 
 (defun notmuch-fcc-header-setup ()
-  Adds an appropriate fcc header to the current mail buffer
-
-   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
-  (when notmuch-fcc-dirs
-(let (subdir)
-  (if (stringp notmuch-fcc-dirs)
-  ;; notmuch-fcc-dirs is a string, just use it as subdir
-  (setq subdir notmuch-fcc-dirs)
-;; else: it's a list of alists ((sent) (name1 . sent1))
-(setq subdir (cdr (assoc-string (message-fetch-field from) 
notmuch-fcc-dirs t)))
- ;; if we found no hit, use the first entry as default fallback
- (unless subdir (setq subdir (car (car notmuch-fcc-dirs)
-
-  ;; if there is no fcc header yet, add ours
-  (unless (message-fetch-field fcc)
-(message-add-header (concat Fcc: 
-

[PATCH] emacs: Add `notmuch-show-elide-same-subject', controlling the appearance of collapsed messages in notmuch-show mode.

2010-11-05 Thread David Edmondson
If `notmuch-show-elide-same-subject' is set to `t' then collapsed
messages do not show a Subject: line if the subject is the same as
that of the previous message.
---
 emacs/notmuch-show.el |   38 --
 1 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 7ec6aa5..07cf846 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -58,6 +58,12 @@ any given message.
   :group 'notmuch
   :type 'boolean)
 
+(defcustom notmuch-show-elide-same-subject nil
+  Do not show the subject of a collapsed message if it is the
+same as that of the previous message.
+  :group 'notmuch
+  :type 'boolean)
+
 (defcustom notmuch-show-relative-dates t
   Display relative dates in the message summary line.
   :group 'notmuch
@@ -381,17 +387,24 @@ current buffer, if possible.
 (defun notmuch-show-make-symbol (type)
   (make-symbol (concat notmuch-show- type)))
 
+(defun notmuch-show-strip-re (string)
+  (replace-regexp-in-string ^\\([Rr]e: *\\)+  string))
+
+(defvar notmuch-show-previous-subject )
+(make-variable-buffer-local 'notmuch-show-previous-subject)
+
 (defun notmuch-show-insert-msg (msg depth)
   Insert the message MSG at depth DEPTH in the current thread.
-  (let ((headers (plist-get msg :headers))
-   ;; Indentation causes the buffer offset of the start/end
-   ;; points to move, so we must use markers.
-   message-start message-end
-   content-start content-end
-   headers-start headers-end
-   body-start body-end
-   (headers-invis-spec (notmuch-show-make-symbol header))
-   (message-invis-spec (notmuch-show-make-symbol message)))
+  (let* ((headers (plist-get msg :headers))
+;; Indentation causes the buffer offset of the start/end
+;; points to move, so we must use markers.
+message-start message-end
+content-start content-end
+headers-start headers-end
+body-start body-end
+(headers-invis-spec (notmuch-show-make-symbol header))
+(message-invis-spec (notmuch-show-make-symbol message))
+(bare-subject (notmuch-show-strip-re (plist-get headers :Subject
 
 ;; Set `buffer-invisibility-spec' to `nil' (a list), otherwise
 ;; removing items from `buffer-invisibility-spec' (which is what
@@ -428,10 +441,15 @@ current buffer, if possible.
 (insert \n)
 (save-excursion
   (goto-char content-start)
-  (forward-line 1)
+  (when (and notmuch-show-elide-same-subject
+(not (string= notmuch-show-previous-subject
+  bare-subject)))
+   (forward-line 1))
   (setq headers-start (point-marker)))
 (setq headers-end (point-marker))
 
+(setq notmuch-show-previous-subject bare-subject)
+
 (setq body-start (point-marker))
 (notmuch-show-insert-body msg (plist-get msg :body) depth)
 ;; Ensure that the body ends with a newline.
-- 
1.7.2.3

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


Re: Emacs UI improvement suggestion

2010-11-05 Thread Jameson Rollins
On Fri, 05 Nov 2010 08:45:27 +0100, Sebastian Spaeth sebast...@sspaeth.de 
wrote:
 One UI improvement I would love is to see the number of unread 
 emails in a thread in notmuch-show view. I often reply to a 
 mail in a thread just to see that there are followup mails that 
 resolve the issue already.
 
 If I had seen that there are more unread mails in that thread 
 (or at least that branch of the thread), I would read those first 
 before hitting reply.
 
 What do others think?

Hey, Sebastian.  Try looking at notmuch-search-line-faces (not very well
named, my fault) which sets the face of search lines based on tags.
I've been using the following setting:

(setq notmuch-search-line-faces
  '((delete . '(:background grey8))
(unread . '(:weight bold

Threads with unread messages show up in bold, which makes them pretty
easy to identify.  I also bind a key to filter

tag:unread and not tag:delete

which allows me to easily pop view the unread messages.

jamie.


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


Re: [PATCH] emacs: Do not color non-matching authors by tag

2010-11-05 Thread Jameson Rollins
On Fri, 05 Nov 2010 09:17:00 +0100, Michal Sojka sojk...@fel.cvut.cz wrote:
 However, it seems that chaning :background in notmuch-search-line-faces
 collides somewhat with hl-line-mode. If I move the point down to the
 line with changed background, the line is not highlited. Only if I move
 the point upwards, I see the line in green.

Hey, Michal.  I and some others have noticed this as well.  Not sure
what's going on, though.

jamie.


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