GNU bug report logs - #31710
26.1; sh-mode doesn't highlight aliases with dots correctly

Previous Next

Package: emacs;

Reported by: Aria Edm <aria <at> ar1as.space>

Date: Mon, 4 Jun 2018 12:15:02 UTC

Severity: minor

Tags: fixed

Found in version 26.1

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 31710 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Aria Edm <aria <at> ar1as.space>
Cc: 31710 <at> debbugs.gnu.org
Subject: Re: bug#31710: 26.1; sh-mode doesn't highlight aliases with dots
 correctly
Date: Sat, 13 Jul 2019 16:19:33 +0200
Aria Edm <aria <at> ar1as.space> 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




This bug report was last modified 5 years and 315 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.