From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aaron Jensen Subject: Re: Fontification error Date: Sun, 19 Mar 2017 12:50:33 -0700 Message-ID: References: <87r31trybx.fsf@kyleam.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38088) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cpgqa-0007Be-8H for emacs-orgmode@gnu.org; Sun, 19 Mar 2017 15:50:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cpgqZ-0004jm-29 for emacs-orgmode@gnu.org; Sun, 19 Mar 2017 15:50:36 -0400 Received: from mail-ua0-x244.google.com ([2607:f8b0:400c:c08::244]:35037) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cpgqY-0004jc-UA for emacs-orgmode@gnu.org; Sun, 19 Mar 2017 15:50:35 -0400 Received: by mail-ua0-x244.google.com with SMTP id u30so9040231uau.2 for ; Sun, 19 Mar 2017 12:50:34 -0700 (PDT) In-Reply-To: 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" To: Noam Postavsky Cc: Kyle Meyer , emacs-orgmode@gnu.org That appeared to fix it for me! Thanks. >From cdf2c445e46d5691ee82adb1a6ca0bb0ae6bbd1b Mon Sep 17 00:00:00 2001 From: Aaron Jensen Date: Sun, 19 Mar 2017 12:49:18 -0700 Subject: [PATCH] Reduce scope of inhibit-modification-hooks This fixes a fontification error that some users were having. --- lisp/org-src.el | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lisp/org-src.el b/lisp/org-src.el index dfc422b..b0f952f 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -525,19 +525,19 @@ as `org-src-fontify-natively' is non-nil." (let ((inhibit-modification-hooks nil)) (erase-buffer) ;; Add string and a final space to ensure property change. - (insert string " ") - (unless (eq major-mode lang-mode) (funcall lang-mode)) - (org-font-lock-ensure) - (let ((pos (point-min)) next) - (while (setq next (next-property-change pos)) - ;; Handle additional properties from font-lock, so as to - ;; preserve, e.g., composition. - (dolist (prop (cons 'face font-lock-extra-managed-props)) - (let ((new-prop (get-text-property pos prop))) - (put-text-property - (+ start (1- pos)) (1- (+ start next)) prop new-prop - org-buffer))) - (setq pos next))))) + (insert string " ")) + (unless (eq major-mode lang-mode) (funcall lang-mode)) + (org-font-lock-ensure) + (let ((pos (point-min)) next) + (while (setq next (next-property-change pos)) + ;; Handle additional properties from font-lock, so as to + ;; preserve, e.g., composition. + (dolist (prop (cons 'face font-lock-extra-managed-props)) + (let ((new-prop (get-text-property pos prop))) + (put-text-property + (+ start (1- pos)) (1- (+ start next)) prop new-prop + org-buffer))) + (setq pos next)))) ;; Add Org faces. (let ((src-face (nth 1 (assoc-string lang org-src-block-faces t)))) (when (or (facep src-face) (listp src-face)) -- 2.10.0 On Sun, Mar 19, 2017 at 11:04 AM, Noam Postavsky wrote: > On Sun, Mar 19, 2017 at 1:05 PM, Kyle Meyer wrote: >>> >>> * lisp/org-src.el (org-src-font-lock-fontify-block): Let-bind >>> `inhibit-modification-hooks' to nil, since this function can be called >>> from jit-lock-function which binds that variable to t (Bug#25132). >>> >>> Call modification hooks in org-src fontify buffers >>> ae8264c5cccf19d5b25a340a605bf2f07de1577e >>> Noam Postavsky >>> Sun Jan 29 11:01:32 2017 -0500 >>> >>> At the moment, the minimum ECM I know of is to install spacemacs and >>> open an org file containing: >> >> [+cc Noam because I'm not sure if he follows this list.] > > [Thanks, I don't follow this list indeed] > >> >> I backported this commit to the Org repo, but I don't have any good >> guesses at what's leading to the error below. > > I think the problem is that the let-binding's scope is too big, it's > applying to a text property change on the original org buffer, which > seems to cause problems with one of its modifcation hooks due to > narrowing. Actually, I initially posted the patch with a smaller > binding, but then enlarged it before I pushed it; I don't remember > why... > > Could someone who can reproduce this problem try shrinking the scope > of (let ((inhibit-modification-hooks nil))...) to stop after the > (insert " ") as in [1], and see if that fixes it? > > [1]: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25132;att=3;filename=v1-0001-Call-modification-hooks-in-org-src-fontify-buffer.patch;msg=22