unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* notmuch-emacs: Fcc to top-level directory given by database.path
@ 2017-09-23  9:37 Arun Isaac
  2017-09-23 11:41 ` David Bremner
  0 siblings, 1 reply; 15+ messages in thread
From: Arun Isaac @ 2017-09-23  9:37 UTC (permalink / raw)
  To: notmuch


I am using notmuch-emacs, and I would like to Fcc my sent mail to the
top-level directory given by database.path, instead of using a folder
like "sent" relative to the top-level directory.

The function `notmuch-maildir-notmuch-insert-current-buffer' in
notmuch-maildir-fcc.el calls `notmuch insert' with the `--folder='
argument. I would like it to not do this.

For my immediate purposes, I have overridden
`notmuch-maildir-notmuch-insert-current-buffer' with the following
advice. But, it would be nice if this feature existed out of the box.

(define-advice notmuch-maildir-notmuch-insert-current-buffer
      (:override (folder &optional create tags)
		 insert-into-root)
    (apply 'notmuch-call-notmuch-process
	   :stdin-string (buffer-string)
	   "insert" tags))

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

* Re: notmuch-emacs: Fcc to top-level directory given by database.path
  2017-09-23  9:37 notmuch-emacs: Fcc to top-level directory given by database.path Arun Isaac
@ 2017-09-23 11:41 ` David Bremner
  2017-09-23 12:08   ` Mark Walters
                     ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: David Bremner @ 2017-09-23 11:41 UTC (permalink / raw)
  To: Arun Isaac, notmuch

Arun Isaac <arunisaac@systemreboot.net> writes:

> I am using notmuch-emacs, and I would like to Fcc my sent mail to the
> top-level directory given by database.path, instead of using a folder
> like "sent" relative to the top-level directory.
>
> The function `notmuch-maildir-notmuch-insert-current-buffer' in
> notmuch-maildir-fcc.el calls `notmuch insert' with the `--folder='
> argument. I would like it to not do this.

Do you happen to know if it calls with an empty string as the folder
name? It would be consistent with searching for that to insert at the
top level.

In any case I've noted your feature request/bug-report. It doesn't sound
terribly difficult to change, but it will need someone motivated to
think about all of the related details like updating the test suite and
changing docstrings.

d

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

* Re: notmuch-emacs: Fcc to top-level directory given by database.path
  2017-09-23 11:41 ` David Bremner
@ 2017-09-23 12:08   ` Mark Walters
  2017-09-23 14:52   ` Arun Isaac
  2017-09-30  9:03   ` Jani Nikula
  2 siblings, 0 replies; 15+ messages in thread
From: Mark Walters @ 2017-09-23 12:08 UTC (permalink / raw)
  To: David Bremner, Arun Isaac, notmuch


On Sat, 23 Sep 2017, David Bremner <david@tethera.net> wrote:
> Arun Isaac <arunisaac@systemreboot.net> writes:
>
>> I am using notmuch-emacs, and I would like to Fcc my sent mail to the
>> top-level directory given by database.path, instead of using a folder
>> like "sent" relative to the top-level directory.
>>
>> The function `notmuch-maildir-notmuch-insert-current-buffer' in
>> notmuch-maildir-fcc.el calls `notmuch insert' with the `--folder='
>> argument. I would like it to not do this.
>
> Do you happen to know if it calls with an empty string as the folder
> name? It would be consistent with searching for that to insert at the
> top level.
>
> In any case I've noted your feature request/bug-report. It doesn't sound
> terribly difficult to change, but it will need someone motivated to
> think about all of the related details like updating the test suite and
> changing docstrings.

Alternatively, does just using / as the folder work?

Best wishes

Mark

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

* Re: notmuch-emacs: Fcc to top-level directory given by database.path
  2017-09-23 11:41 ` David Bremner
  2017-09-23 12:08   ` Mark Walters
@ 2017-09-23 14:52   ` Arun Isaac
  2017-09-24 12:14     ` David Bremner
  2017-09-30  9:03   ` Jani Nikula
  2 siblings, 1 reply; 15+ messages in thread
From: Arun Isaac @ 2017-09-23 14:52 UTC (permalink / raw)
  To: notmuch


Mark Walters <markwalters1009@gmail.com> writes:

> Alternatively, does just using / as the folder work?

notmuch complains about absolute paths if / is used as the folder. Look
at function `notmuch-maildir-add-notmuch-insert-style-fcc-header' in
notmuch-maildir-fcc.el.

David Bremner <david@tethera.net> writes:

> Do you happen to know if it calls with an empty string as the folder
> name? It would be consistent with searching for that to insert at the
> top level.

Setting notmuch-fcc-dirs to "\"\"" fails, if that's what you are asking.

I also tried "." as the folder. This works, but if I search using
`notmuch search --output=files ...', the filename is of the form
"database.path/./cur/some.mail.file". This is not so clean.

> In any case I've noted your feature request/bug-report. It doesn't sound
> terribly difficult to change, but it will need someone motivated to
> think about all of the related details like updating the test suite and
> changing docstrings.

I can contribute this patch. Shall I make it such that if the folder
part of `notmuch-fcc-dirs' is an empty string, then `notmuch insert' is
called without a `--folder=' argument?

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

* Re: notmuch-emacs: Fcc to top-level directory given by database.path
  2017-09-23 14:52   ` Arun Isaac
@ 2017-09-24 12:14     ` David Bremner
  2017-09-25 15:25       ` Tomi Ollila
  2017-09-30  6:24       ` Mark Walters
  0 siblings, 2 replies; 15+ messages in thread
From: David Bremner @ 2017-09-24 12:14 UTC (permalink / raw)
  To: Arun Isaac, notmuch

Arun Isaac <arunisaac@systemreboot.net> writes:

>> In any case I've noted your feature request/bug-report. It doesn't sound
>> terribly difficult to change, but it will need someone motivated to
>> think about all of the related details like updating the test suite and
>> changing docstrings.
>
> I can contribute this patch. Shall I make it such that if the folder
> part of `notmuch-fcc-dirs' is an empty string, then `notmuch insert' is
> called without a `--folder=' argument?

Sounds reasonable to me. Any objections Mark?

d

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

* Re: notmuch-emacs: Fcc to top-level directory given by database.path
  2017-09-24 12:14     ` David Bremner
@ 2017-09-25 15:25       ` Tomi Ollila
  2017-09-30  6:24       ` Mark Walters
  1 sibling, 0 replies; 15+ messages in thread
From: Tomi Ollila @ 2017-09-25 15:25 UTC (permalink / raw)
  To: David Bremner, Arun Isaac, notmuch

On Sun, Sep 24 2017, David Bremner wrote:

> Arun Isaac <arunisaac@systemreboot.net> writes:
>
>>> In any case I've noted your feature request/bug-report. It doesn't sound
>>> terribly difficult to change, but it will need someone motivated to
>>> think about all of the related details like updating the test suite and
>>> changing docstrings.
>>
>> I can contribute this patch. Shall I make it such that if the folder
>> part of `notmuch-fcc-dirs' is an empty string, then `notmuch insert' is
>> called without a `--folder=' argument?
>
> Sounds reasonable to me. Any objections Mark?

Will the eventual fate of the --folder argument be decided based on the

Fcc:

header string in Message[Notmuch] mode: buffer ?

i.e. if it is empty, then call notmuch insert w/o --folder argument,
and is absent, don't do fcc  (and e.g. './' would save directly...?)

> d

Tomi

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

* Re: notmuch-emacs: Fcc to top-level directory given by database.path
  2017-09-24 12:14     ` David Bremner
  2017-09-25 15:25       ` Tomi Ollila
@ 2017-09-30  6:24       ` Mark Walters
  2017-10-01 19:06         ` Arun Isaac
  1 sibling, 1 reply; 15+ messages in thread
From: Mark Walters @ 2017-09-30  6:24 UTC (permalink / raw)
  To: David Bremner, Arun Isaac, notmuch

On Sun, 24 Sep 2017, David Bremner <david@tethera.net> wrote:
> Arun Isaac <arunisaac@systemreboot.net> writes:
>
>>> In any case I've noted your feature request/bug-report. It doesn't sound
>>> terribly difficult to change, but it will need someone motivated to
>>> think about all of the related details like updating the test suite and
>>> changing docstrings.
>>
>> I can contribute this patch. Shall I make it such that if the folder
>> part of `notmuch-fcc-dirs' is an empty string, then `notmuch insert' is
>> called without a `--folder=' argument?
>
> Sounds reasonable to me. Any objections Mark?

I am not sure: do we want an empty Fcc header to save the message to the
root folder? (At the moment the insert fails for an empty Fcc header
which isn't good either) In general though are suggesting Fcc header
lines of the form

""

or

"" +sent

save to the root folder?

Apart from the empty header case that sounds fine. I am not sure about
the documentation for it -- the variable is already a little
complicated, so I wouldn't want to clutter it further.

Incidentally, I think "/" is an alternative for the fcc line which
already works, which is "\"/\" in notmuch-fcc-dirs.

Best wishes

Mark

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

* Re: notmuch-emacs: Fcc to top-level directory given by database.path
  2017-09-23 11:41 ` David Bremner
  2017-09-23 12:08   ` Mark Walters
  2017-09-23 14:52   ` Arun Isaac
@ 2017-09-30  9:03   ` Jani Nikula
  2017-10-02 16:29     ` Jani Nikula
                       ` (2 more replies)
  2 siblings, 3 replies; 15+ messages in thread
From: Jani Nikula @ 2017-09-30  9:03 UTC (permalink / raw)
  To: David Bremner, Arun Isaac, notmuch

On Sat, 23 Sep 2017, David Bremner <david@tethera.net> wrote:
> Do you happen to know if it calls with an empty string as the folder
> name? It would be consistent with searching for that to insert at the
> top level.

notmuch insert --folder= or --folder="" does not work:

String argument for option "folder" must be non-empty.
Unrecognized option: --folder=

It seems that our argument parser doesn't accept empty strings at all,
which is a bit of a limitation. It would be logical for the empty string
to work here, and AFAICT the notmuch insert code would handle this if
the argument was let through the parsing.

BR,
Jani.

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

* Re: notmuch-emacs: Fcc to top-level directory given by database.path
  2017-09-30  6:24       ` Mark Walters
@ 2017-10-01 19:06         ` Arun Isaac
  2017-10-02  6:48           ` Mark Walters
  2017-10-02 16:03           ` Jani Nikula
  0 siblings, 2 replies; 15+ messages in thread
From: Arun Isaac @ 2017-10-01 19:06 UTC (permalink / raw)
  To: notmuch

Mark Walters <markwalters1009@gmail.com> writes:

> Incidentally, I think "/" is an alternative for the fcc line which
> already works, which is "\"/\" in notmuch-fcc-dirs.

Perhaps, notmuch should be made to tolerate a "/" at the beginning of the
Fcc folder argument. That is, notmuch should not complain about absolute
paths, and it should interpret these as relative to the root. To
maintain backward compatibility, we could add a "/" at the beginning if
it is not already there.

So,

"/" => database.path
"/sent" => database.path/sent
"sent" => database.path/sent

etc.

Is this a better idea?

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

* Re: notmuch-emacs: Fcc to top-level directory given by database.path
  2017-10-01 19:06         ` Arun Isaac
@ 2017-10-02  6:48           ` Mark Walters
  2017-10-02 16:03           ` Jani Nikula
  1 sibling, 0 replies; 15+ messages in thread
From: Mark Walters @ 2017-10-02  6:48 UTC (permalink / raw)
  To: Arun Isaac, notmuch


Hi

On Sun, 01 Oct 2017, Arun Isaac <arunisaac@systemreboot.net> wrote:
> Mark Walters <markwalters1009@gmail.com> writes:
>
>> Incidentally, I think "/" is an alternative for the fcc line which
>> already works, which is "\"/\" in notmuch-fcc-dirs.
>
> Perhaps, notmuch should be made to tolerate a "/" at the beginning of the
> Fcc folder argument. That is, notmuch should not complain about absolute
> paths, and it should interpret these as relative to the root. To
> maintain backward compatibility, we could add a "/" at the beginning if
> it is not already there.
>
> So,
>
> "/" => database.path
> "/sent" => database.path/sent
> "sent" => database.path/sent
>
> etc.
>
> Is this a better idea?

The reason for the warning is that this behaviour is completely
different from what you would get with normal file fcc. Given that, I am
a little reluctant to drop the warning.

Best wishes

Mark

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

* Re: notmuch-emacs: Fcc to top-level directory given by database.path
  2017-10-01 19:06         ` Arun Isaac
  2017-10-02  6:48           ` Mark Walters
@ 2017-10-02 16:03           ` Jani Nikula
  1 sibling, 0 replies; 15+ messages in thread
From: Jani Nikula @ 2017-10-02 16:03 UTC (permalink / raw)
  To: Arun Isaac, notmuch

On Mon, 02 Oct 2017, Arun Isaac <arunisaac@systemreboot.net> wrote:
> Mark Walters <markwalters1009@gmail.com> writes:
>
>> Incidentally, I think "/" is an alternative for the fcc line which
>> already works, which is "\"/\" in notmuch-fcc-dirs.
>
> Perhaps, notmuch should be made to tolerate a "/" at the beginning of the
> Fcc folder argument. That is, notmuch should not complain about absolute
> paths, and it should interpret these as relative to the root. To
> maintain backward compatibility, we could add a "/" at the beginning if
> it is not already there.
>
> So,
>
> "/" => database.path
> "/sent" => database.path/sent
> "sent" => database.path/sent
>
> etc.
>
> Is this a better idea?

At the cli notmuch insert level, I'd actually rather do the opposite and
be even stricter about folder being relative. I just had to look at the
code for other reasons, and it seems to accept all sorts of weird combos
with "/" and "." that I think should be rejected. Or at the very least
sanitized. Otherwise we end up with filenames with "//" or "/./" in
them, probably confusing notmuch later on.

I'd argue notmuch insert --folder="" should Fcc to the mail store root,
but alas that doesn't work at the cli level. It doesn't appear to work
at the emacs level either, but perhaps notmuch-emacs could translate ""
to dropping the --folder argument? Could even add that as a choice
option in notmuch-fcc-dirs customization. Mark?

BR,
Jani.

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

* Re: notmuch-emacs: Fcc to top-level directory given by database.path
  2017-09-30  9:03   ` Jani Nikula
@ 2017-10-02 16:29     ` Jani Nikula
  2017-10-04  9:30     ` Arun Isaac
  2018-06-06 14:04     ` David Bremner
  2 siblings, 0 replies; 15+ messages in thread
From: Jani Nikula @ 2017-10-02 16:29 UTC (permalink / raw)
  To: David Bremner, Arun Isaac, notmuch

On Sat, 30 Sep 2017, Jani Nikula <jani@nikula.org> wrote:
> On Sat, 23 Sep 2017, David Bremner <david@tethera.net> wrote:
>> Do you happen to know if it calls with an empty string as the folder
>> name? It would be consistent with searching for that to insert at the
>> top level.
>
> notmuch insert --folder= or --folder="" does not work:
>
> String argument for option "folder" must be non-empty.
> Unrecognized option: --folder=
>
> It seems that our argument parser doesn't accept empty strings at all,
> which is a bit of a limitation. It would be logical for the empty string
> to work here, and AFAICT the notmuch insert code would handle this if
> the argument was let through the parsing.

Turns out this is trivial to address on top of the arg parsing series:
id:20171002162552.4827-1-jani@nikula.org.

BR,
Jani.

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

* Re: notmuch-emacs: Fcc to top-level directory given by database.path
  2017-09-30  9:03   ` Jani Nikula
  2017-10-02 16:29     ` Jani Nikula
@ 2017-10-04  9:30     ` Arun Isaac
  2018-06-06 14:04     ` David Bremner
  2 siblings, 0 replies; 15+ messages in thread
From: Arun Isaac @ 2017-10-04  9:30 UTC (permalink / raw)
  To: notmuch

Jani Nikula <jani@nikula.org> writes:

> On Sat, 23 Sep 2017, David Bremner <david@tethera.net> wrote:
>> Do you happen to know if it calls with an empty string as the folder
>> name? It would be consistent with searching for that to insert at the
>> top level.
>
> notmuch insert --folder= or --folder="" does not work:
>
> String argument for option "folder" must be non-empty.
> Unrecognized option: --folder=
>
> It seems that our argument parser doesn't accept empty strings at all,
> which is a bit of a limitation. It would be logical for the empty string
> to work here, and AFAICT the notmuch insert code would handle this if
> the argument was let through the parsing.

I agree. Fixing this in the `notmuch insert' argument parser is a better
solution.

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

* Re: notmuch-emacs: Fcc to top-level directory given by database.path
  2017-09-30  9:03   ` Jani Nikula
  2017-10-02 16:29     ` Jani Nikula
  2017-10-04  9:30     ` Arun Isaac
@ 2018-06-06 14:04     ` David Bremner
  2018-06-19  9:06       ` Arun Isaac
  2 siblings, 1 reply; 15+ messages in thread
From: David Bremner @ 2018-06-06 14:04 UTC (permalink / raw)
  To: Jani Nikula, Arun Isaac, notmuch

Jani Nikula <jani@nikula.org> writes:

> On Sat, 23 Sep 2017, David Bremner <david@tethera.net> wrote:
>> Do you happen to know if it calls with an empty string as the folder
>> name? It would be consistent with searching for that to insert at the
>> top level.
>
> notmuch insert --folder= or --folder="" does not work:
>
> String argument for option "folder" must be non-empty.
> Unrecognized option: --folder=
>

This should be fixed in 733ccfabc, as part of 0.26

d

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

* Re: notmuch-emacs: Fcc to top-level directory given by database.path
  2018-06-06 14:04     ` David Bremner
@ 2018-06-19  9:06       ` Arun Isaac
  0 siblings, 0 replies; 15+ messages in thread
From: Arun Isaac @ 2018-06-19  9:06 UTC (permalink / raw)
  To: David Bremner, Jani Nikula, notmuch


>> notmuch insert --folder= or --folder="" does not work:
>>
>> String argument for option "folder" must be non-empty.
>> Unrecognized option: --folder=
>>
> This should be fixed in 733ccfabc, as part of 0.26

I have verified this, and it works.

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

end of thread, other threads:[~2018-06-19  9:31 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-23  9:37 notmuch-emacs: Fcc to top-level directory given by database.path Arun Isaac
2017-09-23 11:41 ` David Bremner
2017-09-23 12:08   ` Mark Walters
2017-09-23 14:52   ` Arun Isaac
2017-09-24 12:14     ` David Bremner
2017-09-25 15:25       ` Tomi Ollila
2017-09-30  6:24       ` Mark Walters
2017-10-01 19:06         ` Arun Isaac
2017-10-02  6:48           ` Mark Walters
2017-10-02 16:03           ` Jani Nikula
2017-09-30  9:03   ` Jani Nikula
2017-10-02 16:29     ` Jani Nikula
2017-10-04  9:30     ` Arun Isaac
2018-06-06 14:04     ` David Bremner
2018-06-19  9:06       ` Arun Isaac

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).