Would a more sophisticated notmuch-fcc-dirs be acceptable?

2010-09-27 Thread Sebastian Spaeth
On 2010-09-27, Rob Browning wrote:
> I'd like to be able to archive to a destination based on the year, i.e.:
> 
>   (concat "sent-" (format-time-string "%Y"))

At it seems that this can potentially very confusing for
configuring. Wouldn't it be nicest if that config variable were able to
take a function that returns one or multiple FCC paths? This way people
could become really creative in their .emacs.

Personally, I would love if we could keep the default configuration (1
FCC dir that never changes) as simple as a string value. I have no
problems with the second patch that you sent (ability to use absolute
paths). That having said, if you have nice patches that cworth is
willing to accept, any solution is good to me.

Sebastian


Re: Would a more sophisticated notmuch-fcc-dirs be acceptable?

2010-09-27 Thread Sebastian Spaeth
On 2010-09-27, Rob Browning wrote:
> I'd like to be able to archive to a destination based on the year, i.e.:
> 
>   (concat "sent-" (format-time-string "%Y"))

At it seems that this can potentially very confusing for
configuring. Wouldn't it be nicest if that config variable were able to
take a function that returns one or multiple FCC paths? This way people
could become really creative in their .emacs.

Personally, I would love if we could keep the default configuration (1
FCC dir that never changes) as simple as a string value. I have no
problems with the second patch that you sent (ability to use absolute
paths). That having said, if you have nice patches that cworth is
willing to accept, any solution is good to me.

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


Would a more sophisticated notmuch-fcc-dirs be acceptable?

2010-09-26 Thread Rob Browning
Rob Browning  writes:

> I'd also like to fcc to a directory outside of message-directory

At least for this part, one possiblity would be to just use the chosen
directory literally (don't prepend message-directory) whenever it's an
absolute path according to file-name-absolute-p.

For example:

diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index 32e7d0d..3c5d6c4 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -87,11 +87,13 @@
  ;; 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: "
-(file-name-as-directory message-directory)
-subdir)))
+  ;; if there is no fcc header yet, add ours
+  (unless (message-fetch-field "fcc")
+(let ((path (if (file-name-absolute-p subdir)
+subdir
+  (concat (file-name-as-directory message-directory)
+  subdir
+  (message-add-header (concat "Fcc: " path

   ;; finally test if fcc points to a valid maildir
   (let ((fcc-header (message-fetch-field "fcc")))


If this seems reasonable, I'd be happy to work up a formal patch.

Thanks
-- 
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4


Would a more sophisticated notmuch-fcc-dirs be acceptable?

2010-09-26 Thread Rob Browning

I'd like to be able to archive to a destination based on the year, i.e.:

  (concat "sent-" (format-time-string "%Y"))

and I'd like for that string to be recomputed for each outgoing message.

I'd also like to fcc to a directory outside of message-directory, and I
imagine that sometimes it might be useful to fcc to more than one
location.

If I have time to work on it, would patches for this sort of thing be
interesting?

Thanks
-- 
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4


Re: Would a more sophisticated notmuch-fcc-dirs be acceptable?

2010-09-26 Thread Rob Browning
Rob Browning  writes:

> I'd also like to fcc to a directory outside of message-directory

At least for this part, one possiblity would be to just use the chosen
directory literally (don't prepend message-directory) whenever it's an
absolute path according to file-name-absolute-p.

For example:

diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index 32e7d0d..3c5d6c4 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -87,11 +87,13 @@
  ;; 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: "
-(file-name-as-directory message-directory)
-subdir)))
+  ;; if there is no fcc header yet, add ours
+  (unless (message-fetch-field "fcc")
+(let ((path (if (file-name-absolute-p subdir)
+subdir
+  (concat (file-name-as-directory message-directory)
+  subdir
+  (message-add-header (concat "Fcc: " path
 
   ;; finally test if fcc points to a valid maildir
   (let ((fcc-header (message-fetch-field "fcc")))


If this seems reasonable, I'd be happy to work up a formal patch.

Thanks
-- 
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Would a more sophisticated notmuch-fcc-dirs be acceptable?

2010-09-26 Thread Rob Browning

I'd like to be able to archive to a destination based on the year, i.e.:

  (concat "sent-" (format-time-string "%Y"))

and I'd like for that string to be recomputed for each outgoing message.

I'd also like to fcc to a directory outside of message-directory, and I
imagine that sometimes it might be useful to fcc to more than one
location.

If I have time to work on it, would patches for this sort of thing be
interesting?

Thanks
-- 
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch