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

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

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


From: Pierre Rouleau
Subject: Fwd: When is a syntax-propertize-function called when parse-sexp-lookup-properties is t for a current buffer?
Date: Tue, 5 Oct 2021 16:05:03 -0400

(forgot to copy the list)

On Tue, Oct 5, 2021 at 3:42 PM Stefan Monnier <monnier@iro.umontreal.ca>
wrote:

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

>
> 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).
>
> Ahh, a silly typo, when I copied from the wrong place.  I have the right
'1' in place in
erlang.el but it still does not behave as I would have expected.


> 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.
>
This is had done to check the syntax and wrote something to list all text
properties
of the character at point because what-cursor-position does not show them
all.


> - 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`.
>
> Thanks! That's what I was looking for!  I'll read more on that topic.

Now I did experimentation with that and got the following trace
**when I complete a closing >> only**:

1 -> (my-syntax-propertize 980 1555)
1 <- my-syntax-propertize: nil
======================================================================
1 -> (my-syntax-propertize 980 1556)
1 <- my-syntax-propertize: nil
======================================================================
1 -> (my-syntax-propertize 1043 1616)
1 <- my-syntax-propertize: nil
======================================================================
1 -> (my-syntax-propertize 1043 1617)
1 <- my-syntax-propertize: nil

But I still can't use forward-sexp and backward-sexp to navigate from one
end of
<< to its matching >> or vice versa...


-- 
/Pierre


reply via email to

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