emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [WDYT] org-attach-sync better remove an empty attachment directory?


From: Tim Cross
Subject: Re: [WDYT] org-attach-sync better remove an empty attachment directory?
Date: Thu, 08 Jul 2021 17:56:17 +1000
User-agent: mu4e 1.5.13; emacs 28.0.50

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]