From: Mauro Aranda <maurooaranda@gmail.com>
To: Marco Antoniotti <marcoxa@gmail.com>
Cc: 63838@debbugs.gnu.org
Subject: bug#63838: 28.2; 'wid-edit.el' problems with 'integer' (and 'sexp') widgets.
Date: Sun, 16 Jul 2023 08:50:28 -0300 [thread overview]
Message-ID: <174623a9-45bf-10d1-8b59-cb5b816026bc@gmail.com> (raw)
In-Reply-To: <CAKmY7cXEs0uG0h2Wd-DKnqr78+5idv+pehRo_LLUEjmx-z4f2A@mail.gmail.com>
Marco Antoniotti <marcoxa@gmail.com> writes:
> Hi
Thanks for the bug report!
> The issue is with the following code that tries to use the Widget
> library. The slots of the widget are actually not necessary to see the
> problem.
>
> (widget-create 'integer
> :help-echo "Enter an integer..."
> :notify (lambda (w1 &rest ws)
> (ignore ws)
> (message "WIFT: IF: %s"
> (widget-value w1)
> ))
> :size 4
> )
The :notify value is kind of necessary, right? I mean, the bug doesn't
manifest as long as code doesn't try to access the value of a
restricted-sexp widget while its empty.
> Specializing the widget with a hack like the function below fixes the
> problem, but a
> good solution may need some more work to get all the corner cases.
> Note that setting a "widget buffer" in overwrite mode goes a long way to
> mitigate these problems: maybe having widget-setup switch to it would
> be another good thing to do.
I don't think we want to do that.
> :value-to-external
> (lambda (widget value)
> ;; Lifted, and fixed, from `:value-to-external' in
> ;; `restricted-sexp'.
>
> (unless (stringp value)
> (display-warning
> 'widget-bad-default-value
> (format-message
> "\nA widget of type %S has a bad default value.
> value: %S
> match function: %S
> match-alternatives: %S"
> (widget-type widget)
> value
> (widget-get widget :match)
> (widget-get widget :match-alternatives))
> :warning))
> (if (and (stringp value) (string-equal "" value))
> ;; Oooops, we cannot just `read'.
> (widget-get widget :default-value)
> (read value))
> )
I don't think this is a good place to do this. And there's no
:default-value property in the widget library, just :value.
I think it'd be much better if we specialize the :value-get function for
the restricted-sexp widget, defaulting to return :value when the widget
is empty.
next prev parent reply other threads:[~2023-07-16 11:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-02 9:49 bug#63838: 28.2; 'wid-edit.el' problems with 'integer' (and 'sexp') widgets Marco Antoniotti
2023-07-16 11:50 ` Mauro Aranda [this message]
2023-09-09 15:13 ` Mauro Aranda
2023-09-16 9:58 ` 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=174623a9-45bf-10d1-8b59-cb5b816026bc@gmail.com \
--to=maurooaranda@gmail.com \
--cc=63838@debbugs.gnu.org \
--cc=marcoxa@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 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.