emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Tim Cross <theophilusx@gmail.com>
To: Marco Wahl <marcowahlsoft@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [WDYT] org-attach-sync better remove an empty attachment directory?
Date: Thu, 08 Jul 2021 17:56:17 +1000	[thread overview]
Message-ID: <87sg0ptere.fsf@gmail.com> (raw)
In-Reply-To: <87y2ahi6zo.fsf@gmail.com>


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	other threads:[~2021-07-08  8:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sg0ptere.fsf@gmail.com \
    --to=theophilusx@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=marcowahlsoft@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).