From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Pierre =?UTF-8?Q?T=C3=A9choueyres?= Newsgroups: gmane.emacs.bugs,gmane.emacs.orgmode Subject: bug#41641: 27.0.91; Avoid error on org-html-fontify-code Date: Mon, 01 Jun 2020 12:41:41 +0200 Message-ID: <87h7vye49a.fsf@killashandra.ballybran.fr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="21174"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.5.1; emacs 27.0.91 Cc: emacs-orgmode@gnu.org To: 41641@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jun 01 12:42:11 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jfhtT-0005Ta-J9 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 01 Jun 2020 12:42:11 +0200 Original-Received: from localhost ([::1]:45834 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jfhtS-0005cQ-Ke for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 01 Jun 2020 06:42:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38792) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfhtK-0005cB-SF for bug-gnu-emacs@gnu.org; Mon, 01 Jun 2020 06:42:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51290) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jfhtK-0004jn-H3 for bug-gnu-emacs@gnu.org; Mon, 01 Jun 2020 06:42:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jfhtK-0006fH-FS for bug-gnu-emacs@gnu.org; Mon, 01 Jun 2020 06:42:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Pierre =?UTF-8?Q?T=C3=A9choueyres?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 01 Jun 2020 10:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 41641 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.159100811125598 (code B ref -1); Mon, 01 Jun 2020 10:42:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 Jun 2020 10:41:51 +0000 Original-Received: from localhost ([127.0.0.1]:34603 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jfht8-0006en-Jk for submit@debbugs.gnu.org; Mon, 01 Jun 2020 06:41:50 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:48146) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jfht6-0006ef-U6 for submit@debbugs.gnu.org; Mon, 01 Jun 2020 06:41:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38780) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfht6-0005bI-Il; Mon, 01 Jun 2020 06:41:48 -0400 Original-Received: from smtp5-g21.free.fr ([2a01:e0c:1:1599::14]:23884) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfht5-0004iY-8i; Mon, 01 Jun 2020 06:41:48 -0400 Original-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 D66725FF95; Mon, 1 Jun 2020 12:41:41 +0200 (CEST) Received-SPF: none client-ip=2a01:e0c:1:1599::14; envelope-from=pierre.techoueyres@free.fr; helo=smtp5-g21.free.fr X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:181330 gmane.emacs.orgmode:129648 Archived-At: --=-=-= Content-Type: text/plain 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 --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=ecm-org-src-ro.org Content-Description: ECM export read-only src blocks #+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/plain ;; try to export as html I've also attached is a patch to fix this. --=-=-= 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 >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 --=-=-= Content-Type: text/plain Pierre --=-=-=--