unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#24815: 25.1; emacs could hang whith hs-minor-mode and python-mode
       [not found] <804969215.1445131.1477671599466.JavaMail.zimbra@laposte.net>
@ 2016-10-28 16:35 ` gilles.naulin
  2016-11-02  3:57   ` npostavs
  0 siblings, 1 reply; 4+ messages in thread
From: gilles.naulin @ 2016-10-28 16:35 UTC (permalink / raw)
  To: 24815

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

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 



[-- Attachment #2: Type: text/html, Size: 1258 bytes --]

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

* bug#24815: 25.1; emacs could hang whith hs-minor-mode and python-mode
  2016-10-28 16:35 ` bug#24815: 25.1; emacs could hang whith hs-minor-mode and python-mode gilles.naulin
@ 2016-11-02  3:57   ` npostavs
  2016-11-02  4:07     ` Clément Pit--Claudel
  0 siblings, 1 reply; 4+ messages in thread
From: npostavs @ 2016-11-02  3:57 UTC (permalink / raw)
  To: gilles.naulin; +Cc: 24815

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

tags 24815 patch
quit

gilles.naulin@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.


[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 1244 bytes --]

From df7501fbb0b076bdc9a033c0cce239adfc74560a Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@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


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

* bug#24815: 25.1; emacs could hang whith hs-minor-mode and python-mode
  2016-11-02  3:57   ` npostavs
@ 2016-11-02  4:07     ` Clément Pit--Claudel
  2016-11-06 14:19       ` npostavs
  0 siblings, 1 reply; 4+ messages in thread
From: Clément Pit--Claudel @ 2016-11-02  4:07 UTC (permalink / raw)
  To: 24815


[-- Attachment #1.1: Type: text/plain, Size: 177 bytes --]

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

It looks great :)


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* bug#24815: 25.1; emacs could hang whith hs-minor-mode and python-mode
  2016-11-02  4:07     ` Clément Pit--Claudel
@ 2016-11-06 14:19       ` npostavs
  0 siblings, 0 replies; 4+ messages in thread
From: npostavs @ 2016-11-06 14:19 UTC (permalink / raw)
  To: Clément Pit--Claudel; +Cc: 24815

tags 24815 fixed
close 24815 25.2
quit

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

> On 2016-11-01 23:57, npostavs@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





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

end of thread, other threads:[~2016-11-06 14:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <804969215.1445131.1477671599466.JavaMail.zimbra@laposte.net>
2016-10-28 16:35 ` bug#24815: 25.1; emacs could hang whith hs-minor-mode and python-mode gilles.naulin
2016-11-02  3:57   ` npostavs
2016-11-02  4:07     ` Clément Pit--Claudel
2016-11-06 14:19       ` npostavs

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).