From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= Newsgroups: gmane.emacs.devel Subject: Re: emacs-29 80e1037df44: Add string-interpolation feature to bash-ts-mode Date: Mon, 27 Mar 2023 23:23:36 +0200 Message-ID: <87tty5zy5j.fsf@gmail.com> References: <167805474137.21125.5136297838241493606@vcs2.savannah.gnu.org> <20230305221901.A8D70C13A82@vcs2.savannah.gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15543"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Yuan Fu To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Mar 27 23:24:21 2023 Return-path: Envelope-to: ged-emacs-devel@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 1pguKD-0003pj-Jw for ged-emacs-devel@m.gmane-mx.org; Mon, 27 Mar 2023 23:24:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pguJa-0004SG-J1; Mon, 27 Mar 2023 17:23:42 -0400 Original-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 1pguJZ-0004Rz-9F for emacs-devel@gnu.org; Mon, 27 Mar 2023 17:23:41 -0400 Original-Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pguJX-0001q7-FZ for emacs-devel@gnu.org; Mon, 27 Mar 2023 17:23:41 -0400 Original-Received: by mail-wm1-x32a.google.com with SMTP id u11-20020a05600c19cb00b003edcc414997so6184800wmq.3 for ; Mon, 27 Mar 2023 14:23:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679952217; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=82i9mbm4A9yYqUgNoeEncBY38yCw/HIMNRV21EMLtg8=; b=qS7xvoR/wgKjCzyykFqeIK39gzdASdOzrT1ZgFXkLR6KlUDyDsoqKTy3e9PDim3DPZ oesdZXU4RxfUidlD/h/824h0+CtmSLh55vlavoCsOawMX6p0Rwr3bpxEvp66Me0eZsew KdlXJPf4BUQAeBcRpax+puUP5+v+yhyObixJo6LWmjIdMszHlsLaL2LZVTXX96vShreL 6By3Oe8+SO2x9JzlPjwwgdVUZY4yJcwtyOd7Ys9QKMduPpao/F5odVi85X8fdypbtXpW qO4uJC0pUO4G8aCirKpa6f9e86B9ZptksKzUEmzQ7JFrGNn91XRrVGxCgTMuTRGbLJJ8 6lKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679952217; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=82i9mbm4A9yYqUgNoeEncBY38yCw/HIMNRV21EMLtg8=; b=IYIxxR6X0prAylGJoWbtKWynTum5OdJA8T6QGCSd9scYcCe8DLi2wv0O6n9gewoEOm liH1JgXxpzwKlLZMKJoUXJKNzd/vIrcbTMtasI0XDbUXFWVxV3bB48moxaNo7SsXS+KW Oanmtpu74cbmdXJpOjTJULPt/nJ4wdE4igx94llQMrP6/NShOBB9JfBvte2axEyBZ670 J71aQqueFnV/ZLzf1IGt3YKHmZ3r9wuCx0MTD4S6CppNrvaJA10Y3xyPD6V0E6TIaQwJ UrrQHCFgIdZfkV6u5JHbpmeBCBhvjinRP7TyBJAm0mMQHOfdyZcc8h6AbaMob1Xlv6ts Y0bg== X-Gm-Message-State: AO0yUKUoA+I4JZ/7ozBSe2e1mSQu0CpABM7AAJmztQjmMtHNgXkkKFLd q4v5pN0unDoYPZWgKk/JPjOOup4/6g4= X-Google-Smtp-Source: AK7set8QCjMiYyR+58eNUH+12c96sGvXOc3kOQF7voSyriqDkJ4ZKtwiSwUC5VGZ13B1Ng7pmuMxLA== X-Received: by 2002:a05:600c:3653:b0:3ed:c84c:7efe with SMTP id y19-20020a05600c365300b003edc84c7efemr10338396wmq.7.1679952217463; Mon, 27 Mar 2023 14:23:37 -0700 (PDT) Original-Received: from amdahl30 ([2a01:e0a:253:fe0:2ef0:5dff:fed2:7b49]) by smtp.gmail.com with ESMTPSA id q25-20020a1ce919000000b003ee58e8c971sm14790647wmc.14.2023.03.27.14.23.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 14:23:36 -0700 (PDT) In-Reply-To: <20230305221901.A8D70C13A82@vcs2.savannah.gnu.org> (Yuan Fu's message of "Sun, 5 Mar 2023 17:19:01 -0500 (EST)") Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=kevin.legouguec@gmail.com; helo=mail-wm1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:304792 Archived-At: Hey Yuan, Yuan Fu writes: > branch: emacs-29 > commit 80e1037df44c0b4607423d744a8b9b409a15efce > Author: Yuan Fu > Commit: Yuan Fu > > Add string-interpolation feature to bash-ts-mode >=20=20=20=20=20 > * lisp/progmodes/sh-script.el: > (bash-ts-mode): Add string-interpolation feature. > (sh-mode--treesit-settings): Add rule for string-interpolation featur= e. 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=E2=80=A6 (mapc (lambda (l) (delq 'string-interpolation l)) treesit-font-lock-feature-list) (treesit-font-lock-recompute-features) =E2=80=A6 but I wonder if there might be a way to have my cake and eat it t= oo? 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) >=20=20 > + :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)