From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: bug#22399: org-mode fontification Date: Mon, 18 Jan 2016 19:48:17 +0100 Message-ID: <87bn8i7mha.fsf@gmx.us> References: <87oacjng36.fsf@russet.org.uk> <87ziw36khb.fsf@gmx.us> <87a8o2zrtm.fsf@russet.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49147) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLErU-0005sJ-8t for emacs-orgmode@gnu.org; Mon, 18 Jan 2016 13:49:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLErT-0004Nk-3z for emacs-orgmode@gnu.org; Mon, 18 Jan 2016 13:49:08 -0500 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87a8o2zrtm.fsf@russet.org.uk> (Phillip Lord's message of "Mon, 18 Jan 2016 18:05:25 +0000") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: phillip.lord@russet.org.uk Cc: 22399@debbugs.gnu.org phillip.lord@russet.org.uk (Phillip Lord) writes: > Rasmus writes: > >> Hi Phillip, >> >> Thanks for your report. >> >> phillip.lord@russet.org.uk (Phillip Lord) writes: >> >>> On emacs-25 ox-html, line 1847, org-html-fontify-code does this... >>> >>> (setq code (with-temp-buffer >>> ;; Switch to language-specific mode. >>> (funcall lang-mode) >>> (insert code) >>> ;; Fontify buffer. >>> (org-font-lock-ensure) >>> >>> >>> But `org-font-lock-ensure' is defined like so.... >>> >>> (defalias 'org-font-lock-ensure >>> (if (fboundp 'org-font-lock-ensure) >>> #'font-lock-ensure >>> (lambda (_beg _end) (font-lock-fontify-buffer)))) >>> >>> >>> which takes two args, causing crashes when exporting to code to HTML. >> >> This is fixed in the most recent stable version of Org, i.e. 8.3.3=EF=BB= =BF=C2=B9 , >> which, I guess, will be part of if Emacs 25.2 or 26.1 (whichever comes >> first and allow new features). It=E2=80=99s also fixed in 8.2.10=EF=BB= =BF=C2=B2. I guess >> Emacs-25 should switch v8.2.10. [Honestly, when v8.3 couldn=E2=80=99t b= e merged I >> did not cross my mind to upgrade to v8.2.10]. In case v8.2.10 it too >> radical, a "local fix" must be applied to the version of Org in emacs.gi= t. > > > Well, the fix on emacs-25 appears to be trivial i.e. > > (org-font-lock-ensure (point-min) (point-max)) > > But I don't know what the protocol is for org-mode as it's upstream. > AFAICT, this is a regression from emacs-24.5, so it would be a shame if > the bug gets into 25.1. Sorry, I managed to confuse myself before. Emacs-25 has Org 8.2.10, but this bug only lives in the core version. Isn=E2=80=99t a better fix to change the signature of the alias to mirror t= hat of font-lock-ensure? I.e. (defalias 'org-font-lock-ensure (if (fboundp 'org-font-lock-ensure) #'font-lock-ensure (lambda (&optional _beg _end) (font-lock-fontify-buffer)))) Since (org-font-lock-ensure) is called from many places. Note, this change only lives it the Emacs version of Org. It was added in this commit: 6711a21f1125c0047c56eb266eb374c1ec90a967 Author: Stefan Monnier AuthorDate: Wed May 28 23:45:29 2014 -0400 * lisp/font-lock.el (font-lock-flush, font-lock-ensure): New function= s. * lisp/org/org-compat.el (org-font-lock-ensure): New function. * lisp/org/ox-odt.el (org-odt-do-format-code): * lisp/org/ox-html.el (org-html-fontify-code): * lisp/org/org.el (org-fontify-like-in-org-mode): * lisp/org/org-src.el (org-src-font-lock-fontify-block): * lisp/org/org-clock.el (org-clock-get-clocktable): Use it. * lisp/org/ox-org.el (org-org-publish-to-org): Use it. Avoid using f= ind-file from Elisp. * test/automated/ruby-mode-tests.el (ruby-assert-face): Use font-lock= -ensure. (ruby-interpolation-keeps-non-quote-syntax): Use syntax-propertize. I=E2=80=99ll check on font-lock-ensure business and whether we can use that= in Org-9. Thanks, Rasmus --=20 The right to be left alone is a human right