[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: |
Pierre Rouleau |
Subject: |
Re: When is a syntax-propertize-function called when parse-sexp-lookup-properties is t for a current buffer? |
Date: |
Tue, 5 Oct 2021 09:48:22 -0400 |
On Tue, Oct 5, 2021 at 8:56 AM Stefan Monnier via Users list for the GNU
Emacs text editor <help-gnu-emacs@gnu.org> wrote:
> > What I'd like to understand is what calls the generated function,
> providing
> > it the 2 arguments (start & end) and when should it be called.
>
> > Are these calls protected against error so I can't see them if they
> occur?
>
> No, although some of them can occur in contexts where the error might be
> silenced or at least not displayed in a prominent way.
>
> Why do you ask?
> Are you having an actual problem, or are you asking out of curiosity?
>
>
Both actually. I am trying to add binary pair matching in erlang-mode,
something that works only just after the << >> pair has just been typed
by the user, but later, the matching stops working as the syntax-table
attribute seems to disappear from the character.
I'm trying to make the syntax properties to 'stick' so I can use
forward-sexp, backward-sexp to navigate over Erlang code
code that uses these. Like the following Erlang code:
Values = << <<(X+1)/integer>> || <<X>> <= <<3,7,5,4,7>> >>.
I tried to add the following after the syntax table is built by the
erlang mode function:
(defconst erlang-mode-syntax-propertize-function
(syntax-propertize-rules
("\\(<\\)<" (1 "(>"))
(">\\(>\\)" (2 ")<")))
"Syntax properties to activate << >> pairing.")
(setq-local parse-sexp-lookup-properties t)
(setq-local syntax-propertize-function
erlang-mode-syntax-propertize-function)
But that does not seem to work. So I am trying to understand why
it does not work.
I saw the caution note at the end of the syntax-propertize-function in
section 34.5 Syntax Properties that states:
"Caution: When this variable is non-nil, Emacs removes syntax-table
text properties arbitrarily and relies on syntax-propertize-function to
reapply them. Thus if this facility is used at all, the function must
apply all syntax-table text properties used by the major mode."
Since the erlang-mode modifies the text attribute of the << >> characters
when the user types them I was trying to see what I'm either not doing or
doing wrong.
So I wanted to see where the code was used because it
seems that my addition is just ignored or something in erlang.el prevents
it from working and/or my 'nirvana level' understanding of that mechanism is
obviously not high enough :-)
--
/Pierre
- When is a syntax-propertize-function called when parse-sexp-lookup-properties is t for a current buffer?, Pierre Rouleau, 2021/10/04
- Re: When is a syntax-propertize-function called when parse-sexp-lookup-properties is t for a current buffer?, Emanuel Berg, 2021/10/05
- Re: When is a syntax-propertize-function called when parse-sexp-lookup-properties is t for a current buffer?, Stefan Monnier, 2021/10/05
- Re: When is a syntax-propertize-function called when parse-sexp-lookup-properties is t for a current buffer?,
Pierre Rouleau <=
- Re: When is a syntax-propertize-function called when parse-sexp-lookup-properties is t for a current buffer?, Stefan Monnier, 2021/10/05
- Re: When is a syntax-propertize-function called when parse-sexp-lookup-properties is t for a current buffer?, Pierre Rouleau, 2021/10/05
- Re: When is a syntax-propertize-function called when parse-sexp-lookup-properties is t for a current buffer?, Emanuel Berg, 2021/10/05
- Re: When is a syntax-propertize-function called when parse-sexp-lookup-properties is t for a current buffer?, Pierre Rouleau, 2021/10/05
- Re: When is a syntax-propertize-function called when parse-sexp-lookup-properties is t for a current buffer?, Emanuel Berg, 2021/10/05
- Re: When is a syntax-propertize-function called when parse-sexp-lookup-properties is t for a current buffer?, Pierre Rouleau, 2021/10/05
- Re: When is a syntax-propertize-function called when parse-sexp-lookup-properties is t for a current buffer?, Stefan Monnier, 2021/10/05
- Message not available
- Fwd: When is a syntax-propertize-function called when parse-sexp-lookup-properties is t for a current buffer?, Pierre Rouleau, 2021/10/05
- Re: When is a syntax-propertize-function called when parse-sexp-lookup-properties is t for a current buffer?, Pierre Rouleau, 2021/10/05
- Re: When is a syntax-propertize-function called when parse-sexp-lookup-properties is t for a current buffer?, Stefan Monnier, 2021/10/05