summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1998-05-05 04:25:03 +0000
committerRichard M. Stallman <rms@gnu.org>1998-05-05 04:25:03 +0000
commit42b1fc290dc2570117a67d3a28b52452d9f35420 (patch)
tree3b4f52d2dc24dfa44e764d251e7a64d25a26f304
parentbfce64768d8b655ca4a7c60c50a17cc20c6ef0b5 (diff)
downloademacs-42b1fc290dc2570117a67d3a28b52452d9f35420.tar.gz
(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).
-rw-r--r--lisp/add-log.el28
1 files changed, 16 insertions, 12 deletions
diff --git a/lisp/add-log.el b/lisp/add-log.el
index b71257a015a..6d762cec01c 100644
--- a/lisp/add-log.el
+++ b/lisp/add-log.el
@@ -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)