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 uFUEICit8GNnVgAAbAwnHQ (envelope-from ) for ; Sat, 18 Feb 2023 11:49:12 +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 yFXMHyit8GOSHQAAauVa8A (envelope-from ) for ; Sat, 18 Feb 2023 11:49:12 +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 3866BBB60 for ; Sat, 18 Feb 2023 11:49:12 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pTKla-0006qD-KB; Sat, 18 Feb 2023 05:48:34 -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 1pTKlN-0006nl-9g for emacs-orgmode@gnu.org; Sat, 18 Feb 2023 05:48:22 -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 1pTKlK-0000rR-QH for emacs-orgmode@gnu.org; Sat, 18 Feb 2023 05:48:16 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id CB96A2402CC for ; Sat, 18 Feb 2023 11:48:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1676717292; bh=HO3zp3k9WH9Ws/O/M/4nQXQTB9AxCInzLz+MBAYVVxg=; h=From:To:Cc:Subject:Date:From; b=Im6vOjVlOKNDtCS34WTC7yw89wAT2mjUjAGkhdPNYY1UDvdw/PmkVDZsKypZo+0Qt TM2QDfQ9Y9JAWao8pmVWlOoJBZ1y41eivbAAEFEZI4z6VuA6yIq53TfgH6qE7Q7UAK sZnZe4SPQTakaDfv4dELSJNNI1WqvSfEnC0NHMPUi6Q2JeaUbLObpmcuC7zFartPI2 fGomF8TPCDP95LRq4ML7CKbTJK0R5606Bhi6NJfMATlSc2onBtZA56w4qgVr9GU/xy qZrPbBo0tH5gNUrnqlKSSfswxQnQumSjUR9eQadVRXCj06ABXXKKYcgpJWlktKol2e u1SFJbIqqaqUg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4PJllH6Zgvz6tnL; Sat, 18 Feb 2023 11:48:11 +0100 (CET) From: Ihor Radchenko To: carsten@kragelund.me Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] [FR] Fontifying src-blocks with no language specified In-Reply-To: <2882a71eb58514858769117689e0875b@kragelund.me> References: <99388ff3711696091f0312a5c3f0bcbd@kragelund.me> <87pma8bi0t.fsf@localhost> <2882a71eb58514858769117689e0875b@kragelund.me> Date: Sat, 18 Feb 2023 10:48:48 +0000 Message-ID: <87fsb3l04v.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: 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-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1676717352; 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=+K3nZj6wDah2a4vd9377fWJISvIT6C5G+oHknEJqRe4=; b=ZGqISD3yD02rFsIyyYKoTv3CpljffsozOzckQoMbJmkHOptlqzieB7AAPc7jGHOdwoPOyh MNTZAYnZp8NJQ2QsSHndwRea3ZjRS+oEDZfmk+bs66yykSaRivdciMKFONBQ/lhdEPA3N+ suACLi/fOvqA9i8z7Q4GHUwscv36MIyfDDdKeM+hoEqpN2w6H1uoyBYZseLNuzN2sJKSdQ CG+EUQxLqDv+hcfhWEF9tcyKFQjtIWo+ox+92sQBRcAuigRfo2uAibWC65WTDZp7GUUb+C eBEL5uxDSgC+ReqUuFoup567iBqmp7oBVnfgx0HqxC+oRUVY6wtNbojjfulSzg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Im6vOjVl; 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-Seal: i=1; s=key1; d=yhetil.org; t=1676717352; a=rsa-sha256; cv=none; b=Clju2OrmEeuKopUcl8/6b71xXs/GN4UFxLEObYEP7IDFrwlUFH5zxUjm1GzAZcMsEpFVlE g/zIzMdhYzHOzj6Ib8rcVo67a8xknduSBki6FfDGC/I4Bt37sjP+yxMfsxNWHndDIZ4R6Z PbrvWykFh2u1VMgIq8H4w74VB1vRP3l/q5oIevjO5aGe6NaHj3VNOoHGp6CfkVW5bNxOE1 HC2KcUQCgz4Ywa7uxpHcFEgFBHe7YM5vMHlKEI+b/mE8z1ES1i7RChNBHDw/0omsVbeRxq Usk9gCLrEFsu7CTRX66ZMZ3py6wauI2BMAW1zX53NCVGWJ3DgzI88P6UlnZWag== Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Im6vOjVl; 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: scn1.migadu.com X-Spam-Score: -4.61 X-Migadu-Queue-Id: 3866BBB60 X-Migadu-Spam-Score: -4.61 X-TUID: 9wJglimPdXEr --=-=-= Content-Type: text/plain carsten@kragelund.me writes: >> I do not see much problem adding this. >> See the attached patch. > > Hey, this patch works great, minor issue, I believe > the line (add-to-list 'org-src-block-faces '(("" highlight)) > in ORG-NEWS has an extra opening parenthesis and should > be (add-to-list 'org-src-block-faces '("" highlight)) Indeed. Attaching an updated version of the patch. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=v2-0001-org-fontify-meta-lines-and-blocks-1-Fontify-src-b.patch >From 392a075bb2a75fe16e275745c80d83e7c13fc91d Mon Sep 17 00:00:00 2001 Message-Id: <392a075bb2a75fe16e275745c80d83e7c13fc91d.1676717280.git.yantar92@posteo.net> From: Ihor Radchenko Date: Fri, 17 Feb 2023 15:17:04 +0300 Subject: [PATCH v2] 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 | 4 ++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 87ecd77cd..90663ab5a 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 cc2c09e3a..d148a14bb 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5409,9 +5409,9 @@ (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)) + (org-src-font-lock-fontify-block (or lang "") block-start block-end)) (add-text-properties bol-after-beginline block-end '(src-block t))) (quoting (add-text-properties -- 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 --=-=-=--