help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: custom colorizing keywords


From: ken
Subject: Re: custom colorizing keywords
Date: Wed, 15 Mar 2006 13:41:36 -0500
User-agent: Mozilla Thunderbird 1.0 (X11/20041207)

Steve Wainstead wrote:
> 
> That will give you a permanent solution; but if you just want to
> highlight arbitrary words take a look at hi-lock-face-buffer. Immensely
> useful when tailing logs in shell-mode.
> 
> ~swain

I can see how hi-lock-face-buffer could be very useful in given
situations.  But from what the help on this function tells me, I gather
that it's an interactive function.

I was looking for something which would colorize the specified strings
in any and all buffers visited.  I didn't want to have to invoke it for
every string for every buffer I visited.

Thanks anyhow.

> 
> ken wrote:
>> Wishing to colorize some of my own keywords, I stumbled across
>> font-lock-add-keywords and did C-h f on it.  I'm not an elisp
>> programmer, so of course the explanations there made hardly any sense.
>> So I tried just altering the example:
>>
>>  (font-lock-add-keywords 'c-mode
>>   '(("\\<\\(FIXME\\):" 1 font-lock-warning-face prepend)
>>     ("\\<\\(and\\|or\\|not\\)\\>" . font-lock-keyword-face)))
>>
>> The help page says "MODE should be a symbol, the major mode command
>> name, such as `c-mode' or nil."  Because I want to highlight the added
>> keywords in all modes, I did this:
>>
>> (font-lock-add-keywords nil
>>   '(("\\<\\(FIXME\\):" 1 font-lock-warning-face prepend)
>>     ("\\<\\(XXX\\|xxx\\|???\\)\\>" . font-lock-keyword-face)))
>>
>> Evaluating this failed, told me "Fontifying region...(invalid-regexp
>> Invalid regular expression)".  I've read enough elisp code that I pretty
>> much knew that there shouldn't be an apostrophe (') in front of nil, but
>> I tried it anyway.  Got the same error message.
>>
>> I tried a lot of other things, but this is the easiest yet most
>> perplexing of several questions.  Searching the archives and EmacsWiki
>> yeilded nothing helpful.  Is what I'm asking even possible to do?
>>
>>
>> Thanks for any assistance.
>>
> _______________________________________________
> help-gnu-emacs mailing list
> help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs


-- 
"This world ain't big enough for the both of us,"
said the big noema to the little noema.





reply via email to

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