all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: Question on syntax-propertize-function
Date: Thu, 06 Jun 2013 17:23:41 -0400	[thread overview]
Message-ID: <jwvli6nndiv.fsf-monnier+gmane.emacs.help@gnu.org> (raw)
In-Reply-To: f09e652a-d60a-49ce-b982-b83e31d9e237@googlegroups.com

>     (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	other threads:[~2013-06-06 21:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-06 19:26 Question on syntax-propertize-function Marco Maggesi
2013-06-06 21:23 ` Stefan Monnier [this message]
     [not found] ` <mailman.1117.1370553840.22516.help-gnu-emacs@gnu.org>
2013-06-07  9:13   ` Marco Maggesi
2013-06-08  0:46     ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvli6nndiv.fsf-monnier+gmane.emacs.help@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.