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

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

Re: How to make `forward-sexp` handle other balanced character-pairs suc


From: Thibaut Verron
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:34:34 +0200

Le lun. 27 sept. 2021 à 23:22, Pierre Rouleau <prouleau001@gmail.com> a écrit :
>
>
>
> On Mon, Sep 27, 2021 at 5:14 PM Thibaut Verron <thibaut.verron@gmail.com> 
> wrote:
>>
>> 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?
>>
>
> 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.

Best wishes,
Thibaut



reply via email to

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