unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Pogonyshev <pogonyshev@gmx.net>
To: emacs-devel@gnu.org, rms@gnu.org
Subject: Re: fix infinite loop in python.el
Date: Tue, 31 Jul 2007 16:56:53 +0300	[thread overview]
Message-ID: <200707311656.54091.pogonyshev@gmx.net> (raw)
In-Reply-To: <E1ICpX4-0002vG-P1@fencepost.gnu.org>

Richard Stallman wrote:
> I guess we may as well install the change in Emacs 22.
> 
> If nobody installs it in a few days, would you please remind people
> until they do?

Can someone install this?


2007-07-21  Paul Pogonyshev  <pogonyshev@gmx.net>

        * progmodes/python.el (python-current-defun): Adjust to never fall
        into infinite loop.


*** python.el   12 Jul 2007 22:55:32 +0300      1.63
--- python.el   21 Jul 2007 15:46:18 +0300      
***************
*** 1828,1848 ****
    (save-excursion
      ;; Move up the tree of nested `class' and `def' blocks until we
      ;; get to zero indentation, accumulating the defined names.
!     (let ((start t)
!         (accum)
          (length -1))
!       (while (and (or start (> (current-indentation) 0))
!                 (or (null length-limit)
!                     (null (cdr accum))
!                     (< length length-limit)))
!       (setq start nil)
!       (python-beginning-of-block)
!       (end-of-line)
!       (beginning-of-defun)
!       (when (looking-at (rx (0+ space) (or "def" "class") (1+ space)
!                             (group (1+ (or word (syntax symbol))))))
!         (push (match-string 1) accum)
!         (setq length (+ length 1 (length (car accum))))))
        (when accum
        (when (and length-limit (> length length-limit))
          (setcar accum ".."))
--- 1828,1852 ----
    (save-excursion
      ;; Move up the tree of nested `class' and `def' blocks until we
      ;; get to zero indentation, accumulating the defined names.
!     (let ((accum)
          (length -1))
!       (catch 'done
!       (while (or (null length-limit)
!                  (null (cdr accum))
!                  (< length length-limit))
!         (setq start nil)
!         (let ((started-from (point)))
!           (python-beginning-of-block)
!           (end-of-line)
!           (beginning-of-defun)
!           (when (= (point) started-from)
!             (throw 'done nil)))
!         (when (looking-at (rx (0+ space) (or "def" "class") (1+ space)
!                               (group (1+ (or word (syntax symbol))))))
!           (push (match-string 1) accum)
!           (setq length (+ length 1 (length (car accum)))))
!         (when (= (current-indentation) 0)
!           (throw 'done nil))))
        (when accum
        (when (and length-limit (> length length-limit))
          (setcar accum ".."))

  reply	other threads:[~2007-07-31 13:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-21 12:49 fix infinite loop in python.el Paul Pogonyshev
2007-07-22  1:49 ` Richard Stallman
2007-07-22 16:45   ` Paul Pogonyshev
2007-07-23  4:28     ` Richard Stallman
2007-07-31 13:56       ` Paul Pogonyshev [this message]
2007-08-01  0:49         ` Vinicius Jose Latorre

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=200707311656.54091.pogonyshev@gmx.net \
    --to=pogonyshev@gmx.net \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    /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).