unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: Eshel Yaron <me@eshelyaron.com>
Cc: Eli Zaretskii <eliz@gnu.org>, 65386@debbugs.gnu.org
Subject: bug#65386: [PATCH] ; Refine some 'package-vc' docstrings
Date: Sun, 20 Aug 2023 18:33:46 +0000	[thread overview]
Message-ID: <875y59tvg5.fsf@posteo.net> (raw)
In-Reply-To: <m1v8d98z0b.fsf@eshelyaron.com> (Eshel Yaron's message of "Sun, 20 Aug 2023 18:22:28 +0200")

Eshel Yaron <me@eshelyaron.com> writes:

> Philip Kaludercic <philipk@posteo.net> writes:
>
>> Eshel Yaron <me@eshelyaron.com> writes:
>>
>>>> Also, would it make sense to determine this at compile-time?  On the
>>>> other hand, if a VC backend is installed later on from ELPA, we would
>>>> want the custom type to reflect this.
>>>
>>> Yes, I couldn't find a way to defer computing the set of candidates to
>>> "customization type", I'm not sure if that even makes total sense.  I
>>> think it's not that crucial since someone adding a VC backend and
>>> immediately trying to customize these options seems to me like a very
>>> minor edge case, and we had the same issue prior to my patch anyhow.
>>
>> Likely yes, but if we have two mostly equivalent solutions, I think that
>> flexibility without having to restart Emacs is preferable to performance.
>>
>
> Hmm I'm not sure I completely follow.  Which two solutions do you have
> in mind?  I agree that it would be nice have the `:type` updated if the
> user adds a relevant VC backend, but I don't think `defcustom` supports
> something like that.  How do you propose to achieve that flexibility?

Sorry, in the end it doesn't matter, I can't quickly think of a way to
define a type flexible enough to automatically update to the
environment, nor does computing a constant value at compile time seem
either worth it.

>> [...]
>>
>>> From 8a339d3bffe81f80e7e968505c40855d6598b8ac Mon Sep 17 00:00:00 2001
>>> From: Eshel Yaron <me@eshelyaron.com>
>>> Date: Sun, 20 Aug 2023 16:20:54 +0200
>>> Subject: [PATCH] ; Refine 'defcustom' types in 'package-vc'
>>>
>>> Only include VC backends that support cloning in the ':type' of
>>> 'package-vc-heuristic-alist' and 'package-vc-default-backend'.
>>>
>>> * lisp/emacs-lisp/package-vc.el (package-vc--cloning-backend-p)
>>> (package-vc--backends): New functions.
>>> (package-vc-heuristic-alist, package-vc-default-backend): Use it.
>>> ---
>>>  lisp/emacs-lisp/package-vc.el | 13 +++++++++++--
>>>  1 file changed, 11 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
>>> index a3762d252b0..44a4624e49f 100644
>>> --- a/lisp/emacs-lisp/package-vc.el
>>> +++ b/lisp/emacs-lisp/package-vc.el
>>> @@ -62,6 +62,15 @@ package-vc
>>>  (defconst package-vc--elpa-packages-version 1
>>>    "Version number of the package specification format understood by package-vc.")
>>>  
>>> +(defun package-vc--cloning-backend-p (be)
>>> +  "Return non-nil if the VC backend BE supports cloning repositories."
>>> +  (or (vc-find-backend-function be 'clone)
>>> +      (alist-get 'clone (get be 'vc-functions))))
>>> +
>>> +(defun package-vc--backends ()
>>> +  "Return a list of VC backends suitable for cloning package VCS repositories."
>>> +  (seq-filter #'package-vc--cloning-backend-p vc-handled-backends))
>>
>> Do you think that these utility functions are useful enough to have in
>> general, or would it be better to just define a defconst once that
>> generates the `(choice ...)' object?
>
> I think these are nice to have, but I don't mind removing them in favor
> of a `defconst` (or a `define-widget` for that matter) if you think
> that's better.

I think a defconst would be a simpler solution, having functions like
these always bear the danger of being misused, despite being marked as
internal.





  reply	other threads:[~2023-08-20 18:33 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-19 18:07 bug#65386: [PATCH] ; Refine some 'package-vc' docstrings Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-19 19:47 ` Eli Zaretskii
2023-08-19 20:42   ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-20  6:05     ` Eli Zaretskii
2023-08-20  7:15       ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-20  8:32         ` Philip Kaludercic
2023-08-20 10:14           ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-20 12:18             ` Philip Kaludercic
2023-08-20 14:44               ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-20 16:04                 ` Philip Kaludercic
2023-08-20 16:22                   ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-20 18:33                     ` Philip Kaludercic [this message]
2023-08-20 10:31           ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-20  8:13     ` Philip Kaludercic
2023-08-20 19:24 ` Mauro Aranda
2023-08-20 20:35   ` Philip Kaludercic
2023-08-21  8:16     ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-21  9:27       ` Philip Kaludercic
2023-08-21 10:22         ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
     [not found] <87ledwipkb.fsf@posteo.net>
2023-08-27 17:18 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-29  8:43   ` Philip Kaludercic
2023-08-29  9:10     ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors

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.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=875y59tvg5.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=65386@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=me@eshelyaron.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.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).