[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs/lisp/emacs-lisp lisp.el
From: |
Chong Yidong |
Subject: |
[Emacs-diffs] emacs/lisp/emacs-lisp lisp.el |
Date: |
Sat, 31 Jan 2009 16:19:46 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Chong Yidong <cyd> 09/01/31 16:19:46
Modified files:
lisp/emacs-lisp: lisp.el
Log message:
(end-of-defun): Protect against infloops (Bug#2106).
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/emacs-lisp/lisp.el?cvsroot=emacs&r1=1.93&r2=1.94
Patches:
Index: lisp.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/emacs-lisp/lisp.el,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -b -r1.93 -r1.94
--- lisp.el 9 Jan 2009 04:29:19 -0000 1.93
+++ lisp.el 31 Jan 2009 16:19:46 -0000 1.94
@@ -342,7 +342,8 @@
(push-mark))
(if (or (null arg) (= arg 0)) (setq arg 1))
(while (> arg 0)
- (let ((pos (point)))
+ (let ((pos (point))
+ retry-point)
(end-of-line 1)
(beginning-of-defun-raw 1)
(while (unless (eobp)
@@ -350,28 +351,37 @@
(skip-chars-forward " \t")
(if (looking-at "\\s<\\|\n")
(forward-line 1))
- ;; If we started after the end of the previous function, then
- ;; try again with the next one.
- (when (<= (point) pos)
+ ;; If we started after the end of the previous
+ ;; function, try again with the next one.
+ (unless (or (> (point) pos)
+ (eq (point) retry-point))
(or (bobp) (forward-char -1))
(beginning-of-defun-raw -1)
- 'try-again))))
+ (setq retry-point (point)))))
+ ;; Ensure that we move forward.
+ (when (< (point) pos)
+ (goto-char pos)))
(setq arg (1- arg)))
(while (< arg 0)
(let ((pos (point)))
(while (unless (bobp)
(beginning-of-line 1)
(beginning-of-defun-raw 1)
- (let ((beg (point)))
+ (let ((beg (point))
+ retry-point)
(funcall end-of-defun-function)
(skip-chars-forward " \t")
(if (looking-at "\\s<\\|\n")
(forward-line 1))
- ;; If we started from within the function just found, then
+ ;; If we started from within the function just found,
;; try again with the previous one.
- (when (>= (point) pos)
+ (unless (or (< (point) pos)
+ (eq (point) retry-point))
(goto-char beg)
- 'try-again)))))
+ (setq retry-point (point))))))
+ ;; Ensure that we move backward.
+ (when (> (point) pos)
+ (goto-char pos)))
(setq arg (1+ arg))))
(defun mark-defun (&optional allow-extend)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs/lisp/emacs-lisp lisp.el,
Chong Yidong <=