From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Santiago Mejia Newsgroups: gmane.emacs.help Subject: font-lock on variables Date: Fri, 24 Jul 2009 15:27:44 -0500 Message-ID: <87ljmdsu67.fsf@uchicago.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1248468011 5101 80.91.229.12 (24 Jul 2009 20:40:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 24 Jul 2009 20:40:11 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jul 24 22:40:03 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MURYY-0004Ss-P1 for geh-help-gnu-emacs@m.gmane.org; Fri, 24 Jul 2009 22:39:55 +0200 Original-Received: from localhost ([127.0.0.1]:55147 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MURYY-0003fE-AU for geh-help-gnu-emacs@m.gmane.org; Fri, 24 Jul 2009 16:39:54 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MURN6-0007Zb-Jx for help-gnu-emacs@gnu.org; Fri, 24 Jul 2009 16:28:04 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MURN1-0007W6-SM for help-gnu-emacs@gnu.org; Fri, 24 Jul 2009 16:28:04 -0400 Original-Received: from [199.232.76.173] (port=57522 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MURN1-0007Vx-Lh for help-gnu-emacs@gnu.org; Fri, 24 Jul 2009 16:27:59 -0400 Original-Received: from main.gmane.org ([80.91.229.2]:54869 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MURN1-0004oK-3K for help-gnu-emacs@gnu.org; Fri, 24 Jul 2009 16:27:59 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1MURMy-0001HB-8D for help-gnu-emacs@gnu.org; Fri, 24 Jul 2009 20:27:56 +0000 Original-Received: from wireless-169-9.uchicago.edu ([128.135.169.9]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 24 Jul 2009 20:27:56 +0000 Original-Received: from mejia by wireless-169-9.uchicago.edu with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 24 Jul 2009 20:27:56 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 47 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: wireless-169-9.uchicago.edu User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) Cancel-Lock: sha1:IGZVI6sQVtBhKSRga6IJ5Gl9at0= X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:66375 Archived-At: 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.