emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* 27.0.91; Avoid error on org-html-fontify-code
@ 2020-06-01 15:33 pierre.techoueyres
  2020-06-05  4:33 ` Kyle Meyer
  0 siblings, 1 reply; 4+ messages in thread
From: pierre.techoueyres @ 2020-06-01 15:33 UTC (permalink / raw)
  To: emacs-orgmode

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


Hello Org's developpers,

Some time ago I tried to export in html form an org file containing many
src blocks and ended with the following message :

org-html-do-format-code: Buffer is read-only: #<killed buffer>

After narrowing down my file here are the steps to reproduce :

emacs -q
(require 'htmlize) ;; this is important else `org-html-fontify-code`
                   ;; will keep the wrong branch

;; open the ecm-org-src-ro.org ([1])
;; try to export as html

I've also attached a patch ([2]) to fix this.

I've also opened the bug 41641 with the sames informations.

Pierre

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ecm-org-src-ro --]
[-- Type: text/x-org, Size: 1155 bytes --]

#+title: ECM - src block read-only

   #+begin_src compilation
-*- mode: compilation; default-directory: "~/Travail/VCS/Emacs/emacs-org-mode/" -*-
Compilation started at Fri May 29 20:05:37

make -k targets 

Getting Help
============
make help           - show brief help
make targets        - ditto
make helpall        - show extended help

Build and Check
===============
make                - build Org ELisp and all documentation
make all            - ditto
make compile        - build Org ELisp files
make single         - build Org ELisp files, single Emacs per source
make autoloads      - create org-loaddefs.el to load Org in-place
make test           - build Org ELisp files and run test suite
make vanilla        - run Emacs with this Org-mode and no personal config
make config         - check main configuration
make doc            - build all documentation
make info           - build Info documentation

Installation
============
make install        - build and install Org

Full documentation on Worg
==========================
https://orgmode.org/worg/dev/org-build-system.html


Compilation finished at Fri May 29 20:05:37
   #+end_src

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0001-ox-html.el-Fix-read-only-error-when-export-src-bloc.patch --]
[-- Type: text/x-patch, Size: 1075 bytes --]

From c292c6bc638b6ae94bfe1fa8636b819b1d655d0c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pierre=20T=C3=A9choueyres?= <pierre.techoueyres@free.fr>
Date: Mon, 1 Jun 2020 12:30:04 +0200
Subject: [PATCH] ox-html.el: Fix read-only error when export src bloc

When the type of src block involve an read-only buffer (ex:
compilation mode) avoid to setup the temp buffer as read-only and
error when processing it

* lisp/ox-html.el (org-html-fontify-code): set `inhibit-read-only' to
avoid read-only temp buffer.
---
 lisp/ox-html.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index fe0a315c9..32996c2c2 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -2156,7 +2156,8 @@ org-html-fontify-code
 	  ;; htmlize
 	  (setq code
 		(let ((output-type org-html-htmlize-output-type)
-		      (font-prefix org-html-htmlize-font-prefix))
+		      (font-prefix org-html-htmlize-font-prefix)
+		      (inhibit-read-only t))
 		  (with-temp-buffer
 		    ;; Switch to language-specific mode.
 		    (funcall lang-mode)
-- 
2.26.2


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

end of thread, other threads:[~2020-06-07 16:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-01 15:33 27.0.91; Avoid error on org-html-fontify-code pierre.techoueyres
2020-06-05  4:33 ` Kyle Meyer
2020-06-05 21:04   ` pierre.techoueyres
2020-06-07 16:55     ` Kyle Meyer

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