GNU bug report logs -
#25132
26.0.50; emacs hangs when loading org file with python source blocks
Previous Next
Reported by: David Dynerman <emperordali <at> block-party.net>
Date: Wed, 7 Dec 2016 19:54:02 UTC
Severity: normal
Tags: confirmed, fixed, patch
Found in version 26.0.50
Fixed in version 25.2
Done: npostavs <at> users.sourceforge.net
Bug is archived. No further changes may be made.
Full log
Message #17 received at 25132 <at> debbugs.gnu.org (full text, mbox):
tags 25132 confirmed
quit
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.
org-src-font-lock-fontify-block(#("python" 0 6 (fontified t)) 19 65)
org-fontify-meta-lines-and-blocks-1(172)
org-fontify-meta-lines-and-blocks(172)
font-lock-fontify-keywords-region(1 172 nil)
font-lock-default-fontify-region(1 172 nil)
font-lock-fontify-region(1 172)
...
jit-lock--run-functions(1 172)
jit-lock-fontify-now(1 501)
jit-lock-function(1)
redisplay_internal\ \(C\ function\)()
redisplay()
sit-for(2)
execute-extended-command(nil "25132-test" "25")
funcall-interactively(execute-extended-command nil "25132-test" "25")
call-interactively(execute-extended-command nil nil)
command-execute(execute-extended-command)
(defun org-src-font-lock-fontify-block (lang start end)
...
(with-current-buffer
(get-buffer-create
(concat " org-src-fontification:" (symbol-name lang-mode)))
(delete-region (point-min) (point-max)) ;<-------------- `syntax-propertize--done' not reset here!
(insert string " ") ;; so there's a final property change
(unless (eq major-mode lang-mode) (funcall lang-mode))
(org-font-lock-ensure)
...)
...)
(defun jit-lock-function (start)
...
(jit-lock-fontify-now start (+ start jit-lock-chunk-size))
...)
(defun jit-lock-fontify-now (&optional start end)
"Fontify current buffer from START to END.
Defaults to the whole buffer. END can be out of bounds."
(with-buffer-prepared-for-jit-lock
...))
(defmacro with-buffer-prepared-for-jit-lock (&rest body)
"Execute BODY in current buffer, overriding several variables.
Preserves the `buffer-modified-p' state of the current buffer."
(declare (debug t))
`(let ((inhibit-point-motion-hooks t))
(with-silent-modifications ; <------ binds inhibit-modification-hooks to t
,@body)))
This bug report was last modified 8 years and 109 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.