unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Pierre Rouleau <prouleau001@gmail.com>
To: help-gnu-emacs <help-gnu-emacs@gnu.org>,
	Stefan Monnier <monnier@iro.umontreal.ca>
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	[thread overview]
Message-ID: <CALTqLib=HYGCSo=Y0Jg-pZLagm-NBVeFddDai7kn3USyy9sWcw@mail.gmail.com> (raw)
In-Reply-To: <CALTqLiab4AZx=fn1wX1ovckxFtie9C20O=qZFYTLyQNKWfWZGg@mail.gmail.com>

(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


  parent reply	other threads:[~2021-10-05 20:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-05  3:54 When is a syntax-propertize-function called when parse-sexp-lookup-properties is t for a current buffer? Pierre Rouleau
2021-10-05  4:15 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-05 12:00   ` Pierre Rouleau
2021-10-05 12:54 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-10-05 13:48   ` Pierre Rouleau
2021-10-05 14:57     ` Stefan Monnier
2021-10-05 15:36       ` Pierre Rouleau
2021-10-05 17:29         ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-05 18:45           ` Pierre Rouleau
2021-10-05 19:08             ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-05 19:42               ` Pierre Rouleau
2021-10-05 19:41         ` Stefan Monnier
     [not found]           ` <CALTqLiab4AZx=fn1wX1ovckxFtie9C20O=qZFYTLyQNKWfWZGg@mail.gmail.com>
2021-10-05 20:05             ` Pierre Rouleau [this message]
2021-10-05 20:17           ` Pierre Rouleau
2021-10-06  1:55             ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-10-06  2:46               ` Pierre Rouleau

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='CALTqLib=HYGCSo=Y0Jg-pZLagm-NBVeFddDai7kn3USyy9sWcw@mail.gmail.com' \
    --to=prouleau001@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).