]> git.eshelyaron.com Git - emacs.git/commitdiff
(add-log-current-defun) <lisp>:
authorRichard M. Stallman <rms@gnu.org>
Tue, 5 May 1998 04:25:03 +0000 (04:25 +0000)
committerRichard M. Stallman <rms@gnu.org>
Tue, 5 May 1998 04:25:03 +0000 (04:25 +0000)
If element 1 of the defun is a list, use first symbol
within it (the car of the car.... of it).

lisp/add-log.el

index b71257a015ae81dbf4e802c9e4290a131eda410f..6d762cec01c079cfcba8bfa08674ec675b2b334f 100644 (file)
@@ -491,18 +491,22 @@ Has a preference of looking backwards."
                 (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)