GNU bug report logs - #24815
25.1; emacs could hang whith hs-minor-mode and python-mode

Previous Next

Package: emacs;

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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 24815 in the body.
You can then email your comments to 24815 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#24815; Package emacs. (Fri, 28 Oct 2016 16:48:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to gilles.naulin <at> laposte.net:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 28 Oct 2016 16:48:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: gilles.naulin <at> laposte.net
To: bug-gnu-emacs <at> gnu.org
Subject: 25.1; emacs could hang whith hs-minor-mode and python-mode
Date: Fri, 28 Oct 2016 18:35:11 +0200 (CEST)
[Message part 1 (text/plain, inline)]
Hi, 

In python-mode, emacs could hang if you choose a variable name which ends by "def", 
when you run "hide-all" function (hs-minor-mode menu) 

Code sample 
# 
# -*- coding: utf-8 -*- 
# 

with open("default.conf", 'r') as fdef: 
my_conf = fdef.readlines() 

## 
I had to kill the session. 
The problem seems to come from the regexp for python-mode in the variable 
hs-special-modes-alist : 

(elt (assoc 'python-mode hs-special-modes-alist) 1) 

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 

sincerely 
Gilles Naulin 


[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24815; Package emacs. (Wed, 02 Nov 2016 03:58:02 GMT) Full text and rfc822 format available.

Message #8 received at 24815 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: gilles.naulin <at> laposte.net
Cc: 24815 <at> debbugs.gnu.org
Subject: Re: bug#24815: 25.1;
 emacs could hang whith hs-minor-mode and python-mode
Date: Tue, 01 Nov 2016 23:57:54 -0400
[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


Added tag(s) patch. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Wed, 02 Nov 2016 03:58:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24815; Package emacs. (Wed, 02 Nov 2016 04:09:01 GMT) Full text and rfc822 format available.

Message #13 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit--Claudel <clement.pit <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#24815: 25.1; emacs could hang whith hs-minor-mode and
 python-mode
Date: Wed, 2 Nov 2016 00:07:59 -0400
[Message part 1 (text/plain, inline)]
On 2016-11-01 23:57, npostavs <at> users.sourceforge.net wrote:
> I will apply the following patch to
> emacs-25 in a few days unless there are objections.

It looks great :)

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24815; Package emacs. (Sun, 06 Nov 2016 14:20:02 GMT) Full text and rfc822 format available.

Message #16 received at 24815 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: Clément Pit--Claudel <clement.pit <at> gmail.com>
Cc: 24815 <at> debbugs.gnu.org
Subject: Re: bug#24815: 25.1;
 emacs could hang whith hs-minor-mode and python-mode
Date: Sun, 06 Nov 2016 09:19:39 -0500
tags 24815 fixed
close 24815 25.2
quit

Clément Pit--Claudel <clement.pit <at> gmail.com> writes:

> On 2016-11-01 23:57, npostavs <at> users.sourceforge.net wrote:
>> I will apply the following patch to
>> emacs-25 in a few days unless there are objections.
>
> It looks great :)

Pushed as 0b6b8151




Added tag(s) fixed. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Sun, 06 Nov 2016 14:20:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 25.2, send any further explanations to 24815 <at> debbugs.gnu.org and gilles.naulin <at> laposte.net Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Sun, 06 Nov 2016 14:20:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 05 Dec 2016 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 195 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.