Subject: Re: bug#31710: 26.1; sh-mode doesn't highlight aliases with dots correctly

From: Lars Ingebrigtsen <[email-masked]>
Date: Sat, 13 Jul 2019 16:19:33 +0200

Aria Edm <[email-masked]> writes:

> run emacs -Q
> M-x sh-mode RET
> alias d="echo hi"
> alias d.="echo hi"
>
> the d is highlighted, d. isn't

Looks like there was a typo in the regexp.  At least I think so?  Surely
foo[....]="bar" isn't valid bash syntax?

I've installed the following patch on the Emacs trunk:

diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index ae90531a7f..64608f1930 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -582,7 +582,7 @@ sh-assignment-regexp
     ;; actually spaces are only supported in let/(( ... ))
     (ksh88 . ,(concat "\\<\\([[:alnum:]_]+\\)\\(\\[.+\\]\\)?"
                       "[ \t]*\\(?:[-+*/%&|~^]\\|<<\\|>>\\)?="))
-    (bash . "\\<\\([[:alnum:]_]+\\)\\(\\[.+\\]\\)?\\+?=")
+    (bash . "\\<\\([[:alnum:]_]+\\)\\([.+]\\)?\\+?=")
     (rc . "\\<\\([[:alnum:]_*]+\\)[ \t]*=")
     (sh . "\\<\\([[:alnum:]_]+\\)="))
   "Regexp for the variable name and what may follow in an assignment.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no