[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-24 r117132: * lisp/emacs-lisp/lisp.el (end-of-defun)
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] emacs-24 r117132: * lisp/emacs-lisp/lisp.el (end-of-defun): Ensure we move. |
Date: |
Tue, 20 May 2014 18:55:48 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 117132
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17274
committer: Stefan Monnier <address@hidden>
branch nick: emacs-24
timestamp: Tue 2014-05-20 14:55:41 -0400
message:
* lisp/emacs-lisp/lisp.el (end-of-defun): Ensure we move.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/emacs-lisp/lisp.el lisp.el-20091113204419-o5vbwnq5f7feedwu-131
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2014-05-18 12:58:30 +0000
+++ b/lisp/ChangeLog 2014-05-20 18:55:41 +0000
@@ -1,3 +1,7 @@
+2014-05-20 Stefan Monnier <address@hidden>
+
+ * emacs-lisp/lisp.el (end-of-defun): Ensure we move (bug#17274).
+
2014-05-18 Stefan Monnier <address@hidden>
* emacs-lisp/timer.el (timer-event-handler): Don't run if canceled
=== modified file 'lisp/emacs-lisp/lisp.el'
--- a/lisp/emacs-lisp/lisp.el 2014-02-26 02:31:27 +0000
+++ b/lisp/emacs-lisp/lisp.el 2014-05-20 18:55:41 +0000
@@ -373,16 +373,18 @@
(push-mark))
(if (or (null arg) (= arg 0)) (setq arg 1))
(let ((pos (point))
- (beg (progn (end-of-line 1) (beginning-of-defun-raw 1) (point))))
+ (beg (progn (end-of-line 1) (beginning-of-defun-raw 1) (point)))
+ (skip (lambda ()
+ ;; When comparing point against pos, we want to consider that if
+ ;; point was right after the end of the function, it's still
+ ;; considered as "in that function".
+ ;; E.g. `eval-defun' from right after the last close-paren.
+ (unless (bolp)
+ (skip-chars-forward " \t")
+ (if (looking-at "\\s<\\|\n")
+ (forward-line 1))))))
(funcall end-of-defun-function)
- ;; When comparing point against pos, we want to consider that if
- ;; point was right after the end of the function, it's still
- ;; considered as "in that function".
- ;; E.g. `eval-defun' from right after the last close-paren.
- (unless (bolp)
- (skip-chars-forward " \t")
- (if (looking-at "\\s<\\|\n")
- (forward-line 1)))
+ (funcall skip)
(cond
((> arg 0)
;; Moving forward.
@@ -405,11 +407,19 @@
(goto-char beg))
(unless (zerop arg)
(beginning-of-defun-raw (- arg))
+ (setq beg (point))
(funcall end-of-defun-function))))
- (unless (bolp)
- (skip-chars-forward " \t")
- (if (looking-at "\\s<\\|\n")
- (forward-line 1)))))
+ (funcall skip)
+ (while (and (< arg 0) (>= (point) pos))
+ ;; We intended to move backward, but this ended up not doing so:
+ ;; Try harder!
+ (goto-char beg)
+ (beginning-of-defun-raw (- arg))
+ (if (>= (point) beg)
+ (setq arg 0)
+ (setq beg (point))
+ (funcall end-of-defun-function)
+ (funcall skip)))))
(defun mark-defun (&optional allow-extend)
"Put mark at end of this defun, point at beginning.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-24 r117132: * lisp/emacs-lisp/lisp.el (end-of-defun): Ensure we move.,
Stefan Monnier <=