unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Thien-Thi Nguyen <ttn@gnuvola.org>
To: gnu-emacs-help@gnu.org
Subject: button face vs font-lock
Date: Sun, 27 Jan 2008 13:13:46 +0100	[thread overview]
Message-ID: <87ve5f1n5x.fsf@ambire.localdomain> (raw)

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	other threads:[~2008-01-27 12:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-27 12:13 Thien-Thi Nguyen [this message]
     [not found] <mailman.6603.1201438685.18990.help-gnu-emacs@gnu.org>
2008-01-27 14:05 ` button face vs font-lock Johan Bockgård

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ve5f1n5x.fsf@ambire.localdomain \
    --to=ttn@gnuvola.org \
    --cc=gnu-emacs-help@gnu.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).