From: "Basil L. Contovounesios" <contovob@tcd.ie>
To: Robert Weiner <rsw@gnu.org>
Cc: rswgnu@gmail.com, 34506@debbugs.gnu.org
Subject: bug#34506: 27.0.50: push-button bug with basic text-property button
Date: Tue, 19 Feb 2019 03:08:33 +0000 [thread overview]
Message-ID: <87zhqslbke.fsf@tcd.ie> (raw)
In-Reply-To: <CA+OMD9jY4G_GEX-gYtLpkRw+nStbN=rwBmOaAbz8=2C7-NwHHA@mail.gmail.com> (Robert Weiner's message of "Mon, 18 Feb 2019 17:54:06 -0500")
Robert Weiner <rsw@gnu.org> writes:
> On Mon, Feb 18, 2019 at 3:51 PM Basil L. Contovounesios <contovob@tcd.ie> wrote:
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> >> From: Robert Weiner <rsw@gnu.org>
> >> Date: Sun, 17 Feb 2019 18:46:09 -0500
> >> Cc: 34506@debbugs.gnu.org
> >>
> >> And what about (button-type (button-at (point))) returning
> >> nil when button-at returns non-nil. Both of these functions
> >> operate on push-buttons as the button.el code reflects, right?
> >> If so, then that should be a bug. If not, then it could use
> >> some explanation.
> >
> > button-type requires a button as an argument, whereas button-at is
> > documented to return a marker for text-buttons. So you cannot safely
> > invoke button-type if the button at point might be of the text-button
> > type.
>
> Buffer positions, markers, and overlays all qualify as "buttons", so
> button-type works with both text- and overlay-buttons (but not widgets).
>
> But as I think I noted in my first message, my recollection
> is that button-type returned nil when given a marker value
> returned from button-at.
I think what's confusing you is that button-at returns a marker even
when there is no button at point. If either of the following two
expressions evaluates to nil, then there is no button at point:
(button-type (button-at (point)))
(button-type (point))
If there is something that *looks* like a button at point, yet these
expressions evaluate to nil, then you're probably looking at a widget
instead.
> Since widgets use text-properties,
AFAICT Customize widgets use overlays, not text properties. I concluded
this by comparing the results of (text-properties-at (point)) and
(overlays-at (point)) with point at a Customize button.
> button-at on a widget can return a non-nil value, so to say that
> widgets and buttons are unrelated ignores the programming API.
Again, that button-at returns a marker for a widget is a coincidence,
not part of either library's API. Last time I read/skimmed the relevant
manuals I was not given the impression that these libraries were
related, but suggestions for clarification of their text is always
welcome.
> Maybe the solution is to add a more opaque programming abstraction
> atop each type so that they don't expose their underlying
> implementations and cause programming errors.
Can you please elaborate? I don't see how either library's
implementation is exposed beyond what is documented in its respective
manual.
> So I'm guessing what you meant is "you cannot safely invoke button-type
> if the button at point might be a widget rather than a button".
>
> Yes, again noting that widget documentation specifically mentions push-buttons
> (push-button is the function used to activate buttons).
push-button is indeed a button.el function used to activate buttons, but
this has nothing to do with the push-button widget type, which is
documented under '(widget) Introduction' and '(widget) push-button'.
> This negates the idea that the two constructs are wholly independent
> of each other.
I hope I have managed to convince you otherwise.
--
Basil
next prev parent reply other threads:[~2019-02-19 3:08 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-16 22:08 bug#34506: 27.0.50: push-button bug with basic text-property button Bob Weiner
2019-02-17 15:24 ` Eli Zaretskii
2019-02-17 23:46 ` Robert Weiner
2019-02-18 15:47 ` Eli Zaretskii
2019-02-18 16:56 ` Robert Weiner
2019-02-18 17:36 ` Eli Zaretskii
2019-02-18 20:52 ` Basil L. Contovounesios
2019-02-18 20:51 ` Basil L. Contovounesios
2019-02-18 22:54 ` Robert Weiner
2019-02-19 3:08 ` Basil L. Contovounesios [this message]
2019-02-19 3:29 ` Eli Zaretskii
2019-02-19 15:26 ` Basil L. Contovounesios
2019-02-20 5:22 ` Robert Weiner
2019-02-25 2:40 ` Basil L. Contovounesios
2019-03-02 12:34 ` Eli Zaretskii
2019-04-07 3:14 ` Basil L. Contovounesios
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=87zhqslbke.fsf@tcd.ie \
--to=contovob@tcd.ie \
--cc=34506@debbugs.gnu.org \
--cc=rsw@gnu.org \
--cc=rswgnu@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.