[Top][All Lists]

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

Re: change faces interactively

From: Andreas Röhler
Subject: Re: change faces interactively
Date: Mon, 23 Jan 2012 11:51:02 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; de; rv: Gecko/20111101 SUSE/3.1.16 Thunderbird/3.1.16

Am 21.01.2012 03:07, schrieb Drew Adams:
Sorry for my poor explanation.
What I want is an interactive function that turns on/off
face changes by command.

Say, a buffer is in "my-mode".  The above
(define-generic-mode ... ) will AUTOMATICALLY apply the face
definitions to all characters as soon as the buffer is
opened (assuming the mode definition recognizes its file extension).
I would rather develop a function that applies the faces
AT WILL even after the buffer is opened IN THAT MODE.
For example, a buffer is in "my-mode" but none of the words
in that buffer is applied with any faces.
Now I will implement a function, (defun my-mode-face-1 ()
(interactive)...), then a certain set of words in that
buffer is bold-faced.  After that, I will implement another
function, (defun my-mode-face-2 () (interactive) ...), then
another set of the words in that buffer is italic-faced. And so on...

If it does not make sense, please ask me again.  I appreciate it.

Sorry, I don't have much time right now - perhaps someone else can help.

If you just want to highlight stuff then perhaps have a look here:

here an example from python-mode.el which sets a `py-number-face' depending from a `boolean py-use-number-face-p'

(when py-use-number-face-p
(add-to-list 'python-font-lock-keywords '("\\([0-9]+\\([eE][+-]?[0-9]*\\)?\\|0[xX][0-9a-fA-F]+\\)" 1 py-number-face)))

You can put such into a command, calling font-lock-fontify-buffer afterwards




reply via email to

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