help-gnu-emacs
[Top][All Lists]
Advanced

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

button face vs font-lock


From: Thien-Thi Nguyen
Subject: button face vs font-lock
Date: Sun, 27 Jan 2008 13:13:46 +0100

Greetings,

I'm trying to implement a simple toggle button, using:

 (define-button-type 'toggle
   'mouse-face nil
   'follow-link t
   'help-echo nil
   'active nil
   'face 'button
   'action (lambda (button)
             (let ((now (not (button-get button 'active))))
               (button-put button 'active now)
               (button-put button 'face (if now
                                            font-lock-keyword-face
                                          'button))
               (message "%s %s" (button-label button) now))))
 
 (insert-text-button "abc" :type 'toggle)

This works fine when font-lock is off (M-x font-lock-mode RET),
but when i enable font-lock, the button refuses to change face,
although the toggling is still evidenced in the echo area.

What do i need to do get font lock to leave dynamic button
face changing alone?

thi




reply via email to

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