unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#18462: Emacs freeze with python mode and M-q
@ 2014-09-12 13:37 Gaetan Kenway
  2014-09-30 20:35 ` Leonardo Nobrega
  0 siblings, 1 reply; 3+ messages in thread
From: Gaetan Kenway @ 2014-09-12 13:37 UTC (permalink / raw)
  To: 18462

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

I ran across a odd bug the other day. Essentially, when M-q is run with an
open bracket in python mode, emacs will freeze.
To replicate the error:

$ emacs test.py

type:
def test(

then hit M-q

The version of emacs I'm using is:

GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.10.7)
 of 2014-03-07 on lamiak, modified by Debian

Its not a huge deal, it just struck me as odd since it generally really
difficult to get emacs to crash.

Thanks,

Gaetan

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

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

* bug#18462: Emacs freeze with python mode and M-q
  2014-09-12 13:37 bug#18462: Emacs freeze with python mode and M-q Gaetan Kenway
@ 2014-09-30 20:35 ` Leonardo Nobrega
  2014-09-30 23:01   ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Leonardo Nobrega @ 2014-09-30 20:35 UTC (permalink / raw)
  To: 18462

The second loop in python-fill-paren moves the point until the syntax
context changes. If it doesn't find a close-paren before the end of
the buffer, it loops forever.

ChangeLog entry:

    * lisp/progmodes/python.el (python-fill-paren): Break
    end-of-region loop when it reaches point-max.

Patch:

=== modified file 'lisp/progmodes/python.el'
*** lisp/progmodes/python.el    2014-09-29 18:14:08 +0000
--- lisp/progmodes/python.el    2014-09-30 20:14:37 +0000
*************** JUSTIFY should be used (if applicable) a
*** 3300,3306 ****
                            (end-of-line)
                            (when (not (python-syntax-context 'paren))
                              (skip-syntax-backward "^)")))
!                         (while (python-syntax-context 'paren)
                            (goto-char (1+ (point-marker))))
                          (point-marker)))
      (let ((paragraph-start "\f\\|[ \t]*$")
--- 3300,3307 ----
                            (end-of-line)
                            (when (not (python-syntax-context 'paren))
                              (skip-syntax-backward "^)")))
!                         (while (and (python-syntax-context 'paren)
!                                     (< (point) (point-max)))
                            (goto-char (1+ (point-marker))))
                          (point-marker)))
      (let ((paragraph-start "\f\\|[ \t]*$")





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

* bug#18462: Emacs freeze with python mode and M-q
  2014-09-30 20:35 ` Leonardo Nobrega
@ 2014-09-30 23:01   ` Stefan Monnier
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2014-09-30 23:01 UTC (permalink / raw)
  To: Leonardo Nobrega; +Cc: 18462-done

> The second loop in python-fill-paren moves the point until the syntax
> context changes. If it doesn't find a close-paren before the end of
> the buffer, it loops forever.

Thanks, looks good, installed (using eobp).


        Stefan





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

end of thread, other threads:[~2014-09-30 23:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-12 13:37 bug#18462: Emacs freeze with python mode and M-q Gaetan Kenway
2014-09-30 20:35 ` Leonardo Nobrega
2014-09-30 23:01   ` Stefan Monnier

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).