From: Mauro Aranda <maurooaranda@gmail.com>
To: Drew Adams <drew.adams@oracle.com>
Cc: "59937@debbugs.gnu.org" <59937@debbugs.gnu.org>
Subject: bug#59937: 28.2; Bad defcustom behavior
Date: Wed, 14 Dec 2022 19:20:29 -0300 [thread overview]
Message-ID: <5a25029e-f20b-4c17-2bba-0b4bf7510a69@gmail.com> (raw)
In-Reply-To: <CO6PR10MB5473E27F2A27D9198B16EDA8F3E09@CO6PR10MB5473.namprd10.prod.outlook.com>
Drew Adams <drew.adams@oracle.com> writes:
>> Oh, I think I see a way around that now. I think the following will
>> take care of:
>>
>> 1. Being able to create the restricted-sexp (sub)widget even if the
>> default value isn't valid.
>> (Which I think it's one of your main points throughout the bug report)
>>
>> 2. Being able to do it without prompting or whatsoever.
>> (Which is one of my main points in this conversation).
>
> Fabulous!
>
>> When the restricted-sexp widget has to be created, if there's a valid
>> default value we create it with that one (like I showed in my previous
>> message), but if there's not we create it empty.
>>
>> Let me know if you agree with that.
>
> 100%. I hope you can do it without too much trouble.
> It will make a big difference, I think, including
> perhaps in how much people make use of `restricted-sexp'.
>
>> As I've said, I don't think we need to (nor want to) prompt. I think
>> the prompt there is just an accident, and I would like to avoid it.
>> Sorry if I sound stubborn about this, but I'm convinced that prompting
>> at that time of the widget's creation can be really harmful.
>
> I was seeing prompting only as a necessity as long as the code
> requires a value before it can create the UI field for the
> `restricted-sexp'. If you can dispense with that need then great!
> Certainly it would be much better not to have any prompting
> (especially not with just the default prompt).
Great! I'll work on it. I hope I don't find any surprises.
>> I've seen things like:
>> (defcustom foo nil
>> "..."
>> :type '(repeat (function :value t)))
>>
>> And I would like to make more evident these kind of errors. But if we
>> find a way to cope with an invalid default value for the restricted-sexp
>> widget, then it might be fine to remove it (I'm not so sure yet).
>
> I thought it already coped with invalid input.
> I guess I was mistaken. It definitely should.
>
> Generally, all Customize UI fields (including
> buttons, checkboxes, etc.) do check the input
> for validity, I think. Not necessarily at the
> time you edit but at least when you try to set
> the value to what your editing resulted in.
Yes, Customize checks at the time of creation (and inserts "(mismatch)"
when the value isn't valid), and at the time of setting/saving. But the
Widget code does not check when creating the widget.
>> Yes, thanks to your response I was able to see a way to create the
>> editable field (with value ""), when there's no valid default value.
>
> Really glad I could contribute something to this,
> by my incessant arguing/questioning. ;-)
> I appreciate your working on this. I doubt that
> anyone else would try to tackle it.
:-)
>> > And definers ideally shouldn't need to specify
>> > default values for such fields - the set of
>> > predicates should be able to define what kind
>> > of UI field is needed.
>>
>> I'm not sure if I understand what you say here. I don't think it's
>> possible to figure out a good value to use as a default from the
>> predicates: that's why my idea is about creating it with the empty
>> string.
>
> Ah. Maybe we do disagree, in the sense that I still
> don't understand.
>
> Is there a _logical_ requirement that there be a
> value, in order to create the editable field for
> the `restricted-sexp'? I don't think there should
> be.
>
> That's different from the need for a value because
> the current code works that way.
>
> But I really don't see why a value is needed. All
> the code needs to do is create an editable field
> that expects text that satisfies the predicates,
> no? Of what (logical) use is the ("default") value?
I think you're right on point. It's just that the code works that way,
and makes assumptions that there is always going to be a value (default
or edited).
>> So, would you agree to creating the restricted-sexp widget with an empty
>> editable field, in case the default value is not valid?
>
> In case it's missing, definitely.
>
> In case it's not valid? I guess so, but in that
> case it would be good to signal an error (somehow),
> or a message saying that it's invalid and so will
> be ignored (create the field without any value).
>
>> Then the need to provide a valid default value is not so strong anymore
>> (but still should be encouraged, I think), and Customize can work better
>> and more intuitively when there isn't a valid default value.
>
> It all sounds good to me. Looking forward to
> whatever you come up with. Thx.
I'll see what I can do in the next days. Thanks!
next prev parent reply other threads:[~2022-12-14 22:20 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-10 5:06 bug#59937: 28.2; Bad defcustom behavior Drew Adams
2022-12-10 10:05 ` Mauro Aranda
2022-12-10 22:05 ` Drew Adams
2022-12-11 11:08 ` Mauro Aranda
2022-12-13 22:10 ` Drew Adams
2022-12-13 22:50 ` Mauro Aranda
2022-12-14 1:51 ` Drew Adams
2022-12-14 12:40 ` Mauro Aranda
2022-12-14 18:53 ` Drew Adams
2022-12-14 22:20 ` Mauro Aranda [this message]
2022-12-14 22:42 ` Drew Adams
2023-01-04 16:07 ` Drew Adams
2023-01-04 22:31 ` Mauro Aranda
2023-01-04 22:47 ` Drew Adams
2023-07-16 23:00 ` Mauro Aranda
2023-07-17 15:30 ` Drew Adams
2023-07-17 16:21 ` Mauro Aranda
2023-07-22 12:56 ` 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=5a25029e-f20b-4c17-2bba-0b4bf7510a69@gmail.com \
--to=maurooaranda@gmail.com \
--cc=59937@debbugs.gnu.org \
--cc=drew.adams@oracle.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 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.