unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: npostavs@users.sourceforge.net
To: gilles.naulin@laposte.net
Cc: 24815@debbugs.gnu.org
Subject: bug#24815: 25.1; emacs could hang whith hs-minor-mode and python-mode
Date: Tue, 01 Nov 2016 23:57:54 -0400	[thread overview]
Message-ID: <87lgx2pm7x.fsf@users.sourceforge.net> (raw)
In-Reply-To: <1234264807.1473759.1477672511527.JavaMail.zimbra@laposte.net> (gilles naulin's message of "Fri, 28 Oct 2016 18:35:11 +0200 (CEST)")

[-- 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


  reply	other threads:[~2016-11-02  3:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 [this message]
2016-11-02  4:07     ` Clément Pit--Claudel
2016-11-06 14:19       ` npostavs

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lgx2pm7x.fsf@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=24815@debbugs.gnu.org \
    --cc=gilles.naulin@laposte.net \
    /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 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).