Mercurial > emacs
annotate lisp/add-log.el @ 49590:eac277ee1787
*** empty log message ***
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Tue, 04 Feb 2003 11:29:35 +0000 |
parents | 0e6cefe9e2d0 |
children | caadcafadb0c d7ddb3e565de |
rev | line source |
---|---|
22388 | 1 ;;; add-log.el --- change log maintenance commands for Emacs |
661 | 2 |
28446 | 3 ;; Copyright (C) 1985, 86, 88, 93, 94, 97, 98, 2000 Free Software Foundation, Inc. |
661 | 4 |
38697
a19197c6442f
Keyword added and FSF specified as Maintainer.
Pavel Janík <Pavel@Janik.cz>
parents:
36604
diff
changeset
|
5 ;; Maintainer: FSF |
18277
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
6 ;; Keywords: tools |
2247
2c7997f249eb
Add or correct keywords
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1999
diff
changeset
|
7 |
661 | 8 ;; This file is part of GNU Emacs. |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; 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
|
12 ;; the Free Software Foundation; either version 2, or (at your option) |
661 | 13 ;; any later version. |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
14169 | 21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
23 ;; Boston, MA 02111-1307, USA. | |
661 | 24 |
2307
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2247
diff
changeset
|
25 ;;; Commentary: |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2247
diff
changeset
|
26 |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2247
diff
changeset
|
27 ;; 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
|
28 |
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
678
diff
changeset
|
29 ;;; Code: |
661 | 30 |
27003
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
31 (eval-when-compile |
28446 | 32 (require 'timezone)) |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
33 |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
34 (defgroup change-log nil |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
35 "Change log maintenance" |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
36 :group 'tools |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
37 :link '(custom-manual "(emacs)Change Log") |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
38 :prefix "change-log-" |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
39 :prefix "add-log-") |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
40 |
661 | 41 |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
42 (defcustom change-log-default-name nil |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
43 "*Name of a change log file for \\[add-change-log-entry]." |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
44 :type '(choice (const :tag "default" nil) |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
45 string) |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
46 :group 'change-log) |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
47 |
26613
7f7e6de546ac
(change-log-mode-hook): Customize.
Dave Love <fx@gnu.org>
parents:
25273
diff
changeset
|
48 (defcustom change-log-mode-hook nil |
7f7e6de546ac
(change-log-mode-hook): Customize.
Dave Love <fx@gnu.org>
parents:
25273
diff
changeset
|
49 "Normal hook run by `change-log-mode'." |
7f7e6de546ac
(change-log-mode-hook): Customize.
Dave Love <fx@gnu.org>
parents:
25273
diff
changeset
|
50 :type 'hook |
7f7e6de546ac
(change-log-mode-hook): Customize.
Dave Love <fx@gnu.org>
parents:
25273
diff
changeset
|
51 :group 'change-log) |
7f7e6de546ac
(change-log-mode-hook): Customize.
Dave Love <fx@gnu.org>
parents:
25273
diff
changeset
|
52 |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
53 (defcustom add-log-current-defun-function nil |
28446 | 54 "*If non-nil, function to guess name of surrounding function. |
55 It is used by `add-log-current-defun' in preference to built-in rules. | |
56 Returns function's name as a string, or nil if outside a function." | |
35936 | 57 :type '(choice (const nil) function) |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
58 :group 'change-log) |
4154
20a0593431b7
(add-log-current-defun-function): New defvar.
Roland McGrath <roland@gnu.org>
parents:
3897
diff
changeset
|
59 |
14856
f64fa743c80f
(add-log-full-name, add-log-mailing-address): Add autoload cookies.
Richard M. Stallman <rms@gnu.org>
parents:
14528
diff
changeset
|
60 ;;;###autoload |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
61 (defcustom 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
|
62 "*Full name of user, for inclusion in ChangeLog daily headers. |
27240 | 63 This defaults to the value returned by the function `user-full-name'." |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
64 :type '(choice (const :tag "Default" nil) |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
65 string) |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
66 :group 'change-log) |
4741
c0ea0009268a
add-log-full-name, add-log-mailing-address: new varialbes
Brian Fox <bfox@gnu.org>
parents:
4380
diff
changeset
|
67 |
14856
f64fa743c80f
(add-log-full-name, add-log-mailing-address): Add autoload cookies.
Richard M. Stallman <rms@gnu.org>
parents:
14528
diff
changeset
|
68 ;;;###autoload |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
69 (defcustom add-log-mailing-address nil |
45267
c9022ab03c89
(add-log-mailing-address): Can be a list, too.
Colin Walters <walters@gnu.org>
parents:
45255
diff
changeset
|
70 "*Electronic mail addresses of user, for inclusion in ChangeLog headers. |
c9022ab03c89
(add-log-mailing-address): Can be a list, too.
Colin Walters <walters@gnu.org>
parents:
45255
diff
changeset
|
71 This defaults to the value of `user-mail-address'. In addition to |
c9022ab03c89
(add-log-mailing-address): Can be a list, too.
Colin Walters <walters@gnu.org>
parents:
45255
diff
changeset
|
72 being a simple string, this value can also be a list. All elements |
c9022ab03c89
(add-log-mailing-address): Can be a list, too.
Colin Walters <walters@gnu.org>
parents:
45255
diff
changeset
|
73 will be recognized as referring to the same user; when creating a new |
c9022ab03c89
(add-log-mailing-address): Can be a list, too.
Colin Walters <walters@gnu.org>
parents:
45255
diff
changeset
|
74 ChangeLog entry, one element will be chosen at random." |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
75 :type '(choice (const :tag "Default" nil) |
46632
ac754a11b012
(add-log-mailing-address): Fix type. Can be a string.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
45267
diff
changeset
|
76 (string :tag "String") |
ac754a11b012
(add-log-mailing-address): Fix type. Can be a string.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
45267
diff
changeset
|
77 (repeat :tag "List of Strings" string)) |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
78 :group 'change-log) |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
79 |
18277
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
80 (defcustom add-log-time-format 'add-log-iso8601-time-string |
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
81 "*Function that defines the time format. |
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
82 For example, `add-log-iso8601-time-string', which gives the |
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
83 date in international ISO 8601 format, |
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
84 and `current-time-string' are two valid values." |
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
85 :type '(radio (const :tag "International ISO 8601 format" |
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
86 add-log-iso8601-time-string) |
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
87 (const :tag "Old format, as returned by `current-time-string'" |
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
88 current-time-string) |
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
89 (function :tag "Other")) |
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
90 :group 'change-log) |
4741
c0ea0009268a
add-log-full-name, add-log-mailing-address: new varialbes
Brian Fox <bfox@gnu.org>
parents:
4380
diff
changeset
|
91 |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
92 (defcustom add-log-keep-changes-together nil |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
93 "*If non-nil, normally keep day's log entries for one file together. |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
94 |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
95 Log entries for a given file made with \\[add-change-log-entry] or |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
96 \\[add-change-log-entry-other-window] will only be added to others \ |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
97 for that file made |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
98 today if this variable is non-nil or that file comes first in today's |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
99 entries. Otherwise another entry for that file will be started. An |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
100 original log: |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
101 |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
102 * foo (...): ... |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
103 * bar (...): change 1 |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
104 |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
105 in the latter case, \\[add-change-log-entry-other-window] in a \ |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
106 buffer visiting `bar', yields: |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
107 |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
108 * bar (...): -!- |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
109 * foo (...): ... |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
110 * bar (...): change 1 |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
111 |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
112 and in the former: |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
113 |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
114 * foo (...): ... |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
115 * bar (...): change 1 |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
116 (...): -!- |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
117 |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
118 The NEW-ENTRY arg to `add-change-log-entry' can override the effect of |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
119 this variable." |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
120 :version "20.3" |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
121 :type 'boolean |
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
122 :group 'change-log) |
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
123 |
40315
e41eca24ba8c
(add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents:
39625
diff
changeset
|
124 (defcustom add-log-always-start-new-record nil |
e41eca24ba8c
(add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents:
39625
diff
changeset
|
125 "*If non-nil, `add-change-log-entry' will always start a new record." |
45255
20c79f08a7da
Change all post-21.1 :version attributes to 21.4.
Eli Zaretskii <eliz@gnu.org>
parents:
40315
diff
changeset
|
126 :version "21.4" |
40315
e41eca24ba8c
(add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents:
39625
diff
changeset
|
127 :type 'boolean |
e41eca24ba8c
(add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents:
39625
diff
changeset
|
128 :group 'change-log) |
e41eca24ba8c
(add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents:
39625
diff
changeset
|
129 |
32011
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
130 (defcustom add-log-buffer-file-name-function nil |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
131 "*If non-nil, function to call to identify the full filename of a buffer. |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
132 This function is called with no argument. If this is nil, the default is to |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
133 use `buffer-file-name'." |
35936 | 134 :type '(choice (const nil) function) |
32011
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
135 :group 'change-log) |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
136 |
24289
7917ac967ee5
(add-log-file-name-function): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
23215
diff
changeset
|
137 (defcustom add-log-file-name-function nil |
7917ac967ee5
(add-log-file-name-function): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
23215
diff
changeset
|
138 "*If non-nil, function to call to identify the filename for a ChangeLog entry. |
27240 | 139 This function is called with one argument, the value of variable |
140 `buffer-file-name' in that buffer. If this is nil, the default is to | |
141 use the file's name relative to the directory of the change log file." | |
35936 | 142 :type '(choice (const nil) function) |
24289
7917ac967ee5
(add-log-file-name-function): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
23215
diff
changeset
|
143 :group 'change-log) |
7917ac967ee5
(add-log-file-name-function): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
23215
diff
changeset
|
144 |
27003
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
145 |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
146 (defcustom change-log-version-info-enabled nil |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
147 "*If non-nil, enable recording version numbers with the changes." |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
148 :version "21.1" |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
149 :type 'boolean |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
150 :group 'change-log) |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
151 |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
152 (defcustom change-log-version-number-regexp-list |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
153 (let ((re "\\([0-9]+\.[0-9.]+\\)")) |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
154 (list |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
155 ;; (defconst ad-version "2.15" |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
156 (concat "^(def[^ \t\n]+[ \t]+[^ \t\n][ \t]\"" re) |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
157 ;; Revision: pcl-cvs.el,v 1.72 1999/09/05 20:21:54 monnier Exp |
28446 | 158 (concat "^;+ *Revision: +[^ \t\n]+[ \t]+" re))) |
27003
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
159 "*List of regexps to search for version number. |
28446 | 160 The version number must be in group 1. |
27003
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
161 Note: The search is conducted only within 10%, at the beginning of the file." |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
162 :version "21.1" |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
163 :type '(repeat regexp) |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
164 :group 'change-log) |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
165 |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
166 (defface change-log-date-face |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
167 '((t (:inherit font-lock-string-face))) |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
168 "Face used to highlight dates in date lines." |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
169 :version "21.1" |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
170 :group 'change-log) |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
171 |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
172 (defface change-log-name-face |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
173 '((t (:inherit font-lock-constant-face))) |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
174 "Face for highlighting author names." |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
175 :version "21.1" |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
176 :group 'change-log) |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
177 |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
178 (defface change-log-email-face |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
179 '((t (:inherit font-lock-variable-name-face))) |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
180 "Face for highlighting author email addresses." |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
181 :version "21.1" |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
182 :group 'change-log) |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
183 |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
184 (defface change-log-file-face |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
185 '((t (:inherit font-lock-function-name-face))) |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
186 "Face for highlighting file names." |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
187 :version "21.1" |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
188 :group 'change-log) |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
189 |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
190 (defface change-log-list-face |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
191 '((t (:inherit font-lock-keyword-face))) |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
192 "Face for highlighting parenthesized lists of functions or variables." |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
193 :version "21.1" |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
194 :group 'change-log) |
40315
e41eca24ba8c
(add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents:
39625
diff
changeset
|
195 |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
196 (defface change-log-conditionals-face |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
197 '((t (:inherit font-lock-variable-name-face))) |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
198 "Face for highlighting conditionals of the form `[...]'." |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
199 :version "21.1" |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
200 :group 'change-log) |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
201 |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
202 (defface change-log-function-face |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
203 '((t (:inherit font-lock-variable-name-face))) |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
204 "Face for highlighting items of the form `<....>'." |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
205 :version "21.1" |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
206 :group 'change-log) |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
207 |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
208 (defface change-log-acknowledgement-face |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
209 '((t (:inherit font-lock-comment-face))) |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
210 "Face for highlighting acknowledgments." |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
211 :version "21.1" |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
212 :group 'change-log) |
27003
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
213 |
9377
45228a0f6b78
(change-log-mode): Set font-lock-keywords locally.
Richard M. Stallman <rms@gnu.org>
parents:
9347
diff
changeset
|
214 (defvar change-log-font-lock-keywords |
16450
82b0566ece27
Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents:
16035
diff
changeset
|
215 '(;; |
82b0566ece27
Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents:
16035
diff
changeset
|
216 ;; Date lines, new and old styles. |
21009
f3149849a051
(change-log-font-lock-keywords): Recognize + in date.
Richard M. Stallman <rms@gnu.org>
parents:
20953
diff
changeset
|
217 ("^\\sw.........[0-9:+ ]*" |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
218 (0 'change-log-date-face) |
23215
c06f07cf6bba
(change-log-font-lock-keywords): Do parenthesized
Dave Love <fx@gnu.org>
parents:
22388
diff
changeset
|
219 ;; Name and e-mail; some people put e-mail in parens, not angles. |
31720
601145997e91
(change-log-font-lock-keywords): Match names
Gerd Moellmann <gerd@gnu.org>
parents:
30809
diff
changeset
|
220 ("\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.-]+@[A-Za-z0-9_.-]+\\)[>)]" nil nil |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
221 (1 'change-log-name-face) |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
222 (2 'change-log-email-face))) |
16450
82b0566ece27
Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents:
16035
diff
changeset
|
223 ;; |
82b0566ece27
Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents:
16035
diff
changeset
|
224 ;; File names. |
82b0566ece27
Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents:
16035
diff
changeset
|
225 ("^\t\\* \\([^ ,:([\n]+\\)" |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
226 (1 'change-log-file-face) |
23215
c06f07cf6bba
(change-log-font-lock-keywords): Do parenthesized
Dave Love <fx@gnu.org>
parents:
22388
diff
changeset
|
227 ;; Possibly further names in a list: |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
228 ("\\=, \\([^ ,:([\n]+\\)" nil nil (1 'change-log-file-face)) |
23215
c06f07cf6bba
(change-log-font-lock-keywords): Do parenthesized
Dave Love <fx@gnu.org>
parents:
22388
diff
changeset
|
229 ;; Possibly a parenthesized list of names: |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
230 ("\\= (\\([^) ,:\n]+\\)" nil nil (1 'change-log-list-face)) |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
231 ("\\=, *\\([^) ,:\n]+\\)" nil nil (1 'change-log-list-face))) |
16450
82b0566ece27
Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents:
16035
diff
changeset
|
232 ;; |
82b0566ece27
Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents:
16035
diff
changeset
|
233 ;; Function or variable names. |
23215
c06f07cf6bba
(change-log-font-lock-keywords): Do parenthesized
Dave Love <fx@gnu.org>
parents:
22388
diff
changeset
|
234 ("^\t(\\([^) ,:\n]+\\)" |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
235 (1 'change-log-list-face) |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
236 ("\\=, *\\([^) ,:\n]+\\)" nil nil (1 'change-log-list-face))) |
16450
82b0566ece27
Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents:
16035
diff
changeset
|
237 ;; |
82b0566ece27
Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents:
16035
diff
changeset
|
238 ;; Conditionals. |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
239 ("\\[!?\\([^]\n]+\\)\\]\\(:\\| (\\)" (1 'change-log-conditionals-face)) |
16450
82b0566ece27
Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents:
16035
diff
changeset
|
240 ;; |
29329
5b85d9e700da
(change-log-font-lock-keywords) <function>: Add
Dave Love <fx@gnu.org>
parents:
29243
diff
changeset
|
241 ;; Function of change. |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
242 ("<\\([^>\n]+\\)>\\(:\\| (\\)" (1 'change-log-function-face)) |
29329
5b85d9e700da
(change-log-font-lock-keywords) <function>: Add
Dave Love <fx@gnu.org>
parents:
29243
diff
changeset
|
243 ;; |
19439 | 244 ;; Acknowledgements. |
29329
5b85d9e700da
(change-log-font-lock-keywords) <function>: Add
Dave Love <fx@gnu.org>
parents:
29243
diff
changeset
|
245 ("\\(^\t\\| \\)\\(From\\|Patch\\(es\\)? by\\|Report\\(ed by\\| from\\)\\|Suggest\\(ed by\\|ion from\\)\\)" |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
246 2 'change-log-acknowledgement-face)) |
9377
45228a0f6b78
(change-log-mode): Set font-lock-keywords locally.
Richard M. Stallman <rms@gnu.org>
parents:
9347
diff
changeset
|
247 "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
|
248 |
28446 | 249 (defvar change-log-mode-map (make-sparse-keymap) |
15889 | 250 "Keymap for Change Log major mode.") |
251 | |
15909
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
252 (defvar change-log-time-zone-rule nil |
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
253 "Time zone used for calculating change log time stamps. |
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
254 It takes the same format as the TZ argument of `set-time-zone-rule'. |
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
255 If nil, use local time.") |
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
256 |
18277
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
257 (defun add-log-iso8601-time-zone (time) |
15909
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
258 (let* ((utc-offset (or (car (current-time-zone time)) 0)) |
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
259 (sign (if (< utc-offset 0) ?- ?+)) |
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
260 (sec (abs utc-offset)) |
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
261 (ss (% sec 60)) |
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
262 (min (/ sec 60)) |
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
263 (mm (% min 60)) |
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
264 (hh (/ min 60))) |
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
265 (format (cond ((not (zerop ss)) "%c%02d:%02d:%02d") |
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
266 ((not (zerop mm)) "%c%02d:%02d") |
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
267 (t "%c%02d")) |
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
268 sign hh mm ss))) |
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
269 |
18277
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
270 (defun add-log-iso8601-time-string () |
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
271 (if change-log-time-zone-rule |
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
272 (let ((tz (getenv "TZ")) |
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
273 (now (current-time))) |
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
274 (unwind-protect |
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
275 (progn |
30809 | 276 (set-time-zone-rule change-log-time-zone-rule) |
18277
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
277 (concat |
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
278 (format-time-string "%Y-%m-%d " now) |
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
279 (add-log-iso8601-time-zone now))) |
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
280 (set-time-zone-rule tz))) |
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
281 (format-time-string "%Y-%m-%d"))) |
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
282 |
661 | 283 (defun change-log-name () |
27240 | 284 "Return (system-dependent) default name for a change log file." |
661 | 285 (or change-log-default-name |
19477
a9629283bc4c
(change-log-font-lock-keywords): Recognize "Patch by".
Richard M. Stallman <rms@gnu.org>
parents:
19439
diff
changeset
|
286 (if (eq system-type 'vax-vms) |
16035
9d8b374b5bb1
(change-log-name): Don't treat MSDOS, NT specially.
Richard M. Stallman <rms@gnu.org>
parents:
15909
diff
changeset
|
287 "$CHANGE_LOG$.TXT" |
9d8b374b5bb1
(change-log-name): Don't treat MSDOS, NT specially.
Richard M. Stallman <rms@gnu.org>
parents:
15909
diff
changeset
|
288 "ChangeLog"))) |
661 | 289 |
4157
d2316090d029
(prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents:
4154
diff
changeset
|
290 ;;;###autoload |
661 | 291 (defun prompt-for-change-log-name () |
292 "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
|
293 (let* ((default (change-log-name)) |
f4a8265756e7
(prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents:
11816
diff
changeset
|
294 (name (expand-file-name |
f4a8265756e7
(prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents:
11816
diff
changeset
|
295 (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
|
296 nil default)))) |
f4a8265756e7
(prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents:
11816
diff
changeset
|
297 ;; 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
|
298 ;; 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
|
299 (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
|
300 (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
|
301 name) |
f4a8265756e7
(prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents:
11816
diff
changeset
|
302 ;; 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
|
303 (if (file-directory-p name) |
f4a8265756e7
(prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents:
11816
diff
changeset
|
304 (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
|
305 (file-name-as-directory name)) |
f4a8265756e7
(prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents:
11816
diff
changeset
|
306 name)))) |
661 | 307 |
27003
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
308 (defun change-log-version-number-search () |
28446 | 309 "Return version number of current buffer's file. |
310 This is the value returned by `vc-workfile-version' or, if that is | |
311 nil, by matching `change-log-version-number-regexp-list'." | |
27003
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
312 (let* ((size (buffer-size)) |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
313 (end |
28446 | 314 ;; The version number can be anywhere in the file, but |
315 ;; restrict search to the file beginning: 10% should be | |
316 ;; enough to prevent some mishits. | |
27003
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
317 ;; |
28446 | 318 ;; Apply percentage only if buffer size is bigger than |
319 ;; approx 100 lines. | |
27003
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
320 (if (> size (* 100 80)) |
28446 | 321 (/ size 10) |
27003
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
322 size)) |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
323 version) |
32011
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
324 (or (and buffer-file-name (vc-workfile-version buffer-file-name)) |
28446 | 325 (save-restriction |
326 (widen) | |
327 (let ((regexps change-log-version-number-regexp-list)) | |
328 (while regexps | |
329 (save-excursion | |
330 (goto-char (point-min)) | |
331 (when (re-search-forward (pop regexps) end t) | |
332 (setq version (match-string 1) | |
333 regexps nil))))))))) | |
27003
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
334 |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
335 |
661 | 336 ;;;###autoload |
32011
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
337 (defun find-change-log (&optional file-name buffer-file) |
2463
d3c9f0ad5964
(find-change-log): New function.
Roland McGrath <roland@gnu.org>
parents:
2307
diff
changeset
|
338 "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
|
339 |
0495d3085f00
(find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents:
6562
diff
changeset
|
340 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
|
341 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
|
342 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
|
343 \(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
|
344 |
f54af6fe889e
(find-change-log): If change-log-default-name
Richard M. Stallman <rms@gnu.org>
parents:
9774
diff
changeset
|
345 If 'change-log-default-name' contains a leading directory component, then |
19477
a9629283bc4c
(change-log-font-lock-keywords): Recognize "Patch by".
Richard M. Stallman <rms@gnu.org>
parents:
19439
diff
changeset
|
346 simply find it in the current directory. Otherwise, search in the current |
9886
f54af6fe889e
(find-change-log): If change-log-default-name
Richard M. Stallman <rms@gnu.org>
parents:
9774
diff
changeset
|
347 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
|
348 |
d3c9f0ad5964
(find-change-log): New function.
Roland McGrath <roland@gnu.org>
parents:
2307
diff
changeset
|
349 Once a file is found, `change-log-default-name' is set locally in the |
32011
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
350 current buffer to the complete file name. |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
351 Optional arg BUFFER-FILE overrides `buffer-file-name'." |
8042
0495d3085f00
(find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents:
6562
diff
changeset
|
352 ;; 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
|
353 ;; just use that. |
2463
d3c9f0ad5964
(find-change-log): New function.
Roland McGrath <roland@gnu.org>
parents:
2307
diff
changeset
|
354 (or file-name |
9886
f54af6fe889e
(find-change-log): If change-log-default-name
Richard M. Stallman <rms@gnu.org>
parents:
9774
diff
changeset
|
355 (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
|
356 (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
|
357 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
|
358 (progn |
0495d3085f00
(find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents:
6562
diff
changeset
|
359 ;; 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
|
360 ;; and use the change log in the dir where it points. |
32011
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
361 (setq file-name (or (and (or buffer-file buffer-file-name) |
8042
0495d3085f00
(find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents:
6562
diff
changeset
|
362 (file-name-directory |
32011
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
363 (file-chase-links |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
364 (or buffer-file buffer-file-name)))) |
8042
0495d3085f00
(find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents:
6562
diff
changeset
|
365 default-directory)) |
0495d3085f00
(find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents:
6562
diff
changeset
|
366 (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
|
367 (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
|
368 ;; 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
|
369 ;; 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
|
370 ;; 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
|
371 (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
|
372 (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
|
373 ;; 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
|
374 (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
|
375 parent-dir) |
0495d3085f00
(find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents:
6562
diff
changeset
|
376 (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
|
377 (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
|
378 (file-name-directory |
0495d3085f00
(find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents:
6562
diff
changeset
|
379 (directory-file-name |
0495d3085f00
(find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents:
6562
diff
changeset
|
380 (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
|
381 ;; 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
|
382 (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
|
383 parent-dir)))) |
0495d3085f00
(find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents:
6562
diff
changeset
|
384 ;; Move up to the parent dir and try again. |
19477
a9629283bc4c
(change-log-font-lock-keywords): Recognize "Patch by".
Richard M. Stallman <rms@gnu.org>
parents:
19439
diff
changeset
|
385 (setq file1 (expand-file-name |
8042
0495d3085f00
(find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents:
6562
diff
changeset
|
386 (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
|
387 parent-dir))) |
0495d3085f00
(find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents:
6562
diff
changeset
|
388 ;; 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
|
389 (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
|
390 (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
|
391 ;; 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
|
392 (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
|
393 file-name) |
2463
d3c9f0ad5964
(find-change-log): New function.
Roland McGrath <roland@gnu.org>
parents:
2307
diff
changeset
|
394 |
31794
7e8ab579609b
(add-log-file-name): New function (split out of add-change-log-entry).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31720
diff
changeset
|
395 (defun add-log-file-name (buffer-file log-file) |
7e8ab579609b
(add-log-file-name): New function (split out of add-change-log-entry).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31720
diff
changeset
|
396 ;; Never want to add a change log entry for the ChangeLog file itself. |
7e8ab579609b
(add-log-file-name): New function (split out of add-change-log-entry).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31720
diff
changeset
|
397 (unless (or (null buffer-file) (string= buffer-file log-file)) |
32011
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
398 (if add-log-file-name-function |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
399 (funcall add-log-file-name-function buffer-file) |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
400 (setq buffer-file |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
401 (if (string-match |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
402 (concat "^" (regexp-quote (file-name-directory log-file))) |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
403 buffer-file) |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
404 (substring buffer-file (match-end 0)) |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
405 (file-name-nondirectory buffer-file))) |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
406 ;; If we have a backup file, it's presumably because we're |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
407 ;; comparing old and new versions (e.g. for deleted |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
408 ;; functions) and we'll want to use the original name. |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
409 (if (backup-file-name-p buffer-file) |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
410 (file-name-sans-versions buffer-file) |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
411 buffer-file)))) |
31794
7e8ab579609b
(add-log-file-name): New function (split out of add-change-log-entry).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31720
diff
changeset
|
412 |
2463
d3c9f0ad5964
(find-change-log): New function.
Roland McGrath <roland@gnu.org>
parents:
2307
diff
changeset
|
413 ;;;###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
|
414 (defun add-change-log-entry (&optional whoami file-name other-window new-entry) |
39625
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
415 "Find change log file, and add an entry for today and an item for this file. |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
416 Optional arg WHOAMI (interactive prefix) non-nil means prompt for user |
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
417 name and site. |
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
418 |
39625
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
419 Second arg FILE-NAME is file name of the change log. |
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
420 If nil, use the value of `change-log-default-name'. |
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
421 |
4157
d2316090d029
(prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents:
4154
diff
changeset
|
422 Third arg OTHER-WINDOW non-nil means visit in other window. |
39625
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
423 |
4157
d2316090d029
(prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents:
4154
diff
changeset
|
424 Fourth arg NEW-ENTRY non-nil means always create a new entry at the front; |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
425 never append to an existing entry. Option `add-log-keep-changes-together' |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
426 otherwise affects whether a new entry is created. |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
427 |
40315
e41eca24ba8c
(add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents:
39625
diff
changeset
|
428 Option `add-log-always-start-new-record' non-nil means always create a |
e41eca24ba8c
(add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents:
39625
diff
changeset
|
429 new record, even when the last record was made on the same date and by |
e41eca24ba8c
(add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents:
39625
diff
changeset
|
430 the same person. |
e41eca24ba8c
(add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents:
39625
diff
changeset
|
431 |
39625
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
432 The change log file can start with a copyright notice and a copying |
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
433 permission notice. The first blank line indicates the end of these |
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
434 notices. |
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
435 |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
436 Today's date is calculated according to `change-log-time-zone-rule' if |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
437 non-nil, otherwise in local time." |
661 | 438 (interactive (list current-prefix-arg |
439 (prompt-for-change-log-name))) | |
13648
ce23ae11d3fa
(add-change-log-entry): Initialize add-log-full-name
Richard M. Stallman <rms@gnu.org>
parents:
13505
diff
changeset
|
440 (or add-log-full-name |
ce23ae11d3fa
(add-change-log-entry): Initialize add-log-full-name
Richard M. Stallman <rms@gnu.org>
parents:
13505
diff
changeset
|
441 (setq add-log-full-name (user-full-name))) |
ce23ae11d3fa
(add-change-log-entry): Initialize add-log-full-name
Richard M. Stallman <rms@gnu.org>
parents:
13505
diff
changeset
|
442 (or add-log-mailing-address |
ce23ae11d3fa
(add-change-log-entry): Initialize add-log-full-name
Richard M. Stallman <rms@gnu.org>
parents:
13505
diff
changeset
|
443 (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
|
444 (if whoami |
c0ea0009268a
add-log-full-name, add-log-mailing-address: new varialbes
Brian Fox <bfox@gnu.org>
parents:
4380
diff
changeset
|
445 (progn |
c0ea0009268a
add-log-full-name, add-log-mailing-address: new varialbes
Brian Fox <bfox@gnu.org>
parents:
4380
diff
changeset
|
446 (setq add-log-full-name (read-input "Full name: " add-log-full-name)) |
661 | 447 ;; Note that some sites have room and phone number fields in |
448 ;; full name which look silly when inserted. Rather than do | |
449 ;; anything about that here, let user give prefix argument so that | |
450 ;; 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
|
451 (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
|
452 (read-input "Mailing address: " add-log-mailing-address)))) |
31794
7e8ab579609b
(add-log-file-name): New function (split out of add-change-log-entry).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31720
diff
changeset
|
453 |
32011
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
454 (let* ((defun (add-log-current-defun)) |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
455 (version (and change-log-version-info-enabled |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
456 (change-log-version-number-search))) |
34576
372841b7a5ad
(add-change-log-entry): Only expand-file-name if non-nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32011
diff
changeset
|
457 (buf-file-name (if add-log-buffer-file-name-function |
372841b7a5ad
(add-change-log-entry): Only expand-file-name if non-nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32011
diff
changeset
|
458 (funcall add-log-buffer-file-name-function) |
372841b7a5ad
(add-change-log-entry): Only expand-file-name if non-nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32011
diff
changeset
|
459 buffer-file-name)) |
372841b7a5ad
(add-change-log-entry): Only expand-file-name if non-nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32011
diff
changeset
|
460 (buffer-file (if buf-file-name (expand-file-name buf-file-name))) |
32011
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
461 (file-name (expand-file-name |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
462 (or file-name (find-change-log file-name buffer-file)))) |
39625
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
463 ;; Set ITEM to the file name to use in the new item. |
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
464 (item (add-log-file-name buffer-file file-name)) |
32011
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
465 bound) |
1727
d6cc12c97a59
(add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents:
1644
diff
changeset
|
466 |
47828
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
467 (unless (equal file-name buffer-file-name) |
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
468 (if (or other-window (window-dedicated-p (selected-window))) |
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
469 (find-file-other-window file-name) |
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
470 (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
|
471 (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
|
472 (change-log-mode)) |
661 | 473 (undo-boundary) |
474 (goto-char (point-min)) | |
39625
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
475 |
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
476 ;; If file starts with a copyright and permission notice, skip them. |
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
477 ;; Assume they end at first blank line. |
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
478 (when (looking-at "Copyright") |
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
479 (search-forward "\n\n") |
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
480 (skip-chars-forward "\n")) |
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
481 |
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
482 ;; Advance into first entry if it is usable; else make new one. |
45267
c9022ab03c89
(add-log-mailing-address): Can be a list, too.
Colin Walters <walters@gnu.org>
parents:
45255
diff
changeset
|
483 (let ((new-entries (mapcar (lambda (addr) |
c9022ab03c89
(add-log-mailing-address): Can be a list, too.
Colin Walters <walters@gnu.org>
parents:
45255
diff
changeset
|
484 (concat (funcall add-log-time-format) |
c9022ab03c89
(add-log-mailing-address): Can be a list, too.
Colin Walters <walters@gnu.org>
parents:
45255
diff
changeset
|
485 " " add-log-full-name |
c9022ab03c89
(add-log-mailing-address): Can be a list, too.
Colin Walters <walters@gnu.org>
parents:
45255
diff
changeset
|
486 " <" addr ">")) |
c9022ab03c89
(add-log-mailing-address): Can be a list, too.
Colin Walters <walters@gnu.org>
parents:
45255
diff
changeset
|
487 (if (consp add-log-mailing-address) |
c9022ab03c89
(add-log-mailing-address): Can be a list, too.
Colin Walters <walters@gnu.org>
parents:
45255
diff
changeset
|
488 add-log-mailing-address |
c9022ab03c89
(add-log-mailing-address): Can be a list, too.
Colin Walters <walters@gnu.org>
parents:
45255
diff
changeset
|
489 (list add-log-mailing-address))))) |
40315
e41eca24ba8c
(add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents:
39625
diff
changeset
|
490 (if (and (not add-log-always-start-new-record) |
45267
c9022ab03c89
(add-log-mailing-address): Can be a list, too.
Colin Walters <walters@gnu.org>
parents:
45255
diff
changeset
|
491 (let ((hit nil)) |
c9022ab03c89
(add-log-mailing-address): Can be a list, too.
Colin Walters <walters@gnu.org>
parents:
45255
diff
changeset
|
492 (dolist (entry new-entries hit) |
c9022ab03c89
(add-log-mailing-address): Can be a list, too.
Colin Walters <walters@gnu.org>
parents:
45255
diff
changeset
|
493 (when (looking-at (regexp-quote entry)) |
c9022ab03c89
(add-log-mailing-address): Can be a list, too.
Colin Walters <walters@gnu.org>
parents:
45255
diff
changeset
|
494 (setq hit t))))) |
15909
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
495 (forward-line 1) |
45267
c9022ab03c89
(add-log-mailing-address): Can be a list, too.
Colin Walters <walters@gnu.org>
parents:
45255
diff
changeset
|
496 (insert (nth (random (length new-entries)) |
c9022ab03c89
(add-log-mailing-address): Can be a list, too.
Colin Walters <walters@gnu.org>
parents:
45255
diff
changeset
|
497 new-entries) |
c9022ab03c89
(add-log-mailing-address): Can be a list, too.
Colin Walters <walters@gnu.org>
parents:
45255
diff
changeset
|
498 "\n\n") |
39625
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
499 (forward-line -1))) |
1727
d6cc12c97a59
(add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents:
1644
diff
changeset
|
500 |
39625
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
501 ;; Determine where we should stop searching for a usable |
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
502 ;; item to add to, within this entry. |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
503 (setq bound |
39625
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
504 (save-excursion |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
505 (if (looking-at "\n*[^\n* \t]") |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
506 (skip-chars-forward "\n") |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
507 (if add-log-keep-changes-together |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
508 (forward-page) ; page delimits entries for date |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
509 (forward-paragraph))) ; paragraph delimits entries for file |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
510 (point))) |
39625
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
511 |
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
512 ;; Now insert the new line for this item. |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
513 (cond ((re-search-forward "^\\s *\\*\\s *$" bound t) |
39625
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
514 ;; Put this file name into the existing empty item. |
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
515 (if item |
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
516 (insert item))) |
4157
d2316090d029
(prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents:
4154
diff
changeset
|
517 ((and (not new-entry) |
12551
572a8ef6b1f4
(add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents:
12157
diff
changeset
|
518 (let (case-fold-search) |
572a8ef6b1f4
(add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents:
12157
diff
changeset
|
519 (re-search-forward |
39625
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
520 (concat (regexp-quote (concat "* " item)) |
12551
572a8ef6b1f4
(add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents:
12157
diff
changeset
|
521 ;; Don't accept `foo.bar' when |
572a8ef6b1f4
(add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents:
12157
diff
changeset
|
522 ;; looking for `foo': |
572a8ef6b1f4
(add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents:
12157
diff
changeset
|
523 "\\(\\s \\|[(),:]\\)") |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
524 bound t))) |
39625
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
525 ;; Add to the existing item for the same file. |
1727
d6cc12c97a59
(add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents:
1644
diff
changeset
|
526 (re-search-forward "^\\s *$\\|^\\s \\*") |
12551
572a8ef6b1f4
(add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents:
12157
diff
changeset
|
527 (goto-char (match-beginning 0)) |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
528 ;; Delete excess empty lines; make just 2. |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
529 (while (and (not (eobp)) (looking-at "^\\s *$")) |
28446 | 530 (delete-region (point) (line-beginning-position 2))) |
30809 | 531 (insert-char ?\n 2) |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
532 (forward-line -2) |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
533 (indent-relative-maybe)) |
666
7fa6b835da67
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
661
diff
changeset
|
534 (t |
39625
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
535 ;; Make a new item. |
678 | 536 (while (looking-at "\\sW") |
537 (forward-line 1)) | |
912
1c37c99856de
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
538 (while (and (not (eobp)) (looking-at "^\\s *$")) |
28446 | 539 (delete-region (point) (line-beginning-position 2))) |
30809 | 540 (insert-char ?\n 3) |
837
a8aef92e0025
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
811
diff
changeset
|
541 (forward-line -2) |
678 | 542 (indent-to left-margin) |
30809 | 543 (insert "* ") |
39625
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
544 (if item (insert item)))) |
837
a8aef92e0025
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
811
diff
changeset
|
545 ;; Now insert the function name, if we have one. |
39625
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
546 ;; Point is at the item for this file, |
666
7fa6b835da67
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
661
diff
changeset
|
547 ;; either at the end of the line or at the first blank line. |
49308
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
548 (if (not defun) |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
549 ;; No function name, so put in a colon unless we have just a star. |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
550 (unless (save-excursion |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
551 (beginning-of-line 1) |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
552 (looking-at "\\s *\\(\\*\\s *\\)?$")) |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
553 (insert ": ") |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
554 (if version (insert version ?\ ))) |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
555 ;; Make it easy to get rid of the function name. |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
556 (undo-boundary) |
28446 | 557 (unless (save-excursion |
558 (beginning-of-line 1) | |
49308
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
559 (looking-at "\\s *$")) |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
560 (insert ?\ )) |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
561 ;; See if the prev function name has a message yet or not. |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
562 ;; If not, merge the two items. |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
563 (let ((pos (point-marker))) |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
564 (skip-syntax-backward " ") |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
565 (skip-chars-backward "):") |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
566 (if (and (looking-at "):") |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
567 (> fill-column (+ (current-column) (length defun) 4))) |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
568 (progn (delete-region (point) pos) (insert ", ")) |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
569 (if (looking-at "):") |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
570 (delete-region (+ 1 (point)) (line-end-position))) |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
571 (goto-char pos) |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
572 (insert "(")) |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
573 (set-marker pos nil)) |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
574 (insert defun "): ") |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
575 (if version (insert version ?\ ))))) |
661 | 576 |
577 ;;;###autoload | |
578 (defun add-change-log-entry-other-window (&optional whoami file-name) | |
39625
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
579 "Find change log file in other window and add entry and item. |
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
580 This is just like `add-change-log-entry' except that it displays |
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
581 the change log file in another window." |
661 | 582 (interactive (if current-prefix-arg |
583 (list current-prefix-arg | |
584 (prompt-for-change-log-name)))) | |
585 (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
|
586 ;;;###autoload (define-key ctl-x-4-map "a" 'add-change-log-entry-other-window) |
661 | 587 |
980
b62886fbf2a7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
953
diff
changeset
|
588 ;;;###autoload |
47828
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
589 (define-derived-mode change-log-mode text-mode "Change Log" |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3499
diff
changeset
|
590 "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
|
591 Prevents numeric backups and sets `left-margin' to 8 and `fill-column' to 74. |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
592 New log entries are usually made with \\[add-change-log-entry] or \\[add-change-log-entry-other-window]. |
951 | 593 Each entry behaves as a paragraph, and the entries for one day as a page. |
594 Runs `change-log-mode-hook'." | |
47828
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
595 (setq left-margin 8 |
13706
ba34746d66fd
(change-log-mode): Defaults for `indent-tabs-mode'
Karl Heuer <kwzh@gnu.org>
parents:
13648
diff
changeset
|
596 fill-column 74 |
15887
18c1dcf40139
(change-log-mode): Set fill-paragraph-function.
Karl Heuer <kwzh@gnu.org>
parents:
15299
diff
changeset
|
597 indent-tabs-mode t |
18c1dcf40139
(change-log-mode): Set fill-paragraph-function.
Karl Heuer <kwzh@gnu.org>
parents:
15299
diff
changeset
|
598 tab-width 8) |
18c1dcf40139
(change-log-mode): Set fill-paragraph-function.
Karl Heuer <kwzh@gnu.org>
parents:
15299
diff
changeset
|
599 (set (make-local-variable 'fill-paragraph-function) |
18c1dcf40139
(change-log-mode): Set fill-paragraph-function.
Karl Heuer <kwzh@gnu.org>
parents:
15299
diff
changeset
|
600 'change-log-fill-paragraph) |
48615
35a56f4a18d3
(change-log-mode): Set indent-line-function explicitly
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47828
diff
changeset
|
601 (set (make-local-variable 'indent-line-function) 'indent-to-left-margin) |
21719
c888284a54f7
(change-log-mode): Add `* ' to paragraph-start.
Dave Love <fx@gnu.org>
parents:
21629
diff
changeset
|
602 ;; We really do want "^" in paragraph-start below: it is only the |
c888284a54f7
(change-log-mode): Add `* ' to paragraph-start.
Dave Love <fx@gnu.org>
parents:
21629
diff
changeset
|
603 ;; lines that begin at column 0 (despite the left-margin of 8) that |
c888284a54f7
(change-log-mode): Add `* ' to paragraph-start.
Dave Love <fx@gnu.org>
parents:
21629
diff
changeset
|
604 ;; we are looking for. Adding `* ' allows eliding the blank line |
c888284a54f7
(change-log-mode): Add `* ' to paragraph-start.
Dave Love <fx@gnu.org>
parents:
21629
diff
changeset
|
605 ;; between entries for different files. |
21749
84df514f7719
(change-log-mode): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
21719
diff
changeset
|
606 (set (make-local-variable 'paragraph-start) "\\s *$\\|\f\\|^\\<") |
21719
c888284a54f7
(change-log-mode): Add `* ' to paragraph-start.
Dave Love <fx@gnu.org>
parents:
21629
diff
changeset
|
607 (set (make-local-variable 'paragraph-separate) paragraph-start) |
1078
15b4ed20e524
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1062
diff
changeset
|
608 ;; 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
|
609 ;; 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
|
610 (set (make-local-variable 'page-delimiter) "^\\<\\|^\f") |
678 | 611 (set (make-local-variable 'version-control) 'never) |
47828
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
612 (set (make-local-variable 'smerge-resolve-function) |
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
613 'change-log-resolve-conflict) |
678 | 614 (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
|
615 (set (make-local-variable 'font-lock-defaults) |
47828
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
616 '(change-log-font-lock-keywords t nil nil backward-paragraph))) |
666
7fa6b835da67
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
661
diff
changeset
|
617 |
4157
d2316090d029
(prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents:
4154
diff
changeset
|
618 ;; 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
|
619 ;; 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
|
620 ;; 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
|
621 ;; 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
|
622 (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
|
623 "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
|
624 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
|
625 (interactive "P") |
16505
39efcea11aad
(change-log-fill-paragraph): Return non-nil so
Richard M. Stallman <rms@gnu.org>
parents:
16450
diff
changeset
|
626 (let ((end (progn (forward-paragraph) (point))) |
39efcea11aad
(change-log-fill-paragraph): Return non-nil so
Richard M. Stallman <rms@gnu.org>
parents:
16450
diff
changeset
|
627 (beg (progn (backward-paragraph) (point))) |
13505
86470b361571
(change-log-mode): Remove incorrect "^" anchors from
Richard M. Stallman <rms@gnu.org>
parents:
13282
diff
changeset
|
628 (paragraph-start (concat paragraph-start "\\|\\s *\\s("))) |
16505
39efcea11aad
(change-log-fill-paragraph): Return non-nil so
Richard M. Stallman <rms@gnu.org>
parents:
16450
diff
changeset
|
629 (fill-region beg end justify) |
39efcea11aad
(change-log-fill-paragraph): Return non-nil so
Richard M. Stallman <rms@gnu.org>
parents:
16450
diff
changeset
|
630 t)) |
4157
d2316090d029
(prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents:
4154
diff
changeset
|
631 |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
632 (defcustom add-log-current-defun-header-regexp |
29329
5b85d9e700da
(change-log-font-lock-keywords) <function>: Add
Dave Love <fx@gnu.org>
parents:
29243
diff
changeset
|
633 "^\\([[:upper:]][[:upper:]_ ]*[[:upper:]_]\\|[-_[:alpha:]]+\\)[ \t]*[:=]" |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
634 "*Heuristic regexp used by `add-log-current-defun' for unknown major modes." |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
635 :type 'regexp |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
636 :group 'change-log) |
666
7fa6b835da67
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
661
diff
changeset
|
637 |
6562
0541a368505c
(add-log-current-defun): Autoload this.
Roland McGrath <roland@gnu.org>
parents:
6309
diff
changeset
|
638 ;;;###autoload |
17912
653987823f79
(add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents:
17413
diff
changeset
|
639 (defvar add-log-lisp-like-modes |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
640 '(emacs-lisp-mode lisp-mode scheme-mode dsssl-mode lisp-interaction-mode) |
17912
653987823f79
(add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents:
17413
diff
changeset
|
641 "*Modes that look like Lisp to `add-log-current-defun'.") |
653987823f79
(add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents:
17413
diff
changeset
|
642 |
653987823f79
(add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents:
17413
diff
changeset
|
643 ;;;###autoload |
653987823f79
(add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents:
17413
diff
changeset
|
644 (defvar add-log-c-like-modes |
653987823f79
(add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents:
17413
diff
changeset
|
645 '(c-mode c++-mode c++-c-mode objc-mode) |
653987823f79
(add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents:
17413
diff
changeset
|
646 "*Modes that look like C to `add-log-current-defun'.") |
653987823f79
(add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents:
17413
diff
changeset
|
647 |
653987823f79
(add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents:
17413
diff
changeset
|
648 ;;;###autoload |
653987823f79
(add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents:
17413
diff
changeset
|
649 (defvar add-log-tex-like-modes |
653987823f79
(add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents:
17413
diff
changeset
|
650 '(TeX-mode plain-TeX-mode LaTeX-mode plain-tex-mode latex-mode) |
653987823f79
(add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents:
17413
diff
changeset
|
651 "*Modes that look like TeX to `add-log-current-defun'.") |
653987823f79
(add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents:
17413
diff
changeset
|
652 |
653987823f79
(add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents:
17413
diff
changeset
|
653 ;;;###autoload |
666
7fa6b835da67
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
661
diff
changeset
|
654 (defun add-log-current-defun () |
7fa6b835da67
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
661
diff
changeset
|
655 "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
|
656 |
3499
6428162f137c
(add-log-current-defun): Fix typos in last change.
Richard M. Stallman <rms@gnu.org>
parents:
3486
diff
changeset
|
657 Understands C, Lisp, LaTeX (\"functions\" are chapters, sections, ...), |
28446 | 658 Texinfo (@node titles) and Perl. |
666
7fa6b835da67
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
661
diff
changeset
|
659 |
7fa6b835da67
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
661
diff
changeset
|
660 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
|
661 point for uppercase headings starting in the first column or |
28446 | 662 identifiers followed by `:' or `='. See variables |
27277
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
663 `add-log-current-defun-header-regexp' and |
46637
f0f715e7aabc
(add-log-current-defun): Fix typo in documentation.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
46632
diff
changeset
|
664 `add-log-current-defun-function'. |
666
7fa6b835da67
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
661
diff
changeset
|
665 |
7fa6b835da67
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
661
diff
changeset
|
666 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
|
667 (condition-case nil |
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
668 (save-excursion |
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
669 (let ((location (point))) |
28446 | 670 (cond (add-log-current-defun-function |
671 (funcall add-log-current-defun-function)) | |
27277
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
672 ((memq major-mode add-log-lisp-like-modes) |
13086
1bc6075184d7
(add-log-current-defun): Ignore quotes before fcn name.
Richard M. Stallman <rms@gnu.org>
parents:
12551
diff
changeset
|
673 ;; 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
|
674 ;; 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
|
675 ;; rather than the previous one. |
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
676 (or (eobp) (forward-char 1)) |
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
677 (beginning-of-defun) |
28446 | 678 ;; Make sure we are really inside the defun found, |
679 ;; not after it. | |
21944
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
680 (when (and (looking-at "\\s(") |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
681 (progn (end-of-defun) |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
682 (< location (point))) |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
683 (progn (forward-sexp -1) |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
684 (>= location (point)))) |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
685 (if (looking-at "\\s(") |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
686 (forward-char 1)) |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
687 ;; Skip the defining construct name, typically "defun" |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
688 ;; or "defvar". |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
689 (forward-sexp 1) |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
690 ;; The second element is usually a symbol being defined. |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
691 ;; If it is not, use the first symbol in it. |
22018 | 692 (skip-chars-forward " \t\n'(") |
28446 | 693 (buffer-substring-no-properties (point) |
694 (progn (forward-sexp 1) | |
695 (point))))) | |
17912
653987823f79
(add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents:
17413
diff
changeset
|
696 ((and (memq major-mode add-log-c-like-modes) |
653987823f79
(add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents:
17413
diff
changeset
|
697 (save-excursion |
653987823f79
(add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents:
17413
diff
changeset
|
698 (beginning-of-line) |
653987823f79
(add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents:
17413
diff
changeset
|
699 ;; Use eq instead of = here to avoid |
653987823f79
(add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents:
17413
diff
changeset
|
700 ;; error when at bob and char-after |
653987823f79
(add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents:
17413
diff
changeset
|
701 ;; returns nil. |
653987823f79
(add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents:
17413
diff
changeset
|
702 (while (eq (char-after (- (point) 2)) ?\\) |
653987823f79
(add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents:
17413
diff
changeset
|
703 (forward-line -1)) |
653987823f79
(add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents:
17413
diff
changeset
|
704 (looking-at "[ \t]*#[ \t]*define[ \t]"))) |
1447
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
705 ;; Handle a C macro definition. |
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
706 (beginning-of-line) |
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
707 (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
|
708 (forward-line -1)) |
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
709 (search-forward "define") |
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
710 (skip-chars-forward " \t") |
28446 | 711 (buffer-substring-no-properties (point) |
712 (progn (forward-sexp 1) | |
713 (point)))) | |
17912
653987823f79
(add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents:
17413
diff
changeset
|
714 ((memq major-mode add-log-c-like-modes) |
1447
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
715 (beginning-of-line) |
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
716 ;; 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
|
717 ;; 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
|
718 (while (not (looking-at "{\\|\\(\\s *$\\)")) |
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
719 (forward-line 1)) |
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
720 (or (eobp) |
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
721 (forward-char 1)) |
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
722 (beginning-of-defun) |
28446 | 723 (when (progn (end-of-defun) |
724 (< location (point))) | |
725 (backward-sexp 1) | |
726 (let (beg tem) | |
1447
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
727 |
28446 | 728 (forward-line -1) |
729 ;; Skip back over typedefs of arglist. | |
730 (while (and (not (bobp)) | |
731 (looking-at "[ \t\n]")) | |
732 (forward-line -1)) | |
733 ;; See if this is using the DEFUN macro used in Emacs, | |
734 ;; or the DEFUN macro used by the C library. | |
735 (if (condition-case nil | |
736 (and (save-excursion | |
737 (end-of-line) | |
738 (while (= (preceding-char) ?\\) | |
739 (end-of-line 2)) | |
740 (backward-sexp 1) | |
741 (beginning-of-line) | |
742 (setq tem (point)) | |
743 (looking-at "DEFUN\\b")) | |
744 (>= location tem)) | |
745 (error nil)) | |
746 (progn | |
747 (goto-char tem) | |
748 (down-list 1) | |
749 (if (= (char-after (point)) ?\") | |
750 (progn | |
751 (forward-sexp 1) | |
752 (skip-chars-forward " ,"))) | |
753 (buffer-substring-no-properties | |
754 (point) | |
755 (progn (forward-sexp 1) | |
756 (point)))) | |
757 (if (looking-at "^[+-]") | |
758 (change-log-get-method-definition) | |
759 ;; Ordinary C function syntax. | |
760 (setq beg (point)) | |
761 (if (and | |
762 ;; Protect against "Unbalanced parens" error. | |
763 (condition-case nil | |
764 (progn | |
765 (down-list 1) ; into arglist | |
766 (backward-up-list 1) | |
767 (skip-chars-backward " \t") | |
768 t) | |
769 (error nil)) | |
770 ;; Verify initial pos was after | |
771 ;; real start of function. | |
772 (save-excursion | |
773 (goto-char beg) | |
774 ;; For this purpose, include the line | |
775 ;; that has the decl keywords. This | |
776 ;; may also include some of the | |
777 ;; comments before the function. | |
778 (while (and (not (bobp)) | |
779 (save-excursion | |
780 (forward-line -1) | |
781 (looking-at "[^\n\f]"))) | |
782 (forward-line -1)) | |
783 (>= location (point))) | |
784 ;; Consistency check: going down and up | |
785 ;; shouldn't take us back before BEG. | |
786 (> (point) beg)) | |
787 (let (end middle) | |
788 ;; Don't include any final whitespace | |
789 ;; in the name we use. | |
790 (skip-chars-backward " \t\n") | |
791 (setq end (point)) | |
792 (backward-sexp 1) | |
793 ;; Now find the right beginning of the name. | |
794 ;; Include certain keywords if they | |
795 ;; precede the name. | |
796 (setq middle (point)) | |
797 (forward-word -1) | |
798 ;; Ignore these subparts of a class decl | |
799 ;; and move back to the class name itself. | |
800 (while (looking-at "public \\|private ") | |
801 (skip-chars-backward " \t:") | |
802 (setq end (point)) | |
803 (backward-sexp 1) | |
804 (setq middle (point)) | |
805 (forward-word -1)) | |
806 (and (bolp) | |
807 (looking-at | |
808 "enum \\|struct \\|union \\|class ") | |
809 (setq middle (point))) | |
810 (goto-char end) | |
811 (when (eq (preceding-char) ?=) | |
812 (forward-char -1) | |
813 (skip-chars-backward " \t") | |
814 (setq end (point))) | |
815 (buffer-substring-no-properties | |
816 middle end)))))))) | |
17912
653987823f79
(add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents:
17413
diff
changeset
|
817 ((memq major-mode add-log-tex-like-modes) |
1447
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
818 (if (re-search-backward |
28446 | 819 "\\\\\\(sub\\)*\\(section\\|paragraph\\|chapter\\)" |
820 nil t) | |
1447
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
821 (progn |
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
822 (goto-char (match-beginning 0)) |
28446 | 823 (buffer-substring-no-properties |
824 (1+ (point)) ; without initial backslash | |
825 (line-end-position))))) | |
1447
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
826 ((eq major-mode 'texinfo-mode) |
9397
eba13d81ba0b
(add-log-current-defun): In texinfo-mode,
Richard M. Stallman <rms@gnu.org>
parents:
9377
diff
changeset
|
827 (if (re-search-backward "^@node[ \t]+\\([^,\n]+\\)" nil t) |
28446 | 828 (match-string-no-properties 1))) |
36604
9a50e930a703
(add-log-current-defun): Check major-mode for `cperl-mode' as well.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
35936
diff
changeset
|
829 ((memq major-mode '(perl-mode cperl-mode)) |
49308
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
830 (if (re-search-backward "^sub[ \t]+\\([^({ \t\n]+\\)" nil t) |
28446 | 831 (match-string-no-properties 1))) |
832 ;; Emacs's autoconf-mode installs its own | |
833 ;; `add-log-current-defun-function'. This applies to | |
834 ;; a different mode apparently for editing .m4 | |
835 ;; autoconf source. | |
27945
c11a0bbb5c88
(add-log-current-defun): Add support for
Gerd Moellmann <gerd@gnu.org>
parents:
27310
diff
changeset
|
836 ((eq major-mode 'autoconf-mode) |
28446 | 837 (if (re-search-backward |
838 "^\\(\\(m4_\\)?define\\|A._DEFUN\\)(\\[?\\([A-Za-z0-9_]+\\)" nil t) | |
839 (match-string-no-properties 3))) | |
1447
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
840 (t |
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
841 ;; If all else fails, try heuristics |
27277
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
842 (let (case-fold-search |
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
843 result) |
1447
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
844 (end-of-line) |
27277
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
845 (when (re-search-backward |
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
846 add-log-current-defun-header-regexp |
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
847 (- (point) 10000) |
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
848 t) |
28446 | 849 (setq result (or (match-string-no-properties 1) |
850 (match-string-no-properties 0))) | |
27277
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
851 ;; Strip whitespace away |
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
852 (when (string-match "\\([^ \t\n\r\f].*[^ \t\n\r\f]\\)" |
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
853 result) |
28446 | 854 (setq result (match-string-no-properties 1 result))) |
27277
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
855 result)))))) |
1447
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
856 (error nil))) |
999 | 857 |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
858 (defvar change-log-get-method-definition-md) |
13282
69fe836d7f02
(get-method-definition, get-method-definition-1):
Richard M. Stallman <rms@gnu.org>
parents:
13255
diff
changeset
|
859 |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
860 ;; Subroutine used within change-log-get-method-definition. |
11749
8da04214faed
(get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
11517
diff
changeset
|
861 ;; 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
|
862 ;; followed by the string END; move to the end of that match. |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
863 (defun change-log-get-method-definition-1 (end) |
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
864 (setq change-log-get-method-definition-md |
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
865 (concat change-log-get-method-definition-md |
28446 | 866 (match-string 1) |
13282
69fe836d7f02
(get-method-definition, get-method-definition-1):
Richard M. Stallman <rms@gnu.org>
parents:
13255
diff
changeset
|
867 end)) |
11749
8da04214faed
(get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
11517
diff
changeset
|
868 (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
|
869 |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
870 (defun change-log-get-method-definition () |
27240 | 871 "For objective C, return the method name if we are in a method." |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
872 (let ((change-log-get-method-definition-md "[")) |
11749
8da04214faed
(get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
11517
diff
changeset
|
873 (save-excursion |
11816
2a8e1b01bc15
(get-method-definition): Fix regexps.
Karl Heuer <kwzh@gnu.org>
parents:
11757
diff
changeset
|
874 (if (re-search-backward "^@implementation\\s-*\\([A-Za-z_]*\\)" nil t) |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
875 (change-log-get-method-definition-1 " "))) |
11749
8da04214faed
(get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
11517
diff
changeset
|
876 (save-excursion |
8da04214faed
(get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
11517
diff
changeset
|
877 (cond |
11816
2a8e1b01bc15
(get-method-definition): Fix regexps.
Karl Heuer <kwzh@gnu.org>
parents:
11757
diff
changeset
|
878 ((re-search-forward "^\\([-+]\\)[ \t\n\f\r]*\\(([^)]*)\\)?\\s-*" nil t) |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
879 (change-log-get-method-definition-1 "") |
11749
8da04214faed
(get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
11517
diff
changeset
|
880 (while (not (looking-at "[{;]")) |
8da04214faed
(get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
11517
diff
changeset
|
881 (looking-at |
11816
2a8e1b01bc15
(get-method-definition): Fix regexps.
Karl Heuer <kwzh@gnu.org>
parents:
11757
diff
changeset
|
882 "\\([A-Za-z_]*:?\\)\\s-*\\(([^)]*)\\)?[A-Za-z_]*[ \t\n\f\r]*") |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
883 (change-log-get-method-definition-1 "")) |
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
884 (concat change-log-get-method-definition-md "]")))))) |
27240 | 885 |
886 (defun change-log-sortable-date-at () | |
887 "Return date of log entry in a consistent form for sorting. | |
888 Point is assumed to be at the start of the entry." | |
889 (require 'timezone) | |
890 (if (looking-at "^\\sw.........[0-9:+ ]*") | |
891 (let ((date (match-string-no-properties 0))) | |
892 (if date | |
893 (if (string-match "\\(....\\)-\\(..\\)-\\(..\\)\\s-+" date) | |
894 (concat (match-string 1 date) (match-string 2 date) | |
895 (match-string 3 date)) | |
896 (condition-case nil | |
897 (timezone-make-date-sortable date) | |
898 (error nil))))) | |
899 (error "Bad date"))) | |
11749
8da04214faed
(get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
11517
diff
changeset
|
900 |
47828
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
901 (defun change-log-resolve-conflict () |
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
902 "Function to be used in `smerge-resolve-function'." |
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
903 (let ((buf (current-buffer))) |
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
904 (with-temp-buffer |
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
905 (insert-buffer-substring buf (match-beginning 1) (match-end 1)) |
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
906 (save-match-data (change-log-mode)) |
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
907 (let ((other-buf (current-buffer))) |
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
908 (with-current-buffer buf |
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
909 (save-excursion |
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
910 (save-restriction |
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
911 (narrow-to-region (match-beginning 0) (match-end 0)) |
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
912 (replace-match (match-string 3) t t) |
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
913 (change-log-merge other-buf)))))))) |
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
914 |
27240 | 915 ;;;###autoload |
916 (defun change-log-merge (other-log) | |
917 "Merge the contents of ChangeLog file OTHER-LOG with this buffer. | |
918 Both must be found in Change Log mode (since the merging depends on | |
47828
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
919 the appropriate motion commands). OTHER-LOG can be either a file name |
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
920 or a buffer. |
27240 | 921 |
30809 | 922 Entries are inserted in chronological order. Both the current and |
923 old-style time formats for entries are supported." | |
27240 | 924 (interactive "*fLog file name to merge: ") |
925 (if (not (eq major-mode 'change-log-mode)) | |
926 (error "Not in Change Log mode")) | |
47828
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
927 (let ((other-buf (if (bufferp other-log) other-log |
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
928 (find-file-noselect other-log))) |
27240 | 929 (buf (current-buffer)) |
930 date1 start end) | |
931 (save-excursion | |
932 (goto-char (point-min)) | |
933 (set-buffer other-buf) | |
934 (goto-char (point-min)) | |
935 (if (not (eq major-mode 'change-log-mode)) | |
936 (error "%s not found in Change Log mode" other-log)) | |
937 ;; Loop through all the entries in OTHER-LOG. | |
938 (while (not (eobp)) | |
939 (setq date1 (change-log-sortable-date-at)) | |
940 (setq start (point) | |
941 end (progn (forward-page) (point))) | |
942 ;; Look for an entry in original buffer that isn't later. | |
943 (with-current-buffer buf | |
944 (while (and (not (eobp)) | |
945 (string< date1 (change-log-sortable-date-at))) | |
946 (forward-page)) | |
947 (if (not (eobp)) | |
948 (insert-buffer-substring other-buf start end) | |
949 ;; At the end of the original buffer, insert a newline to | |
950 ;; separate entries and then the rest of the file being | |
47828
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
951 ;; merged. |
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
952 (unless (or (bobp) |
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
953 (and (= ?\n (char-before)) |
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
954 (or (<= (1- (point)) (point-min)) |
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
955 (= ?\n (char-before (1- (point))))))) |
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
956 (insert "\n")) |
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
957 ;; Move to the end of it to terminate outer loop. |
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
958 (with-current-buffer other-buf |
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
959 (goto-char (point-max))) |
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
960 (insert-buffer-substring other-buf start))))))) |
999 | 961 |
30809 | 962 ;;;###autoload |
963 (defun change-log-redate () | |
964 "Fix any old-style date entries in the current log file to default format." | |
965 (interactive) | |
966 (require 'timezone) | |
967 (save-excursion | |
968 (goto-char (point-min)) | |
969 (while (re-search-forward "^\\sw.........[0-9:+ ]*" nil t) | |
970 (unless (= 12 (- (match-end 0) (match-beginning 0))) | |
971 (let* ((date (save-match-data | |
972 (timezone-fix-time (match-string 0) nil nil))) | |
973 (zone (if (consp (aref date 6)) | |
974 (nth 1 (aref date 6))))) | |
975 (replace-match (format-time-string | |
976 "%Y-%m-%d " | |
977 (encode-time (aref date 5) | |
978 (aref date 4) | |
979 (aref date 3) | |
980 (aref date 2) | |
981 (aref date 1) | |
982 (aref date 0) | |
983 zone)))))))) | |
984 | |
980
b62886fbf2a7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
953
diff
changeset
|
985 (provide 'add-log) |
b62886fbf2a7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
953
diff
changeset
|
986 |
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
678
diff
changeset
|
987 ;;; add-log.el ends here |