From acaf905b1130aae80fa59d2c861ffd4c8eb75486 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Thu, 5 Jan 2012 01:46:05 -0800 Subject: Add 2012 to FSF copyright years for Emacs files --- lisp/emacs-lisp/lisp.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp/emacs-lisp/lisp.el') diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index db6a03333d4..8c53ad58612 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -1,6 +1,6 @@ ;;; lisp.el --- Lisp editing commands for Emacs -;; Copyright (C) 1985-1986, 1994, 2000-2011 Free Software Foundation, Inc. +;; Copyright (C) 1985-1986, 1994, 2000-2012 Free Software Foundation, Inc. ;; Maintainer: FSF ;; Keywords: lisp, languages -- cgit v1.2.1 From 8e911f6f933455fd1d6709dd60965fb9191e81d6 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Thu, 23 Feb 2012 03:13:48 -0500 Subject: * lisp/emacs-lisp/lisp.el (beginning-of-defun-raw): Don't call end-of-defun when it might call us back infinitely. Fixes: debbugs:10797 --- lisp/emacs-lisp/lisp.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lisp/emacs-lisp/lisp.el') diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index 8c53ad58612..4efdc3240cd 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -257,9 +257,8 @@ is called as a function to find the defun's beginning." (if (> arg 0) (dotimes (i arg) (funcall beginning-of-defun-function)) - ;; Better not call end-of-defun-function directly, in case - ;; it's not defined. - (end-of-defun (- arg)))))) + (dotimes (i (- arg)) + (funcall end-of-defun-function)))))) ((or defun-prompt-regexp open-paren-in-column-0-is-defun-start) (and (< arg 0) (not (eobp)) (forward-char 1)) -- cgit v1.2.1 From 050cc68b402f5998193a6026d0eeeecb9d2cb9c4 Mon Sep 17 00:00:00 2001 From: Lennart Borgman Date: Wed, 11 Apr 2012 04:12:20 +0200 Subject: `narrow-to-defun' fixup * emacs-lisp/lisp.el (narrow-to-defun): `beginning-of-defun' goes to previous function when point is on the first character of a function. Take care of that in `narrow-to-defun'. Fixes: debbugs:6157 --- lisp/emacs-lisp/lisp.el | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp/lisp.el') diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index 4efdc3240cd..bcb7fab026b 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -447,7 +447,21 @@ Optional ARG is ignored." ;; Try first in this order for the sake of languages with nested ;; functions where several can end at the same place as with ;; the offside rule, e.g. Python. - (beginning-of-defun) + + ;; Finding the start of the function is a bit problematic since + ;; `beginning-of-defun' when we are on the first character of + ;; the function might go to the previous function. + ;; + ;; Therefore we first move one character forward and then call + ;; `beginning-of-defun'. However now we must check that we did + ;; not move into the next function. + (let ((here (point))) + (unless (eolp) + (forward-char)) + (beginning-of-defun) + (when (< (point) here) + (goto-char here) + (beginning-of-defun))) (setq beg (point)) (end-of-defun) (setq end (point)) -- cgit v1.2.1