[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] [PATCH] Per syntax key bindings
From: |
Brand Huntsman |
Subject: |
Re: [Nano-devel] [PATCH] Per syntax key bindings |
Date: |
Wed, 23 May 2018 22:53:05 -0600 |
On Thu, 24 May 2018 01:17:42 -0300
Marco Diego Aurélio Mesquita <address@hidden> wrote:
> Currently it is possible to define a syntax in nano right after a
> "syntax" command. You are proposing that every "syntax" command should
> be matched by a corresponding "endsyntax" command so that the syntax
> is defined inside a block (that starts in "syntax" and ends in
> "endsyntax") and allow the bind command to be used inside such block;
> is that?
Yes, endsyntax closes the syntax block, both visually and internally. But
endsyntax would only be required and allowed in nanorc, to avoid breaking all
include files. Optionally allowing it in include files might cause confusion as
to why some have it and others don't. Indentation of commands inside syntax
block would be optional.
# this is currently allowed in nanorc
syntax ...
color ...
bind ...
color ...
# the user and nano can see that bind is not part of the syntax
syntax ...
color ...
endsyntax
bind ...
# the user and nano can see that bind is part of the syntax
syntax ...
color ...
bind ...
endsyntax
Everything inside an include file is a syntax command, the user and nano
currently have no issues determining this. And placing two syntaxes in the same
include file also doesn't cause any issues.
syntax a ...
bind A ...
syntax b ...
bind B ...
But parse_one_include() needs to perform an implicit endsyntax after parsing
the file. That way a bind after an include won't be added to the included
syntax.