From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id qGYMK7ck1V6rXgAA0tVLHw (envelope-from ) for ; Mon, 01 Jun 2020 15:54:31 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 0G3/Jrck1V5lIgAAB5/wlQ (envelope-from ) for ; Mon, 01 Jun 2020 15:54:31 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 4493A940CBD for ; Mon, 1 Jun 2020 15:54:31 +0000 (UTC) Received: from localhost ([::1]:57030 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jfmli-0002TN-7Z for larch@yhetil.org; Mon, 01 Jun 2020 11:54:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45814) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfmRt-0005FN-CH for emacs-orgmode@gnu.org; Mon, 01 Jun 2020 11:34:01 -0400 Received: from smtp5-g21.free.fr ([212.27.42.5]:1586) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfmRq-0001zz-SK for emacs-orgmode@gnu.org; Mon, 01 Jun 2020 11:34:00 -0400 Received: from killashandra.ballybran.fr.free.fr (unknown [IPv6:2a01:e0a:1e2:f8b0:6e3d:5f8:9612:9a5e]) by smtp5-g21.free.fr (Postfix) with ESMTPS id EF93E60000 for ; Mon, 1 Jun 2020 17:33:55 +0200 (CEST) User-agent: mu4e 1.5.1; emacs 27.0.91 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 Message-ID: <87eeqyyf4t.fsf@killashandra.ballybran.fr> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: softfail client-ip=212.27.42.5; envelope-from=pierre.techoueyres@gmail.com; helo=smtp5-g21.free.fr X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/01 11:33:56 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: 7 X-Spam_score: 0.7 X-Spam_bar: / X-Spam_report: (0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FREEMAIL_FROM=0.001, NML_ADSP_CUSTOM_MED=0.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_SOFTFAIL=0.665, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Mailman-Approved-At: Mon, 01 Jun 2020 11:53:39 -0400 X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -0.91 X-TUID: 0JLcHxUlbYxI --=-=-= Content-Type: text/plain 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: # 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 --=-=-= Content-Type: text/x-org Content-Disposition: attachment; filename=ecm-org-src-ro.org Content-Description: ecm-org-src-ro #+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 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-ox-html.el-Fix-read-only-error-when-export-src-bloc.patch Content-Description: 0001-ox-html.el-Fix-read-only-error-when-export-src-bloc.patch >From c292c6bc638b6ae94bfe1fa8636b819b1d655d0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20T=C3=A9choueyres?= 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 --=-=-=--