[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] bug#25132: 26.0.50; emacs hangs when loading org file with python so

From: npostavs
Subject: [O] bug#25132: 26.0.50; emacs hangs when loading org file with python source blocks
Date: Sat, 07 Jan 2017 01:38:04 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

tags 25132 confirmed

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)
  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)
  redisplay_internal\ \(C\ function\)()
  execute-extended-command(nil "25132-test" "25")
  funcall-interactively(execute-extended-command nil "25132-test" "25")
  call-interactively(execute-extended-command nil nil)

(defun org-src-font-lock-fontify-block (lang start end)
               (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))

(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."

  (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 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]