unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#41641: 27.0.91; Avoid error on org-html-fontify-code
@ 2020-06-01 10:41 Pierre Téchoueyres
  2020-06-01 11:10 ` bug#41641: Status: " Pierre Téchoueyres
  0 siblings, 1 reply; 2+ messages in thread
From: Pierre Téchoueyres @ 2020-06-01 10:41 UTC (permalink / raw)
  To: 41641; +Cc: emacs-orgmode

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


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

[-- Attachment #2: ECM export read-only src blocks --]
[-- Type: text/plain, 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

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

;; try to export as html

I've also attached is a patch to fix this.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0001-ox-html.el-Fix-read-only-error-when-export-src-bloc --]
[-- 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


[-- Attachment #5: Type: text/plain, Size: 8 bytes --]


Pierre

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

end of thread, other threads:[~2020-06-01 11:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-01 10:41 bug#41641: 27.0.91; Avoid error on org-html-fontify-code Pierre Téchoueyres
2020-06-01 11:10 ` bug#41641: Status: " Pierre Téchoueyres

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

	https://git.savannah.gnu.org/cgit/emacs.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).