nano-devel
[Top][All Lists]
Advanced

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

Re: [Nano-devel] [PATCH] enables syntax coloring for all GNU Make suppor


From: Cristian Caloghera
Subject: Re: [Nano-devel] [PATCH] enables syntax coloring for all GNU Make supported filenames
Date: Tue, 22 May 2018 16:03:49 +0200

Hello Benno,

you are right. It is better to have the '/' at the beginning of the regex. I was not aware that the match is done against the absolute filename. Patches attached.

Regarding the actual coloring, this is another issue. Time permitting I would use the GNU Make manual for a list of keywords:
https://www.gnu.org/software/make/manual/html_node/Quick-Reference.html

What other editors are doing I do not know. :)

On Fri, May 18, 2018 at 7:38 PM, Benno Schulenberg <address@hidden> wrote:

Hello Cristian,

Op 18-05-18 om 15:05 schreef Cristian Caloghera:
> Subject: [PATCH] enables syntax coloring for all GNU Make supported filenames
>
> makefile.nanorc now recognizes all the filename which GNU Make looks for:
>  * GNUmakefile
>  * makefile
>  * Makefile
>
> [...]
>
> -syntax makefile "Makefile[^/]*$" "\.(make|mk)$"
> +syntax makefile "((GNU)?m|M)akefile[^/]*$" "\.(make|mk)$"

Thanks for the improvement.  The "(GNU)?" part, however, does not add
anything, because the regex will also match FooBarMakefile, for example,
and all other names that end with Makefile or makefile.  Maybe this is
wrong?  If yes, then the regex should begin with a slash:

  "/((GNU)?m|M)akefile[^/]*$"

This will work because the regex is matched against the absolute filename,
not against the filename as provided on the command line.

By the way, the syntax would color the keyword "endif" magenta, but
makefiles don't seem to contain that keyword -- they contain "elif"
and "fi", though, but they are not colored.  They also contain "case"
and "esac" and "for" and "do" and "done", which are all left uncolored.
However, Vim and Emacs and Joe don't color any of these keywords at all
(except that Emacs colors "else") -- maybe nano should neither?

Benno


Attachment: 0001-enables-syntax-coloring-for-all-GNU-Make-supported-f.patch
Description: Binary data

Attachment: 0002-makefile.nanorc-match-files-that-actually-start-with.patch
Description: Binary data


reply via email to

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