From: "Basil L. Contovounesios" <contovob@tcd.ie>
To: Robert Weiner <rswgnu@gmail.com>
Cc: 34506@debbugs.gnu.org
Subject: bug#34506: 27.0.50: push-button bug with basic text-property button
Date: Mon, 25 Feb 2019 02:40:26 +0000 [thread overview]
Message-ID: <874l8ssi91.fsf@tcd.ie> (raw)
In-Reply-To: <9A74136C-D6E3-44B8-8C9F-060BFC29E068@gmail.com> (Robert Weiner's message of "Wed, 20 Feb 2019 00:22:44 -0500")
[-- Attachment #1: Type: text/plain, Size: 520 bytes --]
Robert Weiner <rswgnu@gmail.com> writes:
>> On Feb 19, 2019, at 10:26 AM, Basil L. Contovounesios <contovob@tcd.ie> 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?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: button.diff --]
[-- Type: text/x-diff, Size: 1348 bytes --]
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 ()
[-- Attachment #3: Type: text/plain, Size: 11 bytes --]
--
Basil
next prev parent reply other threads:[~2019-02-25 2:40 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
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 [this message]
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=874l8ssi91.fsf@tcd.ie \
--to=contovob@tcd.ie \
--cc=34506@debbugs.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.