unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Kyle Meyer <kyle@kyleam.com>
Cc: 22399@debbugs.gnu.org, Rasmus <rasmus@gmx.us>,
	Phillip Lord <phillip.lord@russet.org.uk>
Subject: bug#22399: org-mode fontification
Date: Mon, 25 Jan 2016 09:30:37 -0500	[thread overview]
Message-ID: <jwvio2hycfw.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <87oacf92wl.fsf@kyleam.com> (Kyle Meyer's message of "Wed, 20 Jan 2016 19:44:58 -0500")

> Sure.  With
>
> --8<---------------cut here---------------start------------->8---
>
> #+BEGIN_SRC elisp
>   (require 'cl-lib)
>   (message "test")
> #+END_SRC
> --8<---------------cut here---------------end--------------->8---
>
> in /tmp/scratch.org, run
>
>   emacs -Q --eval "(setq org-src-fontify-natively t)" --visit /tmp/scratch.org
>
> Go to the code block and hit C-c ' (org-edit-special), and then exit
> with another C-c '.  Without this change, the source block is no longer
> highlighted as elisp code when I return to the buffer.

I see the problem.  org-src-font-lock-fontify-block is using buffers
named " org-src-fontification:<major-mode>" in an unusual way:
they're updated via normal buffer modifications, but they're not put in
font-lock-mode, so all the font-lock machinery which tries to keep the
fontification up-to-date is short-circuited, so it triggers a bug in
font-lock-ensure where we made incorrect assumptions.

I installed the patch below into emacs-25, which should fix this
problem,


        Stefan


--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -1074,7 +1074,13 @@ font-lock-flush
 
 (defvar font-lock-ensure-function
   (lambda (_beg _end)
-    (unless font-lock-fontified (font-lock-default-fontify-buffer)))
+    (unless font-lock-fontified
+      (font-lock-default-fontify-buffer)
+      (unless font-lock-mode
+        ;; If font-lock is not enabled, we don't have the hooks in place to
+        ;; track modifications, so a subsequent call to font-lock-ensure can't
+        ;; assume that the fontification is still valid.
+        (setq font-lock-fontified nil))))
   "Function to make sure a region has been fontified.
 Called with two arguments BEG and END.")
 





  parent reply	other threads:[~2016-01-25 14:30 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-18 13:59 bug#22399: org-mode fontification Phillip Lord
2016-01-18 14:16 ` Rasmus
2016-01-18 18:05   ` Phillip Lord
2016-01-18 18:48     ` Rasmus
     [not found]     ` <87bn8i7mha.fsf@gmx.us>
2016-01-18 19:27       ` Kyle Meyer
     [not found]       ` <87d1syvgc7.fsf@kyleam.com>
2016-01-19  6:32         ` Kyle Meyer
2016-01-19 11:25           ` Phillip Lord
     [not found]         ` <8737tu13la.fsf__5430.1016768024$1453185240$gmane$org@kyleam.com>
2016-01-19  8:51           ` Rasmus
     [not found]           ` <87d1sy54vt.fsf@gmx.us>
2016-01-19 15:33             ` Kyle Meyer
     [not found]             ` <87wpr5zirr.fsf@kyleam.com>
2016-01-19 18:04               ` Kyle Meyer
2016-01-19 19:05               ` Rasmus
     [not found]               ` <871t9d4cg3.fsf@gmx.us>
2016-01-20 11:39                 ` bug#22399: [O] " Phillip Lord
2016-01-20 17:18                   ` Kyle Meyer
2016-01-20 22:02                     ` Stefan Monnier
2016-01-21  0:44                       ` Kyle Meyer
     [not found]                       ` <87oacf92wl.fsf@kyleam.com>
2016-01-25 14:30                         ` Stefan Monnier [this message]
2016-01-26  6:58                           ` Kyle Meyer
2016-01-26 13:06                             ` Stefan Monnier
2016-01-26 15:27                               ` Kyle Meyer
2016-02-01 13:50                                 ` Stefan Monnier
2016-02-03  6:38                                   ` Bastien Guerry
2016-02-03  6:51                                     ` Kyle Meyer
2016-02-03  6:55                                       ` Bastien Guerry
2016-02-11 18:18                                         ` Phillip Lord

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.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvio2hycfw.fsf-monnier+emacsbugs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=22399@debbugs.gnu.org \
    --cc=kyle@kyleam.com \
    --cc=phillip.lord@russet.org.uk \
    --cc=rasmus@gmx.us \
    /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.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).