diff options
| author | Richard M. Stallman | 2005-10-23 17:58:45 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2005-10-23 17:58:45 +0000 |
| commit | faf142ec8201c887a11d89927e548e9a09b438df (patch) | |
| tree | e3bc03581c9a641b90f2ef9346f5aee59e6414b7 | |
| parent | e536613ebf2b9623b0e1c667164f99ebd8b9605a (diff) | |
| download | emacs-faf142ec8201c887a11d89927e548e9a09b438df.tar.gz emacs-faf142ec8201c887a11d89927e548e9a09b438df.zip | |
(add-log-current-defun): Clean up handling of DEFUNs.
| -rw-r--r-- | lisp/add-log.el | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/lisp/add-log.el b/lisp/add-log.el index 8ea934084f6..024262a6bee 100644 --- a/lisp/add-log.el +++ b/lisp/add-log.el | |||
| @@ -826,31 +826,28 @@ Has a preference of looking backwards." | |||
| 826 | ;; If the desired position is within the defun we found, | 826 | ;; If the desired position is within the defun we found, |
| 827 | ;; find the function name. | 827 | ;; find the function name. |
| 828 | (when (< location (point)) | 828 | (when (< location (point)) |
| 829 | ;; Move back over function body. | ||
| 829 | (backward-sexp 1) | 830 | (backward-sexp 1) |
| 830 | (let (beg tem) | 831 | (let (beg) |
| 831 | 832 | ;; Skip back over typedefs and arglist. | |
| 833 | ;; Stop at the function definition itself | ||
| 834 | ;; or at the line that follows end of function doc string. | ||
| 832 | (forward-line -1) | 835 | (forward-line -1) |
| 833 | ;; Skip back over typedefs of arglist. | ||
| 834 | (while (and (not (bobp)) | 836 | (while (and (not (bobp)) |
| 835 | (looking-at "[ \t\n]")) | 837 | (looking-at "[ \t\n]") |
| 838 | (not (looking-back "[*]/)\n" (- (point) 4)))) | ||
| 836 | (forward-line -1)) | 839 | (forward-line -1)) |
| 837 | ;; See if this is using the DEFUN macro used in Emacs, | 840 | ;; If we found a doc string, this must be the DEFUN macro |
| 838 | ;; or the DEFUN macro used by the C library: | 841 | ;; used in Emacs. Move back to the DEFUN line. |
| 839 | (if (condition-case nil | 842 | (when (looking-back "[*]/)\n" (- (point) 4)) |
| 840 | (and (save-excursion | 843 | (backward-sexp 1) |
| 841 | (end-of-line) | 844 | (beginning-of-line)) |
| 842 | (while (= (preceding-char) ?\\) | 845 | ;; Is this a DEFUN construct? And is LOCATION in it? |
| 843 | (end-of-line 2)) | 846 | (if (and (looking-at "DEFUN\\b") |
| 844 | (backward-sexp 1) | 847 | (>= location (point))) |
| 845 | (beginning-of-line) | ||
| 846 | (setq tem (point)) | ||
| 847 | (looking-at "DEFUN\\b")) | ||
| 848 | (>= location tem)) | ||
| 849 | (error nil)) | ||
| 850 | ;; DEFUN ("file-name-directory", Ffile_name_directory, Sfile_name_directory, ...) ==> Ffile_name_directory | 848 | ;; DEFUN ("file-name-directory", Ffile_name_directory, Sfile_name_directory, ...) ==> Ffile_name_directory |
| 851 | ;; DEFUN(POSIX::STREAM-LOCK, stream lockp &key BLOCK SHARED START LENGTH) ==> POSIX::STREAM-LOCK | 849 | ;; DEFUN(POSIX::STREAM-LOCK, stream lockp &key BLOCK SHARED START LENGTH) ==> POSIX::STREAM-LOCK |
| 852 | (progn | 850 | (progn |
| 853 | (goto-char tem) | ||
| 854 | (down-list 1) | 851 | (down-list 1) |
| 855 | (when (= (char-after (point)) ?\") | 852 | (when (= (char-after (point)) ?\") |
| 856 | (forward-sexp 1) | 853 | (forward-sexp 1) |
| @@ -863,6 +860,7 @@ Has a preference of looking backwards." | |||
| 863 | (skip-syntax-backward " ") | 860 | (skip-syntax-backward " ") |
| 864 | (point)))) | 861 | (point)))) |
| 865 | (if (looking-at "^[+-]") | 862 | (if (looking-at "^[+-]") |
| 863 | ;; C++. | ||
| 866 | (change-log-get-method-definition) | 864 | (change-log-get-method-definition) |
| 867 | ;; Ordinary C function syntax. | 865 | ;; Ordinary C function syntax. |
| 868 | (setq beg (point)) | 866 | (setq beg (point)) |