1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 22:41:06 -08:00

Merge from emacs-24; up to 2014-05-26T10:21:18Z!rgm@gnu.org

This commit is contained in:
Glenn Morris 2014-05-25 19:28:09 -07:00
commit 015936fba1
46 changed files with 898 additions and 445 deletions

View file

@ -431,16 +431,18 @@ is called as a function to find the defun's end."
(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.
@ -463,11 +465,19 @@ is called as a function to find the defun's end."
(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.