* Re: emacs-29 80e1037df44: Add string-interpolation feature to bash-ts-mode
[not found] ` <20230305221901.A8D70C13A82@vcs2.savannah.gnu.org>
@ 2023-03-05 22:24 ` Dmitry Gutov
2023-03-05 22:45 ` Yuan Fu
2023-03-27 21:23 ` Kévin Le Gouguec
1 sibling, 1 reply; 3+ messages in thread
From: Dmitry Gutov @ 2023-03-05 22:24 UTC (permalink / raw)
To: emacs-devel, Yuan Fu
Hi!
On 06/03/2023 00:19, Yuan Fu wrote:
> + (string (expansion (variable_name) @font-lock-variable-name-face)))
I think that should be font-lock-variable-use-face.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: emacs-29 80e1037df44: Add string-interpolation feature to bash-ts-mode
2023-03-05 22:24 ` emacs-29 80e1037df44: Add string-interpolation feature to bash-ts-mode Dmitry Gutov
@ 2023-03-05 22:45 ` Yuan Fu
0 siblings, 0 replies; 3+ messages in thread
From: Yuan Fu @ 2023-03-05 22:45 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: emacs-devel
> On Mar 5, 2023, at 2:24 PM, Dmitry Gutov <dgutov@yandex.ru> wrote:
>
> Hi!
>
> On 06/03/2023 00:19, Yuan Fu wrote:
>> + (string (expansion (variable_name) @font-lock-variable-name-face)))
>
> I think that should be font-lock-variable-use-face.
Oh! Sorry, fixed it.
Yuan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: emacs-29 80e1037df44: Add string-interpolation feature to bash-ts-mode
[not found] ` <20230305221901.A8D70C13A82@vcs2.savannah.gnu.org>
2023-03-05 22:24 ` emacs-29 80e1037df44: Add string-interpolation feature to bash-ts-mode Dmitry Gutov
@ 2023-03-27 21:23 ` Kévin Le Gouguec
1 sibling, 0 replies; 3+ messages in thread
From: Kévin Le Gouguec @ 2023-03-27 21:23 UTC (permalink / raw)
To: emacs-devel; +Cc: Yuan Fu
Hey Yuan,
Yuan Fu <casouri@gmail.com> writes:
> branch: emacs-29
> commit 80e1037df44c0b4607423d744a8b9b409a15efce
> Author: Yuan Fu <casouri@gmail.com>
> Commit: Yuan Fu <casouri@gmail.com>
>
> Add string-interpolation feature to bash-ts-mode
>
> * lisp/progmodes/sh-script.el:
> (bash-ts-mode): Add string-interpolation feature.
> (sh-mode--treesit-settings): Add rule for string-interpolation feature.
Prior to that commit, I rather liked how bash-ts-mode handled command
substitutions; specifically, how syntactic elements (commands, "quoted
words", ${variables}) were fontified just as well inside `backticks` or
$(parens) as outside.
(See for example some `echo $stuff | sed -e 'morestuff'` pipelines we
have in autogen.sh)
AFAICT I can get that back with something like…
(mapc (lambda (l) (delq 'string-interpolation l))
treesit-font-lock-feature-list)
(treesit-font-lock-recompute-features)
… but I wonder if there might be a way to have my cake and eat it too?
E.g. theming sh-quoted-exec to something more subtle (like a faint
background), I've tried replacing :override t in the hunk below with
:override 'append, but that does not seem to be enough to get all the
syntax elements back; only "quoted words" seem to return.
I know that the current implementation more or less has feature parity
with sh-mode's bash dialect (it's actually an improvement, because it
handles $(nested $(command) substitutions) better); still, wondering if
(1) what I have in mind sounds achievable (2) there is appetite for it.
> ---
> lisp/progmodes/sh-script.el | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
> index 4c06efc8146..29820049636 100644
> --- a/lisp/progmodes/sh-script.el
> +++ b/lisp/progmodes/sh-script.el
> @@ -1619,7 +1619,8 @@ not written in Bash or sh."
> (setq-local treesit-font-lock-feature-list
> '(( comment function)
> ( command declaration-command keyword string)
> - ( builtin-variable constant heredoc number variable)
> + ( builtin-variable constant heredoc number
> + string-interpolation variable)
> ( bracket delimiter misc-punctuation operator)))
> (setq-local treesit-font-lock-settings
> sh-mode--treesit-settings)
> @@ -3289,6 +3290,12 @@ See `sh-mode--treesit-other-keywords' and
> :language 'bash
> '([(string) (raw_string)] @font-lock-string-face)
>
> + :feature 'string-interpolation
> + :language 'bash
> + :override t
> + '((command_substitution) @sh-quoted-exec
> + (string (expansion (variable_name) @font-lock-variable-name-face)))
> +
> :feature 'heredoc
> :language 'bash
> '([(heredoc_start) (heredoc_body)] @sh-heredoc)
(Sorry for coming late to the party, I know this dates from
<83bklacluc.fsf@gnu.org>, but I wanted to find the time to tinker a bit
before badgering you)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-03-27 21:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <167805474137.21125.5136297838241493606@vcs2.savannah.gnu.org>
[not found] ` <20230305221901.A8D70C13A82@vcs2.savannah.gnu.org>
2023-03-05 22:24 ` emacs-29 80e1037df44: Add string-interpolation feature to bash-ts-mode Dmitry Gutov
2023-03-05 22:45 ` Yuan Fu
2023-03-27 21:23 ` Kévin Le Gouguec
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).