From mboxrd@z Thu Jan 1 00:00:00 1970 From: npostavs@users.sourceforge.net Subject: bug#25132: 26.0.50; emacs hangs when loading org file with python source blocks Date: Sat, 07 Jan 2017 01:38:04 -0500 Message-ID: <87y3yn2x4j.fsf__26357.2038420991$1483771127$gmane$org@users.sourceforge.net> References: <4aa23451-b6cd-88b0-369e-99f6fe5f2175@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48672) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cPkdh-0001kh-9E for emacs-orgmode@gnu.org; Sat, 07 Jan 2017 01:38:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cPkde-0001xK-7G for emacs-orgmode@gnu.org; Sat, 07 Jan 2017 01:38:05 -0500 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: (David Dynerman's message of "Wed, 07 Dec 2016 23:17:36 -0800") 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: David Dynerman Cc: Glenn Morris , 25132@debbugs.gnu.org, =?UTF-8?Q?Cl=C3=A9ment?= Pit--Claudel 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)))