emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Benjamin McMillan <mcmillanbb@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] export blocks no longer fontifying [9.7.10 (release_9.7.10 @ /Users/ben/Scripts/emacs/lisp/org/)]
Date: Tue, 17 Sep 2024 21:29:58 +0900	[thread overview]
Message-ID: <CALo8A5WFU2htoHQvzOej7Qip3+7Jor4GpA4p-=G1EfeeOB+yYw@mail.gmail.com> (raw)
In-Reply-To: <CALo8A5VGSk-gnnm2Ug-zc02wNkZgs1PH2uwfAM368nzf0+kvEA@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2939 bytes --]

I attach the patch here.

However, I have two questions.
First, I am not certain that I set up the repository correctly, because
when I run "make test" it generates 55 unexpected failures. This without
making any changes.
(The patch submitted here does not generate any new failures.)

Second, the existing comment at the patch becomes slightly out of date with
the change.
In fact, I propose that it might be good to update the docstring for
`org-src-fontify-natively' to explicitly state that it enable fontification
for src, example, and export blocks.
If that is agreed on, I am happy to submit a further patch.
Thanks,
Ben

On Mon, Sep 16, 2024 at 11:27 PM Benjamin McMillan <mcmillanbb@gmail.com>
wrote:

> Ok, I am happy to submit a patch. It would be my first, so I will have to
> find time to make the commit properly.
>
> On Wed, Sep 11, 2024 at 1:59 AM Ihor Radchenko <yantar92@posteo.net>
> wrote:
>
>> Benjamin McMillan <mcmillanbb@gmail.com> writes:
>>
>> > At some point in the last few months, org mode stopped fontifying my
>> > latex export blocks. However, an older version of emacs on my computer
>> > still does fontify.
>> > (The difference is seen even opening emacs with the -q flag)
>> > It seems that there was a change to the function
>> > org-fontify-meta-lines-and-blocks-1 in org.el, specifically at the
>> > conditional that checks org-src-fontify-natively.
>> > As the comment there explains, the intention is to only fontify src
>> > blocks, but I don't see any option exposed to enable fontififcation of
>> > export blocks, which is a fairly crucial feature to my workflow.
>> >
>> > I think fontification of export blocks should follow that of src blocks,
>> > or a separate option should be made. (Or, I may be missing some already
>> > existing solution!)
>> >
>> > For what it is worth, I can get the desired behavior by modifying the
>> > code mentioned above to include "export", as in the following:
>> > (and org-src-fontify-natively
>> >     ;; Technically, according to
>> >     ;; `org-src-fontify-natively' docstring, we should
>> >     ;; only fontify src blocks.  However, it is common
>> >     ;; to use undocumented fontification of example
>> >     ;; blocks with undocumented language specifier.
>> >     ;; Keep this undocumented feature for user
>> >     ;; convenience.
>> >     (member block-type '("src" "example" "export")))
>>
>> Since we already do it for example blocks, I see not why we should not
>> for export blocks.
>>
>> Would you be interested to submit a patch with your modification?
>> See https://orgmode.org/worg/org-contribute.html#first-patch
>>
>> --
>> Ihor Radchenko // yantar92,
>> Org mode contributor,
>> Learn more about Org mode at <https://orgmode.org/>.
>> Support Org development at <https://liberapay.com/org-mode>,
>> or support my work at <https://liberapay.com/yantar92>
>>
>

[-- Attachment #1.2: Type: text/html, Size: 4223 bytes --]

[-- Attachment #2: 0001-lisp-org.el-Change-native-fontification-to-include-e.patch --]
[-- Type: application/octet-stream, Size: 1107 bytes --]

From 2e543eb4393b01a640c2b1d66de55a744be75bca Mon Sep 17 00:00:00 2001
From: Benjamin McMillan <mcmillanbb@gmail.com>
Date: Tue, 17 Sep 2024 21:05:07 +0900
Subject: [PATCH] lisp/org.el: Change native fontification to include export
 blocks

lisp/org.el (org-fontify-meta-lines-and-blocks-1): Add "export" to
list of block types that are fontified if org-src-fontify-natively
is non-nil.

TINYCHANGE
---
 lisp/org.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index d5c1dcb35..156e1716f 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5497,7 +5497,7 @@ by a #."
                    ;; blocks with undocumented language specifier.
                    ;; Keep this undocumented feature for user
                    ;; convenience.
-                   (member block-type '("src" "example")))
+                   (member block-type '("src" "example" "export")))
 	      (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.46.0


  reply	other threads:[~2024-09-17 12:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-01  4:35 [BUG] export blocks no longer fontifying [9.7.10 (release_9.7.10 @ /Users/ben/Scripts/emacs/lisp/org/)] Benjamin McMillan
2024-09-10 17:01 ` Ihor Radchenko
2024-09-16 14:27   ` Benjamin McMillan
2024-09-17 12:29     ` Benjamin McMillan [this message]
2024-09-17 18:44       ` Ihor Radchenko
     [not found]         ` <CALo8A5Vm-gik0qQC7KacNg7kN2VzL0Y1e8_LXxV8S7-we9CYSw@mail.gmail.com>
2024-09-22  9:53           ` Ihor Radchenko
2024-09-23 13:17             ` Benjamin McMillan
2024-11-03 18:00               ` Ihor Radchenko
2024-11-04 12:58                 ` Benjamin McMillan
2024-11-04 20:13                   ` Ihor Radchenko
2024-11-05  1:00                     ` Benjamin McMillan

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='CALo8A5WFU2htoHQvzOej7Qip3+7Jor4GpA4p-=G1EfeeOB+yYw@mail.gmail.com' \
    --to=mcmillanbb@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@posteo.net \
    /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).