emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: Tim Visher <tim.visher@gmail.com>,
	Emacs Org Mode mailing list <emacs-orgmode@gnu.org>
Subject: Re: [PATCH]: org-attach.el: Use `force' arg everywhere in `org-attach-delete-all'
Date: Wed, 04 Mar 2020 04:10:58 +0000	[thread overview]
Message-ID: <87d09sn4j1.fsf@kyleam.com> (raw)
In-Reply-To: <CAHa53uxR2wnR+QrEOXj0F+vs3dWqfLgSy-vd9x-MukycQPZsSA@mail.gmail.com>

Tim Visher <tim.visher@gmail.com> writes:

> * lisp/org-attach.el (org-attach-delete-all): Use `force' arg
> throughout function.
>
> `org-attach-delete-all` advertised a `force` option but passing it
> only forced its way past the initial "Really remove all…" query.  This
> was unexpected and not properly documented.
>
> This extends the use of the `force` argument to the `delete-directory`
> call and documents its meaning in the docstring.

Sounds reasonable to me.

>  (defun org-attach-delete-all (&optional force)
>    "Delete all attachments from the current outline node.
>  This actually deletes the entire attachment directory.
> -A safer way is to open the directory in dired and delete from there."
> +A safer way is to open the directory in dired and delete from there.
> +
> +If FORCE is truthy, directory will be recursively deleted with no
> +prompts."

While I think any reader would know what you meant by "truthy",
"non-nil" would be more standard/familiar in the context of elisp
docstrings.  Or, given this is an interactive command, "With prefix
argument FORCE" or something along those lines.

>    (interactive "P")
>    (let ((attach-dir (org-attach-dir)))
>      (when (and attach-dir
>         (or force
>     (yes-or-no-p "Really remove all attachments of this entry? ")))
> -      (delete-directory attach-dir (yes-or-no-p "Recursive?") t)
> +      (delete-directory attach-dir (or force
> +       (yes-or-no-p "Recursive?")) t)

With Emacs 25 or newer and the default font-lock levels, you should see
"t)" highlighted with font-lock-warning-face because t is "hidden behind
a deeper element".  You could fix it by moving t to its own line, but to
my eyes keeping the entire delete-directory on a single line would be
readable enough.

Thanks.

  reply	other threads:[~2020-03-04  4:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-03 14:24 [PATCH]: org-attach.el: Use `force' arg everywhere in `org-attach-delete-all' Tim Visher
2020-03-04  4:10 ` Kyle Meyer [this message]
2020-03-04 18:27   ` Tim Visher
2020-03-06  4:26     ` Kyle Meyer

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=87d09sn4j1.fsf@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=tim.visher@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).