From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Fleischer Newsgroups: gmane.emacs.bugs Subject: bug#49733: 27.2; Syntax Highlighting (Bash) Issue Date: Sat, 18 Sep 2021 23:55:22 +0300 Message-ID: References: <87wnpdc4e1.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13912"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (darwin) Cc: "\[" , 49733@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 18 22:56:15 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mRhNf-0003XS-2Y for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 18 Sep 2021 22:56:15 +0200 Original-Received: from localhost ([::1]:60126 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRhNe-0001d8-0i for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 18 Sep 2021 16:56:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44810) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRhNS-0001b3-Tw for bug-gnu-emacs@gnu.org; Sat, 18 Sep 2021 16:56:06 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53744) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRhNS-0003Sj-MA for bug-gnu-emacs@gnu.org; Sat, 18 Sep 2021 16:56:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mRhNS-0003Ok-J8 for bug-gnu-emacs@gnu.org; Sat, 18 Sep 2021 16:56:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Fleischer Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Sep 2021 20:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49733 X-GNU-PR-Package: emacs Original-Received: via spool by 49733-submit@debbugs.gnu.org id=B49733.163199853313026 (code B ref 49733); Sat, 18 Sep 2021 20:56:02 +0000 Original-Received: (at 49733) by debbugs.gnu.org; 18 Sep 2021 20:55:33 +0000 Original-Received: from localhost ([127.0.0.1]:37057 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mRhMy-0003O2-Sm for submit@debbugs.gnu.org; Sat, 18 Sep 2021 16:55:33 -0400 Original-Received: from mail-wr1-f52.google.com ([209.85.221.52]:45999) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mRhMw-0003Nl-TU for 49733@debbugs.gnu.org; Sat, 18 Sep 2021 16:55:31 -0400 Original-Received: by mail-wr1-f52.google.com with SMTP id d21so21147254wra.12 for <49733@debbugs.gnu.org>; Sat, 18 Sep 2021 13:55:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=GfNOZ5V8vucUfaUQv7yeSEcW2K49lNisgspHEu8myTY=; b=YbDDESYlioDHT2x1YVLxzNPf2M2xTawWxwH7DIs2yqGTLYunR5dlA+zIXa9wVE4Fxx LeUGi1zRxgy7Jg1p2IrNrwGOyhhYOrcWK4ohjTYX4gWpLsGfRinPkU0rErrkF+XweyQO X+q02Tw3x5506UdiSKU/OzYySfpqhDx6FK7gSFxXDIJ+H8oodteo8HJrt8jpl6sdbe6I n3EBoSBq+UEzdfQrZiTs9ewlsNzjNriFL/nTk9ulf6W4vJTUp4bEi/Zb6fhTuI6BAJJd teo0oPJItjmjZoNHlrKk5RlRnKxhFCxV3brOo2H5FL1u41wcWKAhfdEXphnnZJ2PzzGI nOnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=GfNOZ5V8vucUfaUQv7yeSEcW2K49lNisgspHEu8myTY=; b=QlVA9CAL4rH4Am/7I8/knOqEy+CsJOwWNSMp7g7urNko7HZglP4yaq6bJO4rXe+N4G xfMIvwvNCCLOhxczrdAGm8hpI9YM+rhnTZWnXZncQjTH3zpTaZIlgjnYR5wN7V7h7jGI uycwLk6aR9M8K7LIgF4DLc6XZyG5+3/rahCnVqquYzLy/FSkoD3x2j/fzROVSOTEkLow l9xrGXSWkBDWfgucPB+AMWJIhpsr0ZKl/3bQFeOafjsVFnG1srcyH9HRsWcWBTl4uBQw ga8R2TF0Tx/CZWXKuHDaLDooOYeN2K6COFaBY1tfeGri9Epuw+WyS+KBKnUazqrxFrl/ N9+Q== X-Gm-Message-State: AOAM5327jY3fEBCMhK4XHM+hdis/pfWrXsEGO/IDoqeRTL6SYDguQHBQ y9QTDMDASRnppyizougo4/FeaMnu1Vc= X-Google-Smtp-Source: ABdhPJx6s6CSGuecA172ml0LqXfKsYGsswy565bT+r0STTO7kZ7x9vcuKC5PAH51h73yTiLbFVFEYg== X-Received: by 2002:adf:9dc6:: with SMTP id q6mr19040794wre.161.1631998524972; Sat, 18 Sep 2021 13:55:24 -0700 (PDT) Original-Received: from Home-Mac ([141.226.13.159]) by smtp.gmail.com with ESMTPSA id p5sm12153980wrd.25.2021.09.18.13.55.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 13:55:24 -0700 (PDT) In-Reply-To: <87wnpdc4e1.fsf@gnus.org> (Lars Ingebrigtsen's message of "Mon, 26 Jul 2021 20:32:38 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:214659 Archived-At: Lars Ingebrigtsen [2021-07-26 Mon 20:32] wrote: > "[" 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