From unknown Sun Jun 22 00:13:00 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78167: [PATCH] 31.0.50; bash-ts-mode does not fontify varibles used consistently Resent-From: Jostein =?UTF-8?Q?Kj=C3=B8nigsen?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Apr 2025 20:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 78167 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 78167@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.174604591422912 (code B ref -1); Wed, 30 Apr 2025 20:46:01 +0000 Received: (at submit) by debbugs.gnu.org; 30 Apr 2025 20:45:14 +0000 Received: from localhost ([127.0.0.1]:45933 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uAEIr-0005xT-HX for submit@debbugs.gnu.org; Wed, 30 Apr 2025 16:45:13 -0400 Received: from lists.gnu.org ([2001:470:142::17]:52018) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uAEIn-0005qh-MP for submit@debbugs.gnu.org; Wed, 30 Apr 2025 16:45:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uAEId-0008PE-KG for bug-gnu-emacs@gnu.org; Wed, 30 Apr 2025 16:45:00 -0400 Received: from fout-a7-smtp.messagingengine.com ([103.168.172.150]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uAEIa-0006wQ-Fp for bug-gnu-emacs@gnu.org; Wed, 30 Apr 2025 16:44:59 -0400 Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfout.phl.internal (Postfix) with ESMTP id 8F7D0138020A for ; Wed, 30 Apr 2025 16:44:53 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Wed, 30 Apr 2025 16:44:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= secure.kjonigsen.net; h=cc:content-type:content-type:date:date :from:from:in-reply-to:message-id:mime-version:reply-to:subject :subject:to:to; s=fm2; t=1746045893; x=1746132293; bh=BrSEfiP2Gt D+2Own6nBDL7mrD5qT57iEAKK5eKou0UY=; b=LPvwMeJDzA6IVbKlQVTKYbdPXj BCQBO8UbozaewX/5r20iZXOE6Px0y5Hv1PzjujgpIaRu6bJhnXA0A2wa86QPkh6x d6FJU9M+9z3awq1uLBzf44GCcAGjUi5uqv/x2SNeSEDo0veQs8yNBUT2wnGLBDUq IXF4ryd30uPsSJiJyffYdAfMNnEcgJe0Fk8sAWw2oa4boXgTGbVhYk020Gf2KBXT 4/b8XvJU6VZbgvo8+fsFi2F/v7xWpfcr7GqKsDrx42KBo8qqtneq1fiOCm4OPG0s YO/LJsOrhuWxKYgqiklGRLQaT5Gz1inhP7tdpaQYsqCctTzAazTdOdLyEiiA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1746045893; x= 1746132293; bh=BrSEfiP2GtD+2Own6nBDL7mrD5qT57iEAKK5eKou0UY=; b=b jWLJMG7vXoc5GfR+n3fgLbZ4q46arLNpOjc5s4ssX84x4LhUZnoSMF/ij+33Z9F7 0/QJilIKdS/G+viTr8BuDRdQaYGJGzPR/LIntW4zIby+6GFAj03j1ACc50PUEU+q ryBuH4m4s4+yfK3PpZTOmEYA+tVVfaaewyfrVJ0XD5UgisP6W/LrMBgIvxXaOuu5 RSYgkEeSJ/AjGzHfTUfzelmPtNI5YWNdRRWm3+B40PNV+uGk+4VxKicnZMmyEvBS 31/F0UJwN5k2rrHV4JTbviytQc7eSx4GaceuavdXGJ/wF55LMLMdsADdFEtEtRl7 gaknS2c/XnP8WmNbv0wMg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvieejieelucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhtg gguffkfffvofesrgdtmherhhdtjeenucfhrhhomheplfhoshhtvghinhcumfhjpphnihhg shgvnhcuoehjohhsthgvihhnsehsvggtuhhrvgdrkhhjohhnihhgshgvnhdrnhgvtheqne cuggftrfgrthhtvghrnhepffdtieegteeggffhkefgtdelffdufffgffefvdefffeghedu vdejvdfhvdffveeinecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepjhhoshhtvghinhesshgvtghurhgvrdhkjhhonhhighhsvghnrdhnvghtpdhn sggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegsuhhgqd hgnhhuqdgvmhgrtghssehgnhhurdhorhhg X-ME-Proxy: Feedback-ID: ib2f84088:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Wed, 30 Apr 2025 16:44:52 -0400 (EDT) From: Jostein =?UTF-8?Q?Kj=C3=B8nigsen?= Content-Type: multipart/alternative; boundary="Apple-Mail=_D407993E-4BE7-4429-A935-F9E9621150FB" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.500.181.1.5\)) Message-Id: Date: Wed, 30 Apr 2025 22:43:59 +0200 X-Mailer: Apple Mail (2.3826.500.181.1.5) Received-SPF: pass client-ip=103.168.172.150; envelope-from=jostein@secure.kjonigsen.net; helo=fout-a7-smtp.messagingengine.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) --Apple-Mail=_D407993E-4BE7-4429-A935-F9E9621150FB Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hey everyone. When writing bash-scripts one often refers to variables in lots of = different syntax variants, like the ones below: echo "${var}" echo "$var" echo ${var} echo $var Using bash-ts-mode in Emacs these are all presented inconsistently: * as string * as variable-declaration * as variable-use This is due to missing or incorrectly configured selectors in = sh-script.el. Attached is a patch which makes them consistely fontified as = font-lock-variable-use-face and use font-lock-bracket-face for the = enclosing brackets. Cheers! =E2=80=94 Kind Regards Jostein Kj=C3=B8nigsen =EF=BF=BC= --Apple-Mail=_D407993E-4BE7-4429-A935-F9E9621150FB Content-Type: multipart/mixed; boundary="Apple-Mail=_71E41DD1-5C0F-4675-867B-695F70073DCF" --Apple-Mail=_71E41DD1-5C0F-4675-867B-695F70073DCF Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
Hey = everyone.

When writing bash-scripts one often = refers to variables in lots of different syntax variants, like the ones = below:

    echo = "${var}"
    echo "$var"
    = echo ${var}
    echo = $var

Using bash-ts-mode in Emacs these = are all presented inconsistently:

* as = string
* as variable-declaration
* as = variable-use

This is due to missing or = incorrectly configured selectors in = sh-script.el.

Attached is a patch which makes = them consistely fontified as font-lock-variable-use-face and use = font-lock-bracket-face for the enclosing = brackets.

Cheers!

=E2=80=94
Kind Regards
Jostein = Kj=C3=B8nigsen

= --Apple-Mail=_71E41DD1-5C0F-4675-867B-695F70073DCF Content-Disposition: attachment; filename=0001-sh-script.el-Improve-consistency-in-variable-use-fon.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-sh-script.el-Improve-consistency-in-variable-use-fon.patch" Content-Transfer-Encoding: quoted-printable =46rom=206ab6e324fc6ab23c3d444aba5e678f6003452f19=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Jostein=3D20Kj=3DC3=3DB8nigsen?=3D=20= =0ADate:=20Wed,=2030=20Apr=202025=2011:33:26=20= +0200=0ASubject:=20[PATCH]=20sh-script.el:=20Improve=20consistency=20in=20= variable-use=0A=20fontification.=0A=0Ash-mode--treesit-settings:=20= Ensure=20all=20variable=20use=20is=20treated=20the=20same=20way.=0A=0A= Before=20this=20patch=20the=20following=20commands=20would=20all=20be=20= treated=20differently:=0A=0A=20=20=20=20echo=20"${var}"=0A=20=20=20=20= echo=20"$var"=0A=20=20=20=20echo=20${var}=0A=20=20=20=20echo=20$var=0A=0A= Now=20they=20are=20treated=20the=20same.=0A---=0A=20= lisp/progmodes/sh-script.el=20|=206=20+++++-=0A=201=20file=20changed,=20= 5=20insertions(+),=201=20deletion(-)=0A=0Adiff=20--git=20= a/lisp/progmodes/sh-script.el=20b/lisp/progmodes/sh-script.el=0Aindex=20= 287f0501350..a7591415a75=20100644=0A---=20a/lisp/progmodes/sh-script.el=0A= +++=20b/lisp/progmodes/sh-script.el=0A@@=20-3369,7=20+3369,11=20@@=20= sh-mode--treesit-settings=0A=20=20=20=20:language=20'bash=0A=20=20=20=20= :override=20t=0A=20=20=20=20'((command_substitution)=20@sh-quoted-exec=0A= -=20=20=20=20=20(string=20(expansion=20(variable_name)=20= @font-lock-variable-use-face)))=0A+=20=20=20=20=20(expansion=20= (variable_name)=20@font-lock-variable-use-face)=0A+=20=20=20=20=20= (expansion=20["${"=20"}"]=20@font-lock-bracket-face)=0A+=20=20=20=20=20= (simple_expansion=0A+=20=20=20=20=20=20"$"=20@font-lock-bracket-face=0A+=20= =20=20=20=20=20(variable_name)=20@font-lock-variable-use-face))=0A=20=0A=20= =20=20=20:feature=20'heredoc=0A=20=20=20=20:language=20'bash=0A--=20=0A= 2.49.0=0A=0A= --Apple-Mail=_71E41DD1-5C0F-4675-867B-695F70073DCF Content-Transfer-Encoding: 7bit Content-Type: text/html; charset=us-ascii --Apple-Mail=_71E41DD1-5C0F-4675-867B-695F70073DCF-- --Apple-Mail=_D407993E-4BE7-4429-A935-F9E9621150FB-- From unknown Sun Jun 22 00:13:00 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Jostein =?UTF-8?Q?Kj=C3=B8nigsen?= Subject: bug#78167: closed (Re: bug#78167: [PATCH] 31.0.50; bash-ts-mode does not fontify varibles used consistently) Message-ID: References: <86ecwwahnq.fsf@gnu.org> X-Gnu-PR-Message: they-closed 78167 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 78167@debbugs.gnu.org Date: Sat, 10 May 2025 10:24:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1746872642-11747-1" This is a multi-part message in MIME format... ------------=_1746872642-11747-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #78167: [PATCH] 31.0.50; bash-ts-mode does not fontify varibles used consis= tently which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 78167@debbugs.gnu.org. --=20 78167: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D78167 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1746872642-11747-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 78167-done) by debbugs.gnu.org; 10 May 2025 10:23:47 +0000 Received: from localhost ([127.0.0.1]:44287 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uDhMx-00032f-7A for submit@debbugs.gnu.org; Sat, 10 May 2025 06:23:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60196) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uDhMv-00032Q-H1 for 78167-done@debbugs.gnu.org; Sat, 10 May 2025 06:23:46 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uDhMp-0006fw-Ry; Sat, 10 May 2025 06:23:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=ycerMdwbg+DgbVuVtYPau29ROJK/cXs3vCzmycsc25g=; b=E0UGmoEtPIMLmMZDlKhi qp1tsv5foHZSX1oTBA8z3XtZEnaZmW4oZkFPVVLfMptwxA54confVIk9c2qEYswAMqc1HefnFpeE3 S9NGaXaHgYBMhgPIFZRiZnGHRNnhebH/qDLPBgfe/59RUJ5S/e2M0byy5gapg83UhWhT/b2mnAkWl rTTvwo+/GE/QxC78uNLYGu4zWHtD3CHl8VIyz5eMLQT4ydWuWhC6C0izsGYtpFCVuUaz8U8JQ37W2 3CvAFb2ws02tiP9KX1IOFP0KOfNY2kc1LHE3u3V0sdOpisW5OSPjHoZfIKV30c59JXRrmi3TnZAAW KfCgvihFaCS1OA==; Date: Sat, 10 May 2025 13:23:21 +0300 Message-Id: <86ecwwahnq.fsf@gnu.org> From: Eli Zaretskii To: Jostein =?utf-8?Q?Kj=C3=B8nigsen?= In-Reply-To: (message from Jostein =?utf-8?Q?Kj=C3=B8nigsen?= on Wed, 30 Apr 2025 22:43:59 +0200) Subject: Re: bug#78167: [PATCH] 31.0.50; bash-ts-mode does not fontify varibles used consistently References: MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78167-done Cc: 78167-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Jostein Kjønigsen > Date: Wed, 30 Apr 2025 22:43:59 +0200 > > Hey everyone. > > When writing bash-scripts one often refers to variables in lots of different syntax variants, like the ones below: > > echo "${var}" > echo "$var" > echo ${var} > echo $var > > Using bash-ts-mode in Emacs these are all presented inconsistently: > > * as string > * as variable-declaration > * as variable-use > > This is due to missing or incorrectly configured selectors in sh-script.el. > > Attached is a patch which makes them consistely fontified as font-lock-variable-use-face and use font-lock-bracket-face for the enclosing brackets. Thanks, installed on the master branch, and closing the bug. ------------=_1746872642-11747-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 30 Apr 2025 20:45:14 +0000 Received: from localhost ([127.0.0.1]:45933 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uAEIr-0005xT-HX for submit@debbugs.gnu.org; Wed, 30 Apr 2025 16:45:13 -0400 Received: from lists.gnu.org ([2001:470:142::17]:52018) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uAEIn-0005qh-MP for submit@debbugs.gnu.org; Wed, 30 Apr 2025 16:45:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uAEId-0008PE-KG for bug-gnu-emacs@gnu.org; Wed, 30 Apr 2025 16:45:00 -0400 Received: from fout-a7-smtp.messagingengine.com ([103.168.172.150]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uAEIa-0006wQ-Fp for bug-gnu-emacs@gnu.org; Wed, 30 Apr 2025 16:44:59 -0400 Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfout.phl.internal (Postfix) with ESMTP id 8F7D0138020A for ; Wed, 30 Apr 2025 16:44:53 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Wed, 30 Apr 2025 16:44:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= secure.kjonigsen.net; h=cc:content-type:content-type:date:date :from:from:in-reply-to:message-id:mime-version:reply-to:subject :subject:to:to; s=fm2; t=1746045893; x=1746132293; bh=BrSEfiP2Gt D+2Own6nBDL7mrD5qT57iEAKK5eKou0UY=; b=LPvwMeJDzA6IVbKlQVTKYbdPXj BCQBO8UbozaewX/5r20iZXOE6Px0y5Hv1PzjujgpIaRu6bJhnXA0A2wa86QPkh6x d6FJU9M+9z3awq1uLBzf44GCcAGjUi5uqv/x2SNeSEDo0veQs8yNBUT2wnGLBDUq IXF4ryd30uPsSJiJyffYdAfMNnEcgJe0Fk8sAWw2oa4boXgTGbVhYk020Gf2KBXT 4/b8XvJU6VZbgvo8+fsFi2F/v7xWpfcr7GqKsDrx42KBo8qqtneq1fiOCm4OPG0s YO/LJsOrhuWxKYgqiklGRLQaT5Gz1inhP7tdpaQYsqCctTzAazTdOdLyEiiA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1746045893; x= 1746132293; bh=BrSEfiP2GtD+2Own6nBDL7mrD5qT57iEAKK5eKou0UY=; b=b jWLJMG7vXoc5GfR+n3fgLbZ4q46arLNpOjc5s4ssX84x4LhUZnoSMF/ij+33Z9F7 0/QJilIKdS/G+viTr8BuDRdQaYGJGzPR/LIntW4zIby+6GFAj03j1ACc50PUEU+q ryBuH4m4s4+yfK3PpZTOmEYA+tVVfaaewyfrVJ0XD5UgisP6W/LrMBgIvxXaOuu5 RSYgkEeSJ/AjGzHfTUfzelmPtNI5YWNdRRWm3+B40PNV+uGk+4VxKicnZMmyEvBS 31/F0UJwN5k2rrHV4JTbviytQc7eSx4GaceuavdXGJ/wF55LMLMdsADdFEtEtRl7 gaknS2c/XnP8WmNbv0wMg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvieejieelucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhtg gguffkfffvofesrgdtmherhhdtjeenucfhrhhomheplfhoshhtvghinhcumfhjpphnihhg shgvnhcuoehjohhsthgvihhnsehsvggtuhhrvgdrkhhjohhnihhgshgvnhdrnhgvtheqne cuggftrfgrthhtvghrnhepffdtieegteeggffhkefgtdelffdufffgffefvdefffeghedu vdejvdfhvdffveeinecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepjhhoshhtvghinhesshgvtghurhgvrdhkjhhonhhighhsvghnrdhnvghtpdhn sggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegsuhhgqd hgnhhuqdgvmhgrtghssehgnhhurdhorhhg X-ME-Proxy: Feedback-ID: ib2f84088:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Wed, 30 Apr 2025 16:44:52 -0400 (EDT) From: =?utf-8?Q?Jostein_Kj=C3=B8nigsen?= Content-Type: multipart/alternative; boundary="Apple-Mail=_D407993E-4BE7-4429-A935-F9E9621150FB" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.500.181.1.5\)) Subject: [PATCH] 31.0.50; bash-ts-mode does not fontify varibles used consistently Message-Id: Date: Wed, 30 Apr 2025 22:43:59 +0200 To: bug-gnu-emacs@gnu.org X-Mailer: Apple Mail (2.3826.500.181.1.5) Received-SPF: pass client-ip=103.168.172.150; envelope-from=jostein@secure.kjonigsen.net; helo=fout-a7-smtp.messagingengine.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) --Apple-Mail=_D407993E-4BE7-4429-A935-F9E9621150FB Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hey everyone. When writing bash-scripts one often refers to variables in lots of = different syntax variants, like the ones below: echo "${var}" echo "$var" echo ${var} echo $var Using bash-ts-mode in Emacs these are all presented inconsistently: * as string * as variable-declaration * as variable-use This is due to missing or incorrectly configured selectors in = sh-script.el. Attached is a patch which makes them consistely fontified as = font-lock-variable-use-face and use font-lock-bracket-face for the = enclosing brackets. Cheers! =E2=80=94 Kind Regards Jostein Kj=C3=B8nigsen =EF=BF=BC= --Apple-Mail=_D407993E-4BE7-4429-A935-F9E9621150FB Content-Type: multipart/mixed; boundary="Apple-Mail=_71E41DD1-5C0F-4675-867B-695F70073DCF" --Apple-Mail=_71E41DD1-5C0F-4675-867B-695F70073DCF Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
Hey = everyone.

When writing bash-scripts one often = refers to variables in lots of different syntax variants, like the ones = below:

    echo = "${var}"
    echo "$var"
    = echo ${var}
    echo = $var

Using bash-ts-mode in Emacs these = are all presented inconsistently:

* as = string
* as variable-declaration
* as = variable-use

This is due to missing or = incorrectly configured selectors in = sh-script.el.

Attached is a patch which makes = them consistely fontified as font-lock-variable-use-face and use = font-lock-bracket-face for the enclosing = brackets.

Cheers!

=E2=80=94
Kind Regards
Jostein = Kj=C3=B8nigsen

= --Apple-Mail=_71E41DD1-5C0F-4675-867B-695F70073DCF Content-Disposition: attachment; filename=0001-sh-script.el-Improve-consistency-in-variable-use-fon.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-sh-script.el-Improve-consistency-in-variable-use-fon.patch" Content-Transfer-Encoding: quoted-printable =46rom=206ab6e324fc6ab23c3d444aba5e678f6003452f19=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Jostein=3D20Kj=3DC3=3DB8nigsen?=3D=20= =0ADate:=20Wed,=2030=20Apr=202025=2011:33:26=20= +0200=0ASubject:=20[PATCH]=20sh-script.el:=20Improve=20consistency=20in=20= variable-use=0A=20fontification.=0A=0Ash-mode--treesit-settings:=20= Ensure=20all=20variable=20use=20is=20treated=20the=20same=20way.=0A=0A= Before=20this=20patch=20the=20following=20commands=20would=20all=20be=20= treated=20differently:=0A=0A=20=20=20=20echo=20"${var}"=0A=20=20=20=20= echo=20"$var"=0A=20=20=20=20echo=20${var}=0A=20=20=20=20echo=20$var=0A=0A= Now=20they=20are=20treated=20the=20same.=0A---=0A=20= lisp/progmodes/sh-script.el=20|=206=20+++++-=0A=201=20file=20changed,=20= 5=20insertions(+),=201=20deletion(-)=0A=0Adiff=20--git=20= a/lisp/progmodes/sh-script.el=20b/lisp/progmodes/sh-script.el=0Aindex=20= 287f0501350..a7591415a75=20100644=0A---=20a/lisp/progmodes/sh-script.el=0A= +++=20b/lisp/progmodes/sh-script.el=0A@@=20-3369,7=20+3369,11=20@@=20= sh-mode--treesit-settings=0A=20=20=20=20:language=20'bash=0A=20=20=20=20= :override=20t=0A=20=20=20=20'((command_substitution)=20@sh-quoted-exec=0A= -=20=20=20=20=20(string=20(expansion=20(variable_name)=20= @font-lock-variable-use-face)))=0A+=20=20=20=20=20(expansion=20= (variable_name)=20@font-lock-variable-use-face)=0A+=20=20=20=20=20= (expansion=20["${"=20"}"]=20@font-lock-bracket-face)=0A+=20=20=20=20=20= (simple_expansion=0A+=20=20=20=20=20=20"$"=20@font-lock-bracket-face=0A+=20= =20=20=20=20=20(variable_name)=20@font-lock-variable-use-face))=0A=20=0A=20= =20=20=20:feature=20'heredoc=0A=20=20=20=20:language=20'bash=0A--=20=0A= 2.49.0=0A=0A= --Apple-Mail=_71E41DD1-5C0F-4675-867B-695F70073DCF Content-Transfer-Encoding: 7bit Content-Type: text/html; charset=us-ascii --Apple-Mail=_71E41DD1-5C0F-4675-867B-695F70073DCF-- --Apple-Mail=_D407993E-4BE7-4429-A935-F9E9621150FB-- ------------=_1746872642-11747-1--