[Top][All Lists]

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

Re: glitches with font-lock-add-keywords

From: martin rudalics
Subject: Re: glitches with font-lock-add-keywords
Date: Tue, 06 Jun 2006 08:38:32 +0200
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

> The LimeGreen is showing up and the "sp?" inside of "(sp?)".  I'm
> thinking that the "()" chars are being overwritten by other, blue
> highlighting.  I changed the last line above to:
>     ("\\<\\(XXX\\|xxx\\)\\>\\|\\_<\\(\\?\\?\\?\\)\\_>\\|(\\(sp\\?\\))" .
> 'my-extra-face)))
> because I don't want the last three chars of "What's lisp?" to be
> highlighted, but only "(sp?)".  So all of that is fine.

"(sp\\?)" will match all occurrences of the character sequence "(sp?)".
It never matches "What's lisp?".  Additional escaped parentheses won't
change anything here.

The blue highlighting you mention probably comes from paren matching
overlays and should disappear as soon as you move the cursor.

> However, "???" is not being highlighted.  There's a lot of characters
> clustered around the "???"... I'm wondering if they're all supposed to
> be there....
> Again, I just want ??? to be highlighted, not _<(???)>_ or anything like
> that... just "???".

I couldn't simply change your initial proposal to something like
"\\<\\?\\?\\?\\>" because in most modes "?" doesn't have word syntax
contradicting the use of "\\<" and "\\>".  "\\_<" and "\\_>" force
matches at symbol begin and end but might not work with Emacs 21.


(defvar my-extra-keywords
  '(("\\<\\(FIXME\\):" 1 font-lock-warning-face prepend)
    ("\\<\\(XXX\\|xxx\\)\\>\\|\\?\\?\\?\\|(sp\\?)" . 'my-extra-face)))

is all you need.  Otherwise you would have to specify the semantics of
the word "just" more distinctly.

reply via email to

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