aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2004-12-03 00:04:45 +0000
committerRichard M. Stallman2004-12-03 00:04:45 +0000
commit8eca85ef5344269c11bef4a4b9fd5e5027eb1daa (patch)
treea814bbc0b3cfa4d0542a9eb68656130fbee58da9
parent0cec6eaf2067c8cc2ea382ba8377d9a1d3794eb8 (diff)
downloademacs-8eca85ef5344269c11bef4a4b9fd5e5027eb1daa.tar.gz
emacs-8eca85ef5344269c11bef4a4b9fd5e5027eb1daa.zip
(add-log-current-defun): Handle the case where point
is in the header part of a DEFUN construct.
-rw-r--r--lisp/add-log.el25
1 files changed, 22 insertions, 3 deletions
diff --git a/lisp/add-log.el b/lisp/add-log.el
index ae135b2bfb3..14a32e580c8 100644
--- a/lisp/add-log.el
+++ b/lisp/add-log.el
@@ -779,9 +779,28 @@ Has a preference of looking backwards."
779 (forward-line 1)) 779 (forward-line 1))
780 (or (eobp) 780 (or (eobp)
781 (forward-char 1)) 781 (forward-char 1))
782 (beginning-of-defun) 782 (let (maybe-beg)
783 (when (progn (end-of-defun) 783 ;; Try to find the containing defun.
784 (< location (point))) 784 (beginning-of-defun)
785 (end-of-defun)
786 ;; If the defun we found ends before the desired position,
787 ;; see if there's a DEFUN construct
788 ;; between that end and the desired position.
789 (when (save-excursion
790 (and (> location (point))
791 (re-search-forward "^DEFUN"
792 (save-excursion
793 (goto-char location)
794 (line-end-position))
795 t)
796 (re-search-forward "^{" nil t)
797 (setq maybe-beg (point))))
798 ;; If so, go to the end of that instead.
799 (goto-char maybe-beg)
800 (end-of-defun)))
801 ;; If the desired position is within the defun we found,
802 ;; find the function name.
803 (when (< location (point))
785 (backward-sexp 1) 804 (backward-sexp 1)
786 (let (beg tem) 805 (let (beg tem)
787 806