comparison lisp/add-log.el @ 58737:a67575cbdd93

(add-log-current-defun): Handle the case where point is in the header part of a DEFUN construct.
author Richard M. Stallman <rms@gnu.org>
date Fri, 03 Dec 2004 00:04:45 +0000
parents d0dbcba62472
children 448dec90812c f2ebccfa87d4
comparison
equal deleted inserted replaced
58736:311652551ce2 58737:a67575cbdd93
777 ;; before the open brace. If so, advance forward. 777 ;; before the open brace. If so, advance forward.
778 (while (not (looking-at "{\\|\\(\\s *$\\)")) 778 (while (not (looking-at "{\\|\\(\\s *$\\)"))
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
788 (forward-line -1) 807 (forward-line -1)
789 ;; Skip back over typedefs of arglist. 808 ;; Skip back over typedefs of arglist.