unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Daniel Fleischer <danflscr@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: "\[" <mwkazban@gmail.com>, 49733@debbugs.gnu.org
Subject: bug#49733: 27.2; Syntax Highlighting (Bash) Issue
Date: Sat, 18 Sep 2021 23:55:22 +0300	[thread overview]
Message-ID: <m2v92xeh8l.fsf@gmail.com> (raw)
In-Reply-To: <87wnpdc4e1.fsf@gnus.org> (Lars Ingebrigtsen's message of "Mon, 26 Jul 2021 20:32:38 +0200")

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	other threads:[~2021-09-18 20:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-25 13:02 bug#49733: 27.2; Syntax Highlighting (Bash) Issue [
2021-07-26 18:32 ` Lars Ingebrigtsen
2021-09-18 20:55   ` Daniel Fleischer [this message]
2021-09-19 15:08     ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2v92xeh8l.fsf@gmail.com \
    --to=danflscr@gmail.com \
    --cc=49733@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=mwkazban@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).