From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id sHaEBGQQK2SIewEASxT56A (envelope-from ) for ; Mon, 03 Apr 2023 19:44:04 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id 4Et7A2QQK2SAqQAAG6o9tA (envelope-from ) for ; Mon, 03 Apr 2023 19:44:04 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 57E4112E0E for ; Mon, 3 Apr 2023 19:44:03 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pjOD3-0006Fr-C5; Mon, 03 Apr 2023 13:43:13 -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 1pjOCz-00068K-Pc for Emacs-orgmode@gnu.org; Mon, 03 Apr 2023 13:43:09 -0400 Received: from mail-qt1-x82c.google.com ([2607:f8b0:4864:20::82c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pjOCx-0005tV-9m for Emacs-orgmode@gnu.org; Mon, 03 Apr 2023 13:43:09 -0400 Received: by mail-qt1-x82c.google.com with SMTP id t19so29109042qta.12 for ; Mon, 03 Apr 2023 10:43:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chen-becker.org; s=google; t=1680543785; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=o/c9v3Er0EHuQKsNTNUoK1UTeox7X6TRB4DSFPDiIuo=; b=jV7d1PRlmR9sDKzZ3ZMRCyENKEx5aGq8dtJpt1MtDMAhjRrHzlKEvPWjZuXGlkrOj/ lWIEHpkzZ/nrFGPiEz2Rd0jDWZ3zw0MLgTF5dYnjJEy48UjbztGF2Z/iPKJk7IBWGtb4 gnN/P84+Lm0gp5nT/YkhqEVpKmo/ftVmsTmcPYdvLi0Am6b2qmTLXqV4/Nb3vGgMwzkQ X9tA25VpCD4LCMCxfuAQQu0iU+fa/u3QswJVPUV7tA8dnEwt62z7UfGax4ndqAa7cVpH 59zz39rWOBuyxKQac1Nsdmkt0De5lwmQLswsVsLXJBIjAOfrA93LSjB14vimwz+X475G NScg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680543785; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=o/c9v3Er0EHuQKsNTNUoK1UTeox7X6TRB4DSFPDiIuo=; b=OCkbVj15sdRoEhuOZ2wao0sire3mMM/VXNn6HVoKAsH+J08KTmxd9OCjStzDx96Wf3 MBb2HSEVlFgvoiiDDNl7+DL+wfmm+/Jpd9ot4xu0gaxQVbvc6WrqmW7uGfbW7HNPb7Ln wyeNQbmXgvCB2viTwl2LUwWuHZ1Ws2fSha1IGfBCu94uqOlde25IotcLT6Cd1T1WZ3iw ZesuLoOMIXXBmXHPdsETbE5StmhHkDLLB9wQX1muX0kh5NjWAKDn9uI4KGgSZYVaaC0S A02IBS3WNxt09GW8CTeRt4Sdc9OiExniLLwJj+oDs3KjxaHKEtiLmlC2n53RMo77qIJ6 YWEw== X-Gm-Message-State: AO0yUKVxX0Wz21wLydNPX98BJ4mnZTPxQpyfL+FGdN7uoXhigsWrJtCR xsPGpM/IvCyCsnuCVZiQIJbsszz806QxTaokL3iA2lbhku8UUSTsV9w= X-Google-Smtp-Source: AK7set8SiuyDOrOlGlPPx0YHBdkXyR5gGnMg9oEAmOwOZGhJhNOMpuINGHbzp9g4Yf9n2n+aczs0xrVYt0eXr+T+y0E= X-Received: by 2002:ac8:5744:0:b0:3d2:8d87:6710 with SMTP id 4-20020ac85744000000b003d28d876710mr12683853qtx.12.1680543785189; Mon, 03 Apr 2023 10:43:05 -0700 (PDT) MIME-Version: 1.0 References: <1872a35eeec.dcff8bea422796.5356383202108217532@excalamus.com> <87pm8rx5lb.fsf@localhost> <1872f04dea1.12a910409155047.1986659191838711991@excalamus.com> <87jzyyehwr.fsf@localhost> <1873f20a792.fcfc6bcd54095.5358297633673942037@excalamus.com> In-Reply-To: <1873f20a792.fcfc6bcd54095.5358297633673942037@excalamus.com> From: Derek Chen-Becker Date: Mon, 3 Apr 2023 11:42:54 -0600 Message-ID: Subject: Re: [BUG] No font lock in src blocks for shells in org-babel-shell-names (was Re: Font lock for org-babel shell scripts?) To: Matt Cc: Ihor Radchenko , Emacs-orgmode Content-Type: multipart/alternative; boundary="00000000000058a6ab05f8721725" Received-SPF: pass client-ip=2607:f8b0:4864:20::82c; envelope-from=derek@chen-becker.org; helo=mail-qt1-x82c.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, HTML_MESSAGE=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-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1680543843; a=rsa-sha256; cv=none; b=PfFwYbXFceFObWjGwQe2D2t/cIewZlTGnf12Ahm6sq/w5EEi9pnLEy+IopXJV2lvYz5lgS zbKCS7kaTVvLWRsIuRAiyOz8ETSD9U9xvCJrlEXZ3GpMR+ZJM09cXXSgbS2FFhPP+95ewA bPoWxCXI8mAmsZPIe/H11n37vhIKSF1U1/rXv9WdJ7HH45FG1yLklK0pIdkPdfPCFa5by6 /JZ2Vh9CiFAtPyVYJMDKxuAdDj4C8VHJmp2mYXaTNK4OdD5lScwGNslr4Vy4qbbbXmLinD xKV5nWPFWGgmrXgHX/MgZdZO390jeXUTLQPGIWXXTv8T6logzGdm8W6KnfqYww== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=chen-becker.org header.s=google header.b=jV7d1PRl; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1680543843; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=o/c9v3Er0EHuQKsNTNUoK1UTeox7X6TRB4DSFPDiIuo=; b=dVb0KBTeH9xcRbQEINXnEGlLac/48U87JpSHtf5BVIgS2ROj9nzjKPtDUj4N3GDfYb8VAa Dg3jheEWPzhDYMQGkIUTc7ig0YtsPBlYKNk/4W6yvZXyjzyuCmYRMgzdlQT++cYr/3F5rA +rLxXKiMYm5JrGSpjbAxFUrrM3o5q6M0+fWfvCbAyCrDMxJC4VIrURqaCzzhvi6Wrv4zKO i5xx2Hz87gXA+ryX5/to0hR423/kW73XC7VbpwF/j8p25rLIBAEFRg3UhZ9hwcGy+3mCwQ onq9JEcdLWmsyjys70epTmAMUWmHYCuPTe/qx9GCZQc/4mpdDrDLnoOwhexMrQ== X-Migadu-Spam-Score: -5.45 X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=chen-becker.org header.s=google header.b=jV7d1PRl; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Spam-Score: -5.45 X-Migadu-Queue-Id: 57E4112E0E X-TUID: oNnmizK1xvzQ --00000000000058a6ab05f8721725 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I fiddled around a little bit this weekend and confirmed that this (sloppy) code makes highlighting work for all shell types that sh-script supports: ;;A quick hack to try and support more shells syntax highlight in org babel (require 'sh-script) (require 'ob-shell) (let ((shells (seq-filter (lambda (shell) (not (eq shell 'sh))) (flatten-tree sh-ancestor-alist)))) (let ((toAppend (mapcar (lambda (shell) `(,(symbol-name shell) . sh)) shells))) (setq org-src-lang-modes (-distinct (append toAppend org-src-lang-modes))))) I'm a relative newcomer to elisp, so comments and suggestions are welcome. This is basically what I meant by "dynamically amend org-src-lang-modes based on the contents of sh-ancestor-alist". Thanks, Derek On Sat, Apr 1, 2023 at 5:22=E2=80=AFPM Matt wrote: > > ---- On Thu, 30 Mar 2023 04:55:32 -0400 Ihor Radchenko wrote --- > > Matt matt@excalamus.com> writes: > > > > > I think this approach will work fine. I tried examples for each > shell type and keywords like if/then/else and function names are > highlighted. > > > > Even for posh (powershell)? > > Yes. It's not great since sh-mode looks for Korn-based keywords. It doe= s > string highlighting and common keywords like 'if', 'exit', and 'param'. > > --=20 +---------------------------------------------------------------+ | Derek Chen-Becker | | GPG Key available at https://keybase.io/dchenbecker and | | https://pgp.mit.edu/pks/lookup?search=3Dderek%40chen-becker.org | | Fngrprnt: EB8A 6480 F0A3 C8EB C1E7 7F42 AFC5 AFEE 96E4 6ACC | +---------------------------------------------------------------+ --00000000000058a6ab05f8721725 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I fiddled around a little bit this week= end and confirmed that this (sloppy) code makes highlighting work for all s= hell types that sh-script supports:

;;A quick hack to try and support more shells syntax highligh= t in org babel
(require 'sh-script)
(require 'ob-shell)
(l= et ((shells (seq-filter (lambda (shell) (not (eq shell 'sh))) (flatten-= tree sh-ancestor-alist))))
=C2=A0 (let ((toAppend (mapcar (lambda (shell= ) `(,(symbol-name shell) . sh)) shells)))
=C2=A0 =C2=A0 (setq org-src-la= ng-modes (-distinct (append toAppend org-src-lang-modes)))))

I'm a relative newcomer to elisp= , so comments and suggestions are welcome. This is basically what I meant b= y "dynamically amend org-src-lang-modes based on the contents of sh-an= cestor-alist".

Th= anks,

Derek
=

= On Sat, Apr 1, 2023 at 5:22=E2=80=AFPM Matt <matt@excalamus.com> wrote:

=C2=A0---- On Thu, 30 Mar 2023 04:55:32 -0400=C2=A0 Ihor Radchenko=C2=A0 wr= ote ---
=C2=A0> Matt mat= t@excalamus.com> writes:
=C2=A0>
=C2=A0> > I think this approach will work fine.=C2=A0 =C2=A0I tried e= xamples for each shell type and keywords like if/then/else and function nam= es are highlighted.
=C2=A0>
=C2=A0> Even for posh (powershell)?

Yes.=C2=A0 It's not great since sh-mode looks for Korn-based keywords.= =C2=A0 It does string highlighting and common keywords like 'if', &= #39;exit', and 'param'.



--
+-------= --------------------------------------------------------+
= | Derek Chen-Becker=C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|<= /div>
| GPG Key availab= le at https://keybase.io/dchenbecker= and=C2=A0 =C2=A0 =C2=A0 = =C2=A0|
| Fngrprnt: EB8= A 6480 F0A3 C8EB C1E7=C2=A0 7F42 AFC5 AFEE 96E4 6ACC=C2=A0 |
+-----------------------------------= ----------------------------+

=
--00000000000058a6ab05f8721725--