GNU bug report logs -
#34506
27.0.50: push-button bug with basic text-property button
Previous Next
Reported by: Bob Weiner <rsw <at> gnu.org>
Date: Sat, 16 Feb 2019 22:10:02 UTC
Severity: minor
Tags: fixed
Found in version 27.0.50
Done: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Robert Weiner <rswgnu <at> gmail.com> writes:
>> On Feb 19, 2019, at 10:26 AM, Basil L. Contovounesios <contovob <at> 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?
[button.diff (text/x-diff, inline)]
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 ()
[Message part 3 (text/plain, inline)]
--
Basil
This bug report was last modified 6 years and 45 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.