From: Thibaut Verron <thibaut.verron@gmail.com>
To: Pierre Rouleau <prouleau001@gmail.com>
Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Re: How to make `forward-sexp` handle other balanced character-pairs such as < and > or << and >> in erlang-mode or others?
Date: Mon, 27 Sep 2021 23:14:30 +0200 [thread overview]
Message-ID: <CAFsi02TVuZgLNHXp=fsAd2tROW3TP0wCqpK3+2=rvtVqYdJ7jw@mail.gmail.com> (raw)
In-Reply-To: <CALTqLibO4uVMmP704+SkkrCdxnbbFw9bkfG0en2D9NtwccpA=A@mail.gmail.com>
Hi,
Adding the characters to the syntax table is the canonical answer.
Maybe erlang-mode sets forward-sexp-function? This is typically done
to enhance the sexp movement beyond simple parentheses, for instance
for modes using SMIE.
If you (setq forward-sexp-function nil), does forward-sexp do what you want?
Best wishes,
Thibaut
Le lun. 27 sept. 2021 à 22:54, Pierre Rouleau <prouleau001@gmail.com> a écrit :
>
> Hi,
>
> I am trying to find an easy and efficient way to modify the behaviour of
> `forward-sexp` to handle
> balanced pairs of characters not normally supported by it, such as balanced
> `<` and `>` and
> balanced `<<` and `>>`.
>
> My specific case is to enhance the support of Erlang but I believe it could
> apply to a lot of scenarios.
>
> The implementation of `forward-sexp` allows the use of a
> `forward-sexp-function` which means I
> could implement such a function.
>
> However I was hoping to find a variable that the C-implemented `scan-sexp`
> could use to define
> the matching pair but have not succeeded so far.
> It would seem the easiest and most efficient way of implementing such
> handling of balanced pairs
> would be done there.
>
> I also tried to modify the syntax table the erlang-mode uses but although
> it matches all sorts of
> Unicode character pairs, I can't get forward-sexp to work with ?< and ?>.
>
> Is there a variable one can use to augment or modify the behaviour of
> `scan-sexp`?
>
> Or is forward-sexp meant to be limited to lisp-like syntaxes and I have to
> use another method
> (like SMIE or writing my own forward-sexp-function)?
>
> Thanks!
> --
> /Pierre
next prev parent reply other threads:[~2021-09-27 21:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-27 20:53 How to make `forward-sexp` handle other balanced character-pairs such as < and > or << and >> in erlang-mode or others? Pierre Rouleau
2021-09-27 21:13 ` Nikolay Kudryavtsev
2021-09-27 21:17 ` Pierre Rouleau
2021-09-27 21:14 ` Thibaut Verron [this message]
2021-09-27 21:22 ` Pierre Rouleau
2021-09-27 21:34 ` Thibaut Verron
2021-09-27 21:48 ` Pierre Rouleau
2021-09-28 3:45 ` Thibaut Verron
2021-09-28 11:22 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFsi02TVuZgLNHXp=fsAd2tROW3TP0wCqpK3+2=rvtVqYdJ7jw@mail.gmail.com' \
--to=thibaut.verron@gmail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=prouleau001@gmail.com \
/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.