From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aaron Jensen Subject: [PATCH] Reduce scope of inhibit-modification-hooks Date: Sun, 19 Mar 2017 13:56:02 -0700 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cphrw-0000PH-Vq for emacs-orgmode@gnu.org; Sun, 19 Mar 2017 16:56:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cphrv-0007U0-RO for emacs-orgmode@gnu.org; Sun, 19 Mar 2017 16:56:05 -0400 Received: from mail-ua0-x230.google.com ([2607:f8b0:400c:c08::230]:33110) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cphrv-0007T3-Jd for emacs-orgmode@gnu.org; Sun, 19 Mar 2017 16:56:03 -0400 Received: by mail-ua0-x230.google.com with SMTP id u30so67171061uau.0 for ; Sun, 19 Mar 2017 13:56:03 -0700 (PDT) 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: emacs-orgmode@gnu.org Cc: Noam Postavsky This fixes the fontification error discussed here: http://lists.gnu.org/archive/html/emacs-orgmode/2017-03/msg00423.html and here: http://lists.gnu.org/archive/html/emacs-orgmode/2017-02/msg00280.html --- 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