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

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

Re: Syntax Highlighting Latency in Emacs


From: Kevin Rodgers
Subject: Re: Syntax Highlighting Latency in Emacs
Date: Mon, 27 Dec 2004 10:09:10 -0700
User-agent: Mozilla Thunderbird 0.9 (X11/20041105)

jab3 wrote:
> Peter Lee finally wrote on Wed December 22 2004 04:55 pm:
>>maybe something like:
>>
>>(global-set-key (kbd "C-c m") (lambda () (interactive) (highlight-regexp
>>"\%s" "hi-yellow")))
>
> Excellent.  I got that to work with font-lock-function-name-face, so
> everything's all starting to come together.  I have a question though.  I
> had to do something odd (at least I consider it odd :); to make '\n' work
> in the .emacs file with the lambda function, I had to use 4 \ for it to
> only use the '\n'.  That is,
>
> (highlight-regexp "\\\\n" "font-lock-function-name-face")
>
> is the only thing that worked correctly.  If I only did "\\n" then Emacs
> highlighted all 'n's.  Why is it necessary to use '\\\\n' to represent
> '\n'?  I can understand '\\n' - it's just the double that is confusing
> me. :)

You want to match the 2-character sequence `backslash lowercase-n',
right?  In order to match the backslash character, the regular
expression is `\\'; the string that contains 2 backslashes is "\\\\".

This is discussed in the Regexps node [aka Syntax of Regular Expressions =============================]
of the Emacs manual; also look for the description of strings in the
Init Syntax node [aka Init File Syntax] and Glossary node.

--
Kevin Rodgers


reply via email to

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