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

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

Re: Question on syntax-propertize-function


From: Stefan Monnier
Subject: Re: Question on syntax-propertize-function
Date: Thu, 06 Jun 2013 17:23:41 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

>     (modify-syntax-entry ?\( "()1" st)
>     (modify-syntax-entry ?\) ")(4" st)
>     (modify-syntax-entry ?\* ". 23n" st)

Looks good.

> (defun holl-syntax-propertize (start end)
>   (goto-char start)
>   (funcall
>    (syntax-propertize-rules
>     ("\\((\\)\\(\\*\\)\\()\\)"
>      (1 "()  ")
>      (2 ".   ")
>      (3 ")(  "))
>     )
>    start end))

Looks OK (changing the syntax of the * in the middle should be
sufficient, but the extra entries shouldn't hurt).

> and I set syntax-propertize-function in the initialization of the major mode:

>   (set (make-local-variable 'syntax-propertize-function)
>        #'holl-syntax-propertize)

Looks good.

> However, this doesn't seems to have any effect.  I also played with
> syntax-propertize-extend-region-functions but with no success.

> Can you see what's wrong with this approach?

Nope, it looks fine.  Which version of Emacs are you using?
Is the mode using font-lock?  Do you have font-lock-syntactic-keywords maybe?

> and if I run it on a region containing (*) I get no effect.

That might be due to the syntax-table property being immediately reset
by the code that auto-runs syntax-propertize-function or something along
these lines.  Try it first in a fundamental-mode buffer.


        Stefan




reply via email to

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