all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#21671: [PATCH] fix python.el hanging up during fontification #21657
@ 2015-10-12 11:48 immerrr again
  2015-10-13  7:37 ` immerrr again
  2015-10-24 16:04 ` immerrr again
  0 siblings, 2 replies; 12+ messages in thread
From: immerrr again @ 2015-10-12 11:48 UTC (permalink / raw
  To: 21671

[-- Attachment #1: Type: text/plain, Size: 940 bytes --]

Two patches are included.

One fixes the fact that for some reason syntax-propertize--done has
ceased to be buffer-local after commit [1] and for some reason commit
[2] did not help. I did it the way other buffer-local variables are
initialized and it worked. The change fixes #21657 that was failing
because syntax-propertize--done was inherited from scratch buffer and
docstring boundaries were not propertized as a result.

The other infinite loop I found accidentally when adding a whitespace
before module docstring. I have fixed one corner-case of it, but in
other circumstances I'd argue that whatever smart extensions
python-mode adds to forward-sexp, those extensions should never move
point less than the normal forward-sexp should.

Cheers,
immerrr

1. https://github.com/emacs-mirror/emacs/commit/3928ef2dd5b8febf3b1d9c1bfb22af3698d16bea

2. https://github.com/emacs-mirror/emacs/commit/0360b7f2c4f0358106e229de4dfe91a67445a50c

[-- Attachment #2: 0002-Prevent-infinite-loop-in-python-info-docstring-p.patch --]
[-- Type: text/x-patch, Size: 1522 bytes --]

From 149066dbfc7f11c40f6dbed70a3279153bf3ab7a Mon Sep 17 00:00:00 2001
From: immerrr <immerrr@gmail.com>
Date: Mon, 12 Oct 2015 14:17:16 +0300
Subject: [PATCH 2/2] Prevent infinite loop in python-info-docstring-p

python-info-docstring-p did not expect that
python-nav-beginning-of-statement could leave point intact not at the
beginning of buffer which happened if the first statement in the file
was indented (it is a Python syntax error).

* python.el (python-nav--forward-sexp): if backward-sexp brought point
to the beginning of the buffer, leave it there
---
 lisp/progmodes/python.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 6ff12b5..7ccd204 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1712,7 +1712,11 @@ expressions when looking at them in either direction."
                    (python-nav-beginning-of-block))
                   ((memq context '(statement-start block-start))
                    (goto-char next-sexp-pos)
-                   (python-nav-beginning-of-statement))
+                   (unless (bobp)
+                     ;; If backward-sexp brought the point to
+                     ;; beginning-of-buffer, beginning-of-statement
+                     ;; will only bring it back.
+                     (python-nav-beginning-of-statement)))
                   (t (goto-char next-sexp-pos))))))))))
 
 (defun python-nav-forward-sexp (&optional arg safe skip-parens-p)
-- 
2.6.1


[-- Attachment #3: 0001-Fix-syntax-propertize-done-to-be-buffer-local.patch --]
[-- Type: text/x-patch, Size: 1209 bytes --]

From a0878abd691e9cc36ee7298b249593a79cdd6029 Mon Sep 17 00:00:00 2001
From: immerrr <immerrr@gmail.com>
Date: Mon, 12 Oct 2015 14:16:48 +0300
Subject: [PATCH 1/2] Fix syntax-propertize--done to be buffer-local

* src/syntax.c (syms_of_syntax): fix syntax-propertize--done to be
buffer-local
---
 src/syntax.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/syntax.c b/src/syntax.c
index 6bfb3b7..4f7dcd7 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -3668,11 +3668,12 @@ Otherwise, that text property is simply ignored.
 See the info node `(elisp)Syntax Properties' for a description of the
 `syntax-table' property.  */);
 
+  DEFSYM (Qsyntax_propertize__done, "syntax-propertize--done");
   DEFVAR_INT ("syntax-propertize--done", syntax_propertize__done,
 	      doc: /* Position up to which syntax-table properties have been set.  */);
   syntax_propertize__done = -1;
   DEFSYM (Qinternal__syntax_propertize, "internal--syntax-propertize");
-  Fmake_variable_buffer_local (intern ("syntax-propertize--done"));
+  Fmake_variable_buffer_local (Qsyntax_propertize__done);
 
   words_include_escapes = 0;
   DEFVAR_BOOL ("words-include-escapes", words_include_escapes,
-- 
2.6.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-03-01  1:06 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-12 11:48 bug#21671: [PATCH] fix python.el hanging up during fontification #21657 immerrr again
2015-10-13  7:37 ` immerrr again
2015-10-13  8:43   ` Torsten Bronger
2015-10-13  8:56     ` immerrr again
2016-02-23  9:06       ` Lars Ingebrigtsen
2016-02-23  9:17         ` immerrr again
2016-02-23  9:49           ` Lars Ingebrigtsen
2016-02-23 10:00             ` immerrr again
2016-02-23 10:04               ` Lars Ingebrigtsen
2017-03-01  1:06                 ` npostavs
2015-10-24 16:04 ` immerrr again
2016-02-07 11:44   ` immerrr again

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.