emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r111195: * lisp/button.el: Handle but


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111195: * lisp/button.el: Handle buttons in display text-properties.
Date: Tue, 11 Dec 2012 13:49:25 -0500
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111195
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Tue 2012-12-11 13:49:25 -0500
message:
  * 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.
modified:
  lisp/ChangeLog
  lisp/button.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-12-11 07:49:06 +0000
+++ b/lisp/ChangeLog    2012-12-11 18:49:25 +0000
@@ -1,3 +1,9 @@
+2012-12-11  Stefan Monnier  <address@hidden>
+
+       * 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.
+
 2012-12-11  Eli Zaretskii  <address@hidden>
 
        * makefile.w32-in (compile4-SH): Fix a typo that caused term

=== modified file 'lisp/button.el'
--- a/lisp/button.el    2012-12-06 20:10:36 +0000
+++ b/lisp/button.el    2012-12-11 18:49:25 +0000
@@ -192,7 +192,8 @@
   (cond ((overlayp button)
         (overlay-get button prop))
        ((button--area-button-p button)
-        (get-text-property 0 prop (button--area-button-string button)))
+        (get-text-property (cdr button)
+                           prop (button--area-button-string button)))
        (t ; Must be a text-property button.
         (get-text-property button prop))))
 
@@ -257,11 +258,11 @@
   "Return t if BUTTON has button-type TYPE, or one of TYPE's subtypes."
   (button-type-subtype-p (button-get button 'type) type))
 
-(defalias 'button--area-button-p 'stringp
+(defun button--area-button-p (b) (stringp (car-safe b))
   "Return non-nil if BUTTON is an area button.
 Such area buttons are used for buttons in the mode-line and header-line.")
 
-(defalias 'button--area-button-string 'identity
+(defalias 'button--area-button-string #'car
   "Return area button BUTTON's button-string.")
 
 ;; Creating overlay buttons
@@ -444,9 +445,9 @@
       ;; POS is a mouse event; switch to the proper window/buffer
       (let ((posn (event-start pos)))
        (with-current-buffer (window-buffer (posn-window posn))
-         (if (posn-area posn)
-             ;; mode-line or header-line event
-             (button-activate (car (posn-string posn)) t)
+         (if (posn-string posn)
+             ;; mode-line, header-line, or display string event.
+             (button-activate (posn-string posn) t)
            (push-button (posn-point posn)) t)))
     ;; POS is just normal position
     (let ((button (button-at (or pos (point)))))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]