changeset 21944:8e606f5208eb

(add-log-current-defun) <lisp>: If element 1 of the defun is a list, use first symbol within it (the car of the car.... of it).
author Richard M. Stallman <rms@gnu.org>
date Tue, 05 May 1998 04:25:03 +0000
parents f702be237f91
children bda081af77e7
files lisp/add-log.el
diffstat 1 files changed, 16 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/add-log.el	Tue May 05 04:09:14 1998 +0000
+++ b/lisp/add-log.el	Tue May 05 04:25:03 1998 +0000
@@ -491,18 +491,22 @@
 		 (or (eobp) (forward-char 1))
 		 (beginning-of-defun)
 		 ;; Make sure we are really inside the defun found, not after it.
-		 (if (and (looking-at "\\s(")
-			  (progn (end-of-defun)
-				 (< location (point)))
-			  (progn (forward-sexp -1)
-				 (>= location (point))))
-		     (progn
-		       (if (looking-at "\\s(")
-			   (forward-char 1))
-		       (forward-sexp 1)
-		       (skip-chars-forward " '")
-		       (buffer-substring (point)
-					 (progn (forward-sexp 1) (point))))))
+		 (when (and (looking-at "\\s(")
+			    (progn (end-of-defun)
+				   (< location (point)))
+			    (progn (forward-sexp -1)
+				   (>= location (point))))
+		   (if (looking-at "\\s(")
+		       (forward-char 1))
+		   ;; Skip the defining construct name, typically "defun"
+		   ;; or "defvar".
+		   (forward-sexp 1)
+		   ;; The second element is usually a symbol being defined.
+		   ;; If it is not, use the first symbol in it.
+		   (skip-chars-forward " '(")
+		   (buffer-substring (point)
+				     (progn (forward-sexp 1)
+					    (point)))))
 		((and (memq major-mode add-log-c-like-modes)
 		      (save-excursion
 			(beginning-of-line)