From: immerrr again <immerrr@gmail.com>
To: 21671@debbugs.gnu.org
Subject: bug#21671: [PATCH] fix python.el hanging up during fontification #21657
Date: Mon, 12 Oct 2015 14:48:50 +0300 [thread overview]
Message-ID: <CAERznn9QYWJTyZLGU+4Lt4eYpAMse3=8US6kU4dJ-_mNuepw5A@mail.gmail.com> (raw)
[-- 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
next reply other threads:[~2015-10-12 11:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-12 11:48 immerrr again [this message]
2015-10-13 7:37 ` bug#21671: [PATCH] fix python.el hanging up during fontification #21657 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAERznn9QYWJTyZLGU+4Lt4eYpAMse3=8US6kU4dJ-_mNuepw5A@mail.gmail.com' \
--to=immerrr@gmail.com \
--cc=21671@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.