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

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

Re: When is a syntax-propertize-function called when parse-sexp-lookup-p


From: Stefan Monnier
Subject: Re: When is a syntax-propertize-function called when parse-sexp-lookup-properties is t for a current buffer?
Date: Tue, 05 Oct 2021 15:41:58 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>> `setq-local` at the toplevel makes no sense.
>> Is it really the code you're using, or are you paraphrasing?
> Sorry. I did not provide enough context.
> That code is not at top-level; it is being called by the erlang-mode
> function.

OK, thanks, that makes sense (I just wanted to make sure the problem
wasn't some silly misunderstanding).

> I won't leave that code there once I understand the behaviour.
> I'm just modifying my local copy of erlang.el to
> 1) understand that code better
> 2) eliminate as many external sources of disruption while I investigate.

The code you show seems fine to me except for the `2` which should be
a `1` (there is only one subgroup in your second regexp).

To debug these things, you can try:

- `C-u C-x =` on the char(s) where you expect a syntax-table text property,
  to check whether it's present or not.
- Call `syntax-propertize` by hand in case of doubt.
- Trace your rules function.  E.g. use

      (defun my-syntax-propertize (beg end)
        (funcall
         (syntax-propertize-rules
           ("\\(<\\)<" (1 "(>"))
           (">\\(>\\)" (1 ")<")))
         beg end))

      [...]

      (setq-local syntax-propertize-function
                  #'my-syntax-propertize)

  and then `M-x trace-function RET my-syntax-propertize RET`.


        Stefan




reply via email to

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