From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id mC+SIxxx72MEagEAbAwnHQ (envelope-from ) for ; Fri, 17 Feb 2023 13:20:44 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id +GlcIxxx72PLngAAauVa8A (envelope-from ) for ; Fri, 17 Feb 2023 13:20:44 +0100 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 26FA8150C0 for ; Fri, 17 Feb 2023 13:20:43 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b="jcAM/hlU"; 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"; dmarc=pass (policy=none) header.from=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1676636444; a=rsa-sha256; cv=none; b=K3gTN+vr/O/L2jjamM2SIu/gM6k4psdYT5MD0Ed+zGMtD5dQZgKF6Qi9ZK3RHjgBxjo4Vm wHS3w7jYaUbCgjulvWIHvWlB5A5EqOGJx+nHuUFNVeJkVSw3w48YYAxVkjHPubxdadsgOT xHDhFv2Ixm8zDN7n/aHdBROqnzST0P6KdzmGfx8P3lFe64RE/aeMwu/t67n7QyoSRuOlw2 6d2pnWCEyTHOXn1cXgPn682gixcFBLMOkmhBPAwEnWAGi1ZlImNZIpXjRtg71d9N72Wu6V UeWooBELhQpz55AiYSEDvFoY+HPezkPAZR8GKh4rsmNTVfQx4xOE38zMFhvylQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b="jcAM/hlU"; 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"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1676636444; 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=GzmvhBBeZAnl874recQoZnqj0hMhdJr6um53A8Py0pI=; b=k17SVuLR/gKEhR3HmmP8/aM3NoWOy8s4gujSTQc6ebkjGQNv/ub7rOm7rTPkUQzdExXyOI /Ew9uPphH5GEc4i/p1A0ng7bypjBbMEQcUvTfFLWzdwHvxuLKp/rEHoA5VEZzGSnv1Z9G7 vtmArO7N6JHXv/pPOZZVqTubqiioN8A8kaUlvAG/vv8+cQR3qiEiy5h8KK7QY5XSWL+G4f 9De7RitVC9zVWNpj3X689I09BMup7KzjQdUniurYqiW7aJUvs42fhbXe1/fw+a0QTx1Evu rgi3aQmVWaEqqOKKKdm7KjLQYDaJOzC8FNcerczp8c6cKCGAj3St7Zu4zxOrTg== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSziP-00037K-4h; Fri, 17 Feb 2023 07:19:49 -0500 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 1pSziL-000373-4n for emacs-orgmode@gnu.org; Fri, 17 Feb 2023 07:19:45 -0500 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 1pSziI-00008Q-Um for emacs-orgmode@gnu.org; Fri, 17 Feb 2023 07:19:44 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 360B72401DA for ; Fri, 17 Feb 2023 13:19:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1676636381; bh=WFGdv+sQhoMDJ2R1SAUNBZA2mfsUbWNAQ9x1BsW7ySY=; h=From:To:Cc:Subject:Date:From; b=jcAM/hlUwiG6CVuV1Afhfyk7vdj6+iQGuS99K56jDHcEenpdUudTm2SaAeibUg/q8 jVjABtCLgalY4wEx8URJTLaWIJdOrsU/XWJ6ZRqaX3Fo0UsciuieOapH5DaE3xDn1J eXsI2jADlyJwJw2oLdwIGX7RKMZDHAKnMGH5OPNu63yCBDMWEWvbcYlPKvE634Aa6Q 7QniKavy5r6rnkLnDlHBnBJWhoXus5ZixQn92h7I592Gj03gxdaXCXgJ5UGKCS00Cw EMLSD74mDPxUg4tyLI5tQvFstyBx8jUoIpcL3GZrgNLFd/vd7qvGXSHLeOuqaVUIvf 8qtAamuRi14Kg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4PJ9qJ0s6Hz9rxB; Fri, 17 Feb 2023 13:19:39 +0100 (CET) From: Ihor Radchenko To: carsten@kragelund.me Cc: emacs-orgmode@gnu.org Subject: [PATCH] [FR] Fontifying src-blocks with no language specified In-Reply-To: <99388ff3711696091f0312a5c3f0bcbd@kragelund.me> References: <99388ff3711696091f0312a5c3f0bcbd@kragelund.me> Date: Fri, 17 Feb 2023 12:20:18 +0000 Message-ID: <87pma8bi0t.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, 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: X-Migadu-Queue-Id: 26FA8150C0 X-Spam-Score: -7.41 X-Migadu-Spam-Score: -7.41 X-Migadu-Scanner: scn0.migadu.com 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-Flow: FLOW_IN X-Migadu-Country: US X-TUID: AdGutmDDorgF --=-=-= Content-Type: text/plain carsten@kragelund.me writes: > Fontifying src-blocks with a missing language would allow being able to > theme src-blocks without having the unthemed text of languages fallback > to whatever color the src-blocks are set to. > I envision this could be done with an empty string in > org-src-block-faces. I do not see much problem adding this. See the attached patch. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-org-fontify-meta-lines-and-blocks-1-Fontify-src-bloc.patch >From 9c9fa52b934390b9b07648fdf3a31c4baebac551 Mon Sep 17 00:00:00 2001 Message-Id: <9c9fa52b934390b9b07648fdf3a31c4baebac551.1676636352.git.yantar92@posteo.net> From: Ihor Radchenko Date: Fri, 17 Feb 2023 15:17:04 +0300 Subject: [PATCH] org-fontify-meta-lines-and-blocks-1: Fontify src blocks without lang * lisp/org.el (org-fontify-meta-lines-and-blocks-1): Allow fontifying src blocks with language specification missing. * lisp/org-src.el (org-src-block-faces): Clarify in the docstring that "" language name referes to src blocks with no language. Remove redundant :version tag. * etc/ORG-NEWS (~org-src-block-faces~ now accepts empty string ~""~ as language name): Announce the change. Link: https://orgmode.org/list/99388ff3711696091f0312a5c3f0bcbd@kragelund.me --- etc/ORG-NEWS | 15 +++++++++++++++ lisp/org-src.el | 4 ++-- lisp/org.el | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 87ecd77cd..5ab8d62c7 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -24,6 +24,21 @@ consider [[https://gitlab.com/jackkamm/ob-python-mode-mode][ob-python-mode-mode] has been ported to. ** New and changed options +*** ~org-src-block-faces~ now accepts empty string ~""~ as language name + +It is now possible to customize face of source blocks without language specifier. + +: #+begin_src +: Source block with no language +: #+end_src + +For example, to set ~highlight~ face, use + +#+begin_src emacs-lisp +(setq org-src-fontify-natively t) +(add-to-list 'org-src-block-faces '(("" highlight)) +#+end_src + *** New escape in ~org-beamer-environments-extra~ for labels in Beamer export The escape =%l= in ~org-beamer-environments-extra~ inserts the label obtained from ~org-beamer--get-label~. This is added to the default diff --git a/lisp/org-src.el b/lisp/org-src.el index 9e4392811..2fab4020d 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -233,7 +233,8 @@ (defcustom org-src-block-faces nil (\"language\" FACE) -Where FACE is either a defined face or an anonymous face. +Where FACE is either a defined face or an anonymous face. Empty +language string refers to source blocks without specified language. For instance, the following would color the background of emacs-lisp source blocks and python source blocks in purple and @@ -247,7 +248,6 @@ (defcustom org-src-block-faces nil (choice (face :tag "Face") (sexp :tag "Anonymous face")))) - :version "26.1" :package-version '(Org . "9.0")) (defcustom org-src-tab-acts-natively t diff --git a/lisp/org.el b/lisp/org.el index 4d12084d9..777626dce 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5409,7 +5409,7 @@ (defun org-fontify-meta-lines-and-blocks-1 (limit) (org-remove-flyspell-overlays-in beg bol-after-beginline) (org-remove-flyspell-overlays-in nl-before-endline end-of-endline) (cond - ((and lang (not (string= lang "")) org-src-fontify-natively) + (org-src-fontify-natively (save-match-data (org-src-font-lock-fontify-block lang block-start block-end)) (add-text-properties bol-after-beginline block-end '(src-block t))) -- 2.39.1 --=-=-= 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 --=-=-=--