From: Spencer Baugh <sbaugh@janestreet.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 72019@debbugs.gnu.org
Subject: bug#72019: [PATCH] Add project argument to project-kill-buffers
Date: Wed, 10 Jul 2024 13:42:40 -0400 [thread overview]
Message-ID: <iera5ipi1nz.fsf@janestreet.com> (raw)
In-Reply-To: <86zfqpm9ur.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 10 Jul 2024 20:32:12 +0300")
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Spencer Baugh <sbaugh@janestreet.com>
>> Cc: 72019@debbugs.gnu.org
>> Date: Wed, 10 Jul 2024 11:47:48 -0400
>>
>> Eli Zaretskii <eliz@gnu.org> writes:
>>
>> >> From: Spencer Baugh <sbaugh@janestreet.com>
>> >> Date: Wed, 10 Jul 2024 09:27:06 -0400
>> >> Cc: 72019@debbugs.gnu.org
>> >>
>> >> On Wed, Jul 10, 2024, 7:19 AM Eli Zaretskii <eliz@gnu.org> wrote:
>> >>
>> >> > From: Spencer Baugh <sbaugh@janestreet.com>
>> >> > Date: Tue, 09 Jul 2024 14:31:11 -0400
>> >> >
>> >> > Previously, project-kill-buffers always called (project-current t). A
>> >> > Lisp program could change what project project-kill-buffers operated
>> >> > on by binding project-current-directory-override. However, in some
>> >> > edge cases (for example, if the project was deleted between looking it
>> >> > up and calling project-kill-buffers) this might fail to detect a
>> >> > project, and so (project-current t) would prompt the user.
>> >> >
>> >> > To avoid this, accept the project to kill buffers for as an argument.
>> >>
>> >> That sounds like sweeping some minor bug under the carpet, or worse.
>> >> Why is it a good idea to silently second-guess what is TRT in these
>> >> marginal cases? Up front, I'd say asking the user is a safer bet.
>> >>
>> >> Suppose if some Lisp program runs (project-current t) to select a project to operate on, then does some
>> >> things, then runs project-kill-buffers. The p-k-b call should never prompt for a project again - it's intended to
>> >> operate on the project that was already selected. If the project that was already selected has disappeared, an
>> >> error is better than a confusing second prompt which might lead to the user selecting another different
>> >> project and killing all the buffers in that project. If the Lisp program wants to catch that error, it can.
>> >
>> > In my book, prompting the user with the like of
>> >
>> > Project FOO disappeared, continue killing its buffers?
>> >
>> > is better than silently doing the (potentially) wrong thing. IOW,
>> > when something that isn't supposed to happen did happen, let the human
>> > figure out the mess. Relying on project.el to signal an error is
>> > better, but might not be the best idea, either, because the error
>> > message is likely to be confusing and/or non-specific.
>>
>> Yes, that's all true. However, this is a minor edge case, which so far
>> I've only observed happen once, and then it was only due to a user's bad
>> configuration. I'd rather just signal an error for now (by avoiding the
>> call to (project-current t)), which the current patch will do, since
>> that improves on the situation without requiring us to invest more
>> effort on something very rare.
>
> If we want to signal an error, let's signal an error, but with an
> explicit error message explaining the problem. Doing that by adding
> an argument sounds risky, since it doesn't target this specific
> situation, and so installing on the release branch is not necessarily
> justified. Are you okay with diagnosing this specific situation and
> signaling an error explicitly in the code?
I don't need this to be on the release branch. I'd prefer to add the
argument and just keep this on master.
next prev parent reply other threads:[~2024-07-10 17:42 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-09 18:31 bug#72019: [PATCH] Add project argument to project-kill-buffers Spencer Baugh
2024-07-09 19:59 ` Dmitry Gutov
2024-07-10 11:43 ` Eli Zaretskii
2024-07-10 11:19 ` Eli Zaretskii
2024-07-10 13:27 ` Spencer Baugh
2024-07-10 14:32 ` Eli Zaretskii
2024-07-10 15:47 ` Spencer Baugh
2024-07-10 17:32 ` Eli Zaretskii
2024-07-10 17:42 ` Spencer Baugh [this message]
2024-07-10 17:54 ` Eli Zaretskii
2024-07-10 18:30 ` Spencer Baugh
2024-07-10 19:00 ` Eli Zaretskii
2024-07-11 0:18 ` Dmitry Gutov
2024-07-11 4:52 ` Eli Zaretskii
2024-07-11 19:47 ` Dmitry Gutov
2024-07-12 5:48 ` Eli Zaretskii
2024-07-16 2:00 ` Dmitry Gutov
2024-07-11 0:11 ` Dmitry Gutov
2024-07-11 4:50 ` Eli Zaretskii
2024-07-11 19:44 ` Dmitry Gutov
2024-07-12 5:47 ` Eli Zaretskii
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=iera5ipi1nz.fsf@janestreet.com \
--to=sbaugh@janestreet.com \
--cc=72019@debbugs.gnu.org \
--cc=eliz@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.