Mercurial > emacs
annotate lisp/add-log.el @ 93853:8fc3183d5a63
(checkdoc-this-string-valid-engine): Use `string-match-p'.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Tue, 08 Apr 2008 11:47:48 +0000 |
parents | 622e5fddb043 |
children | 5bd4e09f29d0 |
rev | line source |
---|---|
22388 | 1 ;;; add-log.el --- change log maintenance commands for Emacs |
661 | 2 |
74439 | 3 ;; Copyright (C) 1985, 1986, 1988, 1993, 1994, 1997, 1998, 2000, 2001, |
79721 | 4 ;; 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
661 | 5 |
38697
a19197c6442f
Keyword added and FSF specified as Maintainer.
Pavel Janík <Pavel@Janik.cz>
parents:
36604
diff
changeset
|
6 ;; Maintainer: FSF |
18277
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
7 ;; Keywords: tools |
2247
2c7997f249eb
Add or correct keywords
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1999
diff
changeset
|
8 |
661 | 9 ;; This file is part of GNU Emacs. |
10 | |
11 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
12 ;; it under the terms of the GNU General Public License as published by | |
78236
9355f9b7bbff
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
78134
diff
changeset
|
13 ;; the Free Software Foundation; either version 3, or (at your option) |
661 | 14 ;; any later version. |
15 | |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
14169 | 22 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64091 | 23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
24 ;; Boston, MA 02110-1301, USA. | |
661 | 25 |
2307
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2247
diff
changeset
|
26 ;;; Commentary: |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2247
diff
changeset
|
27 |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2247
diff
changeset
|
28 ;; 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
|
29 |
84370
08763df09731
"Todo" comment.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
30 ;; Todo: |
08763df09731
"Todo" comment.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
31 |
08763df09731
"Todo" comment.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
32 ;; - Find/use/create _MTN/log if there's a _MTN directory. |
08763df09731
"Todo" comment.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
33 ;; - Find/use/create ++log.* if there's an {arch} directory. |
08763df09731
"Todo" comment.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
34 ;; - Use an open *VC-Log* or *cvs-commit* buffer if it's related to the |
08763df09731
"Todo" comment.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
35 ;; source file. |
08763df09731
"Todo" comment.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
36 ;; - Don't add TAB indents (and username?) if inserting entries in those |
08763df09731
"Todo" comment.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
37 ;; special places. |
08763df09731
"Todo" comment.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
38 |
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
678
diff
changeset
|
39 ;;; Code: |
661 | 40 |
27003
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
41 (eval-when-compile |
28446 | 42 (require 'timezone)) |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
43 |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
44 (defgroup change-log nil |
63998
7651543ac34c
(change-log): Finish `defgroup' description with period.
Juanma Barranquero <lekktu@gmail.com>
parents:
63668
diff
changeset
|
45 "Change log maintenance." |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
46 :group 'tools |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
47 :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
|
48 :prefix "change-log-" |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
49 :prefix "add-log-") |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
50 |
661 | 51 |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
52 (defcustom change-log-default-name nil |
84370
08763df09731
"Todo" comment.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
53 "Name of a change log file for \\[add-change-log-entry]." |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
54 :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
|
55 string) |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
56 :group 'change-log) |
70541
62bb603c277b
(change-log-default-name): Put `string-or-null-p'
Juri Linkov <juri@jurta.org>
parents:
70231
diff
changeset
|
57 (put 'change-log-default-name 'safe-local-variable 'string-or-null-p) |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
58 |
26613
7f7e6de546ac
(change-log-mode-hook): Customize.
Dave Love <fx@gnu.org>
parents:
25273
diff
changeset
|
59 (defcustom change-log-mode-hook nil |
7f7e6de546ac
(change-log-mode-hook): Customize.
Dave Love <fx@gnu.org>
parents:
25273
diff
changeset
|
60 "Normal hook run by `change-log-mode'." |
7f7e6de546ac
(change-log-mode-hook): Customize.
Dave Love <fx@gnu.org>
parents:
25273
diff
changeset
|
61 :type 'hook |
7f7e6de546ac
(change-log-mode-hook): Customize.
Dave Love <fx@gnu.org>
parents:
25273
diff
changeset
|
62 :group 'change-log) |
7f7e6de546ac
(change-log-mode-hook): Customize.
Dave Love <fx@gnu.org>
parents:
25273
diff
changeset
|
63 |
50641
7ae78cd3ce2e
(add-log-current-defun-function): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
50575
diff
changeset
|
64 ;; Many modes set this variable, so avoid warnings. |
7ae78cd3ce2e
(add-log-current-defun-function): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
50575
diff
changeset
|
65 ;;;###autoload |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
66 (defcustom add-log-current-defun-function nil |
82005
0de2cd15c33d
(add-change-log-entry, add-log-current-defun, change-log-merge):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82003
diff
changeset
|
67 "If non-nil, function to guess name of surrounding function. |
28446 | 68 It is used by `add-log-current-defun' in preference to built-in rules. |
69 Returns function's name as a string, or nil if outside a function." | |
35936 | 70 :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
|
71 :group 'change-log) |
4154
20a0593431b7
(add-log-current-defun-function): New defvar.
Roland McGrath <roland@gnu.org>
parents:
3897
diff
changeset
|
72 |
14856
f64fa743c80f
(add-log-full-name, add-log-mailing-address): Add autoload cookies.
Richard M. Stallman <rms@gnu.org>
parents:
14528
diff
changeset
|
73 ;;;###autoload |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
74 (defcustom add-log-full-name nil |
82005
0de2cd15c33d
(add-change-log-entry, add-log-current-defun, change-log-merge):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82003
diff
changeset
|
75 "Full name of user, for inclusion in ChangeLog daily headers. |
27240 | 76 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
|
77 :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
|
78 string) |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
79 :group 'change-log) |
4741
c0ea0009268a
add-log-full-name, add-log-mailing-address: new varialbes
Brian Fox <bfox@gnu.org>
parents:
4380
diff
changeset
|
80 |
14856
f64fa743c80f
(add-log-full-name, add-log-mailing-address): Add autoload cookies.
Richard M. Stallman <rms@gnu.org>
parents:
14528
diff
changeset
|
81 ;;;###autoload |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
82 (defcustom add-log-mailing-address nil |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
83 "Email addresses of user, for inclusion in ChangeLog headers. |
45267
c9022ab03c89
(add-log-mailing-address): Can be a list, too.
Colin Walters <walters@gnu.org>
parents:
45255
diff
changeset
|
84 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
|
85 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
|
86 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
|
87 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
|
88 :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
|
89 (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
|
90 (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
|
91 :group 'change-log) |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
92 |
18277
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
93 (defcustom add-log-time-format 'add-log-iso8601-time-string |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
94 "Function that defines the time format. |
18277
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
95 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
|
96 date in international ISO 8601 format, |
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
97 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
|
98 :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
|
99 add-log-iso8601-time-string) |
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
100 (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
|
101 current-time-string) |
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
102 (function :tag "Other")) |
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
103 :group 'change-log) |
4741
c0ea0009268a
add-log-full-name, add-log-mailing-address: new varialbes
Brian Fox <bfox@gnu.org>
parents:
4380
diff
changeset
|
104 |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
105 (defcustom add-log-keep-changes-together nil |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
106 "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
|
107 |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
108 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
|
109 \\[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
|
110 for that file made |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
111 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
|
112 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
|
113 original log: |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
114 |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
115 * foo (...): ... |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
116 * bar (...): change 1 |
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 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
|
119 buffer visiting `bar', yields: |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
120 |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
121 * bar (...): -!- |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
122 * foo (...): ... |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
123 * bar (...): change 1 |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
124 |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
125 and in the former: |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
126 |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
127 * foo (...): ... |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
128 * bar (...): change 1 |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
129 (...): -!- |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
130 |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
131 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
|
132 this variable." |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
133 :version "20.3" |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
134 :type 'boolean |
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
135 :group 'change-log) |
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
136 |
40315
e41eca24ba8c
(add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents:
39625
diff
changeset
|
137 (defcustom add-log-always-start-new-record nil |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
138 "If non-nil, `add-change-log-entry' will always start a new record." |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59355
diff
changeset
|
139 :version "22.1" |
40315
e41eca24ba8c
(add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents:
39625
diff
changeset
|
140 :type 'boolean |
e41eca24ba8c
(add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents:
39625
diff
changeset
|
141 :group 'change-log) |
e41eca24ba8c
(add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents:
39625
diff
changeset
|
142 |
32011
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
143 (defcustom add-log-buffer-file-name-function nil |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
144 "If non-nil, function to call to identify the full filename of a buffer. |
32011
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
145 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
|
146 use `buffer-file-name'." |
35936 | 147 :type '(choice (const nil) function) |
32011
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
148 :group 'change-log) |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
149 |
24289
7917ac967ee5
(add-log-file-name-function): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
23215
diff
changeset
|
150 (defcustom add-log-file-name-function nil |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
151 "If non-nil, function to call to identify the filename for a ChangeLog entry. |
27240 | 152 This function is called with one argument, the value of variable |
153 `buffer-file-name' in that buffer. If this is nil, the default is to | |
154 use the file's name relative to the directory of the change log file." | |
35936 | 155 :type '(choice (const nil) function) |
24289
7917ac967ee5
(add-log-file-name-function): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
23215
diff
changeset
|
156 :group 'change-log) |
7917ac967ee5
(add-log-file-name-function): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
23215
diff
changeset
|
157 |
27003
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
158 |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
159 (defcustom change-log-version-info-enabled nil |
82005
0de2cd15c33d
(add-change-log-entry, add-log-current-defun, change-log-merge):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82003
diff
changeset
|
160 "If non-nil, enable recording version numbers with the changes." |
27003
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
161 :version "21.1" |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
162 :type 'boolean |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
163 :group 'change-log) |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
164 |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
165 (defcustom change-log-version-number-regexp-list |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
166 (let ((re "\\([0-9]+\.[0-9.]+\\)")) |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
167 (list |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
168 ;; (defconst ad-version "2.15" |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
169 (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
|
170 ;; Revision: pcl-cvs.el,v 1.72 1999/09/05 20:21:54 monnier Exp |
28446 | 171 (concat "^;+ *Revision: +[^ \t\n]+[ \t]+" re))) |
82005
0de2cd15c33d
(add-change-log-entry, add-log-current-defun, change-log-merge):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82003
diff
changeset
|
172 "List of regexps to search for version number. |
28446 | 173 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
|
174 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
|
175 :version "21.1" |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
176 :type '(repeat regexp) |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
177 :group 'change-log) |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
178 |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
179 (defface change-log-date |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
180 '((t (:inherit font-lock-string-face))) |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
181 "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
|
182 :version "21.1" |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
183 :group 'change-log) |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
184 ;; backward-compatibility alias |
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
185 (put 'change-log-date-face 'face-alias 'change-log-date) |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
186 |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
187 (defface change-log-name |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
188 '((t (:inherit font-lock-constant-face))) |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
189 "Face for highlighting author names." |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
190 :version "21.1" |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
191 :group 'change-log) |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
192 ;; backward-compatibility alias |
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
193 (put 'change-log-name-face 'face-alias 'change-log-name) |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
194 |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
195 (defface change-log-email |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
196 '((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
|
197 "Face for highlighting author email addresses." |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
198 :version "21.1" |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
199 :group 'change-log) |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
200 ;; backward-compatibility alias |
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
201 (put 'change-log-email-face 'face-alias 'change-log-email) |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
202 |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
203 (defface change-log-file |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
204 '((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
|
205 "Face for highlighting file names." |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
206 :version "21.1" |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
207 :group 'change-log) |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
208 ;; backward-compatibility alias |
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
209 (put 'change-log-file-face 'face-alias 'change-log-file) |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
210 |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
211 (defface change-log-list |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
212 '((t (:inherit font-lock-keyword-face))) |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
213 "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
|
214 :version "21.1" |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
215 :group 'change-log) |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
216 ;; backward-compatibility alias |
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
217 (put 'change-log-list-face 'face-alias 'change-log-list) |
40315
e41eca24ba8c
(add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents:
39625
diff
changeset
|
218 |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
219 (defface change-log-conditionals |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
220 '((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
|
221 "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
|
222 :version "21.1" |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
223 :group 'change-log) |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
224 ;; backward-compatibility alias |
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
225 (put 'change-log-conditionals-face 'face-alias 'change-log-conditionals) |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
226 |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
227 (defface change-log-function |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
228 '((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
|
229 "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
|
230 :version "21.1" |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
231 :group 'change-log) |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
232 ;; backward-compatibility alias |
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
233 (put 'change-log-function-face 'face-alias 'change-log-function) |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
234 |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
235 (defface change-log-acknowledgement |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
236 '((t (:inherit font-lock-comment-face))) |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
237 "Face for highlighting acknowledgments." |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
238 :version "21.1" |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
239 :group 'change-log) |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
240 ;; backward-compatibility alias |
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
241 (put 'change-log-acknowledgement-face 'face-alias 'change-log-acknowledgement) |
27003
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
242 |
88035
edcfc11338ad
* add-log.el (change-log-search-file-name, change-log-find-file):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
243 (defconst change-log-file-names-re "^\\( +\\|\t\\)\\* \\([^ ,:([\n]+\\)") |
88036
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
244 (defconst change-log-start-entry-re "^\\sw.........[0-9:+ ]*") |
88035
edcfc11338ad
* add-log.el (change-log-search-file-name, change-log-find-file):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
245 |
9377
45228a0f6b78
(change-log-mode): Set font-lock-keywords locally.
Richard M. Stallman <rms@gnu.org>
parents:
9347
diff
changeset
|
246 (defvar change-log-font-lock-keywords |
88035
edcfc11338ad
* add-log.el (change-log-search-file-name, change-log-find-file):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
247 `(;; |
63668
a7098c7b8f0f
(change-log-font-lock-keywords): Make the regexp for
Kenichi Handa <handa@m17n.org>
parents:
63195
diff
changeset
|
248 ;; Date lines, new (2000-01-01) and old (Sat Jan 1 00:00:00 2000) styles. |
a7098c7b8f0f
(change-log-font-lock-keywords): Make the regexp for
Kenichi Handa <handa@m17n.org>
parents:
63195
diff
changeset
|
249 ;; Fixme: this regepx is just an approximate one and may match |
a7098c7b8f0f
(change-log-font-lock-keywords): Make the regexp for
Kenichi Handa <handa@m17n.org>
parents:
63195
diff
changeset
|
250 ;; wrongly with a non-date line existing as a random note. In |
a7098c7b8f0f
(change-log-font-lock-keywords): Make the regexp for
Kenichi Handa <handa@m17n.org>
parents:
63195
diff
changeset
|
251 ;; addition, using any kind of fixed setting like this doesn't |
a7098c7b8f0f
(change-log-font-lock-keywords): Make the regexp for
Kenichi Handa <handa@m17n.org>
parents:
63195
diff
changeset
|
252 ;; work if a user customizes add-log-time-format. |
a7098c7b8f0f
(change-log-font-lock-keywords): Make the regexp for
Kenichi Handa <handa@m17n.org>
parents:
63195
diff
changeset
|
253 ("^[0-9-]+ +\\|^\\(Sun\\|Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\) [A-z][a-z][a-z] [0-9:+ ]+" |
a7098c7b8f0f
(change-log-font-lock-keywords): Make the regexp for
Kenichi Handa <handa@m17n.org>
parents:
63195
diff
changeset
|
254 (0 'change-log-date-face) |
23215
c06f07cf6bba
(change-log-font-lock-keywords): Do parenthesized
Dave Love <fx@gnu.org>
parents:
22388
diff
changeset
|
255 ;; Name and e-mail; some people put e-mail in parens, not angles. |
62877
b03135d4ca2a
(change-log-font-lock-keywords):
Juri Linkov <juri@jurta.org>
parents:
62458
diff
changeset
|
256 ("\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]" nil nil |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
257 (1 'change-log-name) |
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
258 (2 'change-log-email))) |
16450
82b0566ece27
Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents:
16035
diff
changeset
|
259 ;; |
82b0566ece27
Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents:
16035
diff
changeset
|
260 ;; File names. |
88035
edcfc11338ad
* add-log.el (change-log-search-file-name, change-log-find-file):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
261 (,change-log-file-names-re |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
262 (2 'change-log-file) |
23215
c06f07cf6bba
(change-log-font-lock-keywords): Do parenthesized
Dave Love <fx@gnu.org>
parents:
22388
diff
changeset
|
263 ;; Possibly further names in a list: |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
264 ("\\=, \\([^ ,:([\n]+\\)" nil nil (1 'change-log-file)) |
23215
c06f07cf6bba
(change-log-font-lock-keywords): Do parenthesized
Dave Love <fx@gnu.org>
parents:
22388
diff
changeset
|
265 ;; Possibly a parenthesized list of names: |
61265
847e4dd1b608
(change-log-font-lock-keywords): Names in parenthesized lists can
Lute Kamstra <lute@gnu.org>
parents:
61253
diff
changeset
|
266 ("\\= (\\([^(),\n]+\\|(\\(setf\\|SETF\\) [^() ,\n]+)\\)" |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
267 nil nil (1 'change-log-list)) |
61265
847e4dd1b608
(change-log-font-lock-keywords): Names in parenthesized lists can
Lute Kamstra <lute@gnu.org>
parents:
61253
diff
changeset
|
268 ("\\=, *\\([^(),\n]+\\|(\\(setf\\|SETF\\) [^() ,\n]+)\\)" |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
269 nil nil (1 'change-log-list))) |
16450
82b0566ece27
Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents:
16035
diff
changeset
|
270 ;; |
82b0566ece27
Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents:
16035
diff
changeset
|
271 ;; Function or variable names. |
61342
2a3ffd4954e2
(change-log-font-lock-keywords): Complete 2005-04-03 change.
Lute Kamstra <lute@gnu.org>
parents:
61265
diff
changeset
|
272 ("^\\( +\\|\t\\)(\\([^(),\n]+\\|(\\(setf\\|SETF\\) [^() ,\n]+)\\)" |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
273 (2 'change-log-list) |
61265
847e4dd1b608
(change-log-font-lock-keywords): Names in parenthesized lists can
Lute Kamstra <lute@gnu.org>
parents:
61253
diff
changeset
|
274 ("\\=, *\\([^(),\n]+\\|(\\(setf\\|SETF\\) [^() ,\n]+)\\)" nil nil |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
275 (1 'change-log-list))) |
16450
82b0566ece27
Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents:
16035
diff
changeset
|
276 ;; |
82b0566ece27
Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents:
16035
diff
changeset
|
277 ;; Conditionals. |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
278 ("\\[!?\\([^]\n]+\\)\\]\\(:\\| (\\)" (1 'change-log-conditionals)) |
16450
82b0566ece27
Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents:
16035
diff
changeset
|
279 ;; |
29329
5b85d9e700da
(change-log-font-lock-keywords) <function>: Add
Dave Love <fx@gnu.org>
parents:
29243
diff
changeset
|
280 ;; Function of change. |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
281 ("<\\([^>\n]+\\)>\\(:\\| (\\)" (1 'change-log-function)) |
29329
5b85d9e700da
(change-log-font-lock-keywords) <function>: Add
Dave Love <fx@gnu.org>
parents:
29243
diff
changeset
|
282 ;; |
19439 | 283 ;; Acknowledgements. |
59355
448dec90812c
(change-log-font-lock-keywords): Don't match just "From".
Richard M. Stallman <rms@gnu.org>
parents:
58737
diff
changeset
|
284 ;; Don't include plain "From" because that is vague; |
448dec90812c
(change-log-font-lock-keywords): Don't match just "From".
Richard M. Stallman <rms@gnu.org>
parents:
58737
diff
changeset
|
285 ;; we want to encourage people to say something more specific. |
62255 | 286 ;; Note that the FSF does not use "Patches by"; our convention |
287 ;; is to put the name of the author of the changes at the top | |
288 ;; of the change log entry. | |
61342
2a3ffd4954e2
(change-log-font-lock-keywords): Complete 2005-04-03 change.
Lute Kamstra <lute@gnu.org>
parents:
61265
diff
changeset
|
289 ("\\(^\\( +\\|\t\\)\\| \\)\\(Patch\\(es\\)? by\\|Report\\(ed by\\| from\\)\\|Suggest\\(ed by\\|ion from\\)\\)" |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
290 3 'change-log-acknowledgement)) |
9377
45228a0f6b78
(change-log-mode): Set font-lock-keywords locally.
Richard M. Stallman <rms@gnu.org>
parents:
9347
diff
changeset
|
291 "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
|
292 |
88035
edcfc11338ad
* add-log.el (change-log-search-file-name, change-log-find-file):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
293 (defun change-log-search-file-name (where) |
edcfc11338ad
* add-log.el (change-log-search-file-name, change-log-find-file):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
294 "Return the file-name for the change under point." |
edcfc11338ad
* add-log.el (change-log-search-file-name, change-log-find-file):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
295 (save-excursion |
edcfc11338ad
* add-log.el (change-log-search-file-name, change-log-find-file):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
296 (goto-char where) |
edcfc11338ad
* add-log.el (change-log-search-file-name, change-log-find-file):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
297 (beginning-of-line 1) |
88036
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
298 (if (looking-at change-log-start-entry-re) |
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
299 ;; We are at the start of an entry, search forward for a file |
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
300 ;; name. |
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
301 (progn |
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
302 (re-search-forward change-log-file-names-re nil t) |
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
303 (match-string 2)) |
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
304 (if (looking-at change-log-file-names-re) |
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
305 ;; We found a file name. |
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
306 (match-string 2) |
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
307 ;; Look backwards for either a file name or the log entry start. |
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
308 (if (re-search-backward |
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
309 (concat "\\(" change-log-start-entry-re |
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
310 "\\)\\|\\(" |
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
311 change-log-file-names-re "\\)") nil t) |
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
312 (if (match-beginning 1) |
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
313 ;; We got the start of the entry, look forward for a |
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
314 ;; file name. |
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
315 (progn |
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
316 (re-search-forward change-log-file-names-re nil t) |
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
317 (match-string 2)) |
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
318 (match-string 4)) |
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
319 ;; We must be before any file name, look forward. |
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
320 (re-search-forward change-log-file-names-re nil t) |
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
321 (match-string 2)))))) |
88035
edcfc11338ad
* add-log.el (change-log-search-file-name, change-log-find-file):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
322 |
edcfc11338ad
* add-log.el (change-log-search-file-name, change-log-find-file):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
323 (defun change-log-find-file () |
edcfc11338ad
* add-log.el (change-log-search-file-name, change-log-find-file):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
324 "Visit the file for the change under point." |
edcfc11338ad
* add-log.el (change-log-search-file-name, change-log-find-file):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
325 (interactive) |
edcfc11338ad
* add-log.el (change-log-search-file-name, change-log-find-file):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
326 (let ((file (change-log-search-file-name (point)))) |
edcfc11338ad
* add-log.el (change-log-search-file-name, change-log-find-file):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
327 (if (and file (file-exists-p file)) |
edcfc11338ad
* add-log.el (change-log-search-file-name, change-log-find-file):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
328 (find-file file) |
88036
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
329 (message "No such file or directory: %s" file)))) |
88035
edcfc11338ad
* add-log.el (change-log-search-file-name, change-log-find-file):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
330 |
51580
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
331 (defvar change-log-mode-map |
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
332 (let ((map (make-sparse-keymap))) |
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
333 (define-key map [?\C-c ?\C-p] 'add-log-edit-prev-comment) |
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
334 (define-key map [?\C-c ?\C-n] 'add-log-edit-next-comment) |
88035
edcfc11338ad
* add-log.el (change-log-search-file-name, change-log-find-file):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
335 (define-key map [?\C-c ?\C-f] 'change-log-find-file) |
51580
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
336 map) |
15889 | 337 "Keymap for Change Log major mode.") |
338 | |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
339 ;; It used to be called change-log-time-zone-rule but really should be |
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
340 ;; called add-log-time-zone-rule since it's only used from add-log-* code. |
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
341 (defvaralias 'change-log-time-zone-rule 'add-log-time-zone-rule) |
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
342 (defvar add-log-time-zone-rule nil |
15909
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
343 "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
|
344 It takes the same format as the TZ argument of `set-time-zone-rule'. |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
345 If nil, use local time. |
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
346 If t, use universal time.") |
73719
f172c9540c9c
(add-log-time-zone-rule): Mark as safe-local-variable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
73052
diff
changeset
|
347 (put 'add-log-time-zone-rule 'safe-local-variable |
f172c9540c9c
(add-log-time-zone-rule): Mark as safe-local-variable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
73052
diff
changeset
|
348 '(lambda (x) (or (booleanp x) (stringp x)))) |
15909
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
349 |
70231
b98a2445fe1f
(add-log-iso8601-time-zone): Make parameter optional.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
70217
diff
changeset
|
350 (defun add-log-iso8601-time-zone (&optional time) |
15909
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
351 (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
|
352 (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
|
353 (sec (abs utc-offset)) |
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
354 (ss (% sec 60)) |
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
355 (min (/ sec 60)) |
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
356 (mm (% min 60)) |
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
357 (hh (/ min 60))) |
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
358 (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
|
359 ((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
|
360 (t "%c%02d")) |
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
361 sign hh mm ss))) |
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
362 |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
363 (defvar add-log-iso8601-with-time-zone nil) |
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
364 |
18277
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
365 (defun add-log-iso8601-time-string () |
70231
b98a2445fe1f
(add-log-iso8601-time-zone): Make parameter optional.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
70217
diff
changeset
|
366 (let ((time (format-time-string "%Y-%m-%d" |
b98a2445fe1f
(add-log-iso8601-time-zone): Make parameter optional.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
70217
diff
changeset
|
367 nil (eq t add-log-time-zone-rule)))) |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
368 (if add-log-iso8601-with-time-zone |
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
369 (concat time " " (add-log-iso8601-time-zone)) |
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
370 time))) |
18277
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
371 |
661 | 372 (defun change-log-name () |
27240 | 373 "Return (system-dependent) default name for a change log file." |
661 | 374 (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
|
375 (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
|
376 "$CHANGE_LOG$.TXT" |
9d8b374b5bb1
(change-log-name): Don't treat MSDOS, NT specially.
Richard M. Stallman <rms@gnu.org>
parents:
15909
diff
changeset
|
377 "ChangeLog"))) |
661 | 378 |
51580
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
379 (defun add-log-edit-prev-comment (arg) |
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
380 "Cycle backward through Log-Edit mode comment history. |
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
381 With a numeric prefix ARG, go back ARG comments." |
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
382 (interactive "*p") |
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
383 (save-restriction |
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
384 (narrow-to-region (point) |
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
385 (if (memq last-command '(add-log-edit-prev-comment |
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
386 add-log-edit-next-comment)) |
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
387 (mark) (point))) |
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
388 (when (fboundp 'log-edit-previous-comment) |
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
389 (log-edit-previous-comment arg) |
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
390 (indent-region (point-min) (point-max)) |
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
391 (goto-char (point-min)) |
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
392 (unless (save-restriction (widen) (bolp)) |
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
393 (delete-region (point) (progn (skip-chars-forward " \t\n") (point)))) |
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
394 (set-mark (point-min)) |
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
395 (goto-char (point-max)) |
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
396 (delete-region (point) (progn (skip-chars-backward " \t\n") (point)))))) |
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
397 |
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
398 (defun add-log-edit-next-comment (arg) |
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
399 "Cycle forward through Log-Edit mode comment history. |
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
400 With a numeric prefix ARG, go back ARG comments." |
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
401 (interactive "*p") |
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
402 (add-log-edit-prev-comment (- arg))) |
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
403 |
4157
d2316090d029
(prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents:
4154
diff
changeset
|
404 ;;;###autoload |
661 | 405 (defun prompt-for-change-log-name () |
406 "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
|
407 (let* ((default (change-log-name)) |
f4a8265756e7
(prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents:
11816
diff
changeset
|
408 (name (expand-file-name |
f4a8265756e7
(prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents:
11816
diff
changeset
|
409 (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
|
410 nil default)))) |
f4a8265756e7
(prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents:
11816
diff
changeset
|
411 ;; 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
|
412 ;; 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
|
413 (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
|
414 (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
|
415 name) |
f4a8265756e7
(prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents:
11816
diff
changeset
|
416 ;; 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
|
417 (if (file-directory-p name) |
f4a8265756e7
(prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents:
11816
diff
changeset
|
418 (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
|
419 (file-name-as-directory name)) |
f4a8265756e7
(prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents:
11816
diff
changeset
|
420 name)))) |
661 | 421 |
27003
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
422 (defun change-log-version-number-search () |
28446 | 423 "Return version number of current buffer's file. |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
84676
diff
changeset
|
424 This is the value returned by `vc-working-revision' or, if that is |
28446 | 425 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
|
426 (let* ((size (buffer-size)) |
50575
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
427 (limit |
28446 | 428 ;; The version number can be anywhere in the file, but |
429 ;; restrict search to the file beginning: 10% should be | |
430 ;; enough to prevent some mishits. | |
27003
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
431 ;; |
28446 | 432 ;; Apply percentage only if buffer size is bigger than |
433 ;; approx 100 lines. | |
50575
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
434 (if (> size (* 100 80)) (+ (point) (/ size 10))))) |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
84676
diff
changeset
|
435 (or (and buffer-file-name (vc-working-revision buffer-file-name)) |
28446 | 436 (save-restriction |
437 (widen) | |
50575
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
438 (let ((regexps change-log-version-number-regexp-list) |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
439 version) |
28446 | 440 (while regexps |
441 (save-excursion | |
442 (goto-char (point-min)) | |
50575
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
443 (when (re-search-forward (pop regexps) limit t) |
28446 | 444 (setq version (match-string 1) |
50575
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
445 regexps nil)))) |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
446 version))))) |
27003
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
447 |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
448 |
661 | 449 ;;;###autoload |
32011
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
450 (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
|
451 "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
|
452 |
0495d3085f00
(find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents:
6562
diff
changeset
|
453 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
|
454 If FILE-NAME is nil, use the value of `change-log-default-name'. |
62251
5c40be16225d
(find-change-log): Fix typos in the docstring of function.
Masatake YAMATO <jet@gyve.org>
parents:
61342
diff
changeset
|
455 If `change-log-default-name' is nil, behave as though it were 'ChangeLog' |
9886
f54af6fe889e
(find-change-log): If change-log-default-name
Richard M. Stallman <rms@gnu.org>
parents:
9774
diff
changeset
|
456 \(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
|
457 |
62251
5c40be16225d
(find-change-log): Fix typos in the docstring of function.
Masatake YAMATO <jet@gyve.org>
parents:
61342
diff
changeset
|
458 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
|
459 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
|
460 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
|
461 |
d3c9f0ad5964
(find-change-log): New function.
Roland McGrath <roland@gnu.org>
parents:
2307
diff
changeset
|
462 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
|
463 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
|
464 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
|
465 ;; 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
|
466 ;; just use that. |
2463
d3c9f0ad5964
(find-change-log): New function.
Roland McGrath <roland@gnu.org>
parents:
2307
diff
changeset
|
467 (or file-name |
9886
f54af6fe889e
(find-change-log): If change-log-default-name
Richard M. Stallman <rms@gnu.org>
parents:
9774
diff
changeset
|
468 (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
|
469 (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
|
470 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
|
471 (progn |
0495d3085f00
(find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents:
6562
diff
changeset
|
472 ;; 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
|
473 ;; 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
|
474 (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
|
475 (file-name-directory |
32011
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
476 (file-chase-links |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
477 (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
|
478 default-directory)) |
0495d3085f00
(find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents:
6562
diff
changeset
|
479 (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
|
480 (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
|
481 ;; 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
|
482 ;; 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
|
483 ;; 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
|
484 (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
|
485 (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
|
486 ;; 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
|
487 (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
|
488 parent-dir) |
0495d3085f00
(find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents:
6562
diff
changeset
|
489 (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
|
490 (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
|
491 (file-name-directory |
0495d3085f00
(find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents:
6562
diff
changeset
|
492 (directory-file-name |
0495d3085f00
(find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents:
6562
diff
changeset
|
493 (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
|
494 ;; 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
|
495 (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
|
496 parent-dir)))) |
0495d3085f00
(find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents:
6562
diff
changeset
|
497 ;; 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
|
498 (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
|
499 (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
|
500 parent-dir))) |
0495d3085f00
(find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents:
6562
diff
changeset
|
501 ;; 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
|
502 (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
|
503 (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
|
504 ;; 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
|
505 (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
|
506 file-name) |
2463
d3c9f0ad5964
(find-change-log): New function.
Roland McGrath <roland@gnu.org>
parents:
2307
diff
changeset
|
507 |
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
|
508 (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
|
509 ;; 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
|
510 (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
|
511 (if add-log-file-name-function |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
512 (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
|
513 (setq buffer-file |
82002
43f5e1e99ca4
(add-log-file-name): Use file-relative-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81943
diff
changeset
|
514 (file-relative-name buffer-file (file-name-directory log-file))) |
32011
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
515 ;; 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
|
516 ;; 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
|
517 ;; 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
|
518 (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
|
519 (file-name-sans-versions buffer-file) |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
520 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
|
521 |
2463
d3c9f0ad5964
(find-change-log): New function.
Roland McGrath <roland@gnu.org>
parents:
2307
diff
changeset
|
522 ;;;###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
|
523 (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
|
524 "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
|
525 Optional arg WHOAMI (interactive prefix) non-nil means prompt for user |
54983
e6f8f4939bf6
(add-change-log-entry): Update doc string to mention
Stephen Eglen <stephen@gnu.org>
parents:
54430
diff
changeset
|
526 name and email (stored in `add-log-full-name' and `add-log-mailing-address'). |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
527 |
39625
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
528 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
|
529 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
|
530 |
4157
d2316090d029
(prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents:
4154
diff
changeset
|
531 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
|
532 |
4157
d2316090d029
(prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents:
4154
diff
changeset
|
533 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
|
534 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
|
535 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
|
536 |
40315
e41eca24ba8c
(add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents:
39625
diff
changeset
|
537 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
|
538 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
|
539 the same person. |
e41eca24ba8c
(add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents:
39625
diff
changeset
|
540 |
39625
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
541 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
|
542 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
|
543 notices. |
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
544 |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
545 Today's date is calculated according to `add-log-time-zone-rule' if |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
546 non-nil, otherwise in local time." |
661 | 547 (interactive (list current-prefix-arg |
548 (prompt-for-change-log-name))) | |
32011
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
549 (let* ((defun (add-log-current-defun)) |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
550 (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
|
551 (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
|
552 (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
|
553 (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
|
554 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
|
555 (buffer-file (if buf-file-name (expand-file-name buf-file-name))) |
54430
b521d24f538a
(add-change-log-entry): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
556 (file-name (expand-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
|
557 ;; Set ITEM to the file name to use in the new item. |
82003
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
558 (item (add-log-file-name buffer-file file-name))) |
1727
d6cc12c97a59
(add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents:
1644
diff
changeset
|
559 |
47828
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
560 (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
|
561 (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
|
562 (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
|
563 (find-file file-name))) |
82005
0de2cd15c33d
(add-change-log-entry, add-log-current-defun, change-log-merge):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82003
diff
changeset
|
564 (or (derived-mode-p 'change-log-mode) |
5150
60fa14264c3b
(add-change-log-entry): put buffer in change-log-mode.
Richard M. Stallman <rms@gnu.org>
parents:
5038
diff
changeset
|
565 (change-log-mode)) |
661 | 566 (undo-boundary) |
567 (goto-char (point-min)) | |
39625
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
568 |
82003
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
569 (let ((full-name (or add-log-full-name (user-full-name))) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
570 (mailing-address (or add-log-mailing-address user-mail-address))) |
78134
af3890de344f
(add-change-log-entry): Check add-log-full-name
Richard M. Stallman <rms@gnu.org>
parents:
75446
diff
changeset
|
571 |
82003
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
572 (when whoami |
82073 | 573 (setq full-name (read-string "Full name: " full-name)) |
82003
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
574 ;; Note that some sites have room and phone number fields in |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
575 ;; full name which look silly when inserted. Rather than do |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
576 ;; anything about that here, let user give prefix argument so that |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
577 ;; s/he can edit the full name field in prompter if s/he wants. |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
578 (setq mailing-address |
82073 | 579 (read-string "Mailing address: " mailing-address))) |
82003
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
580 |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
581 ;; If file starts with a copyright and permission notice, skip them. |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
582 ;; Assume they end at first blank line. |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
583 (when (looking-at "Copyright") |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
584 (search-forward "\n\n") |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
585 (skip-chars-forward "\n")) |
39625
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
586 |
82003
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
587 ;; Advance into first entry if it is usable; else make new one. |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
588 (let ((new-entries |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
589 (mapcar (lambda (addr) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
590 (concat |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
591 (if (stringp add-log-time-zone-rule) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
592 (let ((tz (getenv "TZ"))) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
593 (unwind-protect |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
594 (progn |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
595 (set-time-zone-rule add-log-time-zone-rule) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
596 (funcall add-log-time-format)) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
597 (set-time-zone-rule tz))) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
598 (funcall add-log-time-format)) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
599 " " full-name |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
600 " <" addr ">")) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
601 (if (consp mailing-address) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
602 mailing-address |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
603 (list mailing-address))))) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
604 (if (and (not add-log-always-start-new-record) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
605 (let ((hit nil)) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
606 (dolist (entry new-entries hit) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
607 (when (looking-at (regexp-quote entry)) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
608 (setq hit t))))) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
609 (forward-line 1) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
610 (insert (nth (random (length new-entries)) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
611 new-entries) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
612 (if use-hard-newlines hard-newline "\n") |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
613 (if use-hard-newlines hard-newline "\n")) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
614 (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
|
615 |
39625
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
616 ;; 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
|
617 ;; item to add to, within this entry. |
82003
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
618 (let ((bound |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
619 (save-excursion |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
620 (if (looking-at "\n*[^\n* \t]") |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
621 (skip-chars-forward "\n") |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
622 (if add-log-keep-changes-together |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
623 (forward-page) ; page delimits entries for date |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
624 (forward-paragraph))) ; paragraph delimits entries for file |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
625 (point)))) |
39625
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
626 |
82003
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
627 ;; Now insert the new line for this item. |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
628 (cond ((re-search-forward "^\\s *\\*\\s *$" bound t) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
629 ;; Put this file name into the existing empty item. |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
630 (if item |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
631 (insert item))) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
632 ((and (not new-entry) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
633 (let (case-fold-search) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
634 (re-search-forward |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
635 (concat (regexp-quote (concat "* " item)) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
636 ;; Don't accept `foo.bar' when |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
637 ;; looking for `foo': |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
638 "\\(\\s \\|[(),:]\\)") |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
639 bound t))) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
640 ;; Add to the existing item for the same file. |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
641 (re-search-forward "^\\s *$\\|^\\s \\*") |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
642 (goto-char (match-beginning 0)) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
643 ;; Delete excess empty lines; make just 2. |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
644 (while (and (not (eobp)) (looking-at "^\\s *$")) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
645 (delete-region (point) (line-beginning-position 2))) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
646 (insert (if use-hard-newlines hard-newline "\n") |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
647 (if use-hard-newlines hard-newline "\n")) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
648 (forward-line -2) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
649 (indent-relative-maybe)) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
650 (t |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
651 ;; Make a new item. |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
652 (while (looking-at "\\sW") |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
653 (forward-line 1)) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
654 (while (and (not (eobp)) (looking-at "^\\s *$")) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
655 (delete-region (point) (line-beginning-position 2))) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
656 (insert (if use-hard-newlines hard-newline "\n") |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
657 (if use-hard-newlines hard-newline "\n") |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
658 (if use-hard-newlines hard-newline "\n")) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
659 (forward-line -2) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
660 (indent-to left-margin) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
661 (insert "* ") |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
662 (if item (insert item))))) |
837
a8aef92e0025
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
811
diff
changeset
|
663 ;; 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
|
664 ;; Point is at the item for this file, |
666
7fa6b835da67
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
661
diff
changeset
|
665 ;; 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
|
666 (if (not defun) |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
667 ;; 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
|
668 (unless (save-excursion |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
669 (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
|
670 (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
|
671 (insert ": ") |
63998
7651543ac34c
(change-log): Finish `defgroup' description with period.
Juanma Barranquero <lekktu@gmail.com>
parents:
63668
diff
changeset
|
672 (if version (insert version ?\s))) |
49308
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
673 ;; 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
|
674 (undo-boundary) |
28446 | 675 (unless (save-excursion |
676 (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
|
677 (looking-at "\\s *$")) |
63998
7651543ac34c
(change-log): Finish `defgroup' description with period.
Juanma Barranquero <lekktu@gmail.com>
parents:
63668
diff
changeset
|
678 (insert ?\s)) |
49308
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
679 ;; 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
|
680 ;; 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
|
681 (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
|
682 (skip-syntax-backward " ") |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
683 (skip-chars-backward "):") |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
684 (if (and (looking-at "):") |
50575
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
685 (let ((pos (save-excursion (backward-sexp 1) (point)))) |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
686 (when (equal (buffer-substring pos (point)) defun) |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
687 (delete-region pos (point))) |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
688 (> fill-column (+ (current-column) (length defun) 4)))) |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
689 (progn (skip-chars-backward ", ") |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
690 (delete-region (point) pos) |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
691 (unless (memq (char-before) '(?\()) (insert ", "))) |
49308
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
692 (if (looking-at "):") |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
693 (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
|
694 (goto-char pos) |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
695 (insert "(")) |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
696 (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
|
697 (insert defun "): ") |
63998
7651543ac34c
(change-log): Finish `defgroup' description with period.
Juanma Barranquero <lekktu@gmail.com>
parents:
63668
diff
changeset
|
698 (if version (insert version ?\s))))) |
661 | 699 |
700 ;;;###autoload | |
701 (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
|
702 "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
|
703 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
|
704 the change log file in another window." |
661 | 705 (interactive (if current-prefix-arg |
706 (list current-prefix-arg | |
707 (prompt-for-change-log-name)))) | |
708 (add-change-log-entry whoami file-name t)) | |
709 | |
82017
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
710 |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
711 (defvar change-log-indent-text 0) |
50575
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
712 |
82017
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
713 (defun change-log-fill-parenthesized-list () |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
714 ;; Fill parenthesized lists of names according to GNU standards. |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
715 ;; * file-name.ext (very-long-foo, very-long-bar, very-long-foobar): |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
716 ;; should be filled as |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
717 ;; * file-name.ext (very-long-foo, very-long-bar) |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
718 ;; (very-long-foobar): |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
719 (save-excursion |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
720 (end-of-line 0) |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
721 (skip-chars-backward " \t") |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
722 (when (and (equal (char-before) ?\,) |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
723 (> (point) (1+ (point-min)))) |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
724 (condition-case nil |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
725 (when (save-excursion |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
726 (and (prog2 |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
727 (up-list -1) |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
728 (equal (char-after) ?\() |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
729 (skip-chars-backward " \t")) |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
730 (or (bolp) |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
731 ;; Skip everything but a whitespace or asterisk. |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
732 (and (not (zerop (skip-chars-backward "^ \t\n*"))) |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
733 (skip-chars-backward " \t") |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
734 ;; We want one asterisk here. |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
735 (= (skip-chars-backward "*") -1) |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
736 (skip-chars-backward " \t") |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
737 (bolp))))) |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
738 ;; Delete the comma. |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
739 (delete-char -1) |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
740 ;; Close list on previous line. |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
741 (insert ")") |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
742 (skip-chars-forward " \t\n") |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
743 ;; Start list on new line. |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
744 (insert-before-markers "(")) |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
745 (error nil))))) |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
746 |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
747 (defun change-log-indent () |
82017
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
748 (change-log-fill-parenthesized-list) |
50575
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
749 (let* ((indent |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
750 (save-excursion |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
751 (beginning-of-line) |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
752 (skip-chars-forward " \t") |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
753 (cond |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
754 ((and (looking-at "\\(.*\\) [^ \n].*[^ \n] <.*>\\(?: +(.*)\\)? *$") |
50575
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
755 ;; Matching the output of add-log-time-format is difficult, |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
756 ;; but I'll get it has at least two adjacent digits. |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
757 (string-match "[[:digit:]][[:digit:]]" (match-string 1))) |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
758 0) |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
759 ((looking-at "[^*(]") |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
760 (+ (current-left-margin) change-log-indent-text)) |
50575
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
761 (t (current-left-margin))))) |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
762 (pos (save-excursion (indent-line-to indent) (point)))) |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
763 (if (> pos (point)) (goto-char pos)))) |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
764 |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
765 |
51580
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
766 (defvar smerge-resolve-function) |
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
767 |
980
b62886fbf2a7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
953
diff
changeset
|
768 ;;;###autoload |
47828
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
769 (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
|
770 "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
|
771 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
|
772 New log entries are usually made with \\[add-change-log-entry] or \\[add-change-log-entry-other-window]. |
951 | 773 Each entry behaves as a paragraph, and the entries for one day as a page. |
51580
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
774 Runs `change-log-mode-hook'. |
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
775 \\{change-log-mode-map}" |
47828
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
776 (setq left-margin 8 |
13706
ba34746d66fd
(change-log-mode): Defaults for `indent-tabs-mode'
Karl Heuer <kwzh@gnu.org>
parents:
13648
diff
changeset
|
777 fill-column 74 |
15887
18c1dcf40139
(change-log-mode): Set fill-paragraph-function.
Karl Heuer <kwzh@gnu.org>
parents:
15299
diff
changeset
|
778 indent-tabs-mode t |
81501
801606fb518b
(change-log-mode): Set `show-trailing-whitespace'.
Juanma Barranquero <lekktu@gmail.com>
parents:
75446
diff
changeset
|
779 tab-width 8 |
801606fb518b
(change-log-mode): Set `show-trailing-whitespace'.
Juanma Barranquero <lekktu@gmail.com>
parents:
75446
diff
changeset
|
780 show-trailing-whitespace t) |
15887
18c1dcf40139
(change-log-mode): Set fill-paragraph-function.
Karl Heuer <kwzh@gnu.org>
parents:
15299
diff
changeset
|
781 (set (make-local-variable 'fill-paragraph-function) |
18c1dcf40139
(change-log-mode): Set fill-paragraph-function.
Karl Heuer <kwzh@gnu.org>
parents:
15299
diff
changeset
|
782 'change-log-fill-paragraph) |
81943
d32ff111504c
(change-log-mode): Use fill-nobreak-predicate to
Martin Rudalics <rudalics@gmx.at>
parents:
81501
diff
changeset
|
783 ;; Avoid that filling leaves behind a single "*" on a line. |
d32ff111504c
(change-log-mode): Use fill-nobreak-predicate to
Martin Rudalics <rudalics@gmx.at>
parents:
81501
diff
changeset
|
784 (add-hook 'fill-nobreak-predicate |
d32ff111504c
(change-log-mode): Use fill-nobreak-predicate to
Martin Rudalics <rudalics@gmx.at>
parents:
81501
diff
changeset
|
785 '(lambda () |
d32ff111504c
(change-log-mode): Use fill-nobreak-predicate to
Martin Rudalics <rudalics@gmx.at>
parents:
81501
diff
changeset
|
786 (looking-back "^\\s *\\*\\s *" (line-beginning-position))) |
d32ff111504c
(change-log-mode): Use fill-nobreak-predicate to
Martin Rudalics <rudalics@gmx.at>
parents:
81501
diff
changeset
|
787 nil t) |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
788 (set (make-local-variable 'indent-line-function) 'change-log-indent) |
50575
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
789 (set (make-local-variable 'tab-always-indent) nil) |
21719
c888284a54f7
(change-log-mode): Add `* ' to paragraph-start.
Dave Love <fx@gnu.org>
parents:
21629
diff
changeset
|
790 ;; 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
|
791 ;; 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
|
792 ;; 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
|
793 ;; between entries for different files. |
21749
84df514f7719
(change-log-mode): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
21719
diff
changeset
|
794 (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
|
795 (set (make-local-variable 'paragraph-separate) paragraph-start) |
1078
15b4ed20e524
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1062
diff
changeset
|
796 ;; 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
|
797 ;; 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
|
798 (set (make-local-variable 'page-delimiter) "^\\<\\|^\f") |
678 | 799 (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
|
800 (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
|
801 'change-log-resolve-conflict) |
678 | 802 (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
|
803 (set (make-local-variable 'font-lock-defaults) |
85570
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
804 '(change-log-font-lock-keywords t nil nil backward-paragraph)) |
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
805 (set (make-local-variable 'isearch-buffers-next-buffer-function) |
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
806 'change-log-next-buffer) |
85650
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
807 (set (make-local-variable 'beginning-of-defun-function) |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
808 'change-log-beginning-of-defun) |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
809 (set (make-local-variable 'end-of-defun-function) |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
810 'change-log-end-of-defun) |
85570
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
811 (isearch-buffers-minor-mode)) |
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
812 |
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
813 (defun change-log-next-buffer (&optional buffer wrap) |
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
814 "Return the next buffer in the series of ChangeLog file buffers. |
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
815 This function is used for multiple buffers isearch. |
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
816 A sequence of buffers is formed by ChangeLog files with decreasing |
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
817 numeric file name suffixes in the directory of the initial ChangeLog |
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
818 file were isearch was started." |
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
819 (let* ((name (change-log-name)) |
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
820 (files (cons name (sort (file-expand-wildcards |
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
821 (concat name "[-.][0-9]*")) |
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
822 (lambda (a b) |
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
823 (version< (substring b (length name)) |
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
824 (substring a (length name))))))) |
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
825 (files (if isearch-forward files (reverse files)))) |
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
826 (find-file-noselect |
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
827 (if wrap |
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
828 (car files) |
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
829 (cadr (member (file-name-nondirectory (buffer-file-name buffer)) |
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
830 files)))))) |
666
7fa6b835da67
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
661
diff
changeset
|
831 |
4157
d2316090d029
(prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents:
4154
diff
changeset
|
832 ;; 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
|
833 ;; 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
|
834 ;; 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
|
835 ;; 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
|
836 (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
|
837 "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
|
838 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
|
839 (interactive "P") |
16505
39efcea11aad
(change-log-fill-paragraph): Return non-nil so
Richard M. Stallman <rms@gnu.org>
parents:
16450
diff
changeset
|
840 (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
|
841 (beg (progn (backward-paragraph) (point))) |
82017
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
842 ;; Add lines starting with whitespace followed by a left paren or an |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
843 ;; asterisk. |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
844 (paragraph-start (concat paragraph-start "\\|\\s *\\(?:\\s(\\|\\*\\)")) |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
845 ;; Make sure we call `change-log-indent'. |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
846 (fill-indent-according-to-mode t)) |
16505
39efcea11aad
(change-log-fill-paragraph): Return non-nil so
Richard M. Stallman <rms@gnu.org>
parents:
16450
diff
changeset
|
847 (fill-region beg end justify) |
39efcea11aad
(change-log-fill-paragraph): Return non-nil so
Richard M. Stallman <rms@gnu.org>
parents:
16450
diff
changeset
|
848 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
|
849 |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
850 (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
|
851 "^\\([[:upper:]][[:upper:]_ ]*[[:upper:]_]\\|[-_[:alpha:]]+\\)[ \t]*[:=]" |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
852 "Heuristic regexp used by `add-log-current-defun' for unknown major modes." |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
853 :type 'regexp |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
854 :group 'change-log) |
666
7fa6b835da67
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
661
diff
changeset
|
855 |
6562
0541a368505c
(add-log-current-defun): Autoload this.
Roland McGrath <roland@gnu.org>
parents:
6309
diff
changeset
|
856 ;;;###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
|
857 (defvar add-log-lisp-like-modes |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
858 '(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
|
859 "*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
|
860 |
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
|
861 ;;;###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
|
862 (defvar add-log-c-like-modes |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
863 '(c-mode c++-mode c++-c-mode objc-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
|
864 "*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
|
865 |
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
|
866 ;;;###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
|
867 (defvar add-log-tex-like-modes |
82005
0de2cd15c33d
(add-change-log-entry, add-log-current-defun, change-log-merge):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82003
diff
changeset
|
868 '(TeX-mode plain-TeX-mode LaTeX-mode tex-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
|
869 "*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
|
870 |
93565
622e5fddb043
(c-beginning-of-defun, c-end-of-defun): Remove declarations; no longer used.
Glenn Morris <rgm@gnu.org>
parents:
93557
diff
changeset
|
871 (declare-function c-cpp-define-name "cc-cmds" ()) |
622e5fddb043
(c-beginning-of-defun, c-end-of-defun): Remove declarations; no longer used.
Glenn Morris <rgm@gnu.org>
parents:
93557
diff
changeset
|
872 (declare-function c-defun-name "cc-cmds" ()) |
86234
860a7a8e779e
* progmodes/octave-mod.el (inferior-octave-send-list-and-digest):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85650
diff
changeset
|
873 |
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
|
874 ;;;###autoload |
666
7fa6b835da67
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
661
diff
changeset
|
875 (defun add-log-current-defun () |
7fa6b835da67
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
661
diff
changeset
|
876 "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
|
877 |
3499
6428162f137c
(add-log-current-defun): Fix typos in last change.
Richard M. Stallman <rms@gnu.org>
parents:
3486
diff
changeset
|
878 Understands C, Lisp, LaTeX (\"functions\" are chapters, sections, ...), |
28446 | 879 Texinfo (@node titles) and Perl. |
666
7fa6b835da67
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
661
diff
changeset
|
880 |
7fa6b835da67
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
661
diff
changeset
|
881 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
|
882 point for uppercase headings starting in the first column or |
28446 | 883 identifiers followed by `:' or `='. See variables |
27277
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
884 `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
|
885 `add-log-current-defun-function'. |
666
7fa6b835da67
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
661
diff
changeset
|
886 |
7fa6b835da67
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
661
diff
changeset
|
887 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
|
888 (condition-case nil |
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
889 (save-excursion |
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
890 (let ((location (point))) |
28446 | 891 (cond (add-log-current-defun-function |
892 (funcall add-log-current-defun-function)) | |
82005
0de2cd15c33d
(add-change-log-entry, add-log-current-defun, change-log-merge):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82003
diff
changeset
|
893 ((apply 'derived-mode-p 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
|
894 ;; 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
|
895 ;; 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
|
896 ;; rather than the previous one. |
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
897 (or (eobp) (forward-char 1)) |
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
898 (beginning-of-defun) |
28446 | 899 ;; Make sure we are really inside the defun found, |
900 ;; not after it. | |
21944
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
901 (when (and (looking-at "\\s(") |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
902 (progn (end-of-defun) |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
903 (< location (point))) |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
904 (progn (forward-sexp -1) |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
905 (>= location (point)))) |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
906 (if (looking-at "\\s(") |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
907 (forward-char 1)) |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
908 ;; Skip the defining construct name, typically "defun" |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
909 ;; or "defvar". |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
910 (forward-sexp 1) |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
911 ;; 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
|
912 ;; If it is not, use the first symbol in it. |
22018 | 913 (skip-chars-forward " \t\n'(") |
28446 | 914 (buffer-substring-no-properties (point) |
915 (progn (forward-sexp 1) | |
916 (point))))) | |
82005
0de2cd15c33d
(add-change-log-entry, add-log-current-defun, change-log-merge):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82003
diff
changeset
|
917 ((apply 'derived-mode-p add-log-c-like-modes) |
93557
0757ce2515ac
(add-log-current-defun): Move the functionality which gets the current
Alan Mackenzie <acm@muc.de>
parents:
88036
diff
changeset
|
918 (or (c-cpp-define-name) |
0757ce2515ac
(add-log-current-defun): Move the functionality which gets the current
Alan Mackenzie <acm@muc.de>
parents:
88036
diff
changeset
|
919 (c-defun-name))) |
0757ce2515ac
(add-log-current-defun): Move the functionality which gets the current
Alan Mackenzie <acm@muc.de>
parents:
88036
diff
changeset
|
920 ((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
|
921 (if (re-search-backward |
28446 | 922 "\\\\\\(sub\\)*\\(section\\|paragraph\\|chapter\\)" |
923 nil t) | |
1447
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
924 (progn |
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
925 (goto-char (match-beginning 0)) |
28446 | 926 (buffer-substring-no-properties |
927 (1+ (point)) ; without initial backslash | |
928 (line-end-position))))) | |
82005
0de2cd15c33d
(add-change-log-entry, add-log-current-defun, change-log-merge):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82003
diff
changeset
|
929 ((derived-mode-p 'texinfo-mode) |
9397
eba13d81ba0b
(add-log-current-defun): In texinfo-mode,
Richard M. Stallman <rms@gnu.org>
parents:
9377
diff
changeset
|
930 (if (re-search-backward "^@node[ \t]+\\([^,\n]+\\)" nil t) |
28446 | 931 (match-string-no-properties 1))) |
84676
a5b42c90ed30
(add-log-current-defun): Fix thinko w.r.t derived-mode-p.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84370
diff
changeset
|
932 ((derived-mode-p '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
|
933 (if (re-search-backward "^sub[ \t]+\\([^({ \t\n]+\\)" nil t) |
28446 | 934 (match-string-no-properties 1))) |
935 ;; Emacs's autoconf-mode installs its own | |
936 ;; `add-log-current-defun-function'. This applies to | |
937 ;; a different mode apparently for editing .m4 | |
938 ;; autoconf source. | |
82005
0de2cd15c33d
(add-change-log-entry, add-log-current-defun, change-log-merge):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82003
diff
changeset
|
939 ((derived-mode-p 'autoconf-mode) |
28446 | 940 (if (re-search-backward |
941 "^\\(\\(m4_\\)?define\\|A._DEFUN\\)(\\[?\\([A-Za-z0-9_]+\\)" nil t) | |
942 (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
|
943 (t |
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
944 ;; If all else fails, try heuristics |
27277
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
945 (let (case-fold-search |
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
946 result) |
1447
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
947 (end-of-line) |
27277
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
948 (when (re-search-backward |
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
949 add-log-current-defun-header-regexp |
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
950 (- (point) 10000) |
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
951 t) |
28446 | 952 (setq result (or (match-string-no-properties 1) |
953 (match-string-no-properties 0))) | |
27277
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
954 ;; Strip whitespace away |
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
955 (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
|
956 result) |
28446 | 957 (setq result (match-string-no-properties 1 result))) |
27277
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
958 result)))))) |
1447
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
959 (error nil))) |
999 | 960 |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
961 (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
|
962 |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
963 ;; 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
|
964 ;; 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
|
965 ;; 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
|
966 (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
|
967 (setq change-log-get-method-definition-md |
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
968 (concat change-log-get-method-definition-md |
28446 | 969 (match-string 1) |
13282
69fe836d7f02
(get-method-definition, get-method-definition-1):
Richard M. Stallman <rms@gnu.org>
parents:
13255
diff
changeset
|
970 end)) |
11749
8da04214faed
(get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
11517
diff
changeset
|
971 (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
|
972 |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
973 (defun change-log-get-method-definition () |
64315
b12b140acf8b
(add-log-mailing-address, change-log-merge): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
974 "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
|
975 (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
|
976 (save-excursion |
11816
2a8e1b01bc15
(get-method-definition): Fix regexps.
Karl Heuer <kwzh@gnu.org>
parents:
11757
diff
changeset
|
977 (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
|
978 (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
|
979 (save-excursion |
8da04214faed
(get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
11517
diff
changeset
|
980 (cond |
11816
2a8e1b01bc15
(get-method-definition): Fix regexps.
Karl Heuer <kwzh@gnu.org>
parents:
11757
diff
changeset
|
981 ((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
|
982 (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
|
983 (while (not (looking-at "[{;]")) |
8da04214faed
(get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
11517
diff
changeset
|
984 (looking-at |
11816
2a8e1b01bc15
(get-method-definition): Fix regexps.
Karl Heuer <kwzh@gnu.org>
parents:
11757
diff
changeset
|
985 "\\([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
|
986 (change-log-get-method-definition-1 "")) |
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
987 (concat change-log-get-method-definition-md "]")))))) |
27240 | 988 |
989 (defun change-log-sortable-date-at () | |
990 "Return date of log entry in a consistent form for sorting. | |
991 Point is assumed to be at the start of the entry." | |
992 (require 'timezone) | |
85650
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
993 (if (looking-at change-log-start-entry-re) |
27240 | 994 (let ((date (match-string-no-properties 0))) |
995 (if date | |
996 (if (string-match "\\(....\\)-\\(..\\)-\\(..\\)\\s-+" date) | |
997 (concat (match-string 1 date) (match-string 2 date) | |
998 (match-string 3 date)) | |
999 (condition-case nil | |
1000 (timezone-make-date-sortable date) | |
1001 (error nil))))) | |
1002 (error "Bad date"))) | |
11749
8da04214faed
(get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
11517
diff
changeset
|
1003 |
47828
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
1004 (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
|
1005 "Function to be used in `smerge-resolve-function'." |
82007
c934794f2e69
(change-log-resolve-conflict): Don't lose data if the merge fails.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82005
diff
changeset
|
1006 (save-excursion |
c934794f2e69
(change-log-resolve-conflict): Don't lose data if the merge fails.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82005
diff
changeset
|
1007 (save-restriction |
c934794f2e69
(change-log-resolve-conflict): Don't lose data if the merge fails.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82005
diff
changeset
|
1008 (narrow-to-region (match-beginning 0) (match-end 0)) |
c934794f2e69
(change-log-resolve-conflict): Don't lose data if the merge fails.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82005
diff
changeset
|
1009 (let ((mb1 (match-beginning 1)) |
c934794f2e69
(change-log-resolve-conflict): Don't lose data if the merge fails.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82005
diff
changeset
|
1010 (me1 (match-end 1)) |
c934794f2e69
(change-log-resolve-conflict): Don't lose data if the merge fails.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82005
diff
changeset
|
1011 (mb3 (match-beginning 3)) |
c934794f2e69
(change-log-resolve-conflict): Don't lose data if the merge fails.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82005
diff
changeset
|
1012 (me3 (match-end 3)) |
c934794f2e69
(change-log-resolve-conflict): Don't lose data if the merge fails.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82005
diff
changeset
|
1013 (tmp1 (generate-new-buffer " *changelog-resolve-1*")) |
c934794f2e69
(change-log-resolve-conflict): Don't lose data if the merge fails.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82005
diff
changeset
|
1014 (tmp2 (generate-new-buffer " *changelog-resolve-2*"))) |
c934794f2e69
(change-log-resolve-conflict): Don't lose data if the merge fails.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82005
diff
changeset
|
1015 (unwind-protect |
c934794f2e69
(change-log-resolve-conflict): Don't lose data if the merge fails.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82005
diff
changeset
|
1016 (let ((buf (current-buffer))) |
c934794f2e69
(change-log-resolve-conflict): Don't lose data if the merge fails.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82005
diff
changeset
|
1017 (with-current-buffer tmp1 |
c934794f2e69
(change-log-resolve-conflict): Don't lose data if the merge fails.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82005
diff
changeset
|
1018 (change-log-mode) |
c934794f2e69
(change-log-resolve-conflict): Don't lose data if the merge fails.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82005
diff
changeset
|
1019 (insert-buffer-substring buf mb1 me1)) |
c934794f2e69
(change-log-resolve-conflict): Don't lose data if the merge fails.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82005
diff
changeset
|
1020 (with-current-buffer tmp2 |
c934794f2e69
(change-log-resolve-conflict): Don't lose data if the merge fails.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82005
diff
changeset
|
1021 (change-log-mode) |
c934794f2e69
(change-log-resolve-conflict): Don't lose data if the merge fails.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82005
diff
changeset
|
1022 (insert-buffer-substring buf mb3 me3) |
c934794f2e69
(change-log-resolve-conflict): Don't lose data if the merge fails.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82005
diff
changeset
|
1023 ;; Do the merge here instead of inside `buf' so as to be |
c934794f2e69
(change-log-resolve-conflict): Don't lose data if the merge fails.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82005
diff
changeset
|
1024 ;; more robust in case change-log-merge fails. |
c934794f2e69
(change-log-resolve-conflict): Don't lose data if the merge fails.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82005
diff
changeset
|
1025 (change-log-merge tmp1)) |
c934794f2e69
(change-log-resolve-conflict): Don't lose data if the merge fails.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82005
diff
changeset
|
1026 (goto-char (point-max)) |
c934794f2e69
(change-log-resolve-conflict): Don't lose data if the merge fails.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82005
diff
changeset
|
1027 (delete-region (point-min) |
c934794f2e69
(change-log-resolve-conflict): Don't lose data if the merge fails.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82005
diff
changeset
|
1028 (prog1 (point) |
c934794f2e69
(change-log-resolve-conflict): Don't lose data if the merge fails.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82005
diff
changeset
|
1029 (insert-buffer-substring tmp2)))) |
c934794f2e69
(change-log-resolve-conflict): Don't lose data if the merge fails.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82005
diff
changeset
|
1030 (kill-buffer tmp1) |
c934794f2e69
(change-log-resolve-conflict): Don't lose data if the merge fails.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82005
diff
changeset
|
1031 (kill-buffer tmp2)))))) |
47828
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
1032 |
27240 | 1033 ;;;###autoload |
1034 (defun change-log-merge (other-log) | |
64315
b12b140acf8b
(add-log-mailing-address, change-log-merge): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
1035 "Merge the contents of change log file OTHER-LOG with this buffer. |
27240 | 1036 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
|
1037 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
|
1038 or a buffer. |
27240 | 1039 |
30809 | 1040 Entries are inserted in chronological order. Both the current and |
1041 old-style time formats for entries are supported." | |
27240 | 1042 (interactive "*fLog file name to merge: ") |
82005
0de2cd15c33d
(add-change-log-entry, add-log-current-defun, change-log-merge):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82003
diff
changeset
|
1043 (if (not (derived-mode-p 'change-log-mode)) |
27240 | 1044 (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
|
1045 (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
|
1046 (find-file-noselect other-log))) |
27240 | 1047 (buf (current-buffer)) |
1048 date1 start end) | |
1049 (save-excursion | |
1050 (goto-char (point-min)) | |
1051 (set-buffer other-buf) | |
1052 (goto-char (point-min)) | |
82005
0de2cd15c33d
(add-change-log-entry, add-log-current-defun, change-log-merge):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82003
diff
changeset
|
1053 (if (not (derived-mode-p 'change-log-mode)) |
27240 | 1054 (error "%s not found in Change Log mode" other-log)) |
1055 ;; Loop through all the entries in OTHER-LOG. | |
1056 (while (not (eobp)) | |
1057 (setq date1 (change-log-sortable-date-at)) | |
1058 (setq start (point) | |
1059 end (progn (forward-page) (point))) | |
1060 ;; Look for an entry in original buffer that isn't later. | |
1061 (with-current-buffer buf | |
1062 (while (and (not (eobp)) | |
1063 (string< date1 (change-log-sortable-date-at))) | |
1064 (forward-page)) | |
1065 (if (not (eobp)) | |
1066 (insert-buffer-substring other-buf start end) | |
1067 ;; At the end of the original buffer, insert a newline to | |
1068 ;; 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
|
1069 ;; merged. |
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
1070 (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
|
1071 (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
|
1072 (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
|
1073 (= ?\n (char-before (1- (point))))))) |
68182
faf3f34b2d1c
(add-change-log-entry, change-log-merge):
Romain Francoise <romain@orebokech.com>
parents:
66965
diff
changeset
|
1074 (insert (if use-hard-newlines hard-newline "\n"))) |
47828
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
1075 ;; 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
|
1076 (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
|
1077 (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
|
1078 (insert-buffer-substring other-buf start))))))) |
999 | 1079 |
85650
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1080 (defun change-log-beginning-of-defun () |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1081 (re-search-backward change-log-start-entry-re nil 'move)) |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1082 |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1083 (defun change-log-end-of-defun () |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1084 ;; Look back and if there is no entry there it means we are before |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1085 ;; the first ChangeLog entry, so go forward until finding one. |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1086 (unless (save-excursion (re-search-backward change-log-start-entry-re nil t)) |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1087 (re-search-forward change-log-start-entry-re nil t)) |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1088 |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1089 ;; In case we are at the end of log entry going forward a line will |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1090 ;; make us find the next entry when searching. If we are inside of |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1091 ;; an entry going forward a line will still keep the point inside |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1092 ;; the same entry. |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1093 (forward-line 1) |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1094 |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1095 ;; In case we are at the beginning of an entry, move past it. |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1096 (when (looking-at change-log-start-entry-re) |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1097 (goto-char (match-end 0)) |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1098 (forward-line 1)) |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1099 |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1100 ;; Search for the start of the next log entry. Go to the end of the |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1101 ;; buffer if we could not find a next entry. |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1102 (when (re-search-forward change-log-start-entry-re nil 'move) |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1103 (goto-char (match-beginning 0)) |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1104 (forward-line -1))) |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1105 |
980
b62886fbf2a7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
953
diff
changeset
|
1106 (provide 'add-log) |
b62886fbf2a7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
953
diff
changeset
|
1107 |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
1108 ;; arch-tag: 81eee6fc-088f-4372-a37f-80ad9620e762 |
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
678
diff
changeset
|
1109 ;;; add-log.el ends here |