GNU bug report logs - #78567
[PATCH] 31.0.50; bash-ts-mode: brackets not highlighted correctly in shell-expansion expressions

Previous Next

Package: emacs;

Reported by: Jostein Kjønigsen <jostein <at> secure.kjonigsen.net>

Date: Fri, 23 May 2025 19:24:02 UTC

Severity: normal

Tags: patch

Done: Yuan Fu <casouri <at> gmail.com>

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Yuan Fu <casouri <at> gmail.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#78567: closed ([PATCH] 31.0.50; bash-ts-mode: brackets not
 highlighted correctly in shell-expansion expressions)
Date: Wed, 04 Jun 2025 07:11:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Wed, 4 Jun 2025 00:10:33 -0700
with message-id <9FC5B2CA-419B-454B-A7D5-89C4EFA97A0A <at> gmail.com>
and subject line Re: bug#78567: Acknowledgement ([PATCH] 31.0.50; bash-ts-mode: brackets not highlighted correctly in shell-expansion expressions)
has caused the debbugs.gnu.org bug report #78567,
regarding [PATCH] 31.0.50; bash-ts-mode: brackets not highlighted correctly in shell-expansion expressions
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
78567: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=78567
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Jostein Kjønigsen <jostein <at> secure.kjonigsen.net>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] 31.0.50; bash-ts-mode: brackets not highlighted correctly in
 shell-expansion expressions
Date: Fri, 23 May 2025 21:23:01 +0200
[Message part 3 (text/plain, inline)]
Hey everyone.

When using the new bash-ts-mode to edit shell-scripts, simple shell-expansion expressions are fontified using (among other things) sh-quoted-exec face:

Examples below:

echo `test`
echo $(test)

Unfortunately, in both of these cases the enclosing brackets are also fontified using sh-quoted-exec. Not only makes this the shell-expansion expression harder to read, but it also makes the fontification of these brackets inconsistent with all other brackets in bash-ts-mode.

This seems to be due to an overly wide selector used in the tree-sitter rules, which can be easily narrowed without impacting the core function of the rule: highlighting shell-expansions.

Attached is a patch which implements this fix, and makes shell-expansion brackets highlighted consistently.

Cheers!



—
Kind Regards
Jostein Kjønigsen



In GNU Emacs 31.0.50 (build 7, aarch64-apple-darwin24.4.0, NS
 appkit-2575.50 Version 15.4.1 (Build 24E263)) of 2025-05-20 built on
 SOK67R3KWV97
Repository revision: e9bab32bc7229d4260e5870efc54ae4458c6ccc9
Repository branch: master
Windowing system distributor 'Apple', version 10.3.2575
System Description:  macOS 15.5

Configured using:
 'configure --with-tree-sitter --with-native-compilation
 --with-imagemagick --with-harfbuzz'

Configured features:
ACL GLIB GNUTLS IMAGEMAGICK LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIFY
KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TOOLKIT_SCROLL_BARS
TREE_SITTER WEBP XIM ZLIB

Important settings:
  value of $LC_ALL: en_US.UTF-8
  value of $LC_CTYPE: UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Elisp/l

Minor modes in effect:
  bug-reference-prog-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  elisp-slime-nav-mode: t
  paredit-mode: t
  highlight-symbol-mode: t
  flycheck-mode: t
  indent-bars-mode: t
  completion-preview-mode: t
  delete-selection-mode: t
  global-auto-revert-mode: t
  editorconfig-mode: t
  all-the-icons-completion-mode: t
  marginalia-mode: t
  vertico-mode: t
  global-nlinum-mode: t
  nlinum-mode: t
  override-global-mode: t
  server-mode: t
  global-hl-line-mode: t
  pixel-scroll-precision-mode: t
  doom-modeline-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  column-number-mode: t
  line-number-mode: t
  auto-fill-function: do-auto-fill
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  hs-minor-mode: t

Load-path shadows:
/Users/josteink/.emacs.d/elpa/ef-themes-1.9.0/theme-loaddefs hides /Users/josteink/.emacs.d/elpa/modus-themes-20250220.647/theme-loaddefs
/Users/josteink/.emacs.d/elpa/transient-20250301.2218/transient hides /Users/josteink/build/emacs/lisp/transient
/Users/josteink/.emacs.d/elpa/ef-themes-1.9.0/theme-loaddefs hides /Users/josteink/build/emacs/lisp/theme-loaddefs

Features:
(shadow sort mail-extr emacsbug help-fns radix-tree git-rebase pet
let-alist json-ts-mode goto-addr vc-hg vc-bzr vc-src vc-sccs vc-svn
vc-cvs vc-rcs log-view vc bug-reference magit-extras magit-bookmark
magit-submodule magit-blame magit-stash magit-reflog magit-bisect
magit-push magit-pull magit-fetch magit-clone magit-remote magit-commit
magit-sequence magit-notes magit-worktree magit-tag magit-merge
magit-branch magit-reset magit-files magit-refs magit-status magit
magit-repos magit-apply magit-wip magit-log which-func magit-diff
smerge-mode git-commit log-edit pcvs-util add-log magit-core
magit-autorevert magit-margin magit-transient magit-process with-editor
magit-mode benchmark magit-git magit-base magit-section cursor-sensor
crm llama markdown-mode edit-indirect pulse misearch multi-isearch
lisp-mnt elec-pair csharp-mode c-ts-common cc-langs cc-mode cc-fonts
cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
vc-git vc-dispatcher org-duration diary-lib diary-loaddefs cal-iso
disp-table oc-basic ol-eww ol-rmail ol-mhe ol-irc ol-info ol-gnus
nnselect gnus-art mm-uu mml2015 mm-view mml-smime smime gnutls dig
gnus-sum gnus-group gnus-undo gnus-start gnus-dbus dbus gnus-cloud
nnimap nnmail mail-source utf7 nnoo gnus-spec gnus-int gnus-range
message sendmail yank-media rfc822 mml mml-sec epa epg rfc6068
epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047
rfc2045 ietf-drums mailabbrev gmm-utils mailheader gnus-win ol-docview
doc-view jka-compr image-mode exif dired dired-loaddefs ol-bibtex bibtex
ol-bbdb ol-w3m ol-doi org-link-doi org-agenda elisp-slime-nav etags
fileloop paredit highlight-symbol flycheck indent-bars-ts indent-bars
cus-edit cus-start cus-load face-remap color powershell eglot
tree-widget derived external-completion jsonrpc flymake diff ert ewoc
debug backtrace completion-preview hideshow compile eww vtable url-queue
shr pixel-fill kinsoku url-file svg xml puny mm-url gnus nnheader
gnus-util mail-utils range wid-edit mm-util mail-prsvr tramp trampver
tramp-integration tramp-message tramp-compat shell parse-time iso8601
tramp-loaddefs imenu ob-plantuml delsel autorevert filenotify embark-org
org-element org-persist org-id org-refile org-element-ast inline
avl-tree org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro
org-src sh-script smie executable ob-comint org-pcomplete pcomplete
org-list org-footnote org-faces org-entities time-date noutline outline
ob-emacs-lisp ob-core ob-eval org-cycle org-table ol org-fold
org-fold-core org-keys oc org-loaddefs find-func cal-menu calendar
cal-loaddefs org-version org-compat org-macs bicep-ts-mode editorconfig
editorconfig-core editorconfig-core-handle editorconfig-fnmatch
embark-consult consult bookmark text-property-search embark ffap
orderless all-the-icons-completion marginalia vertico nlinum linum
use-package-bind-key bind-key server hl-line pixel-scroll cua-base
all-the-icons all-the-icons-faces data-material data-weathericons
data-octicons data-fileicons data-faicons data-alltheicons doom-modeline
doom-modeline-segments doom-modeline-env doom-modeline-core shrink-path
f s dash nerd-icons nerd-icons-faces nerd-icons-data
nerd-icons-data-mdicon nerd-icons-data-flicon nerd-icons-data-codicon
nerd-icons-data-devicon nerd-icons-data-sucicon nerd-icons-data-wicon
nerd-icons-data-faicon nerd-icons-data-powerline nerd-icons-data-octicon
nerd-icons-data-pomicon nerd-icons-data-ipsicon dracula-theme
use-package-ensure use-package-core finder-inf
all-the-icons-completion-autoloads all-the-icons-autoloads
bicep-ts-mode-autoloads bmx-mode-autoloads cargo-autoloads
cmake-mode-autoloads color-theme-sanityinc-tomorrow-autoloads
combobulate-autoloads combobulate-go combobulate-json combobulate-yaml
combobulate-css combobulate-js-ts combobulate-python combobulate-html
combobulate-toml combobulate-cursor multiple-cursors
mc-separate-operations rectangular-region-mode mc-mark-pop mc-edit-lines
mc-hide-unmatched-lines-mode mc-mark-more sgml-mode facemenu dom
thingatpt mc-cycle-cursors multiple-cursors-core advice comp comp-cstr
cl-extra help-mode warnings comp-run comp-common rect combobulate-query
savehist xref files-x scheme combobulate-ui transient pp format-spec
edmacro kmacro combobulate-display combobulate-ztree
combobulate-envelope combobulate-manipulation python rx project compat
comint ansi-osc ring ansi-color combobulate-procedure
combobulate-navigation combobulate-misc combobulate-setup tempo
combobulate-interface combobulate-settings diff-mode track-changes
easy-mmode treesit generator combobulate-rules company-autoloads
copilot-mode-autoloads crontab-mode-autoloads dap-mode-autoloads
bui-autoloads doom-modeline-autoloads doom-themes-autoloads
dracula-theme-autoloads edit-indirect-autoloads ef-themes-autoloads
elisp-slime-nav-autoloads embark-consult-autoloads consult-autoloads
embark-autoloads expand-region-autoloads flycheck-autoloads
highlight-symbol-autoloads indent-bars-autoloads lsp-docker-autoloads
lsp-treemacs-autoloads lsp-mode-autoloads magit-autoloads pcase
magit-section-autoloads llama-autoloads marginalia-autoloads
markdown-mode-autoloads modus-themes-autoloads
multiple-cursors-autoloads nerd-icons-autoloads nlinum-autoloads
orderless-autoloads paredit-autoloads pet-autoloads poetry-autoloads
powershell-autoloads pyvenv-autoloads shrink-path-autoloads f-autoloads
spinner-autoloads transient-autoloads treemacs-autoloads cfrs-autoloads
posframe-autoloads ht-autoloads hydra-autoloads lv-autoloads
pfuture-autoloads ace-window-autoloads avy-autoloads s-autoloads
dash-autoloads undo-tree-autoloads queue-autoloads vertico-autoloads
wgrep-autoloads info with-editor-autoloads wsd-mode-autoloads
yaml-autoloads package browse-url xdg url url-proxy url-privacy
url-expand url-methods url-history url-cookie generate-lisp-file
url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs icons password-cache json subr-x map byte-opt
gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc iso-transl
tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/ns-win ns-win ucs-normalize
mule-util term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads kqueue cocoa ns lcms2 multi-tty make-network-process
tty-child-frames native-compile emacs)

Memory information:
((conses 16 1279995 196050) (symbols 48 56184 2)
 (strings 32 307557 14688) (string-bytes 1 8465336)
 (vectors 16 106135) (vector-slots 8 2019006 218077)
 (floats 8 2291 3855) (intervals 56 40777 6537) (buffers 1064 68))

[Message part 4 (text/html, inline)]
[0001-sh-script.el-Fix-bracket-fontification-in-command-su.patch (application/octet-stream, attachment)]
[Message part 6 (text/html, inline)]
[Message part 7 (message/rfc822, inline)]
From: Yuan Fu <casouri <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 78567-done <at> debbugs.gnu.org,
 Jostein Kjønigsen <jostein <at> secure.kjonigsen.net>
Subject: Re: bug#78567: Acknowledgement ([PATCH] 31.0.50; bash-ts-mode:
 brackets not highlighted correctly in shell-expansion expressions)
Date: Wed, 4 Jun 2025 00:10:33 -0700

> On Jun 2, 2025, at 5:14 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
>> From: Jostein Kjønigsen <jostein <at> secure.kjonigsen.net>
>> Date: Mon, 2 Jun 2025 11:59:48 +0200
>> Cc: Eli Zaretskii <eliz <at> gnu.org>,
>> Yuan Fu <casouri <at> gmail.com>
>> 
>> Any news on this one?
> 
> Not yet.

Thanks Jostein! I applied it on master. I might miss tree-sitter related bug reports when I’m busy, you can add X-Debbugs-CC: casouri <at> gmail.com <mailto:casouri <at> gmail.com> in your email to make sure I’m always CC’ed [1]. Technically you need to put it in the header, but I found that putting it at the top of the body works too.

[1] https://www.debian.org/Bugs/Reporting

Yuan

This bug report was last modified 11 days ago.

Previous Next


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