bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#49733: 27.2; Syntax Highlighting (Bash) Issue


From: Daniel Fleischer
Subject: bug#49733: 27.2; Syntax Highlighting (Bash) Issue
Date: Sat, 18 Sep 2021 23:55:22 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (darwin)

Lars Ingebrigtsen [2021-07-26 Mon 20:32] wrote:

> "[" <mwkazban@gmail.com> writes:
>
>> To be more concise, (my version of) 
>> emacs does not seem to treat an
>> escaped single quote in a string literal as actually being escaped,
>> though this works in Bash.
>
> I think it looks like the mode doesn't know about the $'foo' construct,
> which allows quoting single quotes (while the normal 'foo' doesn't)?

There is special font-locking treatment for '...' strings that assumes
they don't have escaped characters. It's correct however there are the
$'...' constructs which allow escaped-characters expansion which is not
implemented as seen by OP.

Instead of dealing with these two types how about we just fontify '...'
always by removing the restriction:

diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index cccd70f06c..e5f8a3755f 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -1070,8 +1070,6 @@ sh-syntax-propertize-function
     ;; (e.g. `foo(#q/)' and `(#b)foo' in zsh)
     ("[^|&;<>(`\\\"' \t\n](\\(#+\\)" (1 "_"))
     ("(\\(#\\)[^)]+?)[^|&;<>)`\\\"' \t\n]" (1 "_"))
-    ;; In a '...' the backslash is not escaping.
-    ("\\(\\\\\\)'" (1 (sh-font-lock-backslash-quote)))
     ;; Make sure $@ and $? are correctly recognized as sexps.
     ("\\$\\([?@]\\)" (1 "_"))
     ;; Distinguish the special close-paren in `case'.

-- 

Daniel Fleischer





reply via email to

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