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 01:38:04 -0500 Message-ID: <87y3yn2x4j.fsf@users.sourceforge.net> References: <4aa23451-b6cd-88b0-369e-99f6fe5f2175@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1483771099 3555 195.159.176.226 (7 Jan 2017 06:38:19 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 7 Jan 2017 06:38:19 +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 07:38:15 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 1cPkdp-00006i-9K for geb-bug-gnu-emacs@m.gmane.org; Sat, 07 Jan 2017 07:38:13 +0100 Original-Received: from localhost ([::1]:56149 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cPkdt-0001o2-IA for geb-bug-gnu-emacs@m.gmane.org; Sat, 07 Jan 2017 01:38:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48697) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cPkdj-0001lx-ES for bug-gnu-emacs@gnu.org; Sat, 07 Jan 2017 01:38:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cPkdi-0001zI-G9 for bug-gnu-emacs@gnu.org; Sat, 07 Jan 2017 01:38:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:58354) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cPkde-0001xG-3G; Sat, 07 Jan 2017 01:38:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cPkdd-0003un-RJ; Sat, 07 Jan 2017 01:38:01 -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 06:38:01 +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: Original-Received: via spool by 25132-submit@debbugs.gnu.org id=B25132.148377103014991 (code B ref 25132); Sat, 07 Jan 2017 06:38:01 +0000 Original-Received: (at 25132) by debbugs.gnu.org; 7 Jan 2017 06:37:10 +0000 Original-Received: from localhost ([127.0.0.1]:45520 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cPkco-0003te-9o for submit@debbugs.gnu.org; Sat, 07 Jan 2017 01:37:10 -0500 Original-Received: from mail-it0-f67.google.com ([209.85.214.67]:34599) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cPkcm-0003tK-6G; Sat, 07 Jan 2017 01:37:08 -0500 Original-Received: by mail-it0-f67.google.com with SMTP id q186so4164339itb.1; Fri, 06 Jan 2017 22:37:08 -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=PBjbsyM3oEhOPbCb+sG55Ev40z4zdw72iUYs4DUsM7U=; b=Fg1GZkJc6KAGA8PRKBUtBB85mWLFa4b2MCZroF2ewt1NFNJEQ1v7rCdHhgVoS9Pp9/ 6IOPDKmC5ozNlZeI/zX0i+7OYhpI/p16mpZtVnBAKqaYQL3rmNLG7NWVjfXe4bZnb/Hu emHIXrGnK8LoMcezrCwSYZCIzaogPZBywTuZGSkpdNzgiR6KbmHNhaJzHZZSbY/38/1R eq/6NBisIXjT72mRtBZdazq2wumpX0lIZ8Lud9R/ekWWLUdOmBmuvk6dPCRDlBV1P0CA 6MZh4ivnZVYu8mav3+3KxEswssz5yIdIXKmPBe7LzxXHGcUoROfnys6fujlDufa/rDLy j8OA== 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=PBjbsyM3oEhOPbCb+sG55Ev40z4zdw72iUYs4DUsM7U=; b=bweUDcQWnXWWf0y7Ny1GGNqVPeA3Da4X8kiiX+M4QtShA0mo9ukil5Hf56KcrfMS8v pMrwfHxpTT+5CI5Y6UQXKwd7BGitPaPvWT7GfJ/cMlYINtRygD1WnjHP+YfepMd12loC +kVulGAUNvR7cu7mM0MhAzGn/RDUW8J9gOv4FmFpwTFzKGJYT6CNip8x0Vc1ZsMP01ZG 3LjpBlB7ljV5oVQGvNMO6fJ9C6Si113WMfy24FA6R0YF9cCfazT6VVLWvZevru0Nm5Gg IknawmV6B//7LjhajuCSJhpjJMbGR5pgB3cMx6bbQxEMa7tbbFopip9L4hBobuaxZg31 Wh4g== X-Gm-Message-State: AIkVDXLsSARaTwolLKDbwDxLZWClrvhwFzUc2s/3uymZ6yfxjuj+nr54Fv1dFE6pOPofrQ== X-Received: by 10.36.116.202 with SMTP id o193mr1836672itc.96.1483771022465; Fri, 06 Jan 2017 22:37:02 -0800 (PST) Original-Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id p77sm40705839iod.35.2017.01.06.22.37.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 06 Jan 2017 22:37:01 -0800 (PST) In-Reply-To: (David Dynerman's message of "Wed, 07 Dec 2016 23:17:36 -0800") 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:127863 Archived-At: 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)))