emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [WDYT] org-attach-sync better remove an empty attachment directory?
@ 2021-07-07 20:15 Marco Wahl
  2021-07-08  0:34 ` Tim Cross
  0 siblings, 1 reply; 11+ messages in thread
From: Marco Wahl @ 2021-07-07 20:15 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

org-attach-sync can be used to "Synchronize the current outline node
with its attachments."  Which is great AFAICT.

What do you think about letting org-attach-sync remove the attachment
directory if it's empty?

Rationale: Nobody needs an empty attachment directory.
  

Ciao,
-- 
Marco



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

* Re: [WDYT] org-attach-sync better remove an empty attachment directory?
  2021-07-07 20:15 [WDYT] org-attach-sync better remove an empty attachment directory? Marco Wahl
@ 2021-07-08  0:34 ` Tim Cross
  2021-07-08  7:45   ` Marco Wahl
  0 siblings, 1 reply; 11+ messages in thread
From: Tim Cross @ 2021-07-08  0:34 UTC (permalink / raw)
  To: emacs-orgmode


Marco Wahl <marcowahlsoft@gmail.com> writes:

> Hi,
>
> org-attach-sync can be used to "Synchronize the current outline node
> with its attachments."  Which is great AFAICT.
>
> What do you think about letting org-attach-sync remove the attachment
> directory if it's empty?
>
> Rationale: Nobody needs an empty attachment directory.
>   

This seems pretty reasonable to me provided it only removes an
attachments directly which was created by org-attach-sync. If the
directory existed or was created by something external, then removing it
probably should not be done.

Likely this is something which should be controllable via a custom
setting?


-- 
Tim Cross


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

* Re: [WDYT] org-attach-sync better remove an empty attachment directory?
  2021-07-08  0:34 ` Tim Cross
@ 2021-07-08  7:45   ` Marco Wahl
  2021-07-08  7:56     ` Tim Cross
  0 siblings, 1 reply; 11+ messages in thread
From: Marco Wahl @ 2021-07-08  7:45 UTC (permalink / raw)
  To: Tim Cross; +Cc: emacs-orgmode


>> org-attach-sync can be used to "Synchronize the current outline node
>> with its attachments."  Which is great AFAICT.
>>
>> What do you think about letting org-attach-sync remove the attachment
>> directory if it's empty?
>>
>> Rationale: Nobody needs an empty attachment directory.
>>   
>
> This seems pretty reasonable to me provided it only removes an
> attachments directly which was created by org-attach-sync. If the
> directory existed or was created by something external, then removing it
> probably should not be done.

I think it's too much effort to keep a list of attachment directories
which have been created by Org attachment commands.  Complexity!  (BTW
org-attach-sync does not create an attachment directory.  It rather
checks the state of the directory and acts accordingly.)

Please recall that only empty attachment directories would be removed,
so removal of a directory--and in particular one that existed before its
interpretation as Org attachment--wouldn't be a big deal AFAICS.

> Likely this is something which should be controllable via a custom
> setting?

To be honest I'd rather not make another customizable thing out of it to
keep the overall complexity low.

OTOH we could easily introduce e.g. customizable
org-attach-delete-empty-dirs-on-sync.


















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

* Re: [WDYT] org-attach-sync better remove an empty attachment directory?
  2021-07-08  7:45   ` Marco Wahl
@ 2021-07-08  7:56     ` Tim Cross
  2021-07-08  8:28       ` Colin Baxter
  0 siblings, 1 reply; 11+ messages in thread
From: Tim Cross @ 2021-07-08  7:56 UTC (permalink / raw)
  To: Marco Wahl; +Cc: emacs-orgmode


Marco Wahl <marcowahlsoft@gmail.com> writes:

>>> org-attach-sync can be used to "Synchronize the current outline node
>>> with its attachments."  Which is great AFAICT.
>>>
>>> What do you think about letting org-attach-sync remove the attachment
>>> directory if it's empty?
>>>
>>> Rationale: Nobody needs an empty attachment directory.
>>>   
>>
>> This seems pretty reasonable to me provided it only removes an
>> attachments directly which was created by org-attach-sync. If the
>> directory existed or was created by something external, then removing it
>> probably should not be done.
>
> I think it's too much effort to keep a list of attachment directories
> which have been created by Org attachment commands.  Complexity!  (BTW
> org-attach-sync does not create an attachment directory.  It rather
> checks the state of the directory and acts accordingly.)

Agreed.

>
> Please recall that only empty attachment directories would be removed,
> so removal of a directory--and in particular one that existed before its
> interpretation as Org attachment--wouldn't be a big deal AFAICS.
>

Not as confident here. I can imagine workflows and other external
scripts which might expect a specific directory structure that could be
broken if a directory was removed (even when empty). Hence my suggestion
it needs to be something you can turn off.

>> Likely this is something which should be controllable via a custom
>> setting?
>
> To be honest I'd rather not make another customizable thing out of it to
> keep the overall complexity low.
>
> OTOH we could easily introduce e.g. customizable
> org-attach-delete-empty-dirs-on-sync.

Appreciate the problem with far too many customization options, but when
it comes to software 'automatically' doing something, like removal of an
empty directory, especially when it might not have been responsible for
creation of the directory, it is better to provide some way to allow the
user to turn off the behaviour. I would default to having it enabled
though.


-- 
Tim Cross


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

* Re: [WDYT] org-attach-sync better remove an empty attachment directory?
  2021-07-08  7:56     ` Tim Cross
@ 2021-07-08  8:28       ` Colin Baxter
  2021-07-08 17:36         ` Marco Wahl
  0 siblings, 1 reply; 11+ messages in thread
From: Colin Baxter @ 2021-07-08  8:28 UTC (permalink / raw)
  To: Tim Cross; +Cc: Marco Wahl, emacs-orgmode

I'm afraid I for one often have empty attach directories which I leave
alone knowing that one day soon - sometimes very soon - they will be used
again. Cannot the user be asked if he wants the directory removed?

Best wishes,


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

* Re: [WDYT] org-attach-sync better remove an empty attachment directory?
  2021-07-08  8:28       ` Colin Baxter
@ 2021-07-08 17:36         ` Marco Wahl
  2021-07-08 18:53           ` Marco Wahl
  0 siblings, 1 reply; 11+ messages in thread
From: Marco Wahl @ 2021-07-08 17:36 UTC (permalink / raw)
  To: Colin Baxter; +Cc: Marco Wahl, Tim Cross, emacs-orgmode


    Marco> Please recall that only empty attachment directories would be
    Marco> removed, so removal of a directory--and in particular one
    Marco> that existed before its interpretation as Org
    Marco> attachment--wouldn't be a big deal AFAICS.

    Tim> Not as confident here. I can imagine workflows and other
    Tim> external scripts which might expect a specific directory
    Tim> structure that could be broken if a directory was removed (even
    Tim> when empty). Hence my suggestion it needs to be something you
    Tim> can turn off.

    Tim> Likely this is something which should be controllable via a
    Tim> custom setting?

    Marco> To be honest I'd rather not make another customizable thing
    Marco> out of it to keep the overall complexity low.
    Marco> 
    Marco> OTOH we could easily introduce e.g. customizable
    Marco> org-attach-delete-empty-dirs-on-sync.

    Tim> Appreciate the problem with far too many customization options,
    Tim> but when it comes to software 'automatically' doing something,
    Tim> like removal of an empty directory, especially when it might
    Tim> not have been responsible for creation of the directory, it is
    Tim> better to provide some way to allow the user to turn off the
    Tim> behaviour. I would default to having it enabled though.

    Colin> I'm afraid I for one often have empty attach directories
    Colin> which I leave alone knowing that one day soon - sometimes
    Colin> very soon - they will be used again. Cannot the user be asked
    Colin> if he wants the directory removed?

Thanks Tim and Colin.

We could introduce multiple possibilities to choose from.

1. Ask in case of an empty directory if it should be deleted.
2. Don't ask.  Don't touch an empty directory.  (The state now.)
3. Don't ask.  Delete empty directory.

We could also make 3. the default setting.




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

* Re: [WDYT] org-attach-sync better remove an empty attachment directory?
  2021-07-08 17:36         ` Marco Wahl
@ 2021-07-08 18:53           ` Marco Wahl
  2021-07-08 19:28             ` Tim Cross
  0 siblings, 1 reply; 11+ messages in thread
From: Marco Wahl @ 2021-07-08 18:53 UTC (permalink / raw)
  To: Colin Baxter, Tim Cross, emacs-orgmode

Marco Wahl <marcowahlsoft@gmail.com> writes:

>     Marco> Please recall that only empty attachment directories would be
>     Marco> removed, so removal of a directory--and in particular one
>     Marco> that existed before its interpretation as Org
>     Marco> attachment--wouldn't be a big deal AFAICS.
>
>     Tim> Not as confident here. I can imagine workflows and other
>     Tim> external scripts which might expect a specific directory
>     Tim> structure that could be broken if a directory was removed (even
>     Tim> when empty). Hence my suggestion it needs to be something you
>     Tim> can turn off.
>
>     Tim> Likely this is something which should be controllable via a
>     Tim> custom setting?
>
>     Marco> To be honest I'd rather not make another customizable thing
>     Marco> out of it to keep the overall complexity low.
>     Marco> 
>     Marco> OTOH we could easily introduce e.g. customizable
>     Marco> org-attach-delete-empty-dirs-on-sync.
>
>     Tim> Appreciate the problem with far too many customization options,
>     Tim> but when it comes to software 'automatically' doing something,
>     Tim> like removal of an empty directory, especially when it might
>     Tim> not have been responsible for creation of the directory, it is
>     Tim> better to provide some way to allow the user to turn off the
>     Tim> behaviour. I would default to having it enabled though.
>
>     Colin> I'm afraid I for one often have empty attach directories
>     Colin> which I leave alone knowing that one day soon - sometimes
>     Colin> very soon - they will be used again. Cannot the user be asked
>     Colin> if he wants the directory removed?
>
> Thanks Tim and Colin.
>
> We could introduce multiple possibilities to choose from.
>
> 1. Ask in case of an empty directory if it should be deleted.
> 2. Don't ask.  Don't touch an empty directory.  (The state now.)
> 3. Don't ask.  Delete empty directory.
>
> We could also make 3. the default setting.

I made a mistake here.

If we do this I vote for option 1. (not 3.) as default (following the
suggestion by Colin) since it is the most interactive variant.  If the
question gets annoying the user can switch to one of the other options.

Sorry for the confusion.


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

* Re: [WDYT] org-attach-sync better remove an empty attachment directory?
  2021-07-08 18:53           ` Marco Wahl
@ 2021-07-08 19:28             ` Tim Cross
  2021-07-09  6:15               ` Colin Baxter
  0 siblings, 1 reply; 11+ messages in thread
From: Tim Cross @ 2021-07-08 19:28 UTC (permalink / raw)
  To: Marco Wahl; +Cc: Colin Baxter, emacs-orgmode


Marco Wahl <marcowahlsoft@gmail.com> writes:

> Marco Wahl <marcowahlsoft@gmail.com> writes:
>
>>     Marco> Please recall that only empty attachment directories would be
>>     Marco> removed, so removal of a directory--and in particular one
>>     Marco> that existed before its interpretation as Org
>>     Marco> attachment--wouldn't be a big deal AFAICS.
>>
>>     Tim> Not as confident here. I can imagine workflows and other
>>     Tim> external scripts which might expect a specific directory
>>     Tim> structure that could be broken if a directory was removed (even
>>     Tim> when empty). Hence my suggestion it needs to be something you
>>     Tim> can turn off.
>>
>>     Tim> Likely this is something which should be controllable via a
>>     Tim> custom setting?
>>
>>     Marco> To be honest I'd rather not make another customizable thing
>>     Marco> out of it to keep the overall complexity low.
>>     Marco> 
>>     Marco> OTOH we could easily introduce e.g. customizable
>>     Marco> org-attach-delete-empty-dirs-on-sync.
>>
>>     Tim> Appreciate the problem with far too many customization options,
>>     Tim> but when it comes to software 'automatically' doing something,
>>     Tim> like removal of an empty directory, especially when it might
>>     Tim> not have been responsible for creation of the directory, it is
>>     Tim> better to provide some way to allow the user to turn off the
>>     Tim> behaviour. I would default to having it enabled though.
>>
>>     Colin> I'm afraid I for one often have empty attach directories
>>     Colin> which I leave alone knowing that one day soon - sometimes
>>     Colin> very soon - they will be used again. Cannot the user be asked
>>     Colin> if he wants the directory removed?
>>
>> Thanks Tim and Colin.
>>
>> We could introduce multiple possibilities to choose from.
>>
>> 1. Ask in case of an empty directory if it should be deleted.
>> 2. Don't ask.  Don't touch an empty directory.  (The state now.)
>> 3. Don't ask.  Delete empty directory.
>>
>> We could also make 3. the default setting.
>
> I made a mistake here.
>
> If we do this I vote for option 1. (not 3.) as default (following the
> suggestion by Colin) since it is the most interactive variant.  If the
> question gets annoying the user can switch to one of the other options.
>

That seems quite resonable to me. 

-- 
Tim Cross


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

* Re: [WDYT] org-attach-sync better remove an empty attachment directory?
  2021-07-08 19:28             ` Tim Cross
@ 2021-07-09  6:15               ` Colin Baxter
  2021-07-09 19:18                 ` Marco Wahl
  0 siblings, 1 reply; 11+ messages in thread
From: Colin Baxter @ 2021-07-09  6:15 UTC (permalink / raw)
  To: Tim Cross; +Cc: Marco Wahl, emacs-orgmode

>>>>> Tim Cross <theophilusx@gmail.com> writes:

>>> We could introduce multiple possibilities to choose from.
    >>> 
    >>> 1. Ask in case of an empty directory if it should be deleted.
    >>> 2. Don't ask.  Don't touch an empty directory.  (The state now.)
    >>> 3. Don't ask.  Delete empty directory.
    >>> 
    >>> We could also make 3. the default setting.
    >> 
    >> I made a mistake here.
    >> 
    >> If we do this I vote for option 1. (not 3.) as default (following
    >> the suggestion by Colin) since it is the most interactive
    >> variant.  If the question gets annoying the user can switch to
    >> one of the other options.
    >> 

    > That seems quite resonable to me.

And me.

Best wishes,


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

* Re: [WDYT] org-attach-sync better remove an empty attachment directory?
  2021-07-09  6:15               ` Colin Baxter
@ 2021-07-09 19:18                 ` Marco Wahl
  2021-07-10 13:20                   ` Colin Baxter
  0 siblings, 1 reply; 11+ messages in thread
From: Marco Wahl @ 2021-07-09 19:18 UTC (permalink / raw)
  To: Colin Baxter; +Cc: Tim Cross, emacs-orgmode

Colin Baxter <m43cap@yandex.com> writes:

>>>>>> Tim Cross <theophilusx@gmail.com> writes:
>
>>>> We could introduce multiple possibilities to choose from.
>     >>>
>     >>> 1. Ask in case of an empty directory if it should be deleted.
>     >>> 2. Don't ask.  Don't touch an empty directory.  (The state now.)
>     >>> 3. Don't ask.  Delete empty directory.
>     >>>
>     >>> We could also make 3. the default setting.
>     >>
>     >> I made a mistake here.
>     >>
>     >> If we do this I vote for option 1. (not 3.) as default (following
>     >> the suggestion by Colin) since it is the most interactive
>     >> variant.  If the question gets annoying the user can switch to
>     >> one of the other options.
>     >>
>
>     > That seems quite resonable to me.
>
> And me.

Thanks!

I pushed respective code.  Critique is always welcome.









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

* Re: [WDYT] org-attach-sync better remove an empty attachment directory?
  2021-07-09 19:18                 ` Marco Wahl
@ 2021-07-10 13:20                   ` Colin Baxter
  0 siblings, 0 replies; 11+ messages in thread
From: Colin Baxter @ 2021-07-10 13:20 UTC (permalink / raw)
  To: Marco Wahl; +Cc: Tim Cross, emacs-orgmode

>>>>> Marco Wahl <marcowahlsoft@gmail.com> writes:

    > Colin Baxter <m43cap@yandex.com> writes:
    >>>>>>> Tim Cross <theophilusx@gmail.com> writes:
    >> 
    >>>>> We could introduce multiple possibilities to choose from.
    >> >>>
    >> >>> 1. Ask in case of an empty directory if it should be deleted.
    >> >>> 2. Don't ask.  Don't touch an empty directory.  (The state
    >> now.)  >>> 3. Don't ask.  Delete empty directory.
    >> >>>
    >> >>> We could also make 3. the default setting.
    >> >>
    >> >> I made a mistake here.
    >> >>
    >> >> If we do this I vote for option 1. (not 3.) as default
    >> (following >> the suggestion by Colin) since it is the most
    >> interactive >> variant.  If the question gets annoying the user
    >> can switch to >> one of the other options.
    >> >>
    >> 
    >> > That seems quite resonable to me.
    >> 
    >> And me.

    > Thanks!

    > I pushed respective code.  Critique is always welcome.

For me, this works really well. Thank you for a great addition.

Best wishes,

Colin Baxter.


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

end of thread, other threads:[~2021-07-10 13:21 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-07 20:15 [WDYT] org-attach-sync better remove an empty attachment directory? Marco Wahl
2021-07-08  0:34 ` Tim Cross
2021-07-08  7:45   ` Marco Wahl
2021-07-08  7:56     ` Tim Cross
2021-07-08  8:28       ` Colin Baxter
2021-07-08 17:36         ` Marco Wahl
2021-07-08 18:53           ` Marco Wahl
2021-07-08 19:28             ` Tim Cross
2021-07-09  6:15               ` Colin Baxter
2021-07-09 19:18                 ` Marco Wahl
2021-07-10 13:20                   ` Colin Baxter

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

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).