From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs 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 Message-ID: <87eg0e36un.fsf__14463.2383170121$1483824086$gmane$org@users.sourceforge.net> References: <4aa23451-b6cd-88b0-369e-99f6fe5f2175@gmail.com> <87y3yn2x4j.fsf@users.sourceforge.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1483824086 3859 195.159.176.226 (7 Jan 2017 21:21:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 7 Jan 2017 21:21:26 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: 25132@debbugs.gnu.org, =?UTF-8?Q?Cl=C3=A9ment?= Pit--Claudel To: David Dynerman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jan 07 22:21:16 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cPyQM-0007jd-Em for geb-bug-gnu-emacs@m.gmane.org; Sat, 07 Jan 2017 22:21:14 +0100 Original-Received: from localhost ([::1]:59200 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cPyQP-00010F-7F for geb-bug-gnu-emacs@m.gmane.org; Sat, 07 Jan 2017 16:21:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43409) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cPyPI-0000Io-Ct for bug-gnu-emacs@gnu.org; Sat, 07 Jan 2017 16:20:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cPyPH-0005Le-5Z for bug-gnu-emacs@gnu.org; Sat, 07 Jan 2017 16:20:08 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:59072) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cPyPC-0005Dh-DL; Sat, 07 Jan 2017 16:20:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cPyPC-0002sz-4z; Sat, 07 Jan 2017 16:20:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, emacs-orgmode@gnu.org Resent-Date: Sat, 07 Jan 2017 21:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25132 X-GNU-PR-Package: emacs,org-mode X-GNU-PR-Keywords: confirmed Original-Received: via spool by 25132-submit@debbugs.gnu.org id=B25132.148382396411040 (code B ref 25132); Sat, 07 Jan 2017 21:20:02 +0000 Original-Received: (at 25132) by debbugs.gnu.org; 7 Jan 2017 21:19:24 +0000 Original-Received: from localhost ([127.0.0.1]:46238 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cPyOZ-0002rv-N8 for submit@debbugs.gnu.org; Sat, 07 Jan 2017 16:19:23 -0500 Original-Received: from mail-io0-f195.google.com ([209.85.223.195]:35296) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cPyOX-0002rc-FM; Sat, 07 Jan 2017 16:19:21 -0500 Original-Received: by mail-io0-f195.google.com with SMTP id m98so3372356iod.2; Sat, 07 Jan 2017 13:19:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=LoqKEYSEgJmuVMNq+FUhPQYdUn5azzMhMKKLg7LsNHk=; b=t15spiQ4p83NoQdIBzLfyWl2Uhi8Q09W3K1kdzCk/8h0dUxYrofHr5wnfvqSQaD9sH sccTqlZbUehI/jnzKWwXw+NLs/bMPIl+JxCqUU+z7FoeEZppF9odZBtEy1lKFZv59wCs XgdIFmipGkYQD7G5VvjKPgXs36Xg+BoAOv3kj/pcgeZLMrFyj2DX+r5QhyNjMTwiJJ89 79+Ar/idgPelgN28djLwzBm5vrrmljcRsov8Eu6vRXeYM+nDWuYDIDwZDYti7vlhC1nZ 97ICSWFDhdagjAzDh19YSy/Uz1sfO33EEkY3i7yo0zVMRHqI80rW4E3UxJrGq/rv0EHv Zt0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=LoqKEYSEgJmuVMNq+FUhPQYdUn5azzMhMKKLg7LsNHk=; b=GyiIKug6OB+Wr6MgYnqY+kzA5jak5oAHwHXapCD4LTkywUU6vwwAIcUxIqRuwicgpl l8IIlVQ6xU+LIBIc0pyZLnpU+ZwtCxSBFhobxL6/LQeLjIyEcTilU5wVlzKLnTti9uoZ Xg60iO/lk4aB/sBnQVLg+AsfcyVw4bDP1lcooQBjdShbjnqVjWWlKMVSE2bE+X+5m08a ox4IR2BB9T4qTyugsHT7G8VBn56vj5CXM2czUKobQZ4J/Pg0bcP1sMssSedOnGKcE5/W OBFlquoiQ2M4zUXk9QWnn7oxqBzJ67cbVfcnUqknutMjZ6QfHhEq45JsFXJ6YCPLBGwZ 2b/w== X-Gm-Message-State: AIkVDXIe3sRYCKJmiwmKr1NjYI6sYq8lwf/ksl/cz/R+X6wrugIjY8dWilUfmhqkYYWIwA== X-Received: by 10.107.142.210 with SMTP id q201mr967478iod.31.1483823954960; Sat, 07 Jan 2017 13:19:14 -0800 (PST) Original-Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id o65sm41567628ioe.15.2017.01.07.13.19.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 07 Jan 2017 13:19:13 -0800 (PST) In-Reply-To: <87y3yn2x4j.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net's message of "Sat, 07 Jan 2017 01:38:04 -0500") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:127886 Archived-At: --=-=-= Content-Type: text/plain 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: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v1-0001-Inhibit-modification-hooks-buffer-locally.patch Content-Description: patch for master >From da4f1c0338b2b98f97a553568c4b80872484ee97 Mon Sep 17 00:00:00 2001 From: Noam Postavsky 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 --=-=-= Content-Type: text/plain 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: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v1-0001-Call-modification-hooks-in-org-src-fontify-buffer.patch Content-Description: patch for emacs-25 >From 338aa0c37eba0401616e8e02f0143a57edffd486 Mon Sep 17 00:00:00 2001 From: Noam Postavsky 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 --=-=-=--