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

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

Re: Syntax highlighting keywords starting with #


From: Stefan Monnier
Subject: Re: Syntax highlighting keywords starting with #
Date: Tue, 22 Nov 2005 14:53:42 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> (defvar psc-mode-syntax-table
>   (let ((psc-mode-syntax-table (make-syntax-table)))
>   (modify-syntax-entry ?# "w" psc-mode-syntax-table)
>   psc-mode-syntax-table)
>   "Syntax table for PSC mode")

Better not do that.
Similarly, better not set font-lock-keywords (where did this idea come
from?  I'd like to know so I can fix the source of the problem).   Instead,
set font-lock-defaults:

    (set (make-local-variable 'font-lock-defaults)
         '(psc-font-lock-keywords nil nil ((?# . "w"))))

Note how it tells font-lock to (temporarily) treat # as a word component.
As for your main syntax-table, it should probably use something like "'"
rather than "w" for #.


        Stefan


reply via email to

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