From unknown Fri Jun 20 07:22:49 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#34506 <34506@debbugs.gnu.org> To: bug#34506 <34506@debbugs.gnu.org> Subject: Status: 27.0.50: push-button bug with basic text-property button Reply-To: bug#34506 <34506@debbugs.gnu.org> Date: Fri, 20 Jun 2025 14:22:49 +0000 retitle 34506 27.0.50: push-button bug with basic text-property button reassign 34506 emacs submitter 34506 Bob Weiner severity 34506 minor tag 34506 fixed thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 16 17:09:11 2019 Received: (at submit) by debbugs.gnu.org; 16 Feb 2019 22:09:12 +0000 Received: from localhost ([127.0.0.1]:50576 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gv891-0007Sv-Ip for submit@debbugs.gnu.org; Sat, 16 Feb 2019 17:09:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52895) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gv88z-0007Sj-Q0 for submit@debbugs.gnu.org; Sat, 16 Feb 2019 17:09:10 -0500 Received: from lists.gnu.org ([209.51.188.17]:33876) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gv88u-00026S-Iy for submit@debbugs.gnu.org; Sat, 16 Feb 2019 17:09:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39040) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gv88t-0000El-Du for bug-gnu-emacs@gnu.org; Sat, 16 Feb 2019 17:09:04 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gv88r-00025P-El for bug-gnu-emacs@gnu.org; Sat, 16 Feb 2019 17:09:03 -0500 Received: from mail-qt1-f172.google.com ([209.85.160.172]:33712) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gv88r-000226-Aa for bug-gnu-emacs@gnu.org; Sat, 16 Feb 2019 17:09:01 -0500 Received: by mail-qt1-f172.google.com with SMTP id z39so15243601qtz.0 for ; Sat, 16 Feb 2019 14:08:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=I7rhuoiDssI6uKE3R1qiEXkkebbAscMFeuH3zO5Aypg=; b=WdVfdyE2+7lbpTIoqwyhTsfPT/xF7gKoYPcvTE3VTfzQrW8UW5r2TuYoEOsXXq/1ql 1fvaSxqmvHqpjSj7N50lqFle6Qq+YAN0Lc5XdmNZyWMQc91xZFdW7vK3aCBXw7/J1CHI FdaHRoEqJGrjm25N2mVwrMyGKEnZGFirAazu3sXxKc/NqjE7Hz90AhDu1X75S2ocM9JC wVEq03Xj77VAr6MmkBaTOon7aRLqKPuGCuFfNvFg85qNNC22ZrMjHolhSDRz7pFAQ4sd tUiJeQm2eRrAMGgAuYPAMqgN3zeW8SB5BqfUxm3kzNKKT5FCWDDdVDtVdMF7vQnpMJAO 4gKg== X-Gm-Message-State: AHQUAuZVBiqWWkwGH0eD0BIHm+KwrFuZ+hqz/PF3NGkkUiatNohA/CQc cqXft/ztHrNVU1RQyRaHWD+sfqu3 X-Google-Smtp-Source: AHgI3IZZGGuBS0YpAO9VX42TF0k6hEv9gCE8cGTnp/AV/vfcH/BjD5cxqPMyEwGJ4rgIUQ2gnpOypQ== X-Received: by 2002:a0c:9346:: with SMTP id e6mr12113419qve.98.1550354929305; Sat, 16 Feb 2019 14:08:49 -0800 (PST) Received: from water-imac.local.gnu.org (ool-2f1481cf.dyn.optonline.net. [47.20.129.207]) by smtp.gmail.com with ESMTPSA id y17sm3962342qtc.33.2019.02.16.14.08.48 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 16 Feb 2019 14:08:48 -0800 (PST) From: Bob Weiner To: bug-gnu-emacs@gnu.org Subject: 27.0.50: push-button bug with basic text-property button Date: Sat, 16 Feb 2019 17:08:47 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.160.172 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From the Elisp manual (https://www.gnu.org/software/emacs/manual/html_node/elisp/Manipulating-Buttons.html), we have these accurate explanations: — Function: button-at pos Return the button at position pos in the current buffer, or nil. If the button at pos is a text property button, the return value is a marker pointing to pos. Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: gnu.org] 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (rswgnu[at]gmail.com) 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) >From the Elisp manual (https://www.gnu.org/software/emacs/manual/html_node/= elisp/Manipulating-Buttons.html), we have these accurate explanations: =E2=80=94 Function: button-at pos Return the button at position pos in the current buffer, or nil. If the b= utton at pos is a text property button, the return value is a marker pointi= ng to pos. =E2=80=94 Function: button-activate button &optional use-mouse-action Call button's action property (i.e., invoke the function that is the valu= e of that property, passing it the single argument button). If use-mouse-ac= tion is non-nil, try to invoke the button's mouse-action property instead o= f action; if the button has no mouse-action property, use action as normal. ----- With point on a "Choose" button in a customize-group buffer, point is on a text-property button and (button-at (point)) returns a marker object rather than a button whose action is a marker object. Thus, if one calls (push-button) at that location, it sends this marker object as the button argument to 'button-activate' which then triggers an error when it tries to funcall the button's action which is nil in this case. Shouldn't there be additional logic that checks if the button itself is a marker and then uses the button as the action in that case? Related to this: (button-type (button-at (point))) returns nil which seems to contradict the fact that button-at returns non-nil. Am I missing things here or does button-activate need additional code? Thanks, Bob ------- In GNU Emacs 27.0.50 (build 13, x86_64-apple-darwin16.7.0, NS appkit-1504.8= 3 Version 10.12.6 (Build 16G1036)) of 2017-12-17 built on bka-iMac.local Repository revision: 36375d35aa06e84865cce678559ddfa8f79a9775 Windowing system distributor 'Apple', version 10.3.1561 Recent messages: [Sat 04:46:35 PM]=20 [Sat 04:46:35 PM]=20 [Sat 04:46:35 PM] Result: nil [Sat 04:46:37 PM]=20 [Sat 04:46:37 PM]=20 [Sat 04:46:37 PM] Result: nil [Sat 04:46:38 PM]=20 [Sat 04:46:38 PM] nil [Sat 04:47:16 PM]=20 Back to top level Configured using: 'configure --with-ns --with-imagemagick --without-pop --with-mailutils CC=3Dclang 'CFLAGS=3D-O3 -g'' Configured features: JPEG NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS LCMS2 Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Custom Minor modes in effect: recentf-mode: t treemacs-follow-mode: t treemacs-filewatch-mode: t treemacs-git-mode: deferred treemacs-fringe-indicator-mode: t async-bytecomp-package-mode: t diff-auto-refine-mode: t desktop-save-mode: t winner-mode: t which-key-mode: t which-function-mode: t persistent-scratch-autosave-mode: t global-edit-server-edit-mode: t delete-selection-mode: t auto-compile-on-load-mode: t auto-compile-on-save-mode: t column-number-indicator-zero-based: t dynamic-completion-mode: t eros-mode: t shell-dirtrack-mode: t show-paren-mode: t global-company-mode: t company-mode: t ace-window-display-mode: t major-mode-icons-mode: t minibuffer-depth-indicate-mode: t tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 17 10:24:32 2019 Received: (at 34506) by debbugs.gnu.org; 17 Feb 2019 15:24:32 +0000 Received: from localhost ([127.0.0.1]:51465 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gvOIx-00034B-PY for submit@debbugs.gnu.org; Sun, 17 Feb 2019 10:24:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43818) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gvOIw-00033y-4S for 34506@debbugs.gnu.org; Sun, 17 Feb 2019 10:24:30 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:55846) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvOIq-0003Co-Tq; Sun, 17 Feb 2019 10:24:24 -0500 Received: from [176.228.60.248] (port=2364 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1gvOIq-0003RP-Hx; Sun, 17 Feb 2019 10:24:24 -0500 Date: Sun, 17 Feb 2019 17:24:27 +0200 Message-Id: <83pnrql9p0.fsf@gnu.org> From: Eli Zaretskii To: Bob Weiner In-reply-to: (message from Bob Weiner on Sat, 16 Feb 2019 17:08:47 -0500) Subject: Re: bug#34506: 27.0.50: push-button bug with basic text-property button References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 34506 Cc: 34506@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > From: Bob Weiner > Date: Sat, 16 Feb 2019 17:08:47 -0500 > > With point on a "Choose" button in a customize-group buffer, point is on > a text-property button and (button-at (point)) returns a marker object > rather than a button whose action is a marker object. Thus, if one > calls (push-button) at that location, it sends this marker object as the > button argument to 'button-activate' which then triggers an error when > it tries to funcall the button's action which is nil in this case. > Shouldn't there be additional logic that checks if the button itself is > a marker and then uses the button as the action in that case? > > Related to this: (button-type (button-at (point))) returns nil which seems > to contradict the fact that button-at returns non-nil. > > Am I missing things here or does button-activate need additional code? button-activate and push-button already include that additional code, but you are trying to invoke them on a kind of "button" that they don't know how to handle. The problem is that "button" is overloaded here: buttons created by Customize are not of the kind supported by functions from button.el, you need to invoke functions described in widget.info instead. The "text-property buttons" mentioned in the documentation of button-at etc. are those created by make-text-button and insert-text-button, not those created by Customize. The ELisp manual hints on this at the beginning the parent node, "Buttons". Maybe that's not clear enough; patches to make that more clear are welcome. Other than that, I don't see a bug here. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 17 18:46:44 2019 Received: (at 34506) by debbugs.gnu.org; 17 Feb 2019 23:46:45 +0000 Received: from localhost ([127.0.0.1]:51839 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gvW8y-000535-G8 for submit@debbugs.gnu.org; Sun, 17 Feb 2019 18:46:44 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33057) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gvW8v-00052t-U2 for 34506@debbugs.gnu.org; Sun, 17 Feb 2019 18:46:43 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:35635) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvW8q-0004LI-Nd for 34506@debbugs.gnu.org; Sun, 17 Feb 2019 18:46:36 -0500 Received: from mail-lf1-f46.google.com ([209.85.167.46]:46324) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1gvW8q-00076M-Dz for 34506@debbugs.gnu.org; Sun, 17 Feb 2019 18:46:36 -0500 Received: by mail-lf1-f46.google.com with SMTP id g12so1340681lfb.13 for <34506@debbugs.gnu.org>; Sun, 17 Feb 2019 15:46:36 -0800 (PST) X-Gm-Message-State: AHQUAubKaJWEDDegvIHEK/BZ4g7tur4P1ltQZp28D/qlFU5oktd7X3Ed BSYTLT/Yk20W3VC/ArNqJHMoZY2gdvl3LhqyHJ0= X-Google-Smtp-Source: AHgI3IaCe84i0L9LWdA/7Nn1JENyxBvM1AP9QUYv1FVgon1kZag0usfx/QIh7wO7EFJPr+taly4XQSp7+mC8y8dJEyE= X-Received: by 2002:ac2:4474:: with SMTP id y20mr11695479lfl.40.1550447195070; Sun, 17 Feb 2019 15:46:35 -0800 (PST) MIME-Version: 1.0 References: <83pnrql9p0.fsf@gnu.org> In-Reply-To: <83pnrql9p0.fsf@gnu.org> From: Robert Weiner Date: Sun, 17 Feb 2019 18:46:09 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: bug#34506: 27.0.50: push-button bug with basic text-property button To: Eli Zaretskii Content-Type: multipart/alternative; boundary="0000000000004e295105821f9e2d" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: 2.5 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: On Sun, Feb 17, 2019 at 10:24 AM Eli Zaretskii wrote: > > From: Bob Weiner > > Date: Sat, 16 Feb 2019 17:08:47 -0500 > > > > With point on a "Choose" button in a customize-group buffer, point is on > > a text-property button and (button-at (point)) ret [...] Content analysis details: (2.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: gnu.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 HTML_MESSAGE BODY: HTML included in message 2.5 FREEMAIL_FORGED_REPLYTO Freemail in Reply-To, but not From X-Debbugs-Envelope-To: 34506 Cc: 34506@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: rswgnu@gmail.com Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --0000000000004e295105821f9e2d Content-Type: text/plain; charset="UTF-8" On Sun, Feb 17, 2019 at 10:24 AM Eli Zaretskii wrote: > > From: Bob Weiner > > Date: Sat, 16 Feb 2019 17:08:47 -0500 > > > > With point on a "Choose" button in a customize-group buffer, point is on > > a text-property button and (button-at (point)) returns a marker object > > rather than a button whose action is a marker object. Thus, if one > > calls (push-button) at that location, it sends this marker object as the > > button argument to 'button-activate' which then triggers an error when > > it tries to funcall the button's action which is nil in this case. > > Shouldn't there be additional logic that checks if the button itself is > > a marker and then uses the button as the action in that case? > > > > Related to this: (button-type (button-at (point))) returns nil which > seems > > to contradict the fact that button-at returns non-nil. > > > > Am I missing things here or does button-activate need additional code? > > button-activate and push-button already include that additional code, > but you are trying to invoke them on a kind of "button" that they > don't know how to handle. The problem is that "button" is overloaded > here: buttons created by Customize are not of the kind supported by > functions from button.el, you need to invoke functions described in > widget.info instead. The "text-property buttons" mentioned in the > documentation of button-at etc. are those created by make-text-button > and insert-text-button, not those created by Customize. > I really don't fully understand what you are saying here. There is a section in widget.info which describes use of the (push-button) function which is defined in button.el, so although I understand you are saying there are two different types of buttons, it seems like they are connected. Maybe the custom widgets use text-property buttons. If you could, for each of the two types of buttons, just show code that finds the button at point and then activates it, so I can see the difference clearly. That would be most helpful. 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. Thanks, Bob --0000000000004e295105821f9e2d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sun, Feb 17, 2019 at 10:24 AM Eli Zaretskii <eliz@gnu.org> wrote:
> = From: Bob Weiner <rsw@g= nu.org>
> Date: Sat, 16 Feb 2019 17:08:47 -0500
>
> With point on a "Choose" button in a customize-group buffer,= point is on
> a text-property button and (button-at (point)) returns a marker object=
> rather than a button whose action is a marker object.=C2=A0 Thus, if o= ne
> calls (push-button) at that location, it sends this marker object as t= he
> button argument to 'button-activate' which then triggers an er= ror when
> it tries to funcall the button's action which is nil in this case.=
> Shouldn't there be additional logic that checks if the button itse= lf is
> a marker and then uses the button as the action in that case?
>
> Related to this:=C2=A0 (button-type (button-at (point))) returns nil w= hich seems
> to contradict the fact that button-at returns non-nil.
>
> Am I missing things here or does button-activate need additional code?=

button-activate and push-button already include that additional code,
but you are trying to invoke them on a kind of "button" that they=
don't know how to handle.=C2=A0 The problem is that "button" = is overloaded
here: buttons created by Customize are not of the kind supported by
functions from button.el, you need to invoke functions described in
widget.= info instead.=C2=A0 The "text-property buttons" mentioned in = the
documentation of button-at etc. are those created by make-text-button
and insert-text-button, not those created by Customize.

I really don't fully understand what you are saying here.
=
Ther= e is a section in widget.info which desc= ribes use of the (push-button)
function which is defined in button.el, so = although I
understand you are saying there are two different types
of but= tons, it seems like they are connected.=C2=A0 Maybe
the custom widgets use= text-property buttons.

If you could, for each of the two types of b= uttons,
just show code that finds the button at point and then
activates = it, so I can see the difference clearly.=C2=A0 That
would be most helpful.=

And what about (button-type (button-at (point))) returning
nil whe= n button-at returns non-nil.=C2=A0 Both of these functions
operate on pus= h-buttons as the button.el code reflects, right?
If so, then that should b= e a bug.=C2=A0 If not, then it could use
some explanation.

Thanks,<= /div>

Bob

--0000000000004e295105821f9e2d-- From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 18 10:47:40 2019 Received: (at 34506) by debbugs.gnu.org; 18 Feb 2019 15:47:40 +0000 Received: from localhost ([127.0.0.1]:53092 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gvl8u-0005kn-5P for submit@debbugs.gnu.org; Mon, 18 Feb 2019 10:47:40 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42961) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gvl8p-0005kY-Us for 34506@debbugs.gnu.org; Mon, 18 Feb 2019 10:47:38 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:45693) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvl8j-0003ol-R6; Mon, 18 Feb 2019 10:47:30 -0500 Received: from [176.228.60.248] (port=1095 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1gvl8h-0005Yd-VV; Mon, 18 Feb 2019 10:47:29 -0500 Date: Mon, 18 Feb 2019 17:47:32 +0200 Message-Id: <831s45ksiz.fsf@gnu.org> From: Eli Zaretskii To: rswgnu@gmail.com In-reply-to: (message from Robert Weiner on Sun, 17 Feb 2019 18:46:09 -0500) Subject: Re: bug#34506: 27.0.50: push-button bug with basic text-property button References: <83pnrql9p0.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 34506 Cc: 34506@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > From: Robert Weiner > Date: Sun, 17 Feb 2019 18:46:09 -0500 > Cc: 34506@debbugs.gnu.org > > button-activate and push-button already include that additional code, > but you are trying to invoke them on a kind of "button" that they > don't know how to handle. The problem is that "button" is overloaded > here: buttons created by Customize are not of the kind supported by > functions from button.el, you need to invoke functions described in > widget.info instead. The "text-property buttons" mentioned in the > documentation of button-at etc. are those created by make-text-button > and insert-text-button, not those created by Customize. > > I really don't fully understand what you are saying here. I'm saying that a "button" created by Customize is radically different from "buttons" that button.el functions can handle. They are different objects, and it's unfortunate that both kinds are named the same. > There is a section in widget.info which describes use of the (push-button) > function which is defined in button.el No, push-button described in widget.info is a type of widget, not a function. Again, the same name used for two very different things. > Maybe the custom widgets use text-property buttons. Custom widget button do indeed use text properties, but those properties are entirely different from the properties used by text-buttons created by button.el. You can see that yourself by using the describe-text-properties command with point on each type of button. > If you could, for each of the two types of buttons, > just show code that finds the button at point and then > activates it, so I can see the difference clearly. That > would be most helpful. If you type "C-h c RET" on a button in a Customize buffer, you will see that RET invokes Custom-newline there -- this is the way to "push" the button widgets that Custom uses. By contrast, if you do the same on a button created by button.el, like a hyperlink in the *Help* buffer, you will see that RET invokes the command push-button there, a different command. These are the two ways of pushing these two different kinds of buttons. > 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. IOW, the text-button is not an object, it is a place in the buffer where the button starts. From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 18 11:57:28 2019 Received: (at 34506) by debbugs.gnu.org; 18 Feb 2019 16:57:28 +0000 Received: from localhost ([127.0.0.1]:53143 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gvmER-0007Vi-VH for submit@debbugs.gnu.org; Mon, 18 Feb 2019 11:57:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57340) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gvmEN-0007VS-IS for 34506@debbugs.gnu.org; Mon, 18 Feb 2019 11:57:25 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:46871) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvmEI-0008A9-5v for 34506@debbugs.gnu.org; Mon, 18 Feb 2019 11:57:18 -0500 Received: from mail-lj1-f180.google.com ([209.85.208.180]:38749) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1gvmEH-0003eR-DI for 34506@debbugs.gnu.org; Mon, 18 Feb 2019 11:57:17 -0500 Received: by mail-lj1-f180.google.com with SMTP id j19so14174223ljg.5 for <34506@debbugs.gnu.org>; Mon, 18 Feb 2019 08:57:17 -0800 (PST) X-Gm-Message-State: AHQUAuaiwDu0Z9OUCZmh+/kWU24RBKfYXgFaoZkYkZKymWzlcUKbBol5 wU8esDSaSNPLqk1zlGszcGjRcicN/h769AuoXo4= X-Google-Smtp-Source: AHgI3IbR7T/OGtAEpke3NopnWWU9b3KA0aFJeYJ/7PXbVar822yeIY/FUp8VhZoIeojTEufmkuSKnkdaJv3UNk/glyM= X-Received: by 2002:a2e:4784:: with SMTP id u126-v6mr14580979lja.124.1550509035976; Mon, 18 Feb 2019 08:57:15 -0800 (PST) MIME-Version: 1.0 References: <83pnrql9p0.fsf@gnu.org> <831s45ksiz.fsf@gnu.org> In-Reply-To: <831s45ksiz.fsf@gnu.org> From: Robert Weiner Date: Mon, 18 Feb 2019 11:56:49 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: bug#34506: 27.0.50: push-button bug with basic text-property button To: Eli Zaretskii Content-Type: multipart/alternative; boundary="0000000000005006f005822e0436" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: 2.5 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Thanks Eli, that is much clearer. I can work with that explanation. Your last paragraph indicates that the button API by itself could use some improvement. How does one obtain a button to send to button-type if not button-at? Content analysis details: (2.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 HTML_MESSAGE BODY: HTML included in message 2.5 FREEMAIL_FORGED_REPLYTO Freemail in Reply-To, but not From X-Debbugs-Envelope-To: 34506 Cc: 34506@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: rswgnu@gmail.com Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --0000000000005006f005822e0436 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks Eli, that is much clearer. I can work with that explanation. Your last paragraph indicates that the button API by itself could use some improvement. How does one obtain a button to send to button-type if not button-at? Also, a confusing part of the widget documentation is this: ------- 5.4 The =E2=80=98push-button=E2=80=99 Widget =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D Syntax: TYPE ::=3D (push-button [KEYWORD ARGUMENT]... [ VALUE ]) ------- The above syntax description of course looks like a lisp-function call of push-button. At the very least, changing this thing's name to widget-button would prevent such confusion. -- Bob --0000000000005006f005822e0436 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks Eli, that is much cle= arer.=C2=A0 I can work with that explanation.

Your last paragraph in= dicates that the button API by itself could use some improvement.
How does= one obtain a button to send to button-type if not button-at?

Also, = a confusing part of the widget documentation is this:

-------

5.4 The =E2=80=98push-button=E2=80=99 Widget
= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D

Syntax:

= =C2=A0 =C2=A0 =C2=A0TYPE ::=3D (push-bu= tton [KEYWORD ARGUMENT]...=C2=A0 [ VALUE ])

-------
=

The= above syntax description of course looks like a lisp-function call of push= -button.
At the very least, changing this thing's name to widget-butt= on would prevent such
confusion.

-- Bob

--0000000000005006f005822e0436-- From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 18 12:37:06 2019 Received: (at 34506) by debbugs.gnu.org; 18 Feb 2019 17:37:06 +0000 Received: from localhost ([127.0.0.1]:53176 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gvmql-0008Tw-3Y for submit@debbugs.gnu.org; Mon, 18 Feb 2019 12:37:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41889) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gvmqi-0008TT-US for 34506@debbugs.gnu.org; Mon, 18 Feb 2019 12:37:01 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:48098) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvmqV-0008DN-He; Mon, 18 Feb 2019 12:36:49 -0500 Received: from [176.228.60.248] (port=4118 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1gvmqV-0007oh-5p; Mon, 18 Feb 2019 12:36:47 -0500 Date: Mon, 18 Feb 2019 19:36:52 +0200 Message-Id: <83k1hxj8wb.fsf@gnu.org> From: Eli Zaretskii To: rswgnu@gmail.com In-reply-to: (message from Robert Weiner on Mon, 18 Feb 2019 11:56:49 -0500) Subject: Re: bug#34506: 27.0.50: push-button bug with basic text-property button References: <83pnrql9p0.fsf@gnu.org> <831s45ksiz.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 34506 Cc: 34506@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > From: Robert Weiner > Date: Mon, 18 Feb 2019 11:56:49 -0500 > Cc: 34506@debbugs.gnu.org > > Your last paragraph indicates that the button API by itself could use some improvement. Possibly. > How does one obtain a button to send to button-type if not button-at? Looks like you need to use text-properties-at, and then look at the result: the type is stored in the 'category' property there. From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 18 15:51:23 2019 Received: (at 34506) by debbugs.gnu.org; 18 Feb 2019 20:51:23 +0000 Received: from localhost ([127.0.0.1]:53257 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gvpso-0006Pc-Ob for submit@debbugs.gnu.org; Mon, 18 Feb 2019 15:51:22 -0500 Received: from mail-ed1-f46.google.com ([209.85.208.46]:36444) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gvpsm-0006PE-Mo for 34506@debbugs.gnu.org; Mon, 18 Feb 2019 15:51:21 -0500 Received: by mail-ed1-f46.google.com with SMTP id g9so4412101eds.3 for <34506@debbugs.gnu.org>; Mon, 18 Feb 2019 12:51:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=vd06Kp/OfJKotbKMjE6AE/bwJar4/B5C7dSG5NgL/hs=; b=KYGwff/w1uM6m0eWm417j1Es5le9v7y8tw3T2Rq7p0oSiEilQnqvQY5IQT5PMvqDx6 cDv2VDa8siRQRo0oTgcHOeglMeLWlHOVcFcvc123sekh1DKzidxHVaR/u/aCQupHt9vu xl/7nlPIObsdDLY27yJroICzvZCKtsmMuZj5ijXdgyDsaF86YWt+kh0VUftNNTn+afud qeHVFVpRcfaaxKRhEIEsgOYN7U8UJXZ1TihhOCLSs8NwZ8qJCFG3twC4oo64OftjkL/I dEF5FyPJwEBeHJ23+LEO/dl/OmglfX1e0SQ3q1zNANpjSU0x7PxgguSGuTauhvXturMn GJRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=vd06Kp/OfJKotbKMjE6AE/bwJar4/B5C7dSG5NgL/hs=; b=lnzV5SAsvSewCv4QjBzSA8PD2NMksvYnjzoHG17b1V77W39KhSzSGVu5QGIjsnUwSC /1gPupuBQu/JRax82l5UVKpGdwoZL+YmV4139fBNsRgwmov0Ii+lMk0K0jG5YNIkUx05 hVpHfVdZsEcEbQhHuBauSb80nSEFvSZqXgWxl4SKYcmFHpRxJqCmsQTl/aiMAm501wq5 2VKo58BENL3xWVpuUDF+QIHgpGRfFJxllWZFPO2pG/JBLwcq2LS0LKO8CLL2NdIdZtBv UXB8WEP8liY5sl+3tO9r2pMT+S6vOOVR75gvU8A+ZVpPZM6e6A1/YH0jIswsTlMBcFtd bP+g== X-Gm-Message-State: AHQUAuZsFfiLa+TAl+0qyybQ7jpzbCbdklrkKKeP7sorvPvDB+ns+QnI WekUeGsAiE3F9baLSPy3hYVpMQ== X-Google-Smtp-Source: AHgI3IbJtBC1LqvQ+7QRIDUX3KjU+dRsaQfkRBTXSDa8IeYH4DTmTarv9JJIGPN5RNll1lLQyD4VVw== X-Received: by 2002:a50:ed81:: with SMTP id h1mr13826527edr.145.1550523074839; Mon, 18 Feb 2019 12:51:14 -0800 (PST) Received: from localhost ([2a02:8084:20e2:c380:f786:805d:f4ab:1006]) by smtp.gmail.com with ESMTPSA id j46sm2961914ede.6.2019.02.18.12.51.13 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 18 Feb 2019 12:51:14 -0800 (PST) From: "Basil L. Contovounesios" To: Eli Zaretskii Subject: Re: bug#34506: 27.0.50: push-button bug with basic text-property button References: <83pnrql9p0.fsf@gnu.org> <831s45ksiz.fsf@gnu.org> Date: Mon, 18 Feb 2019 20:51:12 +0000 In-Reply-To: <831s45ksiz.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 18 Feb 2019 17:47:32 +0200") Message-ID: <875ztgrfb3.fsf@tcd.ie> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 34506 Cc: 34506@debbugs.gnu.org, rswgnu@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Robert Weiner >> 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). 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". -- Basil From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 18 15:52:38 2019 Received: (at 34506) by debbugs.gnu.org; 18 Feb 2019 20:52:38 +0000 Received: from localhost ([127.0.0.1]:53261 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gvpu2-0006Sp-4t for submit@debbugs.gnu.org; Mon, 18 Feb 2019 15:52:38 -0500 Received: from mail-ed1-f41.google.com ([209.85.208.41]:44924) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gvpty-0006SO-MA for 34506@debbugs.gnu.org; Mon, 18 Feb 2019 15:52:37 -0500 Received: by mail-ed1-f41.google.com with SMTP id b20so14897366edw.11 for <34506@debbugs.gnu.org>; Mon, 18 Feb 2019 12:52:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=xg4RPiNSgwBH06Z093QcQlslqIrVoVaq/W4/iniC1iY=; b=NlhNKwinEt5UHZm1UetyPupmzBGsN7WAn30TBxsJ96UFBJZpVIqhw8bTLQyM2l9XFT sU03Rc/3EDiCZr7yvx40X/A2IXyHOal1Ubk26tEe7Ex/LFUE5DEiafZc7zJKTzE0CtIh qMj0MgefBRsCxryyI16ry4WBd4icdOGAm8bd2NiCJa4mvLEdPudwOfsFaJfKBMfWrZcp shN1R4CCZJdcZQT2Eg+TW3ShzNIktVEVy1KeKu3fxX5yfCi7YNCMPiLj+vNqii9uS26Z ixLwrnu53IKIamX0oWLBNI3SlNYHaupdCz9ix95uKxarbPA7kbJFtvXdI/0ex/XF+Fhq JpKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=xg4RPiNSgwBH06Z093QcQlslqIrVoVaq/W4/iniC1iY=; b=agivc5wqDqUHLhwPJpDx2QT2HriB+yj607OFJG+j+eR44D5QUjELa7ONr/EzkNo4rY GnDtUmIQZfcQB5JOo0H+fzp68rQlEbHivNjSwSS0MMf/h9X5WW1z9WumPDnasgQ5UPkQ ZO5br9iT1nNk3tIrGTDqZsi/hQ6vsYhhGrB6e2kRaDUV2oihfa6wHtlZZsM7E0PeEbFb iTQ2w19NK+QWesQ1RiIQF2AY6bhqsUF5uasNLJKUGsocn/QR1DYYrOLIQw2f04OqLnBV MmYG1SkpHxfV2Vld+LpOpgPUF9WYSVB4Iuc+IF0ZOlwu/f4F+lDz7Fl++JGw4wF+fY7d hc2A== X-Gm-Message-State: AHQUAuZqIrEswFn3qLt3AevjaYSSPln/Z6wrG+9HTfgHiB73B3Oa94GB hewUbDYQff20AZVbfEB6eM+8cw== X-Google-Smtp-Source: AHgI3IZxKsdki4JwXkjFJatyKomDIlklxlkIzZfn5RYxYYBiZgvffMz+eVcQmfdgq6/JYd182IbO6A== X-Received: by 2002:a50:b623:: with SMTP id b32mr19900120ede.55.1550523148890; Mon, 18 Feb 2019 12:52:28 -0800 (PST) Received: from localhost ([2a02:8084:20e2:c380:f786:805d:f4ab:1006]) by smtp.gmail.com with ESMTPSA id q5sm3279098ejj.60.2019.02.18.12.52.28 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 18 Feb 2019 12:52:28 -0800 (PST) From: "Basil L. Contovounesios" To: Robert Weiner Subject: Re: bug#34506: 27.0.50: push-button bug with basic text-property button References: <83pnrql9p0.fsf@gnu.org> <831s45ksiz.fsf@gnu.org> Date: Mon, 18 Feb 2019 20:52:27 +0000 In-Reply-To: (Robert Weiner's message of "Mon, 18 Feb 2019 11:56:49 -0500") Message-ID: <874l90rf90.fsf@tcd.ie> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 34506 Cc: Eli Zaretskii , rswgnu@gmail.com, 34506@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Robert Weiner writes: > Thanks Eli, that is much clearer. I can work with that explanation. > > Your last paragraph indicates that the button API by itself could use > some improvement. How does one obtain a button to send to button-type > if not button-at? You can use button-at if you want to be agnostic of the button (not widget) type. If you're only dealing with text (not overlay) buttons, you can avoid creating markers by passing a buffer position like (point) directly to button-type. If you are dealing with widgets, on the other hand, you should use widget-at and widget-type in place of button-at and button-type, respectively. The widget and button APIs are mutually incompatible. -- Basil From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 18 17:54:52 2019 Received: (at 34506) by debbugs.gnu.org; 18 Feb 2019 22:54:52 +0000 Received: from localhost ([127.0.0.1]:53404 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gvroK-0003El-3W for submit@debbugs.gnu.org; Mon, 18 Feb 2019 17:54:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52229) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gvroH-0003ER-Gc for 34506@debbugs.gnu.org; Mon, 18 Feb 2019 17:54:50 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:53791) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvro3-00054K-Gr for 34506@debbugs.gnu.org; Mon, 18 Feb 2019 17:54:40 -0500 Received: from mail-lf1-f45.google.com ([209.85.167.45]:35579) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1gvro2-0005mY-Be for 34506@debbugs.gnu.org; Mon, 18 Feb 2019 17:54:35 -0500 Received: by mail-lf1-f45.google.com with SMTP id v7so13499213lfd.2 for <34506@debbugs.gnu.org>; Mon, 18 Feb 2019 14:54:34 -0800 (PST) X-Gm-Message-State: AHQUAuYw99Q73z01CMcPVqZ9110GFI6m0+aMTQFQcT4LDb18RFzDvZGo UmPrni/v9RXcpK5LEXv4cZNZtdYvZsRYUk/zAyk= X-Google-Smtp-Source: AHgI3IZDA+EGTrVhaqCaPlbQCBRVtbwkVJCIuBzpg7DRNhrTWDtLJselk1QQpKoWPbRl1ZcHkbuXW+qWvpXN+1oBeUo= X-Received: by 2002:a19:ee13:: with SMTP id g19mr14927795lfb.72.1550530472831; Mon, 18 Feb 2019 14:54:32 -0800 (PST) MIME-Version: 1.0 References: <83pnrql9p0.fsf@gnu.org> <831s45ksiz.fsf@gnu.org> <875ztgrfb3.fsf@tcd.ie> In-Reply-To: <875ztgrfb3.fsf@tcd.ie> From: Robert Weiner Date: Mon, 18 Feb 2019 17:54:06 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: bug#34506: 27.0.50: push-button bug with basic text-property button To: "Basil L. Contovounesios" Content-Type: multipart/alternative; boundary="0000000000000bf070058233026d" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: 2.5 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: On Mon, Feb 18, 2019 at 3:51 PM Basil L. Contovounesios wrote: > Eli Zaretskii writes: > > >> From: Robert Weiner > >> Date: Sun, 17 Feb 2019 18:46:09 -0500 > >> Cc: 34506@debbugs.gnu.org > >> > >> And what about (button-type (button-at (point))) returning > [...] Content analysis details: (2.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: gnu.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 HTML_MESSAGE BODY: HTML included in message 2.5 FREEMAIL_FORGED_REPLYTO Freemail in Reply-To, but not From X-Debbugs-Envelope-To: 34506 Cc: Eli Zaretskii , 34506@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: rswgnu@gmail.com Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --0000000000000bf070058233026d Content-Type: text/plain; charset="UTF-8" On Mon, Feb 18, 2019 at 3:51 PM Basil L. Contovounesios wrote: > Eli Zaretskii writes: > > >> From: Robert Weiner > >> 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. Since widgets use text-properties, button-at on a widget can return a non-nil value, so to say that widgets and buttons are unrelated ignores the programming API. 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. > > 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). This negates the idea that the two constructs are wholly independent of each other. Regards, Bob --0000000000000bf070058233026d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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: 345= 06@debbugs.gnu.org
>>
>> And what about (button-type (button-at (point))) returning
>> nil when button-at returns non-nil.=C2=A0 Both of these functions<= br> >> operate on push-buttons as the button.el code reflects, right?
>> If so, then that should be a bug.=C2=A0 If not, then it could use<= br> >> some explanation.
>
> button-type requires a button as an argument, whereas button-at is
> documented to return a marker for text-buttons.=C2=A0 So you cannot sa= fely
> invoke button-type if the button at point might be of the text-button<= br> > 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 rec= ollection
is that button-type returned nil when given a marker value
=
retu= rned from button-at.=C2=A0 Since widgets use text-properties,
button-at on= a widget can return a non-nil value, so to say that
widgets and buttons a= re unrelated ignores the programming API.
Maybe the solution is to add a m= ore opaque programming abstraction
atop each type so that they don't = expose their underlying implementations
and cause programming errors.

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 specifical= ly mentions push-buttons
(push-button is the function used to activate but= tons).=C2=A0 This negates the idea
that the two constructs are wholly ind= ependent of each other.

Regards,

Bob
--0000000000000bf070058233026d-- From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 18 22:08:45 2019 Received: (at 34506) by debbugs.gnu.org; 19 Feb 2019 03:08:46 +0000 Received: from localhost ([127.0.0.1]:53499 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gvvm1-0005HA-IV for submit@debbugs.gnu.org; Mon, 18 Feb 2019 22:08:45 -0500 Received: from mail-ed1-f51.google.com ([209.85.208.51]:41022) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gvvly-0005Gn-1i for 34506@debbugs.gnu.org; Mon, 18 Feb 2019 22:08:43 -0500 Received: by mail-ed1-f51.google.com with SMTP id x7so15462181eds.8 for <34506@debbugs.gnu.org>; Mon, 18 Feb 2019 19:08:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=DfmhLx959grlGFATAbnMLMalwpB9VD3b1MjWIq+GYos=; b=LGEtd4A6AMW+Qm810veTIsCNOJL+vqhY6VLB2a/gaA8Pr5/0+tZLgcrv09uN76WAR0 NBIuHTD/CeTRzlm9Yt3NopFlm1YCMDc3cdeDF1bqO4/r+5xJ4VKyW017HYru7XQfSE/k h0ZkwfpWTj6GoL3diw4outUvSRTI+tKaOGGUjlE5cTs5+rAKDgq17OXIsaU4+hKhb8R5 op33NNF+BCgnhhIAGck6iCIXZKHnf5hMUgiPnbu83/jOlwibNIPcnTYHrhGggp7TAwhD eLHx5tW8I7B1uo9xuUMKJQdEZwOIEVksrj+Cw2c5z4LNvK0dSANefsFD1J1lIFeIgdvq mZJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=DfmhLx959grlGFATAbnMLMalwpB9VD3b1MjWIq+GYos=; b=ANxDTUslzx0bdiSkH8W89vyeyhXIPLxuKmSQCnw1e8V3lNny7ErNZoP+QEpTBuXEmh 45ns6Ud8PJPyS/0CnhcYPCk9igreoOwjPTdEmvsJlkcQS94Vr4MzcPaoHJC8Dgkcrav3 PS3nK//OGl4T9j2XXzTF/7thvQbSRa7XpuLSJNnuGIBL9uytutt7UVIQ5JvDBca1ANJF ZqwOmCyk1gIyLEmYMv8RIvcp4+BYQZjW5NVlZVjhoiTGB4/igi4ur456lG2sU3MGl47Q Q4H2GKp/2JJLFG4WsQTfQoWrtcTDyo47rIHY8NTfBIb9DkIGs5lvPuyrhijFISRBBvOj KGAA== X-Gm-Message-State: AHQUAuZqsdiTY9+nWvFkP9AQKAn3dwtBLwXyaMUh3l6n5oKkd4/TTq6W ruy4i2KRo83fkEg5LGVgwfLqzQ== X-Google-Smtp-Source: AHgI3IbZGVx7bzmwLqVyIu+b9yWWG3lGPX0+YWuke2hLZNO361GsQaa+XT1tkHQYylEF0bIpbGfIeg== X-Received: by 2002:a17:906:3055:: with SMTP id d21mr18758062ejd.211.1550545716140; Mon, 18 Feb 2019 19:08:36 -0800 (PST) Received: from localhost ([2a02:8084:20e2:c380:20c2:134e:4f3a:683a]) by smtp.gmail.com with ESMTPSA id o37sm4590167edc.32.2019.02.18.19.08.34 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 18 Feb 2019 19:08:35 -0800 (PST) From: "Basil L. Contovounesios" To: Robert Weiner Subject: Re: bug#34506: 27.0.50: push-button bug with basic text-property button References: <83pnrql9p0.fsf@gnu.org> <831s45ksiz.fsf@gnu.org> <875ztgrfb3.fsf@tcd.ie> Date: Tue, 19 Feb 2019 03:08:33 +0000 In-Reply-To: (Robert Weiner's message of "Mon, 18 Feb 2019 17:54:06 -0500") Message-ID: <87zhqslbke.fsf@tcd.ie> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 34506 Cc: Eli Zaretskii , rswgnu@gmail.com, 34506@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Robert Weiner writes: > On Mon, Feb 18, 2019 at 3:51 PM Basil L. Contovounesios wrote: > > Eli Zaretskii writes: > > >> From: Robert Weiner > >> 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 From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 18 22:30:01 2019 Received: (at 34506) by debbugs.gnu.org; 19 Feb 2019 03:30:01 +0000 Received: from localhost ([127.0.0.1]:53519 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gvw6b-0006AQ-Dh for submit@debbugs.gnu.org; Mon, 18 Feb 2019 22:30:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39939) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gvw6Z-0006A5-NS for 34506@debbugs.gnu.org; Mon, 18 Feb 2019 22:30:00 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:32896) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvw6J-0003sU-Ey; Mon, 18 Feb 2019 22:29:46 -0500 Received: from [176.228.60.248] (port=1203 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1gvw6G-0008Ux-77; Mon, 18 Feb 2019 22:29:43 -0500 Date: Tue, 19 Feb 2019 05:29:48 +0200 Message-Id: <838sycjw0j.fsf@gnu.org> From: Eli Zaretskii To: "Basil L. Contovounesios" In-reply-to: <875ztgrfb3.fsf@tcd.ie> (contovob@tcd.ie) Subject: Re: bug#34506: 27.0.50: push-button bug with basic text-property button References: <83pnrql9p0.fsf@gnu.org> <831s45ksiz.fsf@gnu.org> <875ztgrfb3.fsf@tcd.ie> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 34506 Cc: 34506@debbugs.gnu.org, rswgnu@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > From: "Basil L. Contovounesios" > Cc: , <34506@debbugs.gnu.org> > Date: Mon, 18 Feb 2019 20:51:12 +0000 > > 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". No, I'm trying to explain why button-type returns nil in the case of text-buttons. From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 19 10:27:10 2019 Received: (at 34506) by debbugs.gnu.org; 19 Feb 2019 15:27:10 +0000 Received: from localhost ([127.0.0.1]:55396 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gw7Ic-0000Ky-Il for submit@debbugs.gnu.org; Tue, 19 Feb 2019 10:27:10 -0500 Received: from mail-ed1-f54.google.com ([209.85.208.54]:40112) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gw7IZ-0000KT-JB for 34506@debbugs.gnu.org; Tue, 19 Feb 2019 10:27:08 -0500 Received: by mail-ed1-f54.google.com with SMTP id 10so17070017eds.7 for <34506@debbugs.gnu.org>; Tue, 19 Feb 2019 07:27:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=PH7MT+/y5KGBjtvHELSm6nMPRP/U2MK1ZDaiiye0U1Q=; b=xKmBXgceVwLlVZC8wFwNmPmOtjwkCVQR0QthawBI4769cDA3wnS/Ffx6vAGr02U8yM B1zAYvMwEeNrVa25dMAnUVUWMei82WtadvtJwPNdAZ8tyS0yjcwGs6gjPyXdOLhd0IQF oUvDEtTitpuHTJsR9/trE5lCfRDY4hz/t15zleLGdeF1xPcquPBr9UuUMHJpme6QBHF/ 8ZlKtLw1VvOs6Cpq/gxsVt7ULkPhSgLl+5QOu0Ks1bvfQpnBuvlHfIzWn+yJaaHqMDYh crzCUueKrG+ju9qTfC9YYn7gyD07n//2JNyN7tlkQyGFMYP+FEnz32NUt1Hc6N09X4Kf 7v8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=PH7MT+/y5KGBjtvHELSm6nMPRP/U2MK1ZDaiiye0U1Q=; b=WF2UBXdN+If8FEd9ZBHXT/fisVjL3Yp2QWWMzMSdnxy+eUdhrIygQGhJxHP9A98dwj FXFV3ryRIbNrzO3yQcP0kgVcGua4/bLf3QyR/1i4/Uix+3cnt+37uiIf05isgsI5SJmC 2uTSSEntrE1WLXS4ZJG5bJvXs2X9+MepKzqPCFN4oGAIW6zPclbWkPzBc9yBEVzHqN5+ PGkeHZi6nZgs7cYOy5oU5olub0vcf82cTJXrfPb4BdyqryH8OgGzUfgWQHJ4IIAtkZrF 2qthJ5T+imX3a4evKsUs6VBL0RhaYrVVZnkY7MjXYzHBVaE4H4+0JZPSW4Kdueu+6FOx Aq3A== X-Gm-Message-State: AHQUAuarSSnhC9SrSdiSjmZjctSqP9pZW3quKxAP3hlu1RXGYlMVSc0Q 6MbDuJ2iO9e+qOfvsDj3dpPIdg== X-Google-Smtp-Source: AHgI3Ibc/sRTsBA+p9WFB6wuO4FDyH2j8S53No7Cyoe/IBxMX3ql8/qyCbxkYjDkCVFXVO7vU8uPcQ== X-Received: by 2002:aa7:c419:: with SMTP id j25mr8700533edq.195.1550590021614; Tue, 19 Feb 2019 07:27:01 -0800 (PST) Received: from localhost ([2a02:8084:20e2:c380:f786:805d:f4ab:1006]) by smtp.gmail.com with ESMTPSA id j26sm1964600ejx.10.2019.02.19.07.27.00 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 19 Feb 2019 07:27:00 -0800 (PST) From: "Basil L. Contovounesios" To: Eli Zaretskii Subject: Re: bug#34506: 27.0.50: push-button bug with basic text-property button References: <83pnrql9p0.fsf@gnu.org> <831s45ksiz.fsf@gnu.org> <875ztgrfb3.fsf@tcd.ie> <838sycjw0j.fsf@gnu.org> Date: Tue, 19 Feb 2019 15:26:59 +0000 In-Reply-To: <838sycjw0j.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 19 Feb 2019 05:29:48 +0200") Message-ID: <87lg2bsssc.fsf@tcd.ie> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 34506 Cc: 34506@debbugs.gnu.org, rswgnu@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: "Basil L. Contovounesios" >> Cc: , <34506@debbugs.gnu.org> >> Date: Mon, 18 Feb 2019 20:51:12 +0000 >> >> 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". > > No, I'm trying to explain why button-type returns nil in the case of > text-buttons. I'm sorry if I've misunderstood something obvious, but button-type should never return nil for any kind of button.el button, regardless of whether it's a text or overlay button. As stated in '(elisp) Button Types', "every button has a button type". For example, the following should return 'button: (with-temp-buffer (let* ((tstart (prog1 (point) (insert-text-button "text"))) (ostart (prog1 (point) (insert-button "overlay"))) (tbutton (button-at tstart)) (obutton (button-at ostart)) (ttype (button-type tbutton)) (otype (button-type obutton))) (cl-assert (and tbutton obutton ttype otype)) (cl-assert (eq ttype otype)) (cl-assert (eq ttype (button-type tstart))) (cl-assert (null (button-type ostart))) ttype)) [ By the way, would something like this be welcome as a start for test/lisp/button-tests.el? ] The only cases (within reason) in which button-type may return nil are: 0. button-type is mistakenly given a buffer position POS instead of an overlay when the button at POS is an overlay (not text) button, as shown in the example above. Using (button-at POS) avoids this problem. 1. button-type is given the value of a widget's (not button's) 'button overlay property. This is not that far-fetched since both libraries rely on (get-char-property POS 'button), but I don't see why anyone would mix widgets and buttons in the same buffer and run the risk of such gotchas. I believe this contributed in part to Robert's confusion. Am I missing something? -- Basil From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 20 00:22:54 2019 Received: (at 34506) by debbugs.gnu.org; 20 Feb 2019 05:22:54 +0000 Received: from localhost ([127.0.0.1]:57068 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gwKLO-0004ij-8v for submit@debbugs.gnu.org; Wed, 20 Feb 2019 00:22:54 -0500 Received: from mail-qk1-f182.google.com ([209.85.222.182]:36095) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gwKLL-0004iV-VN for 34506@debbugs.gnu.org; Wed, 20 Feb 2019 00:22:52 -0500 Received: by mail-qk1-f182.google.com with SMTP id o125so1319611qkf.3 for <34506@debbugs.gnu.org>; Tue, 19 Feb 2019 21:22:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=AjH746h68qOyU4IaOgWDYA6WoTwyl8dgbVRH639/tLA=; b=vcIU/HoHk9nXhr/iGFUiloHZ3+TmiaKboHEk55arJfvJNo8tNhlv66S2FZ+QKByCEa GbVd7JSdZEmUaoNXU2YxxI0ZxH+o9m2Y8td3kOLyL3RY3jpK4fYjhRzeT+rLWit/xI2B kVVLj4XegDoiJ0ouq/it5eFpGUeuvXI4xiCBDQWeMkrCmoa6DujOBdpmdNj5VsWQgMsQ Lx08x5ynTWYPWizD6wy8QIac82v/o0NOLUAVHPxSM0bbErbxEwOHQR1oHi/w2gMvAkgi SNbqoXes2CN7C4z6a59UAfbkwFjgPZRz7mg/RuzvrZv6cB5Jnb7fFsZG1TEva89LjXAp qC/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=AjH746h68qOyU4IaOgWDYA6WoTwyl8dgbVRH639/tLA=; b=I2nlgFwPVGVD5jWIf8iOFe9vZFy3WlF94bf7p84R0VTAN9rTtGitpVGV+zAg7tJncu 0f1hGhfF6rD9CePVQadXb+Ctp2gVeavuuSHyzP3Gsw8H0sFdr1jtr40qhc/bmBVEsHNF O/JJ/vVvba+2eE4PlDljIlrxYukEVZ26OYfASoz9L1RAZqxFyJog8l9QvMuSMzokqzj2 LeB023rpU08xdIIacMHL7bqhiFPLz9n0XTG6evI7013iOFBlIcb8R5WxJpDAwz04ZTXH DViORX9YikiQv2w2SCdsKEt+3OAEqgaZ8HVNkbi5mV1DroUJoUrfPX+DFVI6I1SGAtIL wpZg== X-Gm-Message-State: AHQUAuY9jJG2ESttdE6VR5sWqWCaxkJoSvgEKqh7SgvdFejfqAF/IT5e B0yAXYQh+matawcpMksJh8w= X-Google-Smtp-Source: AHgI3IZPvPivbL5t4lpr8B3vjH3vAk9rvb90fVJ0OpjqsxzAiy/A2RSKoEQ2wgzVQUXITwtJlOFUeQ== X-Received: by 2002:a37:8d01:: with SMTP id p1mr23923532qkd.91.1550640166378; Tue, 19 Feb 2019 21:22:46 -0800 (PST) Received: from [192.168.10.108] (ool-2f1481cf.dyn.optonline.net. [47.20.129.207]) by smtp.gmail.com with ESMTPSA id u32sm23658481qtc.54.2019.02.19.21.22.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Feb 2019 21:22:45 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) Subject: Re: bug#34506: 27.0.50: push-button bug with basic text-property button From: Robert Weiner X-Mailer: iPhone Mail (16C101) In-Reply-To: <87lg2bsssc.fsf@tcd.ie> Date: Wed, 20 Feb 2019 00:22:44 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: <9A74136C-D6E3-44B8-8C9F-060BFC29E068@gmail.com> References: <83pnrql9p0.fsf@gnu.org> <831s45ksiz.fsf@gnu.org> <875ztgrfb3.fsf@tcd.ie> <838sycjw0j.fsf@gnu.org> <87lg2bsssc.fsf@tcd.ie> To: "Basil L. Contovounesios" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 34506 Cc: Eli Zaretskii , 34506@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > On Feb 19, 2019, at 10:26 AM, Basil L. Contovounesios wr= ote: >=20 > I don't see why anyone > would mix widgets and buttons in the same buffer and run the risk of > such gotchas. I believe this contributed in part to Robert's > confusion. If buttons and widgets are wholly incompatible and separate then button-at s= hould return nil when on a widget even if both buttons and widgets use the s= ame underlying mechanism. This is what abstractions are for. The implement= ation should be hidden. The abstraction I really want is if there is a clickable item under point, a= ctivate it in the most appropriate way, e.g. if selected with a mouse event,= use it=E2=80=99s mouse action, etc. Maybe an activate-at function that han= dles different types of objects with a priority order if there are multiple m= atches.=20 Bob= From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 24 21:40:41 2019 Received: (at 34506) by debbugs.gnu.org; 25 Feb 2019 02:40:41 +0000 Received: from localhost ([127.0.0.1]:50728 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gy6C9-0001LD-5u for submit@debbugs.gnu.org; Sun, 24 Feb 2019 21:40:41 -0500 Received: from mail-ed1-f46.google.com ([209.85.208.46]:45963) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gy6C7-0001L0-3f for 34506@debbugs.gnu.org; Sun, 24 Feb 2019 21:40:39 -0500 Received: by mail-ed1-f46.google.com with SMTP id d9so6235761edh.12 for <34506@debbugs.gnu.org>; Sun, 24 Feb 2019 18:40:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=LX7bxBv5e5TmBpOq1l5C7eBrK1GobL+nqhgrBwlY1XE=; b=wxly1qKx/y/GCRUGWWdylgXngZDUOW25O57NZVm/RwtrVvRggyaqf7nvZNQGNkKGy1 zWWdBJT5U73NcStCYk+Z7+73ibUVO9F8Csk6I2mxzLpqf0AapKcy+/OZ+XiWBnU5Q3gY KZTy04Iz9EInxbHbbEdCpC3GTP7CeuPoQWa9b+TKL22kRDKd4pnwKf98DezG9OkHDAgY 36s3oR5XjNlFewGTaujr4YET4ph1GLyXGojEVhBb0QzPllxWOV1bZKMpN4HngblREVsp 0jF/S/h4Kdg7Qz8U4caZeDJDu5IV2HWVc3/om2o1PWjs+zp2G5S5wF3SFAtmLoyjx4uq Zmiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=LX7bxBv5e5TmBpOq1l5C7eBrK1GobL+nqhgrBwlY1XE=; b=H/C6oW1S+BgI7BnxVWRS4WtfnUz6HnxpXXHzrewn0OmF2BGexZCjl9+ZXyOX6WXu8N 2QSZP2mfcV0CUv/3LN8tPGEsD7NCNi2riVb/IQ6n9v0yXvb9HlxxGVcRTJPHPYCGBygL FP5DqEW8tKYz3AOgSGl2Oa6uECOdo4/c7aTqLILuaoUtXqZ/71APjqokDGxeqCGSAUXd htH49vFESmH3RuEwcerP4vKv9C5vbrmVnlV0rctEm7OqGQzimjs+giRj7aYfi3XTIJDL oVSH8+Jt8Smbg0soBqn6Dy3/BxjxeIfKQPiAZ8nWMKP4SpFQ0sbKkfCSvPlM99rVynxf /kZA== X-Gm-Message-State: AHQUAuYZ0BNpE89V61/MNUCFXoiw19/rlX8AzIkrTA1soc79y/JJjAG1 Lv5hCRbfXJ02Uq+toNFtyr95kA== X-Google-Smtp-Source: AHgI3IaagVPEm3s4yHyUm2Nby4+FL19cG3TbS1OjBnwmFhpqACZ8n78zRfscpBaBmAFUnc0vFp1V+w== X-Received: by 2002:a50:ba8c:: with SMTP id x12mr13017455ede.230.1551062433132; Sun, 24 Feb 2019 18:40:33 -0800 (PST) Received: from localhost ([2a02:8084:20e2:c380:20c2:134e:4f3a:683a]) by smtp.gmail.com with ESMTPSA id g31sm2349856edb.45.2019.02.24.18.40.32 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 24 Feb 2019 18:40:32 -0800 (PST) From: "Basil L. Contovounesios" To: Robert Weiner Subject: Re: bug#34506: 27.0.50: push-button bug with basic text-property button References: <83pnrql9p0.fsf@gnu.org> <831s45ksiz.fsf@gnu.org> <875ztgrfb3.fsf@tcd.ie> <838sycjw0j.fsf@gnu.org> <87lg2bsssc.fsf@tcd.ie> <9A74136C-D6E3-44B8-8C9F-060BFC29E068@gmail.com> Date: Mon, 25 Feb 2019 02:40:26 +0000 In-Reply-To: <9A74136C-D6E3-44B8-8C9F-060BFC29E068@gmail.com> (Robert Weiner's message of "Wed, 20 Feb 2019 00:22:44 -0500") Message-ID: <874l8ssi91.fsf@tcd.ie> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 34506 Cc: Eli Zaretskii , 34506@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Robert Weiner writes: >> On Feb 19, 2019, at 10:26 AM, Basil L. Contovounesios wrote: >> >> I don't see why anyone >> would mix widgets and buttons in the same buffer and run the risk of >> such gotchas. I believe this contributed in part to Robert's >> confusion. > > If buttons and widgets are wholly incompatible and separate then button-at > should return nil when on a widget even if both buttons and widgets use the same > underlying mechanism. How's the following? --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=button.diff diff --git a/lisp/button.el b/lisp/button.el index c46f3d9a52..921e84dfa6 100644 --- a/lisp/button.el +++ b/lisp/button.el @@ -382,10 +382,12 @@ button-at If the button at POS is a text property button, the return value is a marker pointing to POS." (let ((button (get-char-property pos 'button))) - (if (or (overlayp button) (null button)) - button - ;; Must be a text-property button; return a marker pointing to it. - (copy-marker pos t)))) + (and button (get-char-property pos 'category) + (if (overlayp button) + button + ;; Must be a text-property button; + ;; return a marker pointing to it. + (copy-marker pos t))))) (defun next-button (pos &optional count-current) "Return the next button after position POS in the current buffer. diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index 52c0b5b74d..b9f98cdc4c 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -1163,8 +1163,9 @@ widget-field-list (defun widget-at (&optional pos) "The button or field at POS (default, point)." - (or (get-char-property (or pos (point)) 'button) - (widget-field-at pos))) + (let ((widget (or (get-char-property (or pos (point)) 'button) + (widget-field-at pos)))) + (and (widgetp widget) widget))) ;;;###autoload (defun widget-setup () --=-=-= Content-Type: text/plain -- Basil --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 02 07:34:43 2019 Received: (at 34506) by debbugs.gnu.org; 2 Mar 2019 12:34:43 +0000 Received: from localhost ([127.0.0.1]:57061 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h03qk-0004SF-PE for submit@debbugs.gnu.org; Sat, 02 Mar 2019 07:34:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42776) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h03qj-0004S0-Jv for 34506@debbugs.gnu.org; Sat, 02 Mar 2019 07:34:41 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:40094) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h03qe-0000Zh-C3; Sat, 02 Mar 2019 07:34:36 -0500 Received: from [176.228.60.248] (port=4784 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1h03qc-00072z-PJ; Sat, 02 Mar 2019 07:34:35 -0500 Date: Sat, 02 Mar 2019 14:34:24 +0200 Message-Id: <83a7idh2un.fsf@gnu.org> From: Eli Zaretskii To: "Basil L. Contovounesios" In-reply-to: <874l8ssi91.fsf@tcd.ie> (contovob@tcd.ie) Subject: Re: bug#34506: 27.0.50: push-button bug with basic text-property button References: <83pnrql9p0.fsf@gnu.org> <831s45ksiz.fsf@gnu.org> <875ztgrfb3.fsf@tcd.ie> <838sycjw0j.fsf@gnu.org> <87lg2bsssc.fsf@tcd.ie> <9A74136C-D6E3-44B8-8C9F-060BFC29E068@gmail.com> <874l8ssi91.fsf@tcd.ie> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 34506 Cc: 34506@debbugs.gnu.org, rswgnu@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > From: "Basil L. Contovounesios" > Cc: Eli Zaretskii , 34506@debbugs.gnu.org > Date: Mon, 25 Feb 2019 02:40:26 +0000 > > > If buttons and widgets are wholly incompatible and separate then button-at > > should return nil when on a widget even if both buttons and widgets use the same > > underlying mechanism. > > How's the following? LGTM, but can we please have a simple test for this, so that this never again regresses? Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 06 23:14:25 2019 Received: (at control) by debbugs.gnu.org; 7 Apr 2019 03:14:25 +0000 Received: from localhost ([127.0.0.1]:47661 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hCyGG-0007AT-Hp for submit@debbugs.gnu.org; Sat, 06 Apr 2019 23:14:24 -0400 Received: from mail-ed1-f50.google.com ([209.85.208.50]:46489) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hCyGE-0007AA-Lj for control@debbugs.gnu.org; Sat, 06 Apr 2019 23:14:23 -0400 Received: by mail-ed1-f50.google.com with SMTP id d1so8646814edd.13 for ; Sat, 06 Apr 2019 20:14:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=X4SjB18cXkRogDeBRrXytt/nOQObaF5GSoCt5IAPenw=; b=OkCLVFxXRXKcVnR0+kp2JNK1Os6LnmC1QfjgrQnq2o3RM1wzzKZHvYTRfv2RrCbZBh EXHIA8GLPtt34ZP69vSuKY/OJcet/3wh8Vq1e7mOMOROQ4bNXnEKP1X2W0HPRUbj4ofu 295CHQhkfM4jL/Ta6N9Q85YgjxXHtrxxWhNEYoP7fEfUKH6NHtrOdjc3BzASlcDoque2 gv2nDJ4s6nvuig/oIknlET7Y6bGftohyPS+4O2H7p6MM/aHu/erFPV2mu9Y6H2+pikh8 eLk1NOjVVeHzqe5G9ZdOR0RvO7naBKaDcfQqQWeJAavgmBJ1zpB7Vuh2d3e4gdv1c3F/ QCzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=X4SjB18cXkRogDeBRrXytt/nOQObaF5GSoCt5IAPenw=; b=l9wBhDoD2Lx7IHDTck/PteaKR8LTB//PQbiq0R83/jLVJu0fNkJ7qHEgtvDKCciX17 c86p3W6KB9ghBFmhh1N9xsMG28d+SOj0OimC12fafShIe7W5mwkltLm2Fi/f8fXcLB1v d1+x6nO9cY3wa850MGHbD7OEJnaAMlBfJUmxMC83QsZY6Gy61X7uRnABWBE1NlAkCXUK oLA99yvyoDyV8NtRHvW4NxbNkQ8eef1ZWJSa8R1rJ4MIDeSXFXp/wFVT62LjP8DrhEfI 3P+k1a8xUNS+u8RaWCOEh/Ner+PlQ1lJGsAfizS9xCnjYXhASv06W7kQyGPLJy3AJDVA LWDw== X-Gm-Message-State: APjAAAWstvdvhzCagpKrAD1TGulipW8Wo1omTaqQ9bkrXgMUW2jJFQzp CgfJU9aPxxVeexMsIrGL8qiR7g== X-Google-Smtp-Source: APXvYqx1gYUX+HnMGaKL8pXWJCxjoVgZZNqrb1Z3Fxps+TpTNTtuZFktpVh2YAI7B+XtAEYp2csalw== X-Received: by 2002:aa7:c6c6:: with SMTP id b6mr13448105eds.69.1554606856923; Sat, 06 Apr 2019 20:14:16 -0700 (PDT) Received: from localhost ([2a02:8084:20e2:c380:f786:805d:f4ab:1006]) by smtp.gmail.com with ESMTPSA id e3sm7730293edb.22.2019.04.06.20.14.15 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 06 Apr 2019 20:14:15 -0700 (PDT) From: "Basil L. Contovounesios" To: Eli Zaretskii Subject: Re: bug#34506: 27.0.50: push-button bug with basic text-property button References: <83pnrql9p0.fsf@gnu.org> <831s45ksiz.fsf@gnu.org> <875ztgrfb3.fsf@tcd.ie> <838sycjw0j.fsf@gnu.org> <87lg2bsssc.fsf@tcd.ie> <9A74136C-D6E3-44B8-8C9F-060BFC29E068@gmail.com> <874l8ssi91.fsf@tcd.ie> <83a7idh2un.fsf@gnu.org> Date: Sun, 07 Apr 2019 04:14:09 +0100 In-Reply-To: <83a7idh2un.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 2 Mar 2019 14:34:24 +0200") Message-ID: <877ec6zev2.fsf@tcd.ie> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control Cc: rswgnu@gmail.com, 34506-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain tags 34506 fixed close 34506 quit --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Distinguish-buttons-from-widgets-bug-34506.patch >From 08235af38c92e95d8ec9d268916d8910ea50ab2d Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Sun, 7 Apr 2019 03:36:47 +0100 Subject: [PATCH] Distinguish buttons from widgets (bug#34506) * lisp/button.el (button-at): * lisp/wid-edit.el (widget-at): Avoid returning a false positive when looking for a button and finding a widget, or vice versa. * test/lisp/button-tests.el: * test/lisp/wid-edit-tests.el: New files. --- lisp/button.el | 10 ++++++---- lisp/wid-edit.el | 5 +++-- test/lisp/button-tests.el | 40 +++++++++++++++++++++++++++++++++++++ test/lisp/wid-edit-tests.el | 39 ++++++++++++++++++++++++++++++++++++ 4 files changed, 88 insertions(+), 6 deletions(-) create mode 100644 test/lisp/button-tests.el create mode 100644 test/lisp/wid-edit-tests.el diff --git a/lisp/button.el b/lisp/button.el index c46f3d9a52..921e84dfa6 100644 --- a/lisp/button.el +++ b/lisp/button.el @@ -382,10 +382,12 @@ button-at If the button at POS is a text property button, the return value is a marker pointing to POS." (let ((button (get-char-property pos 'button))) - (if (or (overlayp button) (null button)) - button - ;; Must be a text-property button; return a marker pointing to it. - (copy-marker pos t)))) + (and button (get-char-property pos 'category) + (if (overlayp button) + button + ;; Must be a text-property button; + ;; return a marker pointing to it. + (copy-marker pos t))))) (defun next-button (pos &optional count-current) "Return the next button after position POS in the current buffer. diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index 52c0b5b74d..b9f98cdc4c 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -1163,8 +1163,9 @@ widget-field-list (defun widget-at (&optional pos) "The button or field at POS (default, point)." - (or (get-char-property (or pos (point)) 'button) - (widget-field-at pos))) + (let ((widget (or (get-char-property (or pos (point)) 'button) + (widget-field-at pos)))) + (and (widgetp widget) widget))) ;;;###autoload (defun widget-setup () diff --git a/test/lisp/button-tests.el b/test/lisp/button-tests.el new file mode 100644 index 0000000000..d54a992ab8 --- /dev/null +++ b/test/lisp/button-tests.el @@ -0,0 +1,40 @@ +;;; button-tests.el --- tests for button.el -*- lexical-binding: t -*- + +;; Copyright (C) 2019 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Code: + +(require 'ert) + +(ert-deftest button-at () + "Test `button-at' behavior." + (with-temp-buffer + (should-not (button-at (point))) + (let ((button (insert-text-button "text button")) + (marker (button-at (1- (point))))) + (should (markerp marker)) + (should (= (button-end button) (button-end marker) (point)))) + (let ((button (insert-button "overlay button")) + (overlay (button-at (1- (point))))) + (should (overlayp overlay)) + (should (eq button overlay))) + ;; Buttons and widgets are incompatible (bug#34506). + (widget-create 'link "link widget") + (should-not (button-at (1- (point)))))) + +;;; button-tests.el ends here diff --git a/test/lisp/wid-edit-tests.el b/test/lisp/wid-edit-tests.el new file mode 100644 index 0000000000..a4350e715e --- /dev/null +++ b/test/lisp/wid-edit-tests.el @@ -0,0 +1,39 @@ +;;; wid-edit-tests.el --- tests for wid-edit.el -*- lexical-binding: t -*- + +;; Copyright (C) 2019 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Code: + +(require 'ert) +(require 'wid-edit) + +(ert-deftest widget-at () + "Test `widget-at' behavior." + (with-temp-buffer + (should-not (widget-at)) + (let ((marco (widget-create 'link "link widget")) + (polo (widget-at (1- (point))))) + (should (widgetp polo)) + (should (eq marco polo))) + ;; Buttons and widgets are incompatible (bug#34506). + (insert-text-button "text button") + (should-not (widget-at (1- (point)))) + (insert-button "overlay button") + (should-not (widget-at (1- (point)))))) + +;;; wid-edit-tests.el ends here -- 2.20.1 --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: "Basil L. Contovounesios" >> Cc: Eli Zaretskii , 34506@debbugs.gnu.org >> Date: Mon, 25 Feb 2019 02:40:26 +0000 >> >> > If buttons and widgets are wholly incompatible and separate then button-at >> > should return nil when on a widget even if both buttons and widgets use the same >> > underlying mechanism. >> >> How's the following? > > LGTM, but can we please have a simple test for this, so that this > never again regresses? Of course. I've pushed the attached patch to master, and am thus closing this bug report. Let me know if I missed anything. Thanks, -- Basil --=-=-=-- From unknown Fri Jun 20 07:22:49 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 05 May 2019 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator