emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] export blocks no longer fontifying [9.7.10 (release_9.7.10 @ /Users/ben/Scripts/emacs/lisp/org/)]
@ 2024-09-01  4:35 Benjamin McMillan
  2024-09-10 17:01 ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Benjamin McMillan @ 2024-09-01  4:35 UTC (permalink / raw)
  To: emacs-orgmode

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

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")))

Thanks,
Ben


Emacs  : GNU Emacs 31.0.50 (build 3, aarch64-apple-darwin23.5.0, NS
appkit-2487.60 Version 14.5 (Build 23F79))
 of 2024-08-29
Package: Org mode version 9.7.10 (release_9.7.10 @
/Users/ben/Scripts/emacs/lisp/org/)

current state:
==============
(setq
 org-noter-get-selected-text-hook '(org-noter-djvu--get-selected-text
org-noter-nov--get-selected-text
   org-noter-pdf--get-selected-text)
 org-yank-image-file-name-function 'org-yank-image-autogen-filename
 org-persist-before-write-hook '(org-element--cache-persist-before-write)
 org-noter-doc-split-fraction '(0.6 . 0.5)
 org-html-format-headline-function
'org-html-format-headline-default-function
 org-html-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 org-noter--get-current-view-hook '(org-noter-djvu--get-current-view
org-noter-nov--get-current-view
   org-noter-pdf--get-current-view)
 org-log-into-drawer "LOG"
 org-latex-format-inlinetask-function
'org-latex-format-inlinetask-default-function
 org-M-RET-may-split-line nil
 org-noter--pretty-print-location-for-title-hook
'(org-noter-djvu--pretty-print-location
  org-noter-nov--pretty-print-location
  org-noter-pdf--pretty-print-location-for-title)
 org-babel-tangle-lang-exts '(("python" . "py") ("emacs-lisp" . "el")
("elisp" . "el"))
 org-treat-insert-todo-heading-as-state-change t
 org-noter--get-highlight-location-hook '(org-noter-pdf--get-highlight)
 org-roam-db-node-include-function #[0 "\300\207" [t] 1]
 org-timer-done-hook '(my/org-timer-done-actions)
 org-roam-log-setup-hook '(org-roam--register-completion-functions-h)
 org-speed-command-hook '(org-speed-command-activate
org-babel-speed-command-activate)
 org-export-in-background t
 org-persist-after-read-hook '(org-element--cache-persist-after-read)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-roam-preview-function 'org-roam-preview-default-function
 org-latex-format-headline-function
'org-latex-format-headline-default-function
 org-agenda-window-setup 'current-window
 org-noter--convert-to-location-cons-hook
'(org-noter-pdf--convert-to-location-cons)
 org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"]
 org-blank-before-new-entry '((heading) (plain-list-item))
 org-export-async-init-file "~/.emacs.d/org/export-dispatch-init.el"
 org-mode-hook '(my/org-mode-completion-setup #[nil ((org-bullets-mode 1))
(t)] er/add-org-mode-expansions
#[nil ((add-hook 'change-major-mode-hook 'org-fold-show-all 'append 'local))
  (org--rds reftex-docstruct-symbol org-attach-method
org--single-lines-list-is-paragraph
   org-element-greater-elements org-agenda-restrict-end
org-agenda-restrict-begin
   org-agenda-restrict visual-fill-column-width org-clock-history
org-agenda-current-date
   org-with-time org-defdecode org-def org-read-date-inactive org-ans2
org-ans1
   org-columns-current-fmt-compiled org-clock-current-task org-clock-effort
   org-agenda-skip-function org-agenda-skip-comment-trees
org-agenda-archives-mode
   org-end-time-was-given org-time-was-given org-log-note-extra
org-log-note-purpose
   org-log-post-message org-last-inserted-timestamp
org-last-changed-timestamp
   org-entry-property-inherited-from org-state
org-agenda-headline-snapshot-before-repeat
   org-agenda-buffer-name org-agenda-start-on-weekday
org-agenda-buffer-tmp-name
   org-log-note-marker org-priority-regexp org-mode-abbrev-table
org-element-cache-persistent
   org-element-cache-version org-tbl-menu org-org-menu org-struct-menu
org-entities
   org-last-state org-id-track-globally org-clock-start-time texmathp-why
remember-data-file
   org-agenda-tags-todo-honor-ignore-options calc-embedded-open-mode
calc-embedded-open-formula
   calc-embedded-close-formula align-mode-rules-list org-emphasis-alist
   org-emphasis-regexp-components org-export-registered-backends org-modules
   org-babel-load-languages org-id-overriding-file-name
org-indent-indentation-per-level
   org-element--timestamp-regexp org-element-cache-map-continue-from
   org-element-paragraph-separate org-agenda-buffer-name
org-inlinetask-min-level t)
  ]
#[0 "\300\301\302\303\304$\207"
  [add-hook change-major-mode-hook org-babel-show-result-all append local]
5]
org-babel-result-hide-spec org-babel-hide-all-hashes
#[0 "\301\211 \207" [imenu-create-index-function org-imenu-get-tree] 2])
 org-noter--doc-approx-location-hook '(org-noter-djvu--approx-location-cons
org-noter-nov--approx-location-cons
      org-noter-pdf--approx-location-cons)
 org-noter--pretty-print-highlight-location-hook
'(org-noter-pdf--pretty-print-highlight)
 org-noter-auto-save-last-location t
 org-noter-set-up-document-hook '(org-noter-djvu--setup-handler
org-noter-nov--setup-handler
 org-noter-pdf--doc-view-setup-handler
org-noter-pdf--pdf-view-setup-handler)
 org-capture-templates '(("i" "File to inbox" entry
 (file+olp "~/Projects/getitdone/getitdone.org" "PARA" "PROJECTS"
"PROCESS") "* %?")
("e" "File to emacs issues" entry
 (file+olp "~/.emacs.d/emacs-gtd.org" "Emacs PARA" "PROJECTS" "PROCESS") "*
%?")
("m" "Math note" entry
 (file+olp "~/Projects/getitdone/math-gtd.org" "MATH PARA" "PROJECTS"
"PROCESS") "* %?")
("f" "File to filing cabinet" entry
 (file+olp "~/Projects/getitdone/getitdone.org" "PARA" "PROJECTS" "FILE")
"* %?")
("l" "Local inbox" entry
 (file+headline
  (lambda nil (concat (file-name-directory (buffer-file-name))
".TODO.org")) "Inbox")
 "")
("r" "Research note" entry
 (file+headline (lambda nil (concat (buffer-file-name))) "RESEARCH NOTES")
 "* %?\n:LOG:\nENTRY-DATE: %t\n:END:\n- " :prepend t :jump-to-captured t)
("t" "File to tumble ideas" entry
 (file+olp "~/Projects/getitdone/getitdone.org" "PARA" "AREAS" "tumbles")
"* %?")
)
 org-id-link-consider-parent-id t
 org-confirm-shell-link-function 'yes-or-no-p
 org-export-dispatch-use-expert-ui t
 org-odt-format-headline-function 'org-odt-format-headline-default-function
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-src-window-setup "plain"
 org-noter--show-arrow-hook '(org-noter-pdf--show-arrow)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-occur-hook '(org-first-headline-recenter)
 org-ellipsis " \\/ "
 org-html-format-inlinetask-function
'org-html-format-inlinetask-default-function
 org-roam-node-annotation-function 'org-roam-node-read--annotation
 org-bullets-bullet-list '("○")
 org-confirm-babel-evaluate 'my/org-confirm-babel-evaluate
 org-ascii-format-drawer-function #[771 " \207" [] 4 "\n\n(fn NAME CONTENTS
WIDTH)"]
 org-roam-directory "/Users/ben/own/org-roam"
 org-indent-indentation-per-level 1
 org-roam-db-autosync-mode t
 org-roam-indirect-buffer-hook '(org-roam--register-completion-functions-h)
 org-bibtex-headline-format-function 'org-bibtex-headline-format-default
 org-capture-prepare-finalize-hook '(org-roam-capture--install-finalize-h)
 org-link-parameters '(("eww" :follow org-eww-open :store
org-eww-store-link)
      ("rmail" :follow org-rmail-open :store org-rmail-store-link)
      ("mhe" :follow org-mhe-open :store org-mhe-store-link)
      ("irc" :follow org-irc-visit :store org-irc-store-link :export
org-irc-export)
      ("info" :follow org-info-open :export org-info-export :store
org-info-store-link
:insert-description org-info-description-as-command)
      ("gnus" :follow org-gnus-open :store org-gnus-store-link)
      ("docview" :follow org-docview-open :export org-docview-export :store
org-docview-store-link)
      ("bibtex" :follow org-bibtex-open :store org-bibtex-store-link)
      ("bbdb" :follow org-bbdb-open :export org-bbdb-export :complete
org-bbdb-complete-link
:store org-bbdb-store-link)
      ("w3m" :store org-w3m-store-link)
      ("doi" :follow org-link-doi-open :export org-link-doi-export)
      ("roam" :follow org-roam-link-follow-link)
      ("attachment" :follow org-attach-follow :complete
org-attach-complete-link)
      ("id" :follow org-roam-id-open :store org-id-store-link-maybe)
("file+sys")
      ("file+emacs") ("shell" :follow org-link--open-shell)
      ("news" :follow
#[514 "\301\300\302 Q \"\207" ["news" browse-url ":"] 6 "\n\n(fn URL ARG)"])
      ("mailto" :follow
#[514 "\301\300\302 Q \"\207" ["mailto" browse-url ":"] 6 "\n\n(fn URL
ARG)"])
      ("https" :follow
#[514 "\301\300\302 Q \"\207" ["https" browse-url ":"] 6 "\n\n(fn URL
ARG)"])
      ("http" :follow
#[514 "\301\300\302 Q \"\207" ["http" browse-url ":"] 6 "\n\n(fn URL ARG)"])
      ("ftp" :follow
#[514 "\301\300\302 Q \"\207" ["ftp" browse-url ":"] 6 "\n\n(fn URL ARG)"])
      ("help" :follow org-link--open-help :store org-link--store-help)
      ("file" :complete org-link-complete-file) ("elisp" :follow
org-link--open-elisp))
 org-log-buffer-setup-hook '(org-roam-log--setup)
 org-noter-create-skeleton-functions '(org-noter-djvu--create-skeleton
org-noter-nov--create-skeleton-epub
      org-noter-pdf--create-skeleton)
 org-noter-get-buffer-file-name-hook '(org-noter-nov--get-buffer-file-name
org-noter-pdf--get-buffer-file-name)
 org-cycle-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
 org-todo-keywords '((sequence "TODO(t!)" "|" "SUSP(s@)" "DONE(d!)"))
 org-return-follows-link t
 org-noter--get-containing-element-hook '(org-noter--get-containing-heading
 org-noter--get-containing-property-drawer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-agenda-restore-windows-after-quit t
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
 org-sort-function 'string-collate-lessp
 org--warnings nil
 org-startup-folded t
 org-babel-pre-tangle-hook '(save-buffer)
 org-roam-capture-new-node-hook '(org-roam-capture--insert-captured-ref-h)
 org-highlight-latex-and-related '(latex script entities)
 org-noter--get-precise-info-hook '(org-noter-djvu--get-precise-info
org-noter-nov--get-precise-info
   org-noter-pdf--doc-view-get-precise-info
   org-noter-pdf--pdf-view-get-precise-info)
 org-tags-column -90
 org-export-before-parsing-hook '(org-attach-expand-links)
 org-link-shell-confirm-function 'yes-or-no-p
 org-cycle-emulate-tab nil
 org-fold-core-isearch-open-function 'org-fold--isearch-reveal
 org-yank-adjusted-subtrees t
 org-roam-capture-preface-hook '(org-roam-capture--try-capture-to-ref-h)
 outline-isearch-open-invisible-function 'outline-isearch-open-invisible
 org-noter--doc-goto-location-hook '(org-noter-djvu--goto-location
org-noter-nov--goto-location
    org-noter-pdf--goto-location)
 org-src-mode-hook '(perject--auto-add-buffer
org-src-babel-configure-edit-buffer
    org-src-mode-configure-edit-buffer)
 org-roam-find-file-hook '(org-roam-buffer--setup-redisplay-h
org-roam--register-completion-functions-h
  org-roam--replace-roam-links-on-save-h
org-roam-db-autosync--setup-update-on-save-h)
 org-babel-load-languages '((emacs-lisp . t) (python . t) (gnuplot \.t))
 org-roam-ref-annotation-function 'org-roam-ref-read--annotation
 org-agenda-loop-over-headlines-in-active-region nil
 org-agenda-files '("~/Areas/reading/.TODO.org" "~/Areas/reading/
read_log.org" "~/Areas/talks/Stacks/.TODO.org"
   "~/.emacs.d/.TODO.org" "~/.emacs.d/emacs-gtd.org"
"~/.emacs.d/emacs-gtd.org_archive"
   "~/Projects/235embeddingsPaper/sagecalcs/.TODO.org"
   "~/Projects/235embeddingsPaper/.TODO.org"
"~/Projects/235embeddingsPaper/.TODO.org_archive"
   "~/Projects/235embeddingsPaper/embeddings.org"
"~/Projects/235embeddingsPaper/paper.org"
   "~/Projects/HessianMetrics/sagecalcs/.TODO.org"
"~/Projects/HessianMetrics/.TODO.org"
   "~/Projects/HessianMetrics/hessianmetrics.org"
"~/Projects/distributionmaps/.TODO.org"
   "~/Projects/distributionmaps/distributionmaps.org"
"~/Projects/foliations/Ben/.TODO.org"
   "~/Projects/foliations/Ben/singularfolia.org"
"~/Projects/getitdone/.TODO.org"
   "~/Projects/getitdone/KoreanTaxes.org" "~/Projects/getitdone/
filingcabinet.org"
   "~/Projects/getitdone/getitdone.org"
"~/Projects/getitdone/getitdone.org_archive"
   "~/Projects/getitdone/math-gtd.org" "~/Projects/glenelg/.TODO.org"
   "~/Projects/glenelg/glenelg.org" "~/Projects/lecturenotes/.TODO.org"
   "~/Projects/lecturenotes/notes.org" "~/Projects/miscmath/unfullblown.org"
   "~/Projects/pdemoduli/.TODO.org" "~/Projects/pdemoduli/pdemoduli.org"
   "~/Projects/singularities/.TODO.org")
 org-babel-python-command "python3"
 org-noter-create-session-from-document-hook
'(org-noter--create-session-from-document-file-default)
 org-link-elisp-confirm-function 'yes-or-no-p
 org-noter--add-highlight-hook '(org-noter-pdf--highlight-location)
 org-startup-indented t
 org-odt-format-inlinetask-function
'org-odt-format-inlinetask-default-function
 org-src-lang-modes '(("latex" . LaTeX) ("C" . c) ("C++" . c++)
("asymptote" . asy) ("beamer" . latex)
     ("calc" . fundamental) ("cpp" . c++) ("ditaa" . artist) ("desktop" .
conf-desktop)
     ("dot" . fundamental) ("elisp" . emacs-lisp) ("ocaml" . tuareg)
("screen" . shell-script)
     ("sqlite" . sql) ("toml" . conf-toml) ("shell" . sh) ("ash" . sh)
("sh" . sh)
     ("bash" . sh) ("jsh" . sh) ("bash2" . sh) ("dash" . sh) ("dtksh" . sh)
("ksh" . sh)
     ("es" . sh) ("rc" . sh) ("itcsh" . sh) ("tcsh" . sh) ("jcsh" . sh)
("csh" . sh)
     ("ksh88" . sh) ("oash" . sh) ("pdksh" . sh) ("mksh" . sh) ("posix" .
sh) ("wksh" . sh)
     ("wsh" . sh) ("zsh" . sh) ("rpm" . sh))
 org-cycle-hook '(org-cycle-hide-archived-subtrees
org-cycle-show-empty-lines
 org-cycle-optimize-window-after-visibility-change
org-cycle-display-inline-images)
 org-persist-before-read-hook '(org-element--cache-persist-before-read)
 org-noter--pretty-print-location-hook
'(org-noter-djvu--pretty-print-location
org-noter-nov--pretty-print-location
org-noter-pdf--pretty-print-location)
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 org-id-link-to-org-use-id 'create-if-interactive
 org-agenda-skip-archived-trees nil
 )

[-- Attachment #2: Type: text/html, Size: 19608 bytes --]

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

* Re: [BUG] export blocks no longer fontifying [9.7.10 (release_9.7.10 @ /Users/ben/Scripts/emacs/lisp/org/)]
  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
  0 siblings, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2024-09-10 17:01 UTC (permalink / raw)
  To: Benjamin McMillan; +Cc: emacs-orgmode

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>


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

* Re: [BUG] export blocks no longer fontifying [9.7.10 (release_9.7.10 @ /Users/ben/Scripts/emacs/lisp/org/)]
  2024-09-10 17:01 ` Ihor Radchenko
@ 2024-09-16 14:27   ` Benjamin McMillan
  2024-09-17 12:29     ` Benjamin McMillan
  0 siblings, 1 reply; 5+ messages in thread
From: Benjamin McMillan @ 2024-09-16 14:27 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

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

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 #2: Type: text/html, Size: 3077 bytes --]

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

* Re: [BUG] export blocks no longer fontifying [9.7.10 (release_9.7.10 @ /Users/ben/Scripts/emacs/lisp/org/)]
  2024-09-16 14:27   ` Benjamin McMillan
@ 2024-09-17 12:29     ` Benjamin McMillan
  2024-09-17 18:44       ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Benjamin McMillan @ 2024-09-17 12:29 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode


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


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

* Re: [BUG] export blocks no longer fontifying [9.7.10 (release_9.7.10 @ /Users/ben/Scripts/emacs/lisp/org/)]
  2024-09-17 12:29     ` Benjamin McMillan
@ 2024-09-17 18:44       ` Ihor Radchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Ihor Radchenko @ 2024-09-17 18:44 UTC (permalink / raw)
  To: Benjamin McMillan; +Cc: emacs-orgmode

Benjamin McMillan <mcmillanbb@gmail.com> writes:

> I attach the patch here.

Thanks!

> 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.)

That's odd. May you share the log?

> Second, the existing comment at the patch becomes slightly out of date with
> the change.

Then, may you please update the comment?

Also, may you change the commit message to not sound like it is a new
feature? Just explain the purpose of the change as you did in this
email thread (but shorter, and then add a link to this thread).

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

I'd rather not document this in `org-src-fontify-natively'. The name of
this variable does not really hint that it has anything to do with
export or example blocks.

We may eventually rename it to something more generic, but example
blocks may need to be re-considered because specifying language of the
example block is not even a part of Org syntax. So, generalizing and
documenting this is a bit tricky.

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


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

end of thread, other threads:[~2024-09-17 18:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2024-09-17 18:44       ` Ihor Radchenko

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).