From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#22399: org-mode fontification Date: Mon, 25 Jan 2016 09:30:37 -0500 Message-ID: References: <87oacjng36.fsf@russet.org.uk> <87ziw36khb.fsf@gmx.us> <87a8o2zrtm.fsf@russet.org.uk> <87bn8i7mha.fsf@gmx.us> <87d1syvgc7.fsf@kyleam.com> <8737tu13la.fsf__5430.1016768024$1453185240$gmane$org@kyleam.com> <87d1sy54vt.fsf@gmx.us> <87wpr5zirr.fsf@kyleam.com> <871t9d4cg3.fsf@gmx.us> <874me8pjii.fsf__7050.42196573249$1453290031$gmane$org@russet.org.uk> <87ziw0goel.fsf_-_@kyleam.com> <87oacf92wl.fsf@kyleam.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1453732307 23722 80.91.229.3 (25 Jan 2016 14:31:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 25 Jan 2016 14:31:47 +0000 (UTC) Cc: 22399@debbugs.gnu.org, Rasmus , Phillip Lord To: Kyle Meyer Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jan 25 15:31:26 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aNiAw-0003PY-61 for geb-bug-gnu-emacs@m.gmane.org; Mon, 25 Jan 2016 15:31:26 +0100 Original-Received: from localhost ([::1]:38937 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNiAv-0007pH-Ho for geb-bug-gnu-emacs@m.gmane.org; Mon, 25 Jan 2016 09:31:25 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43573) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNiAm-0007gE-AT for bug-gnu-emacs@gnu.org; Mon, 25 Jan 2016 09:31:22 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aNiAg-000413-CG for bug-gnu-emacs@gnu.org; Mon, 25 Jan 2016 09:31:16 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:47360) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNiAY-000402-Di; Mon, 25 Jan 2016 09:31:10 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aNiAY-0001rB-4e; Mon, 25 Jan 2016 09:31:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, emacs-orgmode@gnu.org Resent-Date: Mon, 25 Jan 2016 14:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22399 X-GNU-PR-Package: emacs,org-mode X-GNU-PR-Keywords: Original-Received: via spool by 22399-submit@debbugs.gnu.org id=B22399.14537322467113 (code B ref 22399); Mon, 25 Jan 2016 14:31:02 +0000 Original-Received: (at 22399) by debbugs.gnu.org; 25 Jan 2016 14:30:46 +0000 Original-Received: from localhost ([127.0.0.1]:35580 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aNiAI-0001qf-9m for submit@debbugs.gnu.org; Mon, 25 Jan 2016 09:30:46 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:17947) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aNiAF-0001qS-Du for 22399@debbugs.gnu.org; Mon, 25 Jan 2016 09:30:44 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BQFgA731xV/zh9oWxWBoMQVF6CUIVVsxiJeoV5BAICgTw9EAEBAQEBAQGBCkEFg10BAQMBJy8jBQsLNBIUGA0kiDcIzyMBAQEBAQUBAQEBAR2LOoRCQweELQWGZYVLinGINJNqgUUjhBYgMYJHAQEB X-IPAS-Result: A0BQFgA731xV/zh9oWxWBoMQVF6CUIVVsxiJeoV5BAICgTw9EAEBAQEBAQGBCkEFg10BAQMBJy8jBQsLNBIUGA0kiDcIzyMBAQEBAQUBAQEBAR2LOoRCQweELQWGZYVLinGINJNqgUUjhBYgMYJHAQEB X-IronPort-AV: E=Sophos;i="5.13,465,1427774400"; d="scan'208";a="191152652" Original-Received: from 108-161-125-56.dsl.teksavvy.com (HELO ceviche.home) ([108.161.125.56]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 25 Jan 2016 09:30:37 -0500 Original-Received: by ceviche.home (Postfix, from userid 20848) id 10E676621A; Mon, 25 Jan 2016 09:30:37 -0500 (EST) In-Reply-To: <87oacf92wl.fsf@kyleam.com> (Kyle Meyer's message of "Wed, 20 Jan 2016 19:44:58 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:111960 Archived-At: > 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:" 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.")