all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: npostavs@users.sourceforge.net
To: David Dynerman <emperordali@block-party.net>
Cc: 25132@debbugs.gnu.org, "Clément Pit--Claudel" <clement.pit@gmail.com>
Subject: bug#25132: 26.0.50; emacs hangs when loading org file with python source blocks
Date: Sat, 07 Jan 2017 16:20:16 -0500	[thread overview]
Message-ID: <87eg0e36un.fsf__14463.2383170121$1483824086$gmane$org@users.sourceforge.net> (raw)
In-Reply-To: <87y3yn2x4j.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net's message of "Sat, 07 Jan 2017 01:38:04 -0500")

[-- Attachment #1: Type: text/plain, Size: 735 bytes --]

tags 25132 patch
quit

npostavs@users.sourceforge.net writes:
> The problem is that org updates its temporary fontification buffer from
> its fontify rules which are called by jit-lock-function, which means
> that inhibit-modification-hooks is bound to t.  Therefore, when
> org-src-font-lock-fontify-block calls delete-region to remove leftover text from
> the previous source block fontification, the `before-change-functions'
> are not run.  In this case `syntax-ppss-flush-cache' is the important
> function that doesn't get run, so `syntax-propertize--done' is still set
> from before and messes up python.el's fontification routines.

I think with-silent-modifications should let-bind
inhibit-modification-hooks buffer locally:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch for master --]
[-- Type: text/x-diff, Size: 1171 bytes --]

From da4f1c0338b2b98f97a553568c4b80872484ee97 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sat, 7 Jan 2017 15:47:37 -0500
Subject: [PATCH v1] Inhibit modification hooks buffer locally

`with-silent-modifications' let-binds `inhibit-modification-hooks' to t
globally.  So modifications to other buffers don't trigger modication
hooks.  This causes unexpected results when functions called from
`jit-lock-function' use temporary buffers and modifies them (Bug#25132).

* lisp/subr.el (with-silent-modifications): Bind
inhibit-modification-hooks buffer locally.
---
 lisp/subr.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index 5377416..fe20d68 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -3298,7 +3298,8 @@ with-silent-modifications
     `(let* ((,modified (buffer-modified-p))
             (buffer-undo-list t)
             (inhibit-read-only t)
-            (inhibit-modification-hooks t))
+            (inhibit-modification-hooks
+             (progn (make-local-variable 'inhibit-modification-hooks) t)))
        (unwind-protect
            (progn
              ,@body)
-- 
2.9.3


[-- Attachment #3: Type: text/plain, Size: 219 bytes --]


Perhaps the other variables it binds should be buffer local as well?

This bug is new in Emacs 25.1, but changing with-silent-modifications is
a bit risky.  Therefore, I propose the following for the emacs-25
branch:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: patch for emacs-25 --]
[-- Type: text/x-diff, Size: 1262 bytes --]

From 338aa0c37eba0401616e8e02f0143a57edffd486 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sat, 7 Jan 2017 16:05:19 -0500
Subject: [PATCH v1] Call modification hooks in org-src fontify buffers

* lisp/org/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).
---
 lisp/org/org-src.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el
index d01f108..9b66907 100644
--- a/lisp/org/org-src.el
+++ b/lisp/org/org-src.el
@@ -913,8 +913,9 @@ org-src-font-lock-fontify-block
 	  (with-current-buffer
 	      (get-buffer-create
 	       (concat " org-src-fontification:" (symbol-name lang-mode)))
-	    (delete-region (point-min) (point-max))
-	    (insert string " ") ;; so there's a final property change
+	    (let ((inhibit-modification-hooks nil)) ; Avoid Bug#25132.
+              (delete-region (point-min) (point-max))
+              (insert string " ")) ;; so there's a final property change
 	    (unless (eq major-mode lang-mode) (funcall lang-mode))
             (org-font-lock-ensure)
 	    (setq pos (point-min))
-- 
2.9.3


  reply	other threads:[~2017-01-07 21:20 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-07 18:33 bug#25132: 26.0.50; emacs hangs when loading org file with python source blocks David Dynerman
2016-12-08  2:08 ` Glenn Morris
2016-12-08  2:08 ` Glenn Morris
2016-12-08  2:40   ` Clément Pit--Claudel
2016-12-08  7:17     ` David Dynerman
2016-12-08  7:17     ` David Dynerman
2017-01-07  6:38       ` npostavs
2017-01-07 21:20         ` npostavs [this message]
2017-01-07 21:20         ` npostavs
2017-01-19  3:15           ` Comments for bug#25132 fix? (Making with-silent-modifications buffer-local) npostavs
2017-01-19  3:51             ` John Wiegley
2017-01-19 15:49               ` Eli Zaretskii
2017-01-19 16:25           ` bug#25132: 26.0.50; emacs hangs when loading org file with python source blocks Dmitry Gutov
2017-01-20  0:52             ` npostavs
2017-01-20  0:52             ` npostavs
2017-01-20  2:22               ` Clément Pit--Claudel
2017-01-20  2:22               ` Clément Pit--Claudel
2017-01-20  3:18                 ` npostavs
2017-01-20  3:18                 ` npostavs
2017-01-23  3:53               ` Dmitry Gutov
2017-01-23  3:53               ` Dmitry Gutov
2017-01-24  3:36                 ` npostavs
2017-01-29 16:05                   ` npostavs
2017-01-29 16:05                   ` npostavs
2017-01-24  3:36                 ` npostavs
2017-01-19 16:25           ` Dmitry Gutov
2017-01-07  6:38       ` npostavs
2016-12-08  2:40   ` Clément Pit--Claudel

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

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

  git send-email \
    --in-reply-to='87eg0e36un.fsf__14463.2383170121$1483824086$gmane$org@users.sourceforge.net' \
    --to=npostavs@users.sourceforge.net \
    --cc=25132@debbugs.gnu.org \
    --cc=clement.pit@gmail.com \
    --cc=emperordali@block-party.net \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.