emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: pierre.techoueyres@gmail.com
To: emacs-orgmode@gnu.org
Subject: 27.0.91; Avoid error on org-html-fontify-code
Date: Mon, 01 Jun 2020 17:33:54 +0200	[thread overview]
Message-ID: <87eeqyyf4t.fsf@killashandra.ballybran.fr> (raw)

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


             reply	other threads:[~2020-06-01 15:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-01 15:33 pierre.techoueyres [this message]
2020-06-05  4:33 ` 27.0.91; Avoid error on org-html-fontify-code Kyle Meyer
2020-06-05 21:04   ` pierre.techoueyres
2020-06-07 16:55     ` Kyle Meyer

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=87eeqyyf4t.fsf@killashandra.ballybran.fr \
    --to=pierre.techoueyres@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).