emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: phillip.lord@russet.org.uk
Cc: 22399@debbugs.gnu.org
Subject: bug#22399: org-mode fontification
Date: Mon, 18 Jan 2016 19:48:17 +0100	[thread overview]
Message-ID: <87bn8i7mha.fsf@gmx.us> (raw)
In-Reply-To: <87a8o2zrtm.fsf@russet.org.uk> (Phillip Lord's message of "Mon, 18 Jan 2016 18:05:25 +0000")

phillip.lord@russet.org.uk (Phillip Lord) writes:

> Rasmus <rasmus@gmx.us> 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¹ ,
>> which, I guess, will be part of if Emacs 25.2 or 26.1 (whichever comes
>> first and allow new features).  It’s also fixed in 8.2.10².  I guess
>> Emacs-25 should switch v8.2.10.  [Honestly, when v8.3 couldn’t be 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.git.
>
>
> 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’t a better fix to change the signature of the alias to mirror that 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 <monnier@iro.umontreal.ca>
       AuthorDate: Wed May 28 23:45:29 2014 -0400

      * lisp/font-lock.el (font-lock-flush, font-lock-ensure): New functions.
      * 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 find-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’ll check on font-lock-ensure business and whether we can use that in
Org-9.

Thanks,
Rasmus

-- 
The right to be left alone is a human right

  parent reply	other threads:[~2016-01-18 18:49 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87oacjng36.fsf@russet.org.uk>
     [not found] ` <87ziw36khb.fsf@gmx.us>
2016-01-18 18:05   ` bug#22399: org-mode fontification Phillip Lord
     [not found]   ` <87a8o2zrtm.fsf@russet.org.uk>
2016-01-18 18:48     ` Rasmus [this message]
2016-01-18 19:27       ` Kyle Meyer
2016-01-19  6:32         ` Kyle Meyer
2016-01-19 11:25           ` Phillip Lord
2016-01-19  6:32         ` Kyle Meyer
2016-01-19  8:51           ` Rasmus
2016-01-19 15:33             ` Kyle Meyer
2016-01-19 18:04               ` Kyle Meyer
2016-01-19 19:05               ` Rasmus
2016-01-20 11:39                 ` Phillip Lord
     [not found]                 ` <874me8pjii.fsf__7050.42196573249$1453290031$gmane$org@russet.org.uk>
2016-01-20 17:18                   ` Kyle Meyer
     [not found]                   ` <87ziw0goel.fsf_-_@kyleam.com>
2016-01-20 22:02                     ` Stefan Monnier
     [not found]                     ` <jwvtwm7kj32.fsf-monnier+emacsbugs@gnu.org>
2016-01-21  0:44                       ` Kyle Meyer
2016-01-25 14:30                         ` Stefan Monnier
     [not found]                         ` <jwvio2hycfw.fsf-monnier+emacsbugs@gnu.org>
2016-01-26  6:58                           ` Kyle Meyer
     [not found]                           ` <87lh7cu8r0.fsf@kyleam.com>
2016-01-26 13:06                             ` Stefan Monnier
     [not found]                             ` <jwvmvrsv6ci.fsf-monnier+emacsbugs@gnu.org>
2016-01-26 15:27                               ` Kyle Meyer
     [not found]                               ` <87a8nstl75.fsf@kyleam.com>
2016-02-01 13:50                                 ` Stefan Monnier
     [not found]                                 ` <jwvpowgmthh.fsf-monnier+emacsbugs@gnu.org>
2016-02-03  6:38                                   ` Bastien Guerry
     [not found]                                   ` <87si1auwlx.fsf@free.fr>
2016-02-03  6:51                                     ` Kyle Meyer
     [not found]                                     ` <8760y6wak7.fsf@kyleam.com>
2016-02-03  6:55                                       ` Bastien Guerry
     [not found]                                       ` <87bn7yuvt5.fsf@gnu.org>
2016-02-11 18:18                                         ` Phillip Lord
2016-01-19  6:32         ` 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=87bn8i7mha.fsf@gmx.us \
    --to=rasmus@gmx.us \
    --cc=22399@debbugs.gnu.org \
    --cc=phillip.lord@russet.org.uk \
    /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).