emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Handle block-type when checking `org-src-fontify-natively'
@ 2023-04-06 15:04 Nathaniel Nicandro
  2023-04-07 10:13 ` Ihor Radchenko
  2024-02-23 13:13 ` Ihor Radchenko
  0 siblings, 2 replies; 4+ messages in thread
From: Nathaniel Nicandro @ 2023-04-06 15:04 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 325 bytes --]


Hello,

I think I found a bug where the condition for `org-src-fontify-natively`
in `org-src-fontify-meta-lines-and-blocks-1` wasn't handling the block
type.  `org-src-fontify-natively` says it should fontify src blocks
only, but the condition didn't have that constraint.  Attached is a
patch that adds in the constraint.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-patch, Size: 1157 bytes --]

From 2f1342ad5b13f75387f6a26f0c68aac054903bcc Mon Sep 17 00:00:00 2001
From: Nathaniel Nicandro <nathanielnicandro@gmail.com>
Date: Thu, 6 Apr 2023 08:49:20 -0500
Subject: [PATCH] Handle block-type when checking `org-src-fontify-natively`

* lisp/org.el (org-fontify-meta-lines-and-blocks-1): Only fontify
  natively for blocks of src type.
---
 lisp/org.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index a6b8a30..d6c5803 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5414,8 +5414,9 @@ (defun org-fontify-meta-lines-and-blocks-1 (limit)
 	     beg end-of-endline '(font-lock-fontified t font-lock-multiline t))
 	    (org-remove-flyspell-overlays-in beg bol-after-beginline)
 	    (org-remove-flyspell-overlays-in nl-before-endline end-of-endline)
-	    (cond
-	     (org-src-fontify-natively
+            (cond
+	     ((and org-src-fontify-natively
+                   (string= block-type "src"))
 	      (save-match-data
                 (org-src-font-lock-fontify-block (or lang "") block-start block-end))
 	      (add-text-properties bol-after-beginline block-end '(src-block t)))
-- 
2.39.1


[-- Attachment #3: Type: text/plain, Size: 15 bytes --]


-- 
Nathaniel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-02-24 17:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-06 15:04 [PATCH] Handle block-type when checking `org-src-fontify-natively' Nathaniel Nicandro
2023-04-07 10:13 ` Ihor Radchenko
2024-02-23 13:13 ` Ihor Radchenko
2024-02-24 17:48   ` Nathaniel Nicandro

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).