[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
font-lock on variables
From: |
Santiago Mejia |
Subject: |
font-lock on variables |
Date: |
Fri, 24 Jul 2009 15:27:44 -0500 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) |
I am trying to hack a few extensions in emacs that allow one to look for
words in dictionaries. (in particular, wordnet.el and sdcv.el (to be
found, respectively, at: http://williamxu.net9.org/ref/wordnet.el and
http://www.emacswiki.org/emacs/sdcv.el)
When one looks for a word in, say, wordnet.el, it creates a new buffer,
*WORDNET* which has several of its key terms fontified. However, I
would like to be able to fontify, also, the actual word that I am
searching. This word is a variable, and changes every time one makes a
new search. After going through the manual, and looking around in
google and the mailing lists, I have not been able to figure out how to
achieve such thing.
My idea so far is to define a global variable, my-foo-var, and add it to
the keywords. I have played with all sorts of small variations of how
to add the variable to the font-lock-keywords, but none has worked.
Here is the most simple example (which as I said, did not work).
(defvar my-foo-var "woman"
"Current word that is seeked.")
(defvar xxx-mode-font-lock-keywords ;keyword for buffer display
'(
;; word used
(my-foo-var . (1 font-lock-type-face))))
I have also tried to use the function font-lock-add-keywords with no
success. (this method, however, strikes me as undesirable, for I would
have to find a way to remove each word that is added, and this might
pose problems if one removes a word that one has looked for, but that is
also a keyword to be fontified (for example, if one looks for the word
"Antonyms", which is a keyword that is also fontified).
Finally, every time I make a change to the xxx-mode-font-lock-keywords,
I have to close emacs and restart it to make sure that the new changes
work. Is there a less brutal way to test the results of one's changes
to this variable? A way to test one's results without having to exit emacs?
Any help is appreciated.
Santiago.
- font-lock on variables,
Santiago Mejia <=