GNU bug report logs -
#24815
25.1; emacs could hang whith hs-minor-mode and python-mode
Previous Next
Reported by: gilles.naulin <at> laposte.net
Date: Fri, 28 Oct 2016 16:48:01 UTC
Severity: normal
Tags: fixed, patch
Found in version 25.1
Fixed in version 25.2
Done: npostavs <at> users.sourceforge.net
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
tags 24815 patch
quit
gilles.naulin <at> laposte.net writes:
> gives
> "\\s-*\\(?:def\\|class\\)\\>" in version 25.1
> instead of
> "^\\s-*\\(?:def\\|class\\)\\>" in version 24.5
>
> if I change it by "^\\s-*\\(?:def\\|class\\)\\>" or by
> "\\_<\\(?:def\\|class\\)\\_>"
> hs-minor-mode works fine with python-mode
I guess removing the ^ would cause the issue described in #19761 to
recur, but adding \\_< makes sense. I will apply the following patch to
emacs-25 in a few days unless there are objections.
[v1-0001-Fix-python-mode-hideshow-regexp.patch (text/plain, inline)]
From df7501fbb0b076bdc9a033c0cce239adfc74560a Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Tue, 1 Nov 2016 23:24:33 -0400
Subject: [PATCH v1] Fix python-mode hideshow regexp
2015-02-07 "Fix hideshow integration[...]" changed the regexp added to
`hs-special-modes-alist' so that it worked when not searching from the
beginning of the line. However, this allows matching tokens ending in
"def" or "class", not just those keywords. This results in an infinite
loop in hs-hide-all (Bug #24815).
* lisp/progmodes/python.el (python-mode): Add symbol boundaries around
the def|class matching part of the regexp added to
hs-special-modes-alist.
---
lisp/progmodes/python.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 49f7bcf..e5efc2b 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -5136,7 +5136,7 @@ python-mode
(add-to-list
'hs-special-modes-alist
`(python-mode
- "\\s-*\\(?:def\\|class\\)\\>"
+ "\\s-*\\_<\\(?:def\\|class\\)\\_>"
;; Use the empty string as end regexp so it doesn't default to
;; "\\s)". This way parens at end of defun are properly hidden.
""
--
2.9.3
This bug report was last modified 8 years and 196 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.