From edabd27cd8d8dbcc59badf2fb8042c530be3f4f2 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 21 Sep 2014 15:29:40 +0000 Subject: [PATCH] Recognizing also header lines that use "/usr/bin/env" to call the program, instead of just a direct call via "/bin/program". Doing this for Shell scripts, and for Python, Perl and Ruby. This fixes Savannah bug #43270 reported by Kitty. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5095 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 5 +++++ doc/syntax/perl.nanorc | 2 +- doc/syntax/python.nanorc | 2 +- doc/syntax/ruby.nanorc | 2 +- doc/syntax/sh.nanorc | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3edb5ffd..645438ee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-09-21 Benno Schulenberg + * doc/syntax/{perl,python,ruby,sh}.nanorc: Recognize also header + lines of the form "#!/usr/bin/env thing" besides "#!/bin/thing". + This fixes Savannah bug #43270 reported by Kitty. + 2014-08-29 Benno Schulenberg * src/text.c (do_justify): Replace the old get_shortcut() wrapper with the new func_from_key(). diff --git a/doc/syntax/perl.nanorc b/doc/syntax/perl.nanorc index 5f39c176..6a70d3d1 100644 --- a/doc/syntax/perl.nanorc +++ b/doc/syntax/perl.nanorc @@ -1,7 +1,7 @@ ## Here is an example for Perl. syntax "perl" "\.p[lm]$" -header "^#!.*/perl[-0-9._]*" +header "^#!.*perl[-0-9._]*" magic "Perl script text" color red "\<(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork))\>" "\<(get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join)\>" "\<(keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek(dir)?)\>" "\<(se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr(y)?|truncate|umask)\>" "\<(un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\>" diff --git a/doc/syntax/python.nanorc b/doc/syntax/python.nanorc index 4679cf10..f2ee15a2 100644 --- a/doc/syntax/python.nanorc +++ b/doc/syntax/python.nanorc @@ -1,7 +1,7 @@ ## Here is an example for Python. syntax "python" "\.py$" -header "^#!.*/python[-0-9._]*" +header "^#!.*python[-0-9._]*" # Function definitions. icolor brightblue "def [0-9A-Z_]+" diff --git a/doc/syntax/ruby.nanorc b/doc/syntax/ruby.nanorc index 3566e1fe..a4ed1783 100644 --- a/doc/syntax/ruby.nanorc +++ b/doc/syntax/ruby.nanorc @@ -1,7 +1,7 @@ ## Here is an example for Ruby. syntax "ruby" "\.rb$" -header "^#!.*/ruby[-0-9._]*" +header "^#!.*ruby[-0-9._]*" # Asciibetical list of reserved words. color yellow "\<(BEGIN|END|alias|and|begin|break|case|class|def|defined\?|do|else|elsif|end|ensure|false|for|if|in|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\>" diff --git a/doc/syntax/sh.nanorc b/doc/syntax/sh.nanorc index 823cc5d1..36b049fc 100644 --- a/doc/syntax/sh.nanorc +++ b/doc/syntax/sh.nanorc @@ -1,7 +1,7 @@ ## Here is an example for Bourne shell scripts. syntax "sh" "\.sh$" -header "^#!.*/(ba|k|pdk)?sh[-0-9_]*" +header "^#!.*(ba|k|pdk)?sh[-0-9_]*" magic "(POSIX|Bourne.*) shell script text" icolor brightgreen "^[0-9A-Z_]+\(\)"