From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: "Basil L. Contovounesios" Newsgroups: gmane.emacs.bugs Subject: bug#34506: 27.0.50: push-button bug with basic text-property button Date: Tue, 19 Feb 2019 15:26:59 +0000 Message-ID: <87lg2bsssc.fsf@tcd.ie> References: <83pnrql9p0.fsf@gnu.org> <831s45ksiz.fsf@gnu.org> <875ztgrfb3.fsf@tcd.ie> <838sycjw0j.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="216401"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: rswgnu@gmail.com, 34506@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Feb 19 16:28:28 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gw7Jq-000u6s-UU for geb-bug-gnu-emacs@m.gmane.org; Tue, 19 Feb 2019 16:28:27 +0100 Original-Received: from localhost ([127.0.0.1]:50446 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gw7Jp-0004yn-VK for geb-bug-gnu-emacs@m.gmane.org; Tue, 19 Feb 2019 10:28:25 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:33418) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gw7Jf-0004xH-DP for bug-gnu-emacs@gnu.org; Tue, 19 Feb 2019 10:28:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gw7Jd-0004e0-F2 for bug-gnu-emacs@gnu.org; Tue, 19 Feb 2019 10:28:15 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56119) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gw7JU-0004Xa-A9 for bug-gnu-emacs@gnu.org; Tue, 19 Feb 2019 10:28:07 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gw7JS-0000Mx-9e for bug-gnu-emacs@gnu.org; Tue, 19 Feb 2019 10:28:04 -0500 X-Loop: help-debbugs@gnu.org Resent-From: "Basil L. Contovounesios" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 19 Feb 2019 15:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34506 X-GNU-PR-Package: emacs Original-Received: via spool by 34506-submit@debbugs.gnu.org id=B34506.15505900301330 (code B ref 34506); Tue, 19 Feb 2019 15:28:02 +0000 Original-Received: (at 34506) by debbugs.gnu.org; 19 Feb 2019 15:27:10 +0000 Original-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 Original-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 Original-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) Original-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) In-Reply-To: <838sycjw0j.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 19 Feb 2019 05:29:48 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:155559 Archived-At: 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