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.
soichi
2012/1/21 Drew Adams
<drew.adams@oracle.com>
> I'm trying to develop an interactive function that changes faces.
> For example, one way to change the face is
>
> ;;changes face of "think", "thinks", and "thought"
> (define-generic-mode my-mode
> nil nil
> '(("think?\\w*\\|thought" . 'org-warning)) nil nil)
>
> But this changes the face according to the mode, not the
> interactive command input.
>
> Is there anyway to develop an interactive function like that ?
> (defun change-face-to-one () (interactive) ...)
Not quite sure what you're asking. Do you just want to modify a set of faces FS
so they look the same as some given face G?
If so, you can define a command that reads the names of the faces to modify (FS)
and the face to copy (G), and then, in the body of the function, call
`copy-face' to modify each of the former (each F in FS).