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

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

How to make `forward-sexp` handle other balanced character-pairs such as


From: Pierre Rouleau
Subject: 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 16:53:49 -0400

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


reply via email to

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