unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* notmuch-insert Fcc handling w/spaces in dir name
@ 2016-10-10 18:17 Keith Amidon
  2016-10-10 19:14 ` Tomi Ollila
  2016-10-10 19:20 ` Mark Walters
  0 siblings, 2 replies; 4+ messages in thread
From: Keith Amidon @ 2016-10-10 18:17 UTC (permalink / raw)
  To: notmuch

I just upgraded to 0.23 and tried out the Fcc handling using notmuch-
insert.  I think this is a significant improvement and I'm excited to
use it.   I have it working successfully for my use case now, but it
did require one workaround that I didn't expect and that seems somewhat
fragile.

The issue is that I'm synchronizing with Gmail and I'd like my sent
mail to be synchronized too.  Therefore I have to insert into the
directory Gmail expects, which is "[Gmail]/Sent Mail".  Notice the
space in the directory name.

I was able to make this work by setting notmuch-fcc-dirs to:

   "\"[Gmail]/Sent Mail\" +sent -inbox -unread"

This works because the Fcc handling constructs a shell command to run
by just appending the notmuch-fcc-dirs value to (in the simple case)
"notmuch-insert --folder=", so the extra double quotes in my notmuch-
fcc-dirs value quote things appropriately at the shell level.

While this works, depending on passing through shell quoting seems very
fragile.  Changes in the implementation could break this solution
without it being obvious why.  It seems like it would be better if the
notmuch-fcc-dirs value could be something like:

    ("[Gmail]/Sent Mail" "+sent" "-inbox" "-unread")

Then the code could generate the shell command with appropriate
quoting.  I took a quick look at implementing this but it looked more
complicated then I had time to invested right now.  I thought it would
be good to get the issue out for discussion ASAP since this new
functionality was just released.

      Cheers!   Keith

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: notmuch-insert Fcc handling w/spaces in dir name
  2016-10-10 18:17 notmuch-insert Fcc handling w/spaces in dir name Keith Amidon
@ 2016-10-10 19:14 ` Tomi Ollila
  2016-10-10 19:20 ` Mark Walters
  1 sibling, 0 replies; 4+ messages in thread
From: Tomi Ollila @ 2016-10-10 19:14 UTC (permalink / raw)
  To: Keith Amidon, notmuch

On Mon, Oct 10 2016, Keith Amidon <camalot@picnicpark.org> wrote:

> I just upgraded to 0.23 and tried out the Fcc handling using notmuch-
> insert.  I think this is a significant improvement and I'm excited to
> use it.   I have it working successfully for my use case now, but it
> did require one workaround that I didn't expect and that seems somewhat
> fragile.
>
> The issue is that I'm synchronizing with Gmail and I'd like my sent
> mail to be synchronized too.  Therefore I have to insert into the
> directory Gmail expects, which is "[Gmail]/Sent Mail".  Notice the
> space in the directory name.
>
> I was able to make this work by setting notmuch-fcc-dirs to:
>
>    "\"[Gmail]/Sent Mail\" +sent -inbox -unread"
>
> This works because the Fcc handling constructs a shell command to run
> by just appending the notmuch-fcc-dirs value to (in the simple case)
> "notmuch-insert --folder=", so the extra double quotes in my notmuch-
> fcc-dirs value quote things appropriately at the shell level.
>
> While this works, depending on passing through shell quoting seems very
> fragile.  Changes in the implementation could break this solution
> without it being obvious why.  It seems like it would be better if the
> notmuch-fcc-dirs value could be something like:
>
>     ("[Gmail]/Sent Mail" "+sent" "-inbox" "-unread")
>
> Then the code could generate the shell command with appropriate
> quoting.

Actually it looks like (also by quick look) that the elisp code does
not generate shell command with appropriate quoting, but first
splits the line with (split-string-and-unquote fcc-header) (*) and then
creates command line arguments based on that list...

(*) line 235 in notmuch-maildir-fcc.el

so, it could be somewhat trivial to allow fcc-header to be either
string or list -- and in the latter case use something like you presented
above…

Tomi





> I took a quick look at implementing this but it looked more
> complicated then I had time to invested right now.  I thought it would
> be good to get the issue out for discussion ASAP since this new
> functionality was just released.
>
>       Cheers!   Keith
>
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: notmuch-insert Fcc handling w/spaces in dir name
  2016-10-10 18:17 notmuch-insert Fcc handling w/spaces in dir name Keith Amidon
  2016-10-10 19:14 ` Tomi Ollila
@ 2016-10-10 19:20 ` Mark Walters
  2016-10-11  3:37   ` Keith Amidon
  1 sibling, 1 reply; 4+ messages in thread
From: Mark Walters @ 2016-10-10 19:20 UTC (permalink / raw)
  To: Keith Amidon, notmuch


On Mon, 10 Oct 2016, Keith Amidon <camalot@picnicpark.org> wrote:
> I just upgraded to 0.23 and tried out the Fcc handling using notmuch-
> insert.  I think this is a significant improvement and I'm excited to
> use it.   I have it working successfully for my use case now, but it
> did require one workaround that I didn't expect and that seems somewhat
> fragile.
>
> The issue is that I'm synchronizing with Gmail and I'd like my sent
> mail to be synchronized too.  Therefore I have to insert into the
> directory Gmail expects, which is "[Gmail]/Sent Mail".  Notice the
> space in the directory name.
>
> I was able to make this work by setting notmuch-fcc-dirs to:
>
>    "\"[Gmail]/Sent Mail\" +sent -inbox -unread"

That is correct and this should probably be documented.

> This works because the Fcc handling constructs a shell command to run
> by just appending the notmuch-fcc-dirs value to (in the simple case)
> "notmuch-insert --folder=", so the extra double quotes in my notmuch-
> fcc-dirs value quote things appropriately at the shell level.

I don't think this is correct. I think the fcc line gets split using
split-string-and-unquote and passes the arguments to notmuch insert
using call-process; I don't think it goes via shell.

> While this works, depending on passing through shell quoting seems very
> fragile.  Changes in the implementation could break this solution
> without it being obvious why.  It seems like it would be better if the
> notmuch-fcc-dirs value could be something like:
>
>     ("[Gmail]/Sent Mail" "+sent" "-inbox" "-unread")

This is possible. However, in the current form it is possible for the
user to edit the fcc header before sending, and that has to be a
string.

Now, we could do as you suggest, and use combine-and-quote-strings to
make the fcc header.

Note, it is going to make things pretty complex if we still want to
allow the folder to specified based on the from address.

> Then the code could generate the shell command with appropriate
> quoting.  I took a quick look at implementing this but it looked more
> complicated then I had time to invested right now.  I thought it would
> be good to get the issue out for discussion ASAP since this new
> functionality was just released.

Thanks: yes if we want to do the above it should be soon.

Best wishes

Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: notmuch-insert Fcc handling w/spaces in dir name
  2016-10-10 19:20 ` Mark Walters
@ 2016-10-11  3:37   ` Keith Amidon
  0 siblings, 0 replies; 4+ messages in thread
From: Keith Amidon @ 2016-10-11  3:37 UTC (permalink / raw)
  To: Mark Walters, notmuch

On Mon, 2016-10-10 at 20:20 +0100, Mark Walters wrote:
> On Mon, 10 Oct 2016, Keith Amidon <camalot@picnicpark.org> wrote:
> > 
> > I was able to make this work by setting notmuch-fcc-dirs to:
> > 
> >    "\"[Gmail]/Sent Mail\" +sent -inbox -unread"
> 
> That is correct and this should probably be documented.

After Mark and Tomi's hints I read the code more closely and really
understand why my setting actually works and why this is actually an
intended behavior.  Given that it doesn't actually depend on passing
through the shell quoting, supports oddball folder names with spaces in
them, and makes it easy to continue to support sender-based Fcc
selection (which I also expect to want to use eventually), I'm happy
with it as is.

I'll send a suggested documentation patch to the list to make it easier
to discover the behavior shortly.

      Thanks for the help!    --- Keith

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-10-11  3:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-10 18:17 notmuch-insert Fcc handling w/spaces in dir name Keith Amidon
2016-10-10 19:14 ` Tomi Ollila
2016-10-10 19:20 ` Mark Walters
2016-10-11  3:37   ` Keith Amidon

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).