From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.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 YO3kDngYLGSTxQAASxT56A (envelope-from ) for ; Tue, 04 Apr 2023 14:30:48 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id OILwDngYLGTwQAAA9RJhRA (envelope-from ) for ; Tue, 04 Apr 2023 14:30:48 +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 C09FC16077 for ; Tue, 4 Apr 2023 14:30:47 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pjfng-0001on-Gu; Tue, 04 Apr 2023 08:30:12 -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 1pjfne-0001nO-CV for Emacs-orgmode@gnu.org; Tue, 04 Apr 2023 08:30:10 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pjfnc-0003XY-1r for Emacs-orgmode@gnu.org; Tue, 04 Apr 2023 08:30:10 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id BA7C42405A5 for ; Tue, 4 Apr 2023 14:30:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1680611405; bh=gW0ReYc0gi3otOj+7Qhgn/s7b76w5PdSt1ASdPXIWvQ=; h=From:To:Cc:Subject:Date:From; b=lY9bpy+7CsdFzTynve2NhBrXenPeQTeA0zUHcrYuDz6S3r/o9L8ekIa7lCnRRP2hy l2HkzigbsqJPfwF3rwGRp43OhIJfIzepz9ie9BoJK24hjwYUCZFsWSI5TBpYbQMD7V F1OZqPat277ow8l4dP0kfY2lfE5tjDU/cpvcHsWM4iwc3X6HUg6OMMmLsbHXUQ+pNI DBkFV/NZT0FfzpURsU1qHWX28fcTnBUj4GuokJpAqdI1e1qg/7IIT56R232zZrSXRc grIxmDb5lxOLk4PjCSx4bbdOitcriLAzQiuS6HGFR7asyrm/mVYEHWXDj0+uW578ke XwYmfh9b46QOw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4PrRt50NrRz6tvq; Tue, 4 Apr 2023 14:30:04 +0200 (CEST) From: Ihor Radchenko To: Derek Chen-Becker Cc: Matt , Emacs-orgmode 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?) In-Reply-To: References: <1872a35eeec.dcff8bea422796.5356383202108217532@excalamus.com> <87pm8rx5lb.fsf@localhost> <1872f04dea1.12a910409155047.1986659191838711991@excalamus.com> <87jzyyehwr.fsf@localhost> <1873f20a792.fcfc6bcd54095.5358297633673942037@excalamus.com> Date: Tue, 04 Apr 2023 12:32:27 +0000 Message-ID: <87sfdfakv8.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, 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=1680611448; a=rsa-sha256; cv=none; b=sNeLxNjvwiIpnzrJyKSpbLgXxIdhk0ZX5ciyCCmYoYV3pD0MqMk/kmsjD4yewdpToUNyRg hbU2ggg0gILX5X/pMg1TLoxr9lSKUec37ZByIDNgEv/ojbYS02NPUaoMzubh6t9OsHUapd f8zp/Duv9nDBe+1sv90EL7CQW9keUB3oZF8XC2ar58yRyalenAxFOMGRNRkc5wX6ipILCc rT5x+PnYXJZ9TjuQTIFQuvubqQfgIV93ms082zRXpI3vzHgd49lMup4G2upTEM/mK2+hBT Q6cFOtn5rm0ajn+O0Ch7zLMoW33PtgsTA1xMTSNAsBjan9qoCUChjH4usdKnEg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=lY9bpy+7; dmarc=pass (policy=none) header.from=posteo.net; 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=1680611448; 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=kVtGbVA9WqmZ36eG7VQE+4qKr1u1v+uVdEq+UwIv3cM=; b=IRF5HihnZqqqCLJvURkjGyJx3E6McBK0UOaZO45q0fT40vFAxBvEO6Fd6pQp58gvsCT7hV KMaDhKqtI4/+F/h8rdrZ9vxkWj/YNlLTDdlxwpH4R1Gcii9y3KTpPOLc6cdrBv+gjRQPP5 MlLKIns8kH4qCWUoXMG1HdsQjSEZt59Mwt6+U4Enoz+5Yk6MydzYyn89oa0XYrwqbWNavh EBMfM8FtqtsFi/D/yRQIMNGC6Wxtrz3nv2d/fYKmxwYPTcjY3bphPxGrGY8p9oXh8teJIX +wp1Uuhgw4jGyexPL2ZLnm0QNRZhkEhDIkMjEONMZweX02asHDBhSKYMj3+Vaw== Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=lY9bpy+7; dmarc=pass (policy=none) header.from=posteo.net; 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-Migadu-Scanner: scn0.migadu.com X-Migadu-Spam-Score: -9.71 X-Spam-Score: -9.71 X-Migadu-Queue-Id: C09FC16077 X-TUID: Wu6D2Uayc2Pr --=-=-= Content-Type: text/plain Derek Chen-Becker writes: > 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)))) See the attached tentative patch. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-org-src-Use-sh-mode-for-all-the-shells-it-can-handle.patch >From 85e268de9435d94eb6766e3f92f4f56a9dc1aebe Mon Sep 17 00:00:00 2001 Message-Id: <85e268de9435d94eb6766e3f92f4f56a9dc1aebe.1680611510.git.yantar92@posteo.net> From: Ihor Radchenko Date: Tue, 4 Apr 2023 14:30:34 +0200 Subject: [PATCH] org-src: Use `sh-mode' for all the shells it can handle * lisp/org-src.el (org-src--get-known-shells): New helper function extracting known shells from `sh-ancestor-alist'. (org-src-lang-modes): Update the value. Link: https://orgmode.org/list/CAMbmz5ntkOHMiZG4EbNAks9ob-0ahnciCfHQ9LQmJoci0+i7fg@mail.gmail.com --- lisp/org-src.el | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lisp/org-src.el b/lisp/org-src.el index ec2716885..2669b1b77 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -194,11 +194,17 @@ (defvar org-src-mode-hook nil or similar things which you want to have when editing a source code file, but which mess up the display of a snippet in Org exported files.") +(defun org-src--get-known-shells () + "List all the shells in `sh-ancestor-alist' for `org-src-lang-modes'. +The shells are associated with `sh-mode'." + (mapcar + (lambda (shell) (cons (symbol-name shell) 'sh)) + (delete-dups (flatten-tree sh-ancestor-alist)))) + (defcustom org-src-lang-modes - '(("C" . c) + `(("C" . c) ("C++" . c++) ("asymptote" . asy) - ("bash" . sh) ("beamer" . latex) ("calc" . fundamental) ("cpp" . c++) @@ -208,9 +214,10 @@ (defcustom org-src-lang-modes ("elisp" . emacs-lisp) ("ocaml" . tuareg) ("screen" . shell-script) - ("shell" . sh) ("sqlite" . sql) - ("toml" . conf-toml)) + ("toml" . conf-toml) + ("shell" . sh) + ,@(org-src--get-known-shells)) "Alist mapping languages to their major mode. The key is the language name. The value is the mode name, as @@ -221,7 +228,7 @@ (defcustom org-src-lang-modes the user side. For example, there is no `ocaml-mode' in Emacs, but the mode to use is `tuareg-mode'." :group 'org-edit-structure - :package-version '(Org . "9.6") + :package-version '(Org . "9.7") :type '(repeat (cons (string "Language name") -- 2.40.0 --=-=-= Content-Type: text/plain -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at --=-=-=--