annotate lisp/add-log.el @ 13255:9e94f911f00c

(add-log-current-defun): Handle `private', `public' in C++ class definitions.
author Richard M. Stallman <rms@gnu.org>
date Fri, 20 Oct 1995 15:22:56 +0000
parents 1bc6075184d7
children 69fe836d7f02
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1 ;;; add-log.el --- change log maintenance commands for Emacs
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
2
6562
0541a368505c (add-log-current-defun): Autoload this.
Roland McGrath <roland@gnu.org>
parents: 6309
diff changeset
3 ;; Copyright (C) 1985, 1986, 1988, 1993, 1994 Free Software Foundation, Inc.
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
4
2247
2c7997f249eb Add or correct keywords
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1999
diff changeset
5 ;; Keywords: maint
2c7997f249eb Add or correct keywords
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1999
diff changeset
6
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
7 ;; This file is part of GNU Emacs.
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
8
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
811
e694e0879463 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 678
diff changeset
11 ;; the Free Software Foundation; either version 2, or (at your option)
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
12 ;; any later version.
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
13
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
14 ;; GNU Emacs is distributed in the hope that it will be useful,
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
17 ;; GNU General Public License for more details.
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
18
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
20 ;; along with GNU Emacs; see the file COPYING. If not, write to
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
21 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
22
2307
10e417efb12a Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2247
diff changeset
23 ;;; Commentary:
10e417efb12a Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2247
diff changeset
24
10e417efb12a Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2247
diff changeset
25 ;; This facility is documented in the Emacs Manual.
10e417efb12a Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2247
diff changeset
26
811
e694e0879463 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 678
diff changeset
27 ;;; Code:
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
28
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
29 (defvar change-log-default-name nil
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
30 "*Name of a change log file for \\[add-change-log-entry].")
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
31
4154
20a0593431b7 (add-log-current-defun-function): New defvar.
Roland McGrath <roland@gnu.org>
parents: 3897
diff changeset
32 (defvar add-log-current-defun-function nil
20a0593431b7 (add-log-current-defun-function): New defvar.
Roland McGrath <roland@gnu.org>
parents: 3897
diff changeset
33 "\
20a0593431b7 (add-log-current-defun-function): New defvar.
Roland McGrath <roland@gnu.org>
parents: 3897
diff changeset
34 *If non-nil, function to guess name of current function from surrounding text.
20a0593431b7 (add-log-current-defun-function): New defvar.
Roland McGrath <roland@gnu.org>
parents: 3897
diff changeset
35 \\[add-change-log-entry] calls this function (if nil, `add-log-current-defun'
20a0593431b7 (add-log-current-defun-function): New defvar.
Roland McGrath <roland@gnu.org>
parents: 3897
diff changeset
36 instead) with no arguments. It returns a string or nil if it cannot guess.")
20a0593431b7 (add-log-current-defun-function): New defvar.
Roland McGrath <roland@gnu.org>
parents: 3897
diff changeset
37
9008
be396da9c611 (add-change-log-entry): Set add-log-full-name and
Richard M. Stallman <rms@gnu.org>
parents: 8949
diff changeset
38 (defvar add-log-full-name nil
4741
c0ea0009268a add-log-full-name, add-log-mailing-address: new varialbes
Brian Fox <bfox@gnu.org>
parents: 4380
diff changeset
39 "*Full name of user, for inclusion in ChangeLog daily headers.
c0ea0009268a add-log-full-name, add-log-mailing-address: new varialbes
Brian Fox <bfox@gnu.org>
parents: 4380
diff changeset
40 This defaults to the value returned by the `user-full-name' function.")
c0ea0009268a add-log-full-name, add-log-mailing-address: new varialbes
Brian Fox <bfox@gnu.org>
parents: 4380
diff changeset
41
9008
be396da9c611 (add-change-log-entry): Set add-log-full-name and
Richard M. Stallman <rms@gnu.org>
parents: 8949
diff changeset
42 (defvar add-log-mailing-address nil
4741
c0ea0009268a add-log-full-name, add-log-mailing-address: new varialbes
Brian Fox <bfox@gnu.org>
parents: 4380
diff changeset
43 "*Electronic mail address of user, for inclusion in ChangeLog daily headers.
8049
1a8747d19087 (add-log-mailing-address): Use user-mail-address.
Richard M. Stallman <rms@gnu.org>
parents: 8042
diff changeset
44 This defaults to the value of `user-mail-address'.")
4741
c0ea0009268a add-log-full-name, add-log-mailing-address: new varialbes
Brian Fox <bfox@gnu.org>
parents: 4380
diff changeset
45
9377
45228a0f6b78 (change-log-mode): Set font-lock-keywords locally.
Richard M. Stallman <rms@gnu.org>
parents: 9347
diff changeset
46 (defvar change-log-font-lock-keywords
11517
d453910ac3da change-log-font-lock-keywords efficiency fix.
Simon Marshall <simon@gnu.org>
parents: 9886
diff changeset
47 '(("^[SMTWF].+" . font-lock-function-name-face) ; Date line.
9377
45228a0f6b78 (change-log-mode): Set font-lock-keywords locally.
Richard M. Stallman <rms@gnu.org>
parents: 9347
diff changeset
48 ("^\t\\* \\([^ :\n]+\\)" 1 font-lock-comment-face) ; File name.
45228a0f6b78 (change-log-mode): Set font-lock-keywords locally.
Richard M. Stallman <rms@gnu.org>
parents: 9347
diff changeset
49 ("\(\\([^)\n]+\\)\)" 1 font-lock-keyword-face)) ; Function name.
45228a0f6b78 (change-log-mode): Set font-lock-keywords locally.
Richard M. Stallman <rms@gnu.org>
parents: 9347
diff changeset
50 "Additional expressions to highlight in Change Log mode.")
45228a0f6b78 (change-log-mode): Set font-lock-keywords locally.
Richard M. Stallman <rms@gnu.org>
parents: 9347
diff changeset
51
9500
a7ac5850ecb4 (change-log-mode-map): Move the definition up.
Richard M. Stallman <rms@gnu.org>
parents: 9471
diff changeset
52 (defvar change-log-mode-map nil
a7ac5850ecb4 (change-log-mode-map): Move the definition up.
Richard M. Stallman <rms@gnu.org>
parents: 9471
diff changeset
53 "Keymap for Change Log major mode.")
a7ac5850ecb4 (change-log-mode-map): Move the definition up.
Richard M. Stallman <rms@gnu.org>
parents: 9471
diff changeset
54 (if change-log-mode-map
a7ac5850ecb4 (change-log-mode-map): Move the definition up.
Richard M. Stallman <rms@gnu.org>
parents: 9471
diff changeset
55 nil
a7ac5850ecb4 (change-log-mode-map): Move the definition up.
Richard M. Stallman <rms@gnu.org>
parents: 9471
diff changeset
56 (setq change-log-mode-map (make-sparse-keymap))
a7ac5850ecb4 (change-log-mode-map): Move the definition up.
Richard M. Stallman <rms@gnu.org>
parents: 9471
diff changeset
57 (define-key change-log-mode-map "\M-q" 'change-log-fill-paragraph))
a7ac5850ecb4 (change-log-mode-map): Move the definition up.
Richard M. Stallman <rms@gnu.org>
parents: 9471
diff changeset
58
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
59 (defun change-log-name ()
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
60 (or change-log-default-name
5455
cbc904743f16 (change-log-name): Let default name for ms-dos be "change.log".
Richard M. Stallman <rms@gnu.org>
parents: 5301
diff changeset
61 (if (eq system-type 'vax-vms)
cbc904743f16 (change-log-name): Let default name for ms-dos be "change.log".
Richard M. Stallman <rms@gnu.org>
parents: 5301
diff changeset
62 "$CHANGE_LOG$.TXT"
9774
3e99bdb36cbb (change-log-name): Use changlo on windows-nt.
Richard M. Stallman <rms@gnu.org>
parents: 9500
diff changeset
63 (if (or (eq system-type 'ms-dos) (eq system-type 'windows-nt))
5467
4507b4972c4a (change-log-name): On MSDOS, use changelo.
Richard M. Stallman <rms@gnu.org>
parents: 5455
diff changeset
64 "changelo"
5455
cbc904743f16 (change-log-name): Let default name for ms-dos be "change.log".
Richard M. Stallman <rms@gnu.org>
parents: 5301
diff changeset
65 "ChangeLog"))))
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
66
4157
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
67 ;;;###autoload
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
68 (defun prompt-for-change-log-name ()
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
69 "Prompt for a change log name."
12157
f4a8265756e7 (prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents: 11816
diff changeset
70 (let* ((default (change-log-name))
f4a8265756e7 (prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents: 11816
diff changeset
71 (name (expand-file-name
f4a8265756e7 (prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents: 11816
diff changeset
72 (read-file-name (format "Log file (default %s): " default)
f4a8265756e7 (prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents: 11816
diff changeset
73 nil default))))
f4a8265756e7 (prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents: 11816
diff changeset
74 ;; Handle something that is syntactically a directory name.
f4a8265756e7 (prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents: 11816
diff changeset
75 ;; Look for ChangeLog or whatever in that directory.
f4a8265756e7 (prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents: 11816
diff changeset
76 (if (string= (file-name-nondirectory name) "")
f4a8265756e7 (prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents: 11816
diff changeset
77 (expand-file-name (file-name-nondirectory default)
f4a8265756e7 (prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents: 11816
diff changeset
78 name)
f4a8265756e7 (prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents: 11816
diff changeset
79 ;; Handle specifying a file that is a directory.
f4a8265756e7 (prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents: 11816
diff changeset
80 (if (file-directory-p name)
f4a8265756e7 (prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents: 11816
diff changeset
81 (expand-file-name (file-name-nondirectory default)
f4a8265756e7 (prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents: 11816
diff changeset
82 (file-name-as-directory name))
f4a8265756e7 (prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents: 11816
diff changeset
83 name))))
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
84
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
85 ;;;###autoload
2463
d3c9f0ad5964 (find-change-log): New function.
Roland McGrath <roland@gnu.org>
parents: 2307
diff changeset
86 (defun find-change-log (&optional file-name)
d3c9f0ad5964 (find-change-log): New function.
Roland McGrath <roland@gnu.org>
parents: 2307
diff changeset
87 "Find a change log file for \\[add-change-log-entry] and return the name.
8042
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
88
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
89 Optional arg FILE-NAME specifies the file to use.
9886
f54af6fe889e (find-change-log): If change-log-default-name
Richard M. Stallman <rms@gnu.org>
parents: 9774
diff changeset
90 If FILE-NAME is nil, use the value of `change-log-default-name'.
f54af6fe889e (find-change-log): If change-log-default-name
Richard M. Stallman <rms@gnu.org>
parents: 9774
diff changeset
91 If 'change-log-default-name' is nil, behave as though it were 'ChangeLog'
f54af6fe889e (find-change-log): If change-log-default-name
Richard M. Stallman <rms@gnu.org>
parents: 9774
diff changeset
92 \(or whatever we use on this operating system).
f54af6fe889e (find-change-log): If change-log-default-name
Richard M. Stallman <rms@gnu.org>
parents: 9774
diff changeset
93
f54af6fe889e (find-change-log): If change-log-default-name
Richard M. Stallman <rms@gnu.org>
parents: 9774
diff changeset
94 If 'change-log-default-name' contains a leading directory component, then
f54af6fe889e (find-change-log): If change-log-default-name
Richard M. Stallman <rms@gnu.org>
parents: 9774
diff changeset
95 simply find it in the current directory. Otherwise, search in the current
f54af6fe889e (find-change-log): If change-log-default-name
Richard M. Stallman <rms@gnu.org>
parents: 9774
diff changeset
96 directory and its successive parents for a file so named.
2463
d3c9f0ad5964 (find-change-log): New function.
Roland McGrath <roland@gnu.org>
parents: 2307
diff changeset
97
d3c9f0ad5964 (find-change-log): New function.
Roland McGrath <roland@gnu.org>
parents: 2307
diff changeset
98 Once a file is found, `change-log-default-name' is set locally in the
d3c9f0ad5964 (find-change-log): New function.
Roland McGrath <roland@gnu.org>
parents: 2307
diff changeset
99 current buffer to the complete file name."
8042
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
100 ;; If user specified a file name or if this buffer knows which one to use,
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
101 ;; just use that.
2463
d3c9f0ad5964 (find-change-log): New function.
Roland McGrath <roland@gnu.org>
parents: 2307
diff changeset
102 (or file-name
9886
f54af6fe889e (find-change-log): If change-log-default-name
Richard M. Stallman <rms@gnu.org>
parents: 9774
diff changeset
103 (setq file-name (and change-log-default-name
f54af6fe889e (find-change-log): If change-log-default-name
Richard M. Stallman <rms@gnu.org>
parents: 9774
diff changeset
104 (file-name-directory change-log-default-name)
f54af6fe889e (find-change-log): If change-log-default-name
Richard M. Stallman <rms@gnu.org>
parents: 9774
diff changeset
105 change-log-default-name))
8042
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
106 (progn
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
107 ;; Chase links in the source file
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
108 ;; and use the change log in the dir where it points.
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
109 (setq file-name (or (and buffer-file-name
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
110 (file-name-directory
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
111 (file-chase-links buffer-file-name)))
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
112 default-directory))
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
113 (if (file-directory-p file-name)
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
114 (setq file-name (expand-file-name (change-log-name) file-name)))
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
115 ;; Chase links before visiting the file.
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
116 ;; This makes it easier to use a single change log file
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
117 ;; for several related directories.
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
118 (setq file-name (file-chase-links file-name))
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
119 (setq file-name (expand-file-name file-name))
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
120 ;; Move up in the dir hierarchy till we find a change log file.
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
121 (let ((file1 file-name)
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
122 parent-dir)
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
123 (while (and (not (or (get-file-buffer file1) (file-exists-p file1)))
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
124 (progn (setq parent-dir
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
125 (file-name-directory
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
126 (directory-file-name
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
127 (file-name-directory file1))))
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
128 ;; Give up if we are already at the root dir.
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
129 (not (string= (file-name-directory file1)
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
130 parent-dir))))
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
131 ;; Move up to the parent dir and try again.
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
132 (setq file1 (expand-file-name
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
133 (file-name-nondirectory (change-log-name))
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
134 parent-dir)))
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
135 ;; If we found a change log in a parent, use that.
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
136 (if (or (get-file-buffer file1) (file-exists-p file1))
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
137 (setq file-name file1)))))
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
138 ;; Make a local variable in this buffer so we needn't search again.
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
139 (set (make-local-variable 'change-log-default-name) file-name)
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
140 file-name)
2463
d3c9f0ad5964 (find-change-log): New function.
Roland McGrath <roland@gnu.org>
parents: 2307
diff changeset
141
d3c9f0ad5964 (find-change-log): New function.
Roland McGrath <roland@gnu.org>
parents: 2307
diff changeset
142 ;;;###autoload
4157
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
143 (defun add-change-log-entry (&optional whoami file-name other-window new-entry)
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
144 "Find change log file and add an entry for today.
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
145 Optional arg (interactive prefix) non-nil means prompt for user name and site.
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
146 Second arg is file name of change log. If nil, uses `change-log-default-name'.
4157
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
147 Third arg OTHER-WINDOW non-nil means visit in other window.
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
148 Fourth arg NEW-ENTRY non-nil means always create a new entry at the front;
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
149 never append to an existing entry."
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
150 (interactive (list current-prefix-arg
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
151 (prompt-for-change-log-name)))
4741
c0ea0009268a add-log-full-name, add-log-mailing-address: new varialbes
Brian Fox <bfox@gnu.org>
parents: 4380
diff changeset
152 (if whoami
c0ea0009268a add-log-full-name, add-log-mailing-address: new varialbes
Brian Fox <bfox@gnu.org>
parents: 4380
diff changeset
153 (progn
c0ea0009268a add-log-full-name, add-log-mailing-address: new varialbes
Brian Fox <bfox@gnu.org>
parents: 4380
diff changeset
154 (setq add-log-full-name (read-input "Full name: " add-log-full-name))
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
155 ;; Note that some sites have room and phone number fields in
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
156 ;; full name which look silly when inserted. Rather than do
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
157 ;; anything about that here, let user give prefix argument so that
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
158 ;; s/he can edit the full name field in prompter if s/he wants.
4741
c0ea0009268a add-log-full-name, add-log-mailing-address: new varialbes
Brian Fox <bfox@gnu.org>
parents: 4380
diff changeset
159 (setq add-log-mailing-address
c0ea0009268a add-log-full-name, add-log-mailing-address: new varialbes
Brian Fox <bfox@gnu.org>
parents: 4380
diff changeset
160 (read-input "Mailing address: " add-log-mailing-address))))
9008
be396da9c611 (add-change-log-entry): Set add-log-full-name and
Richard M. Stallman <rms@gnu.org>
parents: 8949
diff changeset
161 (or add-log-full-name
be396da9c611 (add-change-log-entry): Set add-log-full-name and
Richard M. Stallman <rms@gnu.org>
parents: 8949
diff changeset
162 (setq add-log-full-name (user-full-name)))
be396da9c611 (add-change-log-entry): Set add-log-full-name and
Richard M. Stallman <rms@gnu.org>
parents: 8949
diff changeset
163 (or add-log-mailing-address
be396da9c611 (add-change-log-entry): Set add-log-full-name and
Richard M. Stallman <rms@gnu.org>
parents: 8949
diff changeset
164 (setq add-log-mailing-address user-mail-address))
4741
c0ea0009268a add-log-full-name, add-log-mailing-address: new varialbes
Brian Fox <bfox@gnu.org>
parents: 4380
diff changeset
165 (let ((defun (funcall (or add-log-current-defun-function
c0ea0009268a add-log-full-name, add-log-mailing-address: new varialbes
Brian Fox <bfox@gnu.org>
parents: 4380
diff changeset
166 'add-log-current-defun)))
c0ea0009268a add-log-full-name, add-log-mailing-address: new varialbes
Brian Fox <bfox@gnu.org>
parents: 4380
diff changeset
167 paragraph-end entry)
1752
b2af3186e7a7 (add-change-log-entry): Search for existing ChangeLog
Richard M. Stallman <rms@gnu.org>
parents: 1727
diff changeset
168
8136
9ad3db62f0e7 (add-change-log-entry): Apply expand-file-name to FILE-NAME.
Roland McGrath <roland@gnu.org>
parents: 8049
diff changeset
169 (setq file-name (expand-file-name (find-change-log file-name)))
1727
d6cc12c97a59 (add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents: 1644
diff changeset
170
d6cc12c97a59 (add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents: 1644
diff changeset
171 ;; Set ENTRY to the file name to use in the new entry.
d6cc12c97a59 (add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents: 1644
diff changeset
172 (and buffer-file-name
d6cc12c97a59 (add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents: 1644
diff changeset
173 ;; Never want to add a change log entry for the ChangeLog file itself.
d6cc12c97a59 (add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents: 1644
diff changeset
174 (not (string= buffer-file-name file-name))
d6cc12c97a59 (add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents: 1644
diff changeset
175 (setq entry (if (string-match
d6cc12c97a59 (add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents: 1644
diff changeset
176 (concat "^" (regexp-quote (file-name-directory
d6cc12c97a59 (add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents: 1644
diff changeset
177 file-name)))
d6cc12c97a59 (add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents: 1644
diff changeset
178 buffer-file-name)
d6cc12c97a59 (add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents: 1644
diff changeset
179 (substring buffer-file-name (match-end 0))
d6cc12c97a59 (add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents: 1644
diff changeset
180 (file-name-nondirectory buffer-file-name))))
d6cc12c97a59 (add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents: 1644
diff changeset
181
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
182 (if (and other-window (not (equal file-name buffer-file-name)))
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
183 (find-file-other-window file-name)
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
184 (find-file file-name))
5150
60fa14264c3b (add-change-log-entry): put buffer in change-log-mode.
Richard M. Stallman <rms@gnu.org>
parents: 5038
diff changeset
185 (or (eq major-mode 'change-log-mode)
60fa14264c3b (add-change-log-entry): put buffer in change-log-mode.
Richard M. Stallman <rms@gnu.org>
parents: 5038
diff changeset
186 (change-log-mode))
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
187 (undo-boundary)
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
188 (goto-char (point-min))
1956
02bb7721b67c (add-change-log-entry): Find end of first paragraph from after the header line.
Richard M. Stallman <rms@gnu.org>
parents: 1847
diff changeset
189 (if (looking-at (concat (regexp-quote (substring (current-time-string)
1727
d6cc12c97a59 (add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents: 1644
diff changeset
190 0 10))
4741
c0ea0009268a add-log-full-name, add-log-mailing-address: new varialbes
Brian Fox <bfox@gnu.org>
parents: 4380
diff changeset
191 ".* " (regexp-quote add-log-full-name)
8261
3eab4db14a5d (add-change-log-entry): Use <...> around mail address.
Richard M. Stallman <rms@gnu.org>
parents: 8136
diff changeset
192 " <" (regexp-quote add-log-mailing-address)))
1956
02bb7721b67c (add-change-log-entry): Find end of first paragraph from after the header line.
Richard M. Stallman <rms@gnu.org>
parents: 1847
diff changeset
193 (forward-line 1)
02bb7721b67c (add-change-log-entry): Find end of first paragraph from after the header line.
Richard M. Stallman <rms@gnu.org>
parents: 1847
diff changeset
194 (insert (current-time-string)
4741
c0ea0009268a add-log-full-name, add-log-mailing-address: new varialbes
Brian Fox <bfox@gnu.org>
parents: 4380
diff changeset
195 " " add-log-full-name
8261
3eab4db14a5d (add-change-log-entry): Use <...> around mail address.
Richard M. Stallman <rms@gnu.org>
parents: 8136
diff changeset
196 " <" add-log-mailing-address ">\n\n"))
1727
d6cc12c97a59 (add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents: 1644
diff changeset
197
1847
63af9f715bd3 (add-change-log-entry): Undo Jan 25 change. It worked for buffers in
Roland McGrath <roland@gnu.org>
parents: 1813
diff changeset
198 ;; Search only within the first paragraph.
1999
ced6a5b2519d (add-change-log-entry): Never move past second hdr line.
Richard M. Stallman <rms@gnu.org>
parents: 1956
diff changeset
199 (if (looking-at "\n*[^\n* \t]")
ced6a5b2519d (add-change-log-entry): Never move past second hdr line.
Richard M. Stallman <rms@gnu.org>
parents: 1956
diff changeset
200 (skip-chars-forward "\n")
ced6a5b2519d (add-change-log-entry): Never move past second hdr line.
Richard M. Stallman <rms@gnu.org>
parents: 1956
diff changeset
201 (forward-paragraph 1))
1727
d6cc12c97a59 (add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents: 1644
diff changeset
202 (setq paragraph-end (point))
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
203 (goto-char (point-min))
1727
d6cc12c97a59 (add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents: 1644
diff changeset
204
837
a8aef92e0025 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 811
diff changeset
205 ;; Now insert the new line for this entry.
1727
d6cc12c97a59 (add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents: 1644
diff changeset
206 (cond ((re-search-forward "^\\s *\\*\\s *$" paragraph-end t)
d6cc12c97a59 (add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents: 1644
diff changeset
207 ;; Put this file name into the existing empty entry.
d6cc12c97a59 (add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents: 1644
diff changeset
208 (if entry
d6cc12c97a59 (add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents: 1644
diff changeset
209 (insert entry)))
4157
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
210 ((and (not new-entry)
12551
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
211 (let (case-fold-search)
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
212 (re-search-forward
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
213 (concat (regexp-quote (concat "* " entry))
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
214 ;; Don't accept `foo.bar' when
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
215 ;; looking for `foo':
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
216 "\\(\\s \\|[(),:]\\)")
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
217 paragraph-end t)))
1727
d6cc12c97a59 (add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents: 1644
diff changeset
218 ;; Add to the existing entry for the same file.
d6cc12c97a59 (add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents: 1644
diff changeset
219 (re-search-forward "^\\s *$\\|^\\s \\*")
12551
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
220 (goto-char (match-beginning 0))
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
221 ;; Delete excess empty lines; make just 2.
912
1c37c99856de *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
222 (while (and (not (eobp)) (looking-at "^\\s *$"))
837
a8aef92e0025 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 811
diff changeset
223 (delete-region (point) (save-excursion (forward-line 1) (point))))
a8aef92e0025 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 811
diff changeset
224 (insert "\n\n")
a8aef92e0025 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 811
diff changeset
225 (forward-line -2)
678
8cff3b3bd089 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 666
diff changeset
226 (indent-relative-maybe))
666
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
227 (t
678
8cff3b3bd089 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 666
diff changeset
228 ;; Make a new entry.
8cff3b3bd089 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 666
diff changeset
229 (forward-line 1)
8cff3b3bd089 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 666
diff changeset
230 (while (looking-at "\\sW")
8cff3b3bd089 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 666
diff changeset
231 (forward-line 1))
912
1c37c99856de *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
232 (while (and (not (eobp)) (looking-at "^\\s *$"))
837
a8aef92e0025 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 811
diff changeset
233 (delete-region (point) (save-excursion (forward-line 1) (point))))
a8aef92e0025 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 811
diff changeset
234 (insert "\n\n\n")
a8aef92e0025 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 811
diff changeset
235 (forward-line -2)
678
8cff3b3bd089 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 666
diff changeset
236 (indent-to left-margin)
8cff3b3bd089 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 666
diff changeset
237 (insert "* " (or entry ""))))
837
a8aef92e0025 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 811
diff changeset
238 ;; Now insert the function name, if we have one.
666
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
239 ;; Point is at the entry for this file,
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
240 ;; either at the end of the line or at the first blank line.
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
241 (if defun
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
242 (progn
678
8cff3b3bd089 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 666
diff changeset
243 ;; Make it easy to get rid of the function name.
666
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
244 (undo-boundary)
678
8cff3b3bd089 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 666
diff changeset
245 (insert (if (save-excursion
8cff3b3bd089 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 666
diff changeset
246 (beginning-of-line 1)
8cff3b3bd089 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 666
diff changeset
247 (looking-at "\\s *$"))
8cff3b3bd089 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 666
diff changeset
248 ""
8cff3b3bd089 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 666
diff changeset
249 " ")
8cff3b3bd089 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 666
diff changeset
250 "(" defun "): "))
837
a8aef92e0025 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 811
diff changeset
251 ;; No function name, so put in a colon unless we have just a star.
678
8cff3b3bd089 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 666
diff changeset
252 (if (not (save-excursion
8cff3b3bd089 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 666
diff changeset
253 (beginning-of-line 1)
8cff3b3bd089 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 666
diff changeset
254 (looking-at "\\s *\\(\\*\\s *\\)?$")))
837
a8aef92e0025 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 811
diff changeset
255 (insert ": ")))))
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
256
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
257 ;;;###autoload
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
258 (defun add-change-log-entry-other-window (&optional whoami file-name)
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
259 "Find change log file in other window and add an entry for today.
4154
20a0593431b7 (add-log-current-defun-function): New defvar.
Roland McGrath <roland@gnu.org>
parents: 3897
diff changeset
260 Optional arg (interactive prefix) non-nil means prompt for user name and site.
20a0593431b7 (add-log-current-defun-function): New defvar.
Roland McGrath <roland@gnu.org>
parents: 3897
diff changeset
261 Second arg is file name of change log. \
20a0593431b7 (add-log-current-defun-function): New defvar.
Roland McGrath <roland@gnu.org>
parents: 3897
diff changeset
262 If nil, uses `change-log-default-name'."
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
263 (interactive (if current-prefix-arg
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
264 (list current-prefix-arg
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
265 (prompt-for-change-log-name))))
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
266 (add-change-log-entry whoami file-name t))
1727
d6cc12c97a59 (add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents: 1644
diff changeset
267 ;;;###autoload (define-key ctl-x-4-map "a" 'add-change-log-entry-other-window)
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
268
980
b62886fbf2a7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 953
diff changeset
269 ;;;###autoload
666
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
270 (defun change-log-mode ()
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 3499
diff changeset
271 "Major mode for editing change logs; like Indented Text Mode.
912
1c37c99856de *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
272 Prevents numeric backups and sets `left-margin' to 8 and `fill-column' to 74.
951
c23539669808 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 947
diff changeset
273 New log entries are usually made with \\[add-change-log-entry] or \\[add-change-log-entry-other-window].
c23539669808 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 947
diff changeset
274 Each entry behaves as a paragraph, and the entries for one day as a page.
c23539669808 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 947
diff changeset
275 Runs `change-log-mode-hook'."
666
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
276 (interactive)
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
277 (kill-all-local-variables)
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
278 (indented-text-mode)
1727
d6cc12c97a59 (add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents: 1644
diff changeset
279 (setq major-mode 'change-log-mode
d6cc12c97a59 (add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents: 1644
diff changeset
280 mode-name "Change Log"
d6cc12c97a59 (add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents: 1644
diff changeset
281 left-margin 8
d6cc12c97a59 (add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents: 1644
diff changeset
282 fill-column 74)
4157
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
283 (use-local-map change-log-mode-map)
666
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
284 ;; Let each entry behave as one paragraph:
4380
0c7aefc58e0f (change-log-mode): Use \f for formfeed, to avoid syntax error.
Richard M. Stallman <rms@gnu.org>
parents: 4157
diff changeset
285 (set (make-local-variable 'paragraph-start) "^\\s *$\\|^\f")
0c7aefc58e0f (change-log-mode): Use \f for formfeed, to avoid syntax error.
Richard M. Stallman <rms@gnu.org>
parents: 4157
diff changeset
286 (set (make-local-variable 'paragraph-separate) "^\\s *$\\|^\f\\|^\\sw")
666
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
287 ;; Let all entries for one day behave as one page.
1078
15b4ed20e524 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1062
diff changeset
288 ;; Match null string on the date-line so that the date-line
15b4ed20e524 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1062
diff changeset
289 ;; is grouped with what follows.
4380
0c7aefc58e0f (change-log-mode): Use \f for formfeed, to avoid syntax error.
Richard M. Stallman <rms@gnu.org>
parents: 4157
diff changeset
290 (set (make-local-variable 'page-delimiter) "^\\<\\|^\f")
678
8cff3b3bd089 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 666
diff changeset
291 (set (make-local-variable 'version-control) 'never)
8cff3b3bd089 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 666
diff changeset
292 (set (make-local-variable 'adaptive-fill-regexp) "\\s *")
9471
1b933ccf3c20 * add-log.el: (change-log-mode): Set font-lock-defaults.
Simon Marshall <simon@gnu.org>
parents: 9397
diff changeset
293 (set (make-local-variable 'font-lock-defaults)
1b933ccf3c20 * add-log.el: (change-log-mode): Set font-lock-defaults.
Simon Marshall <simon@gnu.org>
parents: 9397
diff changeset
294 '(change-log-font-lock-keywords t))
666
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
295 (run-hooks 'change-log-mode-hook))
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
296
4157
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
297 ;; It might be nice to have a general feature to replace this. The idea I
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
298 ;; have is a variable giving a regexp matching text which should not be
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
299 ;; moved from bol by filling. change-log-mode would set this to "^\\s *\\s(".
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
300 ;; But I don't feel up to implementing that today.
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
301 (defun change-log-fill-paragraph (&optional justify)
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
302 "Fill the paragraph, but preserve open parentheses at beginning of lines.
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
303 Prefix arg means justify as well."
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
304 (interactive "P")
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
305 (let ((paragraph-separate (concat paragraph-separate "\\|^\\s *\\s("))
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
306 (paragraph-start (concat paragraph-start "\\|^\\s *\\s(")))
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
307 (fill-paragraph justify)))
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
308
666
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
309 (defvar add-log-current-defun-header-regexp
6309
9217f29851c2 Don't use triple-hyphen in a character class.
Karl Heuer <kwzh@gnu.org>
parents: 5467
diff changeset
310 "^\\([A-Z][A-Z_ ]*[A-Z_]\\|[-_a-zA-Z]+\\)[ \t]*[:=]"
666
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
311 "*Heuristic regexp used by `add-log-current-defun' for unknown major modes.")
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
312
6562
0541a368505c (add-log-current-defun): Autoload this.
Roland McGrath <roland@gnu.org>
parents: 6309
diff changeset
313 ;;;###autoload
666
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
314 (defun add-log-current-defun ()
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
315 "Return name of function definition point is in, or nil.
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
316
3499
6428162f137c (add-log-current-defun): Fix typos in last change.
Richard M. Stallman <rms@gnu.org>
parents: 3486
diff changeset
317 Understands C, Lisp, LaTeX (\"functions\" are chapters, sections, ...),
9347
1a69634e3477 (add-log-current-defun): Handle Perl specially.
Richard M. Stallman <rms@gnu.org>
parents: 9008
diff changeset
318 Texinfo (@node titles), Perl, and Fortran.
666
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
319
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
320 Other modes are handled by a heuristic that looks in the 10K before
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
321 point for uppercase headings starting in the first column or
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
322 identifiers followed by `:' or `=', see variable
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
323 `add-log-current-defun-header-regexp'.
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
324
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
325 Has a preference of looking backwards."
1447
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
326 (condition-case nil
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
327 (save-excursion
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
328 (let ((location (point)))
8949
b307091cdf97 (add-log-current-defun): Deal with lisp-interaction-mode like lisp-mode.
Richard M. Stallman <rms@gnu.org>
parents: 8313
diff changeset
329 (cond ((memq major-mode '(emacs-lisp-mode lisp-mode scheme-mode
b307091cdf97 (add-log-current-defun): Deal with lisp-interaction-mode like lisp-mode.
Richard M. Stallman <rms@gnu.org>
parents: 8313
diff changeset
330 lisp-interaction-mode))
13086
1bc6075184d7 (add-log-current-defun): Ignore quotes before fcn name.
Richard M. Stallman <rms@gnu.org>
parents: 12551
diff changeset
331 ;; If we are now precisely at the beginning of a defun,
1447
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
332 ;; make sure beginning-of-defun finds that one
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
333 ;; rather than the previous one.
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
334 (or (eobp) (forward-char 1))
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
335 (beginning-of-defun)
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
336 ;; Make sure we are really inside the defun found, not after it.
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
337 (if (and (progn (end-of-defun)
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
338 (< location (point)))
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
339 (progn (forward-sexp -1)
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
340 (>= location (point))))
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
341 (progn
3853
d771acf8f6ef * add-log.el (add-log-current-defun): To find the name of the
Jim Blandy <jimb@redhat.com>
parents: 3591
diff changeset
342 (if (looking-at "\\s(")
d771acf8f6ef * add-log.el (add-log-current-defun): To find the name of the
Jim Blandy <jimb@redhat.com>
parents: 3591
diff changeset
343 (forward-char 1))
d771acf8f6ef * add-log.el (add-log-current-defun): To find the name of the
Jim Blandy <jimb@redhat.com>
parents: 3591
diff changeset
344 (forward-sexp 1)
13086
1bc6075184d7 (add-log-current-defun): Ignore quotes before fcn name.
Richard M. Stallman <rms@gnu.org>
parents: 12551
diff changeset
345 (skip-chars-forward " '")
1447
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
346 (buffer-substring (point)
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
347 (progn (forward-sexp 1) (point))))))
11757
108646bbd84f (add-log-current-defun): Handle objc-mode like c-mode;
Richard M. Stallman <rms@gnu.org>
parents: 11749
diff changeset
348 ((and (memq major-mode '(c-mode c++-mode c++-c-mode objc-mode))
1447
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
349 (save-excursion (beginning-of-line)
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
350 ;; Use eq instead of = here to avoid
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
351 ;; error when at bob and char-after
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
352 ;; returns nil.
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
353 (while (eq (char-after (- (point) 2)) ?\\)
953
7c035a87c691 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 951
diff changeset
354 (forward-line -1))
1447
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
355 (looking-at "[ \t]*#[ \t]*define[ \t]")))
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
356 ;; Handle a C macro definition.
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
357 (beginning-of-line)
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
358 (while (eq (char-after (- (point) 2)) ?\\) ;not =; note above
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
359 (forward-line -1))
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
360 (search-forward "define")
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
361 (skip-chars-forward " \t")
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
362 (buffer-substring (point)
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
363 (progn (forward-sexp 1) (point))))
11757
108646bbd84f (add-log-current-defun): Handle objc-mode like c-mode;
Richard M. Stallman <rms@gnu.org>
parents: 11749
diff changeset
364 ((memq major-mode '(c-mode c++-mode c++-c-mode objc-mode))
1447
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
365 (beginning-of-line)
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
366 ;; See if we are in the beginning part of a function,
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
367 ;; before the open brace. If so, advance forward.
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
368 (while (not (looking-at "{\\|\\(\\s *$\\)"))
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
369 (forward-line 1))
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
370 (or (eobp)
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
371 (forward-char 1))
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
372 (beginning-of-defun)
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
373 (if (progn (end-of-defun)
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
374 (< location (point)))
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
375 (progn
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
376 (backward-sexp 1)
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
377 (let (beg tem)
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
378
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
379 (forward-line -1)
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
380 ;; Skip back over typedefs of arglist.
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
381 (while (and (not (bobp))
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
382 (looking-at "[ \t\n]"))
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
383 (forward-line -1))
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
384 ;; See if this is using the DEFUN macro used in Emacs,
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
385 ;; or the DEFUN macro used by the C library.
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
386 (if (condition-case nil
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
387 (and (save-excursion
8313
589abdc989e1 (add-log-current-defun): Skip doc string
Richard M. Stallman <rms@gnu.org>
parents: 8261
diff changeset
388 (end-of-line)
589abdc989e1 (add-log-current-defun): Skip doc string
Richard M. Stallman <rms@gnu.org>
parents: 8261
diff changeset
389 (while (= (preceding-char) ?\\)
589abdc989e1 (add-log-current-defun): Skip doc string
Richard M. Stallman <rms@gnu.org>
parents: 8261
diff changeset
390 (end-of-line 2))
1447
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
391 (backward-sexp 1)
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
392 (beginning-of-line)
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
393 (setq tem (point))
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
394 (looking-at "DEFUN\\b"))
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
395 (>= location tem))
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
396 (error nil))
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
397 (progn
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
398 (goto-char tem)
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
399 (down-list 1)
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
400 (if (= (char-after (point)) ?\")
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
401 (progn
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
402 (forward-sexp 1)
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
403 (skip-chars-forward " ,")))
953
7c035a87c691 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 951
diff changeset
404 (buffer-substring (point)
1447
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
405 (progn (forward-sexp 1) (point))))
11757
108646bbd84f (add-log-current-defun): Handle objc-mode like c-mode;
Richard M. Stallman <rms@gnu.org>
parents: 11749
diff changeset
406 (if (looking-at "^[+-]")
108646bbd84f (add-log-current-defun): Handle objc-mode like c-mode;
Richard M. Stallman <rms@gnu.org>
parents: 11749
diff changeset
407 (get-method-definition)
108646bbd84f (add-log-current-defun): Handle objc-mode like c-mode;
Richard M. Stallman <rms@gnu.org>
parents: 11749
diff changeset
408 ;; Ordinary C function syntax.
108646bbd84f (add-log-current-defun): Handle objc-mode like c-mode;
Richard M. Stallman <rms@gnu.org>
parents: 11749
diff changeset
409 (setq beg (point))
12551
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
410 (if (and (condition-case nil
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
411 ;; Protect against "Unbalanced parens" error.
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
412 (progn
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
413 (down-list 1) ; into arglist
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
414 (backward-up-list 1)
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
415 (skip-chars-backward " \t")
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
416 t)
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
417 (error nil))
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
418 ;; Verify initial pos was after
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
419 ;; real start of function.
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
420 (save-excursion
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
421 (goto-char beg)
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
422 ;; For this purpose, include the line
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
423 ;; that has the decl keywords. This
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
424 ;; may also include some of the
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
425 ;; comments before the function.
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
426 (while (and (not (bobp))
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
427 (save-excursion
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
428 (forward-line -1)
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
429 (looking-at "[^\n\f]")))
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
430 (forward-line -1))
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
431 (>= location (point)))
11757
108646bbd84f (add-log-current-defun): Handle objc-mode like c-mode;
Richard M. Stallman <rms@gnu.org>
parents: 11749
diff changeset
432 ;; Consistency check: going down and up
108646bbd84f (add-log-current-defun): Handle objc-mode like c-mode;
Richard M. Stallman <rms@gnu.org>
parents: 11749
diff changeset
433 ;; shouldn't take us back before BEG.
108646bbd84f (add-log-current-defun): Handle objc-mode like c-mode;
Richard M. Stallman <rms@gnu.org>
parents: 11749
diff changeset
434 (> (point) beg))
12551
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
435 (let (end middle)
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
436 ;; Don't include any final newline
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
437 ;; in the name we use.
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
438 (if (= (preceding-char) ?\n)
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
439 (forward-char -1))
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
440 (setq end (point))
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
441 (backward-sexp 1)
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
442 ;; Now find the right beginning of the name.
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
443 ;; Include certain keywords if they
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
444 ;; precede the name.
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
445 (setq middle (point))
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
446 (forward-word -1)
13255
9e94f911f00c (add-log-current-defun): Handle `private', `public' in C++ class definitions.
Richard M. Stallman <rms@gnu.org>
parents: 13086
diff changeset
447 ;; Ignore these subparts of a class decl
9e94f911f00c (add-log-current-defun): Handle `private', `public' in C++ class definitions.
Richard M. Stallman <rms@gnu.org>
parents: 13086
diff changeset
448 ;; and move back to the class name itself.
9e94f911f00c (add-log-current-defun): Handle `private', `public' in C++ class definitions.
Richard M. Stallman <rms@gnu.org>
parents: 13086
diff changeset
449 (while (looking-at "public \\|private ")
9e94f911f00c (add-log-current-defun): Handle `private', `public' in C++ class definitions.
Richard M. Stallman <rms@gnu.org>
parents: 13086
diff changeset
450 (skip-chars-backward " \t:")
9e94f911f00c (add-log-current-defun): Handle `private', `public' in C++ class definitions.
Richard M. Stallman <rms@gnu.org>
parents: 13086
diff changeset
451 (setq end (point))
9e94f911f00c (add-log-current-defun): Handle `private', `public' in C++ class definitions.
Richard M. Stallman <rms@gnu.org>
parents: 13086
diff changeset
452 (backward-sexp 1)
9e94f911f00c (add-log-current-defun): Handle `private', `public' in C++ class definitions.
Richard M. Stallman <rms@gnu.org>
parents: 13086
diff changeset
453 (setq middle (point))
9e94f911f00c (add-log-current-defun): Handle `private', `public' in C++ class definitions.
Richard M. Stallman <rms@gnu.org>
parents: 13086
diff changeset
454 (forward-word -1))
12551
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
455 (and (bolp)
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
456 (looking-at "struct \\|union \\|class ")
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
457 (setq middle (point)))
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
458 (buffer-substring middle end)))))))))
1447
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
459 ((memq major-mode
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
460 '(TeX-mode plain-TeX-mode LaTeX-mode;; tex-mode.el
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
461 plain-tex-mode latex-mode;; cmutex.el
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
462 ))
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
463 (if (re-search-backward
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
464 "\\\\\\(sub\\)*\\(section\\|paragraph\\|chapter\\)" nil t)
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
465 (progn
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
466 (goto-char (match-beginning 0))
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
467 (buffer-substring (1+ (point));; without initial backslash
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
468 (progn
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
469 (end-of-line)
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
470 (point))))))
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
471 ((eq major-mode 'texinfo-mode)
9397
eba13d81ba0b (add-log-current-defun): In texinfo-mode,
Richard M. Stallman <rms@gnu.org>
parents: 9377
diff changeset
472 (if (re-search-backward "^@node[ \t]+\\([^,\n]+\\)" nil t)
1447
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
473 (buffer-substring (match-beginning 1)
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
474 (match-end 1))))
9347
1a69634e3477 (add-log-current-defun): Handle Perl specially.
Richard M. Stallman <rms@gnu.org>
parents: 9008
diff changeset
475 ((eq major-mode 'perl-mode)
1a69634e3477 (add-log-current-defun): Handle Perl specially.
Richard M. Stallman <rms@gnu.org>
parents: 9008
diff changeset
476 (if (re-search-backward "^sub[ \t]+\\([^ \t\n]+\\)" nil t)
1a69634e3477 (add-log-current-defun): Handle Perl specially.
Richard M. Stallman <rms@gnu.org>
parents: 9008
diff changeset
477 (buffer-substring (match-beginning 1)
1a69634e3477 (add-log-current-defun): Handle Perl specially.
Richard M. Stallman <rms@gnu.org>
parents: 9008
diff changeset
478 (match-end 1))))
3486
a4b23b25b671 (add-log-current-defun): Handle Fortran.
Richard M. Stallman <rms@gnu.org>
parents: 3261
diff changeset
479 ((eq major-mode 'fortran-mode)
a4b23b25b671 (add-log-current-defun): Handle Fortran.
Richard M. Stallman <rms@gnu.org>
parents: 3261
diff changeset
480 ;; must be inside function body for this to work
a4b23b25b671 (add-log-current-defun): Handle Fortran.
Richard M. Stallman <rms@gnu.org>
parents: 3261
diff changeset
481 (beginning-of-fortran-subprogram)
a4b23b25b671 (add-log-current-defun): Handle Fortran.
Richard M. Stallman <rms@gnu.org>
parents: 3261
diff changeset
482 (let ((case-fold-search t)) ; case-insensitive
a4b23b25b671 (add-log-current-defun): Handle Fortran.
Richard M. Stallman <rms@gnu.org>
parents: 3261
diff changeset
483 ;; search for fortran subprogram start
a4b23b25b671 (add-log-current-defun): Handle Fortran.
Richard M. Stallman <rms@gnu.org>
parents: 3261
diff changeset
484 (if (re-search-forward
a4b23b25b671 (add-log-current-defun): Handle Fortran.
Richard M. Stallman <rms@gnu.org>
parents: 3261
diff changeset
485 "^[ \t]*\\(program\\|subroutine\\|function\
a4b23b25b671 (add-log-current-defun): Handle Fortran.
Richard M. Stallman <rms@gnu.org>
parents: 3261
diff changeset
486 \\|[ \ta-z0-9*]*[ \t]+function\\)"
3499
6428162f137c (add-log-current-defun): Fix typos in last change.
Richard M. Stallman <rms@gnu.org>
parents: 3486
diff changeset
487 nil t)
3486
a4b23b25b671 (add-log-current-defun): Handle Fortran.
Richard M. Stallman <rms@gnu.org>
parents: 3261
diff changeset
488 (progn
a4b23b25b671 (add-log-current-defun): Handle Fortran.
Richard M. Stallman <rms@gnu.org>
parents: 3261
diff changeset
489 ;; move to EOL or before first left paren
a4b23b25b671 (add-log-current-defun): Handle Fortran.
Richard M. Stallman <rms@gnu.org>
parents: 3261
diff changeset
490 (if (re-search-forward "[(\n]" nil t)
a4b23b25b671 (add-log-current-defun): Handle Fortran.
Richard M. Stallman <rms@gnu.org>
parents: 3261
diff changeset
491 (progn (forward-char -1)
a4b23b25b671 (add-log-current-defun): Handle Fortran.
Richard M. Stallman <rms@gnu.org>
parents: 3261
diff changeset
492 (skip-chars-backward " \t"))
a4b23b25b671 (add-log-current-defun): Handle Fortran.
Richard M. Stallman <rms@gnu.org>
parents: 3261
diff changeset
493 (end-of-line))
a4b23b25b671 (add-log-current-defun): Handle Fortran.
Richard M. Stallman <rms@gnu.org>
parents: 3261
diff changeset
494 ;; Use the name preceding that.
a4b23b25b671 (add-log-current-defun): Handle Fortran.
Richard M. Stallman <rms@gnu.org>
parents: 3261
diff changeset
495 (buffer-substring (point)
a4b23b25b671 (add-log-current-defun): Handle Fortran.
Richard M. Stallman <rms@gnu.org>
parents: 3261
diff changeset
496 (progn (forward-sexp -1)
a4b23b25b671 (add-log-current-defun): Handle Fortran.
Richard M. Stallman <rms@gnu.org>
parents: 3261
diff changeset
497 (point)))))))
1447
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
498 (t
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
499 ;; If all else fails, try heuristics
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
500 (let (case-fold-search)
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
501 (end-of-line)
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
502 (if (re-search-backward add-log-current-defun-header-regexp
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
503 (- (point) 10000)
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
504 t)
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
505 (buffer-substring (match-beginning 1)
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
506 (match-end 1))))))))
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
507 (error nil)))
999
d8d503897aa5 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 980
diff changeset
508
11749
8da04214faed (get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 11517
diff changeset
509 ;; Subroutine used within get-method-definition.
8da04214faed (get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 11517
diff changeset
510 ;; Add the last match in the buffer to the end of `md',
8da04214faed (get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 11517
diff changeset
511 ;; followed by the string END; move to the end of that match.
8da04214faed (get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 11517
diff changeset
512 (defun get-method-definition-1 (end)
8da04214faed (get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 11517
diff changeset
513 (setq md (concat md
8da04214faed (get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 11517
diff changeset
514 (buffer-substring (match-beginning 1) (match-end 1))
8da04214faed (get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 11517
diff changeset
515 end))
8da04214faed (get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 11517
diff changeset
516 (goto-char (match-end 0)))
8da04214faed (get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 11517
diff changeset
517
8da04214faed (get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 11517
diff changeset
518 ;; For objective C, return the method name if we are in a method.
8da04214faed (get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 11517
diff changeset
519 (defun get-method-definition ()
8da04214faed (get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 11517
diff changeset
520 (let ((md "["))
8da04214faed (get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 11517
diff changeset
521 (save-excursion
11816
2a8e1b01bc15 (get-method-definition): Fix regexps.
Karl Heuer <kwzh@gnu.org>
parents: 11757
diff changeset
522 (if (re-search-backward "^@implementation\\s-*\\([A-Za-z_]*\\)" nil t)
11749
8da04214faed (get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 11517
diff changeset
523 (get-method-definition-1 " ")))
8da04214faed (get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 11517
diff changeset
524 (save-excursion
8da04214faed (get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 11517
diff changeset
525 (cond
11816
2a8e1b01bc15 (get-method-definition): Fix regexps.
Karl Heuer <kwzh@gnu.org>
parents: 11757
diff changeset
526 ((re-search-forward "^\\([-+]\\)[ \t\n\f\r]*\\(([^)]*)\\)?\\s-*" nil t)
11749
8da04214faed (get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 11517
diff changeset
527 (get-method-definition-1 "")
8da04214faed (get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 11517
diff changeset
528 (while (not (looking-at "[{;]"))
8da04214faed (get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 11517
diff changeset
529 (looking-at
11816
2a8e1b01bc15 (get-method-definition): Fix regexps.
Karl Heuer <kwzh@gnu.org>
parents: 11757
diff changeset
530 "\\([A-Za-z_]*:?\\)\\s-*\\(([^)]*)\\)?[A-Za-z_]*[ \t\n\f\r]*")
11749
8da04214faed (get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 11517
diff changeset
531 (get-method-definition-1 ""))
8da04214faed (get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 11517
diff changeset
532 (concat md "]"))))))
8da04214faed (get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 11517
diff changeset
533
999
d8d503897aa5 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 980
diff changeset
534
980
b62886fbf2a7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 953
diff changeset
535 (provide 'add-log)
b62886fbf2a7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 953
diff changeset
536
811
e694e0879463 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 678
diff changeset
537 ;;; add-log.el ends here