emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nathaniel Nicandro <nathanielnicandro@gmail.com>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: [PATCH] Handle block-type when checking `org-src-fontify-natively'
Date: Thu, 06 Apr 2023 10:04:55 -0500	[thread overview]
Message-ID: <87zg7lghzz.fsf@gmail.com> (raw)

[-- 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

             reply	other threads:[~2023-04-06 15:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-06 15:04 Nathaniel Nicandro [this message]
2023-04-07 10:13 ` [PATCH] Handle block-type when checking `org-src-fontify-natively' Ihor Radchenko
2024-02-23 13:13 ` Ihor Radchenko
2024-02-24 17:48   ` Nathaniel Nicandro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zg7lghzz.fsf@gmail.com \
    --to=nathanielnicandro@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).