diff lisp/add-log.el @ 90054:f2ebccfa87d4

Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-74 Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-709 Update from CVS: src/indent.c (Fvertical_motion): Fix last change. * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-710 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-715 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-716 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-74 Update from CVS
author Miles Bader <miles@gnu.org>
date Wed, 08 Dec 2004 05:02:30 +0000
parents e24e2e78deda a67575cbdd93
children cb67264d6096
line wrap: on
line diff
--- a/lisp/add-log.el	Mon Dec 06 12:38:25 2004 +0000
+++ b/lisp/add-log.el	Wed Dec 08 05:02:30 2004 +0000
@@ -779,9 +779,28 @@
 		   (forward-line 1))
 		 (or (eobp)
 		     (forward-char 1))
-		 (beginning-of-defun)
-		 (when (progn (end-of-defun)
-			      (< location (point)))
+		 (let (maybe-beg)
+		   ;; Try to find the containing defun.
+		   (beginning-of-defun)
+		   (end-of-defun)
+		   ;; If the defun we found ends before the desired position,
+		   ;; see if there's a DEFUN construct
+		   ;; between that end and the desired position.
+		   (when (save-excursion
+			   (and (> location (point))
+				(re-search-forward "^DEFUN" 
+						   (save-excursion
+						     (goto-char location)
+						     (line-end-position))
+						   t)
+				(re-search-forward "^{" nil t)
+				(setq maybe-beg (point))))
+		     ;; If so, go to the end of that instead.
+		     (goto-char maybe-beg)
+		     (end-of-defun)))
+		 ;; If the desired position is within the defun we found,
+		 ;; find the function name.
+		 (when (< location (point))
 		   (backward-sexp 1)
 		   (let (beg tem)