[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to make `forward-sexp` handle other balanced character-pairs suc
Re: How to make `forward-sexp` handle other balanced character-pairs such as < and > or << and >> in erlang-mode or others?
Mon, 27 Sep 2021 23:34:34 +0200
Le lun. 27 sept. 2021 à 23:22, Pierre Rouleau <firstname.lastname@example.org> a écrit :
> On Mon, Sep 27, 2021 at 5:14 PM Thibaut Verron <email@example.com>
>> 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?
> In erlang-mode forward-sexp-function is already nil and forward-sexp does not
> deal with ?< and ?> as a matching pair then.
> I tried to modify the syntax table but that did not work either.
How are you modifying the syntax table? Directly in the source code of
the erlang mode, or in your user configuration?
If it's in the source code, maybe there is a compiled .elc file which
shadows your modifications?
If it's in your user configuration, you have to make sure that you
define the new syntax table before loading the major-mode. If
erlang.el defines the syntax table with a defvar, it won't change the
variable if already set. But it's important that the
define-derived-mode form gets evaluated with the new syntax table.
> Really I would think would have been to modify the syntax table to get
> scan-sexps to
> do the job.
Yes that should be the case.