aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2012-12-11 13:49:25 -0500
committerStefan Monnier2012-12-11 13:49:25 -0500
commit4b0df84832698d8239f8a5e583955cf853b62ace (patch)
treeb182fa60f7add7f53591899be3223e2f2f05da0a
parent904dd565a04e0023607740320013542c9f77eae0 (diff)
downloademacs-4b0df84832698d8239f8a5e583955cf853b62ace.tar.gz
emacs-4b0df84832698d8239f8a5e583955cf853b62ace.zip
* lisp/button.el: Handle buttons in display text-properties.
(button--area-button-p, button--area-button-string): Use (STRING . STRING-POS) representation instead of just STRING.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/button.el13
2 files changed, 13 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 17dc012fdab..af21ab68606 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12012-12-11 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * button.el: Handle buttons in display text-properties.
4 (button--area-button-p, button--area-button-string):
5 Use (STRING . STRING-POS) representation instead of just STRING.
6
12012-12-11 Eli Zaretskii <eliz@gnu.org> 72012-12-11 Eli Zaretskii <eliz@gnu.org>
2 8
3 * makefile.w32-in (compile4-SH): Fix a typo that caused term 9 * makefile.w32-in (compile4-SH): Fix a typo that caused term
diff --git a/lisp/button.el b/lisp/button.el
index c52dcabed08..f15f09f24db 100644
--- a/lisp/button.el
+++ b/lisp/button.el
@@ -192,7 +192,8 @@ changes to a supertype are not reflected in its subtypes)."
192 (cond ((overlayp button) 192 (cond ((overlayp button)
193 (overlay-get button prop)) 193 (overlay-get button prop))
194 ((button--area-button-p button) 194 ((button--area-button-p button)
195 (get-text-property 0 prop (button--area-button-string button))) 195 (get-text-property (cdr button)
196 prop (button--area-button-string button)))
196 (t ; Must be a text-property button. 197 (t ; Must be a text-property button.
197 (get-text-property button prop)))) 198 (get-text-property button prop))))
198 199
@@ -257,11 +258,11 @@ header-line) a string."
257 "Return t if BUTTON has button-type TYPE, or one of TYPE's subtypes." 258 "Return t if BUTTON has button-type TYPE, or one of TYPE's subtypes."
258 (button-type-subtype-p (button-get button 'type) type)) 259 (button-type-subtype-p (button-get button 'type) type))
259 260
260(defalias 'button--area-button-p 'stringp 261(defun button--area-button-p (b) (stringp (car-safe b))
261 "Return non-nil if BUTTON is an area button. 262 "Return non-nil if BUTTON is an area button.
262Such area buttons are used for buttons in the mode-line and header-line.") 263Such area buttons are used for buttons in the mode-line and header-line.")
263 264
264(defalias 'button--area-button-string 'identity 265(defalias 'button--area-button-string #'car
265 "Return area button BUTTON's button-string.") 266 "Return area button BUTTON's button-string.")
266 267
267;; Creating overlay buttons 268;; Creating overlay buttons
@@ -444,9 +445,9 @@ return t."
444 ;; POS is a mouse event; switch to the proper window/buffer 445 ;; POS is a mouse event; switch to the proper window/buffer
445 (let ((posn (event-start pos))) 446 (let ((posn (event-start pos)))
446 (with-current-buffer (window-buffer (posn-window posn)) 447 (with-current-buffer (window-buffer (posn-window posn))
447 (if (posn-area posn) 448 (if (posn-string posn)
448 ;; mode-line or header-line event 449 ;; mode-line, header-line, or display string event.
449 (button-activate (car (posn-string posn)) t) 450 (button-activate (posn-string posn) t)
450 (push-button (posn-point posn)) t))) 451 (push-button (posn-point posn)) t)))
451 ;; POS is just normal position 452 ;; POS is just normal position
452 (let ((button (button-at (or pos (point))))) 453 (let ((button (button-at (or pos (point)))))