diff options
| author | Richard M. Stallman | 1998-05-05 04:25:03 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-05-05 04:25:03 +0000 |
| commit | 42b1fc290dc2570117a67d3a28b52452d9f35420 (patch) | |
| tree | 3b4f52d2dc24dfa44e764d251e7a64d25a26f304 | |
| parent | bfce64768d8b655ca4a7c60c50a17cc20c6ef0b5 (diff) | |
| download | emacs-42b1fc290dc2570117a67d3a28b52452d9f35420.tar.gz emacs-42b1fc290dc2570117a67d3a28b52452d9f35420.zip | |
(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.el | 28 |
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." | |||
| 491 | (or (eobp) (forward-char 1)) | 491 | (or (eobp) (forward-char 1)) |
| 492 | (beginning-of-defun) | 492 | (beginning-of-defun) |
| 493 | ;; Make sure we are really inside the defun found, not after it. | 493 | ;; Make sure we are really inside the defun found, not after it. |
| 494 | (if (and (looking-at "\\s(") | 494 | (when (and (looking-at "\\s(") |
| 495 | (progn (end-of-defun) | 495 | (progn (end-of-defun) |
| 496 | (< location (point))) | 496 | (< location (point))) |
| 497 | (progn (forward-sexp -1) | 497 | (progn (forward-sexp -1) |
| 498 | (>= location (point)))) | 498 | (>= location (point)))) |
| 499 | (progn | 499 | (if (looking-at "\\s(") |
| 500 | (if (looking-at "\\s(") | 500 | (forward-char 1)) |
| 501 | (forward-char 1)) | 501 | ;; Skip the defining construct name, typically "defun" |
| 502 | (forward-sexp 1) | 502 | ;; or "defvar". |
| 503 | (skip-chars-forward " '") | 503 | (forward-sexp 1) |
| 504 | (buffer-substring (point) | 504 | ;; The second element is usually a symbol being defined. |
| 505 | (progn (forward-sexp 1) (point)))))) | 505 | ;; If it is not, use the first symbol in it. |
| 506 | (skip-chars-forward " '(") | ||
| 507 | (buffer-substring (point) | ||
| 508 | (progn (forward-sexp 1) | ||
| 509 | (point))))) | ||
| 506 | ((and (memq major-mode add-log-c-like-modes) | 510 | ((and (memq major-mode add-log-c-like-modes) |
| 507 | (save-excursion | 511 | (save-excursion |
| 508 | (beginning-of-line) | 512 | (beginning-of-line) |