[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to make font lock work with comments?
From: |
Elena |
Subject: |
Re: How to make font lock work with comments? |
Date: |
Thu, 30 Dec 2010 00:43:29 -0800 (PST) |
User-agent: |
G2/1.0 |
On Dec 29, 9:50 am, rusi <rustompm...@gmail.com> wrote:
> Im hacking on an apl mode
>
> (let ((st (make-syntax-table))
> (comment-char ?\x235d))
> :
> :
> (modify-syntax-entry comment-char "<" st)
>
> This char shows as follows (Dont know if it shows elsewhere..)
>
> ⍝ A comment
>
> When I put point on the char and call describe-char I get
>
> ---------------------------------
> character: ⍝ (9053, #o21535, #x235d)
> preferred charset: unicode (Unicode (ISO10646))
> code point: 0x235D
> syntax: < which means: comment
> category: .:Base
> to input: type "{upshoe-jot}" or "{lamp}" or "{comment}" or
> "{@}" with apl-ascii
> buffer code: #xE2 #x8D #x9D
> file code: not encodable by coding system iso-latin-1-unix
> display: by this font (glyph code)
> xft:-unknown-unifont-normal-normal-normal-*-12-*-*-*-d-0-
> iso10646-1 (#x2359)
> ------------------------------
>
> In other words emacs sees this as a comment-type char (similar to what
> it says for semicolon in elisp buffers
>
> And yet in an elisp buffer the ; to EOL is red
> but here it is not.
>
> Any clues?
Syntax and font-locking are two different things and are handled
separately. Commands look at syntax, humans look at font-locking.
Try typing the string ";" (quotes included) into an Elisp buffer and
then calling `describe-char' on the semicolon: Emacs will tell you the
semicolon is a comment char, yet it will be highlighting it as string.
Check out `font-lock-add-keywords'.