Mercurial > emacs
annotate lisp/vc/add-log.el @ 111502:df6573cbdd34
* lisp/emacs-lisp/pcase.el (pcase-let*, pcase-let): Add debug and
indentation specs.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Thu, 11 Nov 2010 20:35:06 -0500 |
parents | 029e4783cbae |
children | 417b1e4d63cd |
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, |
106815 | 4 ;; 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 |
104778
afa0e028ba97
Mark face aliases with "-face" suffix as obsolete.
Glenn Morris <rgm@gnu.org>
parents:
104085
diff
changeset
|
5 ;; Free Software Foundation, Inc. |
661 | 6 |
38697
a19197c6442f
Keyword added and FSF specified as Maintainer.
Pavel Janík <Pavel@Janik.cz>
parents:
36604
diff
changeset
|
7 ;; Maintainer: FSF |
108971
d928a6a7c3f2
* lisp/finder.el (finder-known-keywords): Add keyword "vc"
Juri Linkov <juri@jurta.org>
parents:
108970
diff
changeset
|
8 ;; Keywords: vc tools |
2247
2c7997f249eb
Add or correct keywords
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1999
diff
changeset
|
9 |
661 | 10 ;; This file is part of GNU Emacs. |
11 | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94225
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
661 | 13 ;; it under the terms of the GNU General Public License as published by |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94225
diff
changeset
|
14 ;; the Free Software Foundation, either version 3 of the License, or |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94225
diff
changeset
|
15 ;; (at your option) any later version. |
661 | 16 |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94225
diff
changeset
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
661 | 24 |
2307
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2247
diff
changeset
|
25 ;;; Commentary: |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2247
diff
changeset
|
26 |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2247
diff
changeset
|
27 ;; This facility is documented in the Emacs Manual. |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2247
diff
changeset
|
28 |
84370
08763df09731
"Todo" comment.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
29 ;; Todo: |
08763df09731
"Todo" comment.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
30 |
08763df09731
"Todo" comment.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
31 ;; - Find/use/create _MTN/log if there's a _MTN directory. |
08763df09731
"Todo" comment.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
32 ;; - Find/use/create ++log.* if there's an {arch} directory. |
08763df09731
"Todo" comment.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
33 ;; - 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
|
34 ;; source file. |
08763df09731
"Todo" comment.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
35 ;; - 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
|
36 ;; special places. |
08763df09731
"Todo" comment.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
37 |
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
678
diff
changeset
|
38 ;;; Code: |
661 | 39 |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
40 (defgroup change-log nil |
63998
7651543ac34c
(change-log): Finish `defgroup' description with period.
Juanma Barranquero <lekktu@gmail.com>
parents:
63668
diff
changeset
|
41 "Change log maintenance." |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
42 :group 'tools |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
43 :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
|
44 :prefix "change-log-" |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
45 :prefix "add-log-") |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
46 |
661 | 47 |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
48 (defcustom change-log-default-name nil |
84370
08763df09731
"Todo" comment.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
49 "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
|
50 :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
|
51 string) |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
52 :group 'change-log) |
98020
1e478a6e3dd0
(change-log-default-name): Autoload safety.
Glenn Morris <rgm@gnu.org>
parents:
97778
diff
changeset
|
53 ;;;###autoload |
70541
62bb603c277b
(change-log-default-name): Put `string-or-null-p'
Juri Linkov <juri@jurta.org>
parents:
70231
diff
changeset
|
54 (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
|
55 |
26613
7f7e6de546ac
(change-log-mode-hook): Customize.
Dave Love <fx@gnu.org>
parents:
25273
diff
changeset
|
56 (defcustom change-log-mode-hook nil |
7f7e6de546ac
(change-log-mode-hook): Customize.
Dave Love <fx@gnu.org>
parents:
25273
diff
changeset
|
57 "Normal hook run by `change-log-mode'." |
7f7e6de546ac
(change-log-mode-hook): Customize.
Dave Love <fx@gnu.org>
parents:
25273
diff
changeset
|
58 :type 'hook |
7f7e6de546ac
(change-log-mode-hook): Customize.
Dave Love <fx@gnu.org>
parents:
25273
diff
changeset
|
59 :group 'change-log) |
7f7e6de546ac
(change-log-mode-hook): Customize.
Dave Love <fx@gnu.org>
parents:
25273
diff
changeset
|
60 |
50641
7ae78cd3ce2e
(add-log-current-defun-function): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
50575
diff
changeset
|
61 ;; 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
|
62 ;;;###autoload |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
63 (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
|
64 "If non-nil, function to guess name of surrounding function. |
28446 | 65 It is used by `add-log-current-defun' in preference to built-in rules. |
66 Returns function's name as a string, or nil if outside a function." | |
35936 | 67 :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
|
68 :group 'change-log) |
4154
20a0593431b7
(add-log-current-defun-function): New defvar.
Roland McGrath <roland@gnu.org>
parents:
3897
diff
changeset
|
69 |
14856
f64fa743c80f
(add-log-full-name, add-log-mailing-address): Add autoload cookies.
Richard M. Stallman <rms@gnu.org>
parents:
14528
diff
changeset
|
70 ;;;###autoload |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
71 (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
|
72 "Full name of user, for inclusion in ChangeLog daily headers. |
27240 | 73 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
|
74 :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
|
75 string) |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
76 :group 'change-log) |
4741
c0ea0009268a
add-log-full-name, add-log-mailing-address: new varialbes
Brian Fox <bfox@gnu.org>
parents:
4380
diff
changeset
|
77 |
14856
f64fa743c80f
(add-log-full-name, add-log-mailing-address): Add autoload cookies.
Richard M. Stallman <rms@gnu.org>
parents:
14528
diff
changeset
|
78 ;;;###autoload |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
79 (defcustom add-log-mailing-address nil |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
80 "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
|
81 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
|
82 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
|
83 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
|
84 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
|
85 :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
|
86 (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
|
87 (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
|
88 :group 'change-log) |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
89 |
18277
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
90 (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
|
91 "Function that defines the time format. |
18277
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
92 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
|
93 date in international ISO 8601 format, |
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
94 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
|
95 :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
|
96 add-log-iso8601-time-string) |
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
97 (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
|
98 current-time-string) |
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
99 (function :tag "Other")) |
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
100 :group 'change-log) |
4741
c0ea0009268a
add-log-full-name, add-log-mailing-address: new varialbes
Brian Fox <bfox@gnu.org>
parents:
4380
diff
changeset
|
101 |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
102 (defcustom add-log-keep-changes-together nil |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
103 "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
|
104 |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
105 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
|
106 \\[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
|
107 for that file made |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
108 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
|
109 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
|
110 original log: |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
111 |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
112 * foo (...): ... |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
113 * bar (...): change 1 |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
114 |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
115 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
|
116 buffer visiting `bar', yields: |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
117 |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
118 * bar (...): -!- |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
119 * foo (...): ... |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
120 * bar (...): change 1 |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
121 |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
122 and in the former: |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
123 |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
124 * foo (...): ... |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
125 * bar (...): change 1 |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
126 (...): -!- |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
127 |
21629
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
128 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
|
129 this variable." |
2da609ac7ab1
(change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents:
21009
diff
changeset
|
130 :version "20.3" |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
131 :type 'boolean |
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
132 :group 'change-log) |
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
133 |
40315
e41eca24ba8c
(add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents:
39625
diff
changeset
|
134 (defcustom add-log-always-start-new-record nil |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
135 "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
|
136 :version "22.1" |
40315
e41eca24ba8c
(add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents:
39625
diff
changeset
|
137 :type 'boolean |
e41eca24ba8c
(add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents:
39625
diff
changeset
|
138 :group 'change-log) |
e41eca24ba8c
(add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents:
39625
diff
changeset
|
139 |
32011
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
140 (defcustom add-log-buffer-file-name-function nil |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
141 "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
|
142 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
|
143 use `buffer-file-name'." |
35936 | 144 :type '(choice (const nil) function) |
32011
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
145 :group 'change-log) |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
146 |
24289
7917ac967ee5
(add-log-file-name-function): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
23215
diff
changeset
|
147 (defcustom add-log-file-name-function nil |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
148 "If non-nil, function to call to identify the filename for a ChangeLog entry. |
27240 | 149 This function is called with one argument, the value of variable |
150 `buffer-file-name' in that buffer. If this is nil, the default is to | |
151 use the file's name relative to the directory of the change log file." | |
35936 | 152 :type '(choice (const nil) function) |
24289
7917ac967ee5
(add-log-file-name-function): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
23215
diff
changeset
|
153 :group 'change-log) |
7917ac967ee5
(add-log-file-name-function): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
23215
diff
changeset
|
154 |
27003
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
155 |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
156 (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
|
157 "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
|
158 :version "21.1" |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
159 :type 'boolean |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
160 :group 'change-log) |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
161 |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
162 (defcustom change-log-version-number-regexp-list |
100947
534e78fa3211
* add-log.el (change-log-search-tag-name): Reflow docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
163 (let ((re "\\([0-9]+\.[0-9.]+\\)")) |
27003
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
164 (list |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
165 ;; (defconst ad-version "2.15" |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
166 (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
|
167 ;; Revision: pcl-cvs.el,v 1.72 1999/09/05 20:21:54 monnier Exp |
28446 | 168 (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
|
169 "List of regexps to search for version number. |
28446 | 170 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
|
171 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
|
172 :version "21.1" |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
173 :type '(repeat regexp) |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
174 :group 'change-log) |
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
175 |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
176 (defface change-log-date |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
177 '((t (:inherit font-lock-string-face))) |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
178 "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
|
179 :version "21.1" |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
180 :group 'change-log) |
104778
afa0e028ba97
Mark face aliases with "-face" suffix as obsolete.
Glenn Morris <rgm@gnu.org>
parents:
104085
diff
changeset
|
181 (define-obsolete-face-alias 'change-log-date-face 'change-log-date "22.1") |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
182 |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
183 (defface change-log-name |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
184 '((t (:inherit font-lock-constant-face))) |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
185 "Face for highlighting author names." |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
186 :version "21.1" |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
187 :group 'change-log) |
104778
afa0e028ba97
Mark face aliases with "-face" suffix as obsolete.
Glenn Morris <rgm@gnu.org>
parents:
104085
diff
changeset
|
188 (define-obsolete-face-alias 'change-log-name-face 'change-log-name "22.1") |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
189 |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
190 (defface change-log-email |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
191 '((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
|
192 "Face for highlighting author email addresses." |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
193 :version "21.1" |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
194 :group 'change-log) |
104778
afa0e028ba97
Mark face aliases with "-face" suffix as obsolete.
Glenn Morris <rgm@gnu.org>
parents:
104085
diff
changeset
|
195 (define-obsolete-face-alias 'change-log-email-face 'change-log-email "22.1") |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
196 |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
197 (defface change-log-file |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
198 '((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
|
199 "Face for highlighting file names." |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
200 :version "21.1" |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
201 :group 'change-log) |
104778
afa0e028ba97
Mark face aliases with "-face" suffix as obsolete.
Glenn Morris <rgm@gnu.org>
parents:
104085
diff
changeset
|
202 (define-obsolete-face-alias 'change-log-file-face 'change-log-file "22.1") |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
203 |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
204 (defface change-log-list |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
205 '((t (:inherit font-lock-keyword-face))) |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
206 "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
|
207 :version "21.1" |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
208 :group 'change-log) |
104778
afa0e028ba97
Mark face aliases with "-face" suffix as obsolete.
Glenn Morris <rgm@gnu.org>
parents:
104085
diff
changeset
|
209 (define-obsolete-face-alias 'change-log-list-face 'change-log-list "22.1") |
40315
e41eca24ba8c
(add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents:
39625
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-conditionals |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
212 '((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
|
213 "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
|
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) |
104778
afa0e028ba97
Mark face aliases with "-face" suffix as obsolete.
Glenn Morris <rgm@gnu.org>
parents:
104085
diff
changeset
|
216 (define-obsolete-face-alias 'change-log-conditionals-face |
afa0e028ba97
Mark face aliases with "-face" suffix as obsolete.
Glenn Morris <rgm@gnu.org>
parents:
104085
diff
changeset
|
217 'change-log-conditionals "22.1") |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
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-function |
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 items 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) |
104778
afa0e028ba97
Mark face aliases with "-face" suffix as obsolete.
Glenn Morris <rgm@gnu.org>
parents:
104085
diff
changeset
|
224 (define-obsolete-face-alias 'change-log-function-face |
afa0e028ba97
Mark face aliases with "-face" suffix as obsolete.
Glenn Morris <rgm@gnu.org>
parents:
104085
diff
changeset
|
225 'change-log-function "22.1") |
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-acknowledgement |
31813
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
228 '((t (:inherit font-lock-comment-face))) |
b7491dcc3530
(change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31794
diff
changeset
|
229 "Face for highlighting acknowledgments." |
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) |
104778
afa0e028ba97
Mark face aliases with "-face" suffix as obsolete.
Glenn Morris <rgm@gnu.org>
parents:
104085
diff
changeset
|
232 (define-obsolete-face-alias 'change-log-acknowledgement-face |
afa0e028ba97
Mark face aliases with "-face" suffix as obsolete.
Glenn Morris <rgm@gnu.org>
parents:
104085
diff
changeset
|
233 'change-log-acknowledgement "22.1") |
27003
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
234 |
88035
edcfc11338ad
* add-log.el (change-log-search-file-name, change-log-find-file):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
235 (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
|
236 (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
|
237 |
9377
45228a0f6b78
(change-log-mode): Set font-lock-keywords locally.
Richard M. Stallman <rms@gnu.org>
parents:
9347
diff
changeset
|
238 (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
|
239 `(;; |
63668
a7098c7b8f0f
(change-log-font-lock-keywords): Make the regexp for
Kenichi Handa <handa@m17n.org>
parents:
63195
diff
changeset
|
240 ;; 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
|
241 ;; 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
|
242 ;; 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
|
243 ;; 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
|
244 ;; work if a user customizes add-log-time-format. |
108738
a8cb6cd21db6
* add-log.el: Highlight all authors in multi-author ChangeLog entries.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
245 ("^[0-9-]+ +\\|^ \\{11,\\}\\|^\\(Sun\\|Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\) [A-z][a-z][a-z] [0-9:+ ]+" |
63668
a7098c7b8f0f
(change-log-font-lock-keywords): Make the regexp for
Kenichi Handa <handa@m17n.org>
parents:
63195
diff
changeset
|
246 (0 'change-log-date-face) |
23215
c06f07cf6bba
(change-log-font-lock-keywords): Do parenthesized
Dave Love <fx@gnu.org>
parents:
22388
diff
changeset
|
247 ;; 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
|
248 ("\\([^<(]+?\\)[ \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
|
249 (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
|
250 (2 'change-log-email))) |
16450
82b0566ece27
Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents:
16035
diff
changeset
|
251 ;; |
82b0566ece27
Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents:
16035
diff
changeset
|
252 ;; 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
|
253 (,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
|
254 (2 'change-log-file) |
23215
c06f07cf6bba
(change-log-font-lock-keywords): Do parenthesized
Dave Love <fx@gnu.org>
parents:
22388
diff
changeset
|
255 ;; 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
|
256 ("\\=, \\([^ ,:([\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
|
257 ;; 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
|
258 ("\\= (\\([^(),\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
|
259 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
|
260 ("\\=, *\\([^(),\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
|
261 nil nil (1 'change-log-list))) |
16450
82b0566ece27
Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents:
16035
diff
changeset
|
262 ;; |
82b0566ece27
Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents:
16035
diff
changeset
|
263 ;; 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
|
264 ("^\\( +\\|\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
|
265 (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
|
266 ("\\=, *\\([^(),\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
|
267 (1 'change-log-list))) |
16450
82b0566ece27
Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents:
16035
diff
changeset
|
268 ;; |
82b0566ece27
Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents:
16035
diff
changeset
|
269 ;; Conditionals. |
63195
d4857c25a45b
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents:
62877
diff
changeset
|
270 ("\\[!?\\([^]\n]+\\)\\]\\(:\\| (\\)" (1 'change-log-conditionals)) |
16450
82b0566ece27
Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents:
16035
diff
changeset
|
271 ;; |
29329
5b85d9e700da
(change-log-font-lock-keywords) <function>: Add
Dave Love <fx@gnu.org>
parents:
29243
diff
changeset
|
272 ;; 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
|
273 ("<\\([^>\n]+\\)>\\(:\\| (\\)" (1 'change-log-function)) |
29329
5b85d9e700da
(change-log-font-lock-keywords) <function>: Add
Dave Love <fx@gnu.org>
parents:
29243
diff
changeset
|
274 ;; |
19439 | 275 ;; Acknowledgements. |
59355
448dec90812c
(change-log-font-lock-keywords): Don't match just "From".
Richard M. Stallman <rms@gnu.org>
parents:
58737
diff
changeset
|
276 ;; 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
|
277 ;; we want to encourage people to say something more specific. |
62255 | 278 ;; Note that the FSF does not use "Patches by"; our convention |
279 ;; is to put the name of the author of the changes at the top | |
280 ;; 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
|
281 ("\\(^\\( +\\|\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
|
282 3 'change-log-acknowledgement)) |
9377
45228a0f6b78
(change-log-mode): Set font-lock-keywords locally.
Richard M. Stallman <rms@gnu.org>
parents:
9347
diff
changeset
|
283 "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
|
284 |
88035
edcfc11338ad
* add-log.el (change-log-search-file-name, change-log-find-file):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
285 (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
|
286 "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
|
287 (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
|
288 (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
|
289 (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
|
290 (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
|
291 ;; 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
|
292 ;; name. |
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
293 (progn |
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
294 (re-search-forward change-log-file-names-re nil t) |
96640
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
295 (match-string-no-properties 2)) |
88036
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
296 (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
|
297 ;; We found a file name. |
96640
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
298 (match-string-no-properties 2) |
88036
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
299 ;; 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
|
300 (if (re-search-backward |
100947
534e78fa3211
* add-log.el (change-log-search-tag-name): Reflow docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
301 (concat "\\(" change-log-start-entry-re |
88036
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
302 "\\)\\|\\(" |
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
303 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
|
304 (if (match-beginning 1) |
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
305 ;; 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
|
306 ;; file name. |
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
307 (progn |
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
308 (re-search-forward change-log-file-names-re nil t) |
96640
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
309 (match-string-no-properties 2)) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
310 (match-string-no-properties 4)) |
88036
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
311 ;; 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
|
312 (re-search-forward change-log-file-names-re nil t) |
96640
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
313 (match-string-no-properties 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
|
314 |
edcfc11338ad
* add-log.el (change-log-search-file-name, change-log-find-file):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
315 (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
|
316 "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
|
317 (interactive) |
edcfc11338ad
* add-log.el (change-log-search-file-name, change-log-find-file):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
318 (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
|
319 (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
|
320 (find-file file) |
88036
f58e88e8d9cb
(change-log-search-file-name): Work harder to find
Dan Nicolaescu <dann@ics.uci.edu>
parents:
88035
diff
changeset
|
321 (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
|
322 |
96640
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
323 (defun change-log-search-tag-name-1 (&optional from) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
324 "Search for a tag name within subexpression 1 of last match. |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
325 Optional argument FROM specifies a buffer position where the tag |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
326 name should be located. Return value is a cons whose car is the |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
327 string representing the tag and whose cdr is the position where |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
328 the tag was found." |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
329 (save-restriction |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
330 (narrow-to-region (match-beginning 1) (match-end 1)) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
331 (when from (goto-char from)) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
332 ;; The regexp below skips any symbol near `point' (FROM) followed by |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
333 ;; whitespace and another symbol. This should skip, for example, |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
334 ;; "struct" in a specification like "(struct buffer)" and move to |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
335 ;; "buffer". A leading paren is ignored. |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
336 (when (looking-at |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
337 "[(]?\\(?:\\(?:\\sw\\|\\s_\\)+\\(?:[ \t]+\\(\\sw\\|\\s_\\)+\\)\\)") |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
338 (goto-char (match-beginning 1))) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
339 (cons (find-tag-default) (point)))) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
340 |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
341 (defconst change-log-tag-re |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
342 "(\\(\\(?:\\sw\\|\\s_\\)+\\(?:[, \t]+\\(?:\\sw\\|\\s_\\)+\\)*\\))" |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
343 "Regexp matching a tag name in change log entries.") |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
344 |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
345 (defun change-log-search-tag-name (&optional at) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
346 "Search for a tag name near `point'. |
100947
534e78fa3211
* add-log.el (change-log-search-tag-name): Reflow docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
347 Optional argument AT non-nil means search near buffer position AT. |
534e78fa3211
* add-log.el (change-log-search-tag-name): Reflow docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
348 Return value is a cons whose car is the string representing |
96640
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
349 the tag and whose cdr is the position where the tag was found." |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
350 (save-excursion |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
351 (goto-char (setq at (or at (point)))) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
352 (save-restriction |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
353 (widen) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
354 (or (condition-case nil |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
355 ;; Within parenthesized list? |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
356 (save-excursion |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
357 (backward-up-list) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
358 (when (looking-at change-log-tag-re) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
359 (change-log-search-tag-name-1 at))) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
360 (error nil)) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
361 (condition-case nil |
97352
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
362 ;; Before parenthesized list on same line? |
96640
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
363 (save-excursion |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
364 (when (and (skip-chars-forward " \t") |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
365 (looking-at change-log-tag-re)) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
366 (change-log-search-tag-name-1))) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
367 (error nil)) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
368 (condition-case nil |
97352
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
369 ;; Near file name? |
96640
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
370 (save-excursion |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
371 (when (and (progn |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
372 (beginning-of-line) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
373 (looking-at change-log-file-names-re)) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
374 (goto-char (match-end 0)) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
375 (skip-syntax-forward " ") |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
376 (looking-at change-log-tag-re)) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
377 (change-log-search-tag-name-1))) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
378 (error nil)) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
379 (condition-case nil |
97352
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
380 ;; Anywhere else within current entry? |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
381 (let ((from |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
382 (save-excursion |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
383 (end-of-line) |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
384 (if (re-search-backward change-log-start-entry-re nil t) |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
385 (match-beginning 0) |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
386 (point-min)))) |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
387 (to |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
388 (save-excursion |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
389 (end-of-line) |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
390 (if (re-search-forward change-log-start-entry-re nil t) |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
391 (match-beginning 0) |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
392 (point-max))))) |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
393 (when (and (< from to) (<= from at) (<= at to)) |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
394 (save-restriction |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
395 ;; Narrow to current change log entry. |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
396 (narrow-to-region from to) |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
397 (cond |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
398 ((re-search-backward change-log-tag-re nil t) |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
399 (narrow-to-region (match-beginning 1) (match-end 1)) |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
400 (goto-char (point-max)) |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
401 (cons (find-tag-default) (point-max))) |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
402 ((re-search-forward change-log-tag-re nil t) |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
403 (narrow-to-region (match-beginning 1) (match-end 1)) |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
404 (goto-char (point-min)) |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
405 (cons (find-tag-default) (point-min))))))) |
96640
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
406 (error nil)))))) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
407 |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
408 (defvar change-log-find-head nil) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
409 (defvar change-log-find-tail nil) |
98170
9a65ff5a8499
(change-log-find-window): New variable.
Martin Rudalics <rudalics@gmx.at>
parents:
98057
diff
changeset
|
410 (defvar change-log-find-window nil) |
96640
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
411 |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
412 (defun change-log-goto-source-1 (tag regexp file buffer |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
413 &optional window first last) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
414 "Search for tag TAG in buffer BUFFER visiting file FILE. |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
415 REGEXP is a regular expression for TAG. The remaining arguments |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
416 are optional: WINDOW denotes the window to display the results of |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
417 the search. FIRST is a position in BUFFER denoting the first |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
418 match from previous searches for TAG. LAST is the position in |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
419 BUFFER denoting the last match for TAG in the last search." |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
420 (with-current-buffer buffer |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
421 (save-excursion |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
422 (save-restriction |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
423 (widen) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
424 (if last |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
425 (progn |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
426 ;; When LAST is set make sure we continue from the next |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
427 ;; line end to not find the same tag again. |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
428 (goto-char last) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
429 (end-of-line) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
430 (condition-case nil |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
431 ;; Try to go to the end of the current defun to avoid |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
432 ;; false positives within the current defun's body |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
433 ;; since these would match `add-log-current-defun'. |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
434 (end-of-defun) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
435 ;; Don't fall behind when `end-of-defun' fails. |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
436 (error (progn (goto-char last) (end-of-line)))) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
437 (setq last nil)) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
438 ;; When LAST was not set start at beginning of BUFFER. |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
439 (goto-char (point-min))) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
440 (let (current-defun) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
441 (while (and (not last) (re-search-forward regexp nil t)) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
442 ;; Verify that `add-log-current-defun' invoked at the end |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
443 ;; of the match returns TAG. This heuristic works well |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
444 ;; whenever the name of the defun occurs within the first |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
445 ;; line of the defun. |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
446 (setq current-defun (add-log-current-defun)) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
447 (when (and current-defun (string-equal current-defun tag)) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
448 ;; Record this as last match. |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
449 (setq last (line-beginning-position)) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
450 ;; Record this as first match when there's none. |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
451 (unless first (setq first last))))))) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
452 (if (or last first) |
98170
9a65ff5a8499
(change-log-find-window): New variable.
Martin Rudalics <rudalics@gmx.at>
parents:
98057
diff
changeset
|
453 (with-selected-window |
9a65ff5a8499
(change-log-find-window): New variable.
Martin Rudalics <rudalics@gmx.at>
parents:
98057
diff
changeset
|
454 (setq change-log-find-window (or window (display-buffer buffer))) |
96640
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
455 (if last |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
456 (progn |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
457 (when (or (< last (point-min)) (> last (point-max))) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
458 ;; Widen to show TAG. |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
459 (widen)) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
460 (push-mark) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
461 (goto-char last)) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
462 ;; When there are no more matches go (back) to FIRST. |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
463 (message "No more matches for tag `%s' in file `%s'" tag file) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
464 (setq last first) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
465 (goto-char first)) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
466 ;; Return new "tail". |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
467 (list (selected-window) first last)) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
468 (message "Source location of tag `%s' not found in file `%s'" tag file) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
469 nil))) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
470 |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
471 (defun change-log-goto-source () |
97352
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
472 "Go to source location of \"change log tag\" near `point'. |
96640
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
473 A change log tag is a symbol within a parenthesized, |
97352
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
474 comma-separated list. If no suitable tag can be found nearby, |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
475 try to visit the file for the change under `point' instead." |
96640
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
476 (interactive) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
477 (if (and (eq last-command 'change-log-goto-source) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
478 change-log-find-tail) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
479 (setq change-log-find-tail |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
480 (condition-case nil |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
481 (apply 'change-log-goto-source-1 |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
482 (append change-log-find-head change-log-find-tail)) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
483 (error |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
484 (format "Cannot find more matches for tag `%s' in file `%s'" |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
485 (car change-log-find-head) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
486 (nth 2 change-log-find-head))))) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
487 (save-excursion |
97352
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
488 (let* ((at (point)) |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
489 (tag-at (change-log-search-tag-name)) |
96640
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
490 (tag (car tag-at)) |
97352
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
491 (file (when tag-at (change-log-search-file-name (cdr tag-at)))) |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
492 (file-at (when file (match-beginning 2))) |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
493 ;; `file-2' is the file `change-log-search-file-name' finds |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
494 ;; at `point'. We use `file-2' as a fallback when `tag' or |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
495 ;; `file' are not suitable for some reason. |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
496 (file-2 (change-log-search-file-name at)) |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
497 (file-2-at (when file-2 (match-beginning 2)))) |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
498 (cond |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
499 ((and (or (not tag) (not file) (not (file-exists-p file))) |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
500 (or (not file-2) (not (file-exists-p file-2)))) |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
501 (error "Cannot find tag or file near `point'")) |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
502 ((and file-2 (file-exists-p file-2) |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
503 (or (not tag) (not file) (not (file-exists-p file)) |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
504 (and (or (and (< file-at file-2-at) (<= file-2-at at)) |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
505 (and (<= at file-2-at) (< file-2-at file-at)))))) |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
506 ;; We either have not found a suitable file name or `file-2' |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
507 ;; provides a "better" file name wrt `point'. Go to the |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
508 ;; buffer of `file-2' instead. |
98170
9a65ff5a8499
(change-log-find-window): New variable.
Martin Rudalics <rudalics@gmx.at>
parents:
98057
diff
changeset
|
509 (setq change-log-find-window |
9a65ff5a8499
(change-log-find-window): New variable.
Martin Rudalics <rudalics@gmx.at>
parents:
98057
diff
changeset
|
510 (display-buffer (find-file-noselect file-2)))) |
97352
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
511 (t |
96640
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
512 (setq change-log-find-head |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
513 (list tag (concat "\\_<" (regexp-quote tag) "\\_>") |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
514 file (find-file-noselect file))) |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
515 (condition-case nil |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
516 (setq change-log-find-tail |
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
517 (apply 'change-log-goto-source-1 change-log-find-head)) |
97352
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
518 (error |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
519 (format "Cannot find matches for tag `%s' in file `%s'" |
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
520 tag file))))))))) |
96640
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
521 |
97288
b0e0f868bbd7
(change-log-next-error, change-log-mode): Add support
Teodor Zlatanov <tzz@lifelogs.com>
parents:
97142
diff
changeset
|
522 (defun change-log-next-error (&optional argp reset) |
98170
9a65ff5a8499
(change-log-find-window): New variable.
Martin Rudalics <rudalics@gmx.at>
parents:
98057
diff
changeset
|
523 "Move to the Nth (default 1) next match in a ChangeLog buffer. |
97288
b0e0f868bbd7
(change-log-next-error, change-log-mode): Add support
Teodor Zlatanov <tzz@lifelogs.com>
parents:
97142
diff
changeset
|
524 Compatibility function for \\[next-error] invocations." |
b0e0f868bbd7
(change-log-next-error, change-log-mode): Add support
Teodor Zlatanov <tzz@lifelogs.com>
parents:
97142
diff
changeset
|
525 (interactive "p") |
b0e0f868bbd7
(change-log-next-error, change-log-mode): Add support
Teodor Zlatanov <tzz@lifelogs.com>
parents:
97142
diff
changeset
|
526 (let* ((argp (or argp 0)) |
b0e0f868bbd7
(change-log-next-error, change-log-mode): Add support
Teodor Zlatanov <tzz@lifelogs.com>
parents:
97142
diff
changeset
|
527 (count (abs argp)) ; how many cycles |
b0e0f868bbd7
(change-log-next-error, change-log-mode): Add support
Teodor Zlatanov <tzz@lifelogs.com>
parents:
97142
diff
changeset
|
528 (down (< argp 0)) ; are we going down? (is argp negative?) |
b0e0f868bbd7
(change-log-next-error, change-log-mode): Add support
Teodor Zlatanov <tzz@lifelogs.com>
parents:
97142
diff
changeset
|
529 (up (not down)) |
b0e0f868bbd7
(change-log-next-error, change-log-mode): Add support
Teodor Zlatanov <tzz@lifelogs.com>
parents:
97142
diff
changeset
|
530 (search-function (if up 're-search-forward 're-search-backward))) |
97352
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
531 |
97288
b0e0f868bbd7
(change-log-next-error, change-log-mode): Add support
Teodor Zlatanov <tzz@lifelogs.com>
parents:
97142
diff
changeset
|
532 ;; set the starting position |
b0e0f868bbd7
(change-log-next-error, change-log-mode): Add support
Teodor Zlatanov <tzz@lifelogs.com>
parents:
97142
diff
changeset
|
533 (goto-char (cond (reset (point-min)) |
b0e0f868bbd7
(change-log-next-error, change-log-mode): Add support
Teodor Zlatanov <tzz@lifelogs.com>
parents:
97142
diff
changeset
|
534 (down (line-beginning-position)) |
b0e0f868bbd7
(change-log-next-error, change-log-mode): Add support
Teodor Zlatanov <tzz@lifelogs.com>
parents:
97142
diff
changeset
|
535 (up (line-end-position)) |
b0e0f868bbd7
(change-log-next-error, change-log-mode): Add support
Teodor Zlatanov <tzz@lifelogs.com>
parents:
97142
diff
changeset
|
536 ((point)))) |
97352
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
537 |
97288
b0e0f868bbd7
(change-log-next-error, change-log-mode): Add support
Teodor Zlatanov <tzz@lifelogs.com>
parents:
97142
diff
changeset
|
538 (funcall search-function change-log-file-names-re nil t count)) |
97352
ed0e9fcb94ac
(change-log-search-tag-name)
Martin Rudalics <rudalics@gmx.at>
parents:
97288
diff
changeset
|
539 |
97288
b0e0f868bbd7
(change-log-next-error, change-log-mode): Add support
Teodor Zlatanov <tzz@lifelogs.com>
parents:
97142
diff
changeset
|
540 (beginning-of-line) |
b0e0f868bbd7
(change-log-next-error, change-log-mode): Add support
Teodor Zlatanov <tzz@lifelogs.com>
parents:
97142
diff
changeset
|
541 ;; if we found a place to visit... |
b0e0f868bbd7
(change-log-next-error, change-log-mode): Add support
Teodor Zlatanov <tzz@lifelogs.com>
parents:
97142
diff
changeset
|
542 (when (looking-at change-log-file-names-re) |
98170
9a65ff5a8499
(change-log-find-window): New variable.
Martin Rudalics <rudalics@gmx.at>
parents:
98057
diff
changeset
|
543 (let (change-log-find-window) |
9a65ff5a8499
(change-log-find-window): New variable.
Martin Rudalics <rudalics@gmx.at>
parents:
98057
diff
changeset
|
544 (change-log-goto-source) |
9a65ff5a8499
(change-log-find-window): New variable.
Martin Rudalics <rudalics@gmx.at>
parents:
98057
diff
changeset
|
545 (when change-log-find-window |
9a65ff5a8499
(change-log-find-window): New variable.
Martin Rudalics <rudalics@gmx.at>
parents:
98057
diff
changeset
|
546 ;; Select window displaying source file. |
9a65ff5a8499
(change-log-find-window): New variable.
Martin Rudalics <rudalics@gmx.at>
parents:
98057
diff
changeset
|
547 (select-window change-log-find-window))))) |
97288
b0e0f868bbd7
(change-log-next-error, change-log-mode): Add support
Teodor Zlatanov <tzz@lifelogs.com>
parents:
97142
diff
changeset
|
548 |
51580
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
549 (defvar change-log-mode-map |
104085
6298508aee59
(change-log-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103722
diff
changeset
|
550 (let ((map (make-sparse-keymap)) |
6298508aee59
(change-log-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103722
diff
changeset
|
551 (menu-map (make-sparse-keymap))) |
51580
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
552 (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
|
553 (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
|
554 (define-key map [?\C-c ?\C-f] 'change-log-find-file) |
96640
970b19b546c0
(change-log-search-file-name): Use match-string-no-properties.
Martin Rudalics <rudalics@gmx.at>
parents:
96217
diff
changeset
|
555 (define-key map [?\C-c ?\C-c] 'change-log-goto-source) |
104085
6298508aee59
(change-log-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103722
diff
changeset
|
556 (define-key map [menu-bar changelog] (cons "ChangeLog" menu-map)) |
6298508aee59
(change-log-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103722
diff
changeset
|
557 (define-key menu-map [gs] |
6298508aee59
(change-log-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103722
diff
changeset
|
558 '(menu-item "Go To Source" change-log-goto-source |
6298508aee59
(change-log-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103722
diff
changeset
|
559 :help "Go to source location of ChangeLog tag near point")) |
6298508aee59
(change-log-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103722
diff
changeset
|
560 (define-key menu-map [ff] |
6298508aee59
(change-log-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103722
diff
changeset
|
561 '(menu-item "Find File" change-log-find-file |
6298508aee59
(change-log-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103722
diff
changeset
|
562 :help "Visit the file for the change under point")) |
6298508aee59
(change-log-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103722
diff
changeset
|
563 (define-key menu-map [sep] '("--")) |
6298508aee59
(change-log-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103722
diff
changeset
|
564 (define-key menu-map [nx] |
6298508aee59
(change-log-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103722
diff
changeset
|
565 '(menu-item "Next Log-Edit Comment" add-log-edit-next-comment |
6298508aee59
(change-log-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103722
diff
changeset
|
566 :help "Cycle forward through Log-Edit mode comment history")) |
6298508aee59
(change-log-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103722
diff
changeset
|
567 (define-key menu-map [pr] |
6298508aee59
(change-log-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103722
diff
changeset
|
568 '(menu-item "Previous Log-Edit Comment" add-log-edit-prev-comment |
6298508aee59
(change-log-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103722
diff
changeset
|
569 :help "Cycle backward through Log-Edit mode comment history")) |
51580
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
570 map) |
15889 | 571 "Keymap for Change Log major mode.") |
572 | |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
573 ;; 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
|
574 ;; 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
|
575 (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
|
576 (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
|
577 "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
|
578 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
|
579 If nil, use local time. |
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
580 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
|
581 (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
|
582 '(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
|
583 |
70231
b98a2445fe1f
(add-log-iso8601-time-zone): Make parameter optional.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
70217
diff
changeset
|
584 (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
|
585 (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
|
586 (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
|
587 (sec (abs utc-offset)) |
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
588 (ss (% sec 60)) |
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
589 (min (/ sec 60)) |
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
590 (mm (% min 60)) |
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
591 (hh (/ min 60))) |
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
592 (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
|
593 ((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
|
594 (t "%c%02d")) |
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
595 sign hh mm ss))) |
088510eef043
Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents:
15889
diff
changeset
|
596 |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
597 (defvar add-log-iso8601-with-time-zone nil) |
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
598 |
18277
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
599 (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
|
600 (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
|
601 nil (eq t add-log-time-zone-rule)))) |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
602 (if add-log-iso8601-with-time-zone |
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
603 (concat time " " (add-log-iso8601-time-zone)) |
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
604 time))) |
18277
7509948b0121
(add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17923
diff
changeset
|
605 |
661 | 606 (defun change-log-name () |
27240 | 607 "Return (system-dependent) default name for a change log file." |
661 | 608 (or change-log-default-name |
97142 | 609 "ChangeLog")) |
661 | 610 |
51580
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
611 (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
|
612 "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
|
613 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
|
614 (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
|
615 (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
|
616 (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
|
617 (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
|
618 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
|
619 (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
|
620 (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
|
621 (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
|
622 (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
|
623 (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
|
624 (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
|
625 (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
|
626 (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
|
627 (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
|
628 (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
|
629 |
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
630 (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
|
631 "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
|
632 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
|
633 (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
|
634 (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
|
635 |
4157
d2316090d029
(prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents:
4154
diff
changeset
|
636 ;;;###autoload |
661 | 637 (defun prompt-for-change-log-name () |
638 "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
|
639 (let* ((default (change-log-name)) |
f4a8265756e7
(prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents:
11816
diff
changeset
|
640 (name (expand-file-name |
f4a8265756e7
(prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents:
11816
diff
changeset
|
641 (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
|
642 nil default)))) |
f4a8265756e7
(prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents:
11816
diff
changeset
|
643 ;; 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
|
644 ;; 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
|
645 (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
|
646 (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
|
647 name) |
f4a8265756e7
(prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents:
11816
diff
changeset
|
648 ;; 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
|
649 (if (file-directory-p name) |
f4a8265756e7
(prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents:
11816
diff
changeset
|
650 (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
|
651 (file-name-as-directory name)) |
f4a8265756e7
(prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents:
11816
diff
changeset
|
652 name)))) |
661 | 653 |
27003
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
654 (defun change-log-version-number-search () |
28446 | 655 "Return version number of current buffer's file. |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
84676
diff
changeset
|
656 This is the value returned by `vc-working-revision' or, if that is |
28446 | 657 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
|
658 (let* ((size (buffer-size)) |
50575
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
659 (limit |
28446 | 660 ;; The version number can be anywhere in the file, but |
661 ;; restrict search to the file beginning: 10% should be | |
662 ;; enough to prevent some mishits. | |
27003
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
663 ;; |
28446 | 664 ;; Apply percentage only if buffer size is bigger than |
665 ;; approx 100 lines. | |
50575
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
666 (if (> size (* 100 80)) (+ (point) (/ size 10))))) |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
84676
diff
changeset
|
667 (or (and buffer-file-name (vc-working-revision buffer-file-name)) |
28446 | 668 (save-restriction |
669 (widen) | |
50575
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
670 (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
|
671 version) |
28446 | 672 (while regexps |
673 (save-excursion | |
674 (goto-char (point-min)) | |
50575
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
675 (when (re-search-forward (pop regexps) limit t) |
28446 | 676 (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
|
677 regexps nil)))) |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
678 version))))) |
27003
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
679 |
98055
04b7a6119a88
(diff-find-source-location): Declare.
Glenn Morris <rgm@gnu.org>
parents:
98020
diff
changeset
|
680 (declare-function diff-find-source-location "diff-mode" |
98190
06cc410bdefa
(diff-find-source-location): Update declaration.
Glenn Morris <rgm@gnu.org>
parents:
98170
diff
changeset
|
681 (&optional other-file reverse noprompt)) |
27003
f6f431fc901b
(change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents:
26618
diff
changeset
|
682 |
661 | 683 ;;;###autoload |
32011
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
684 (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
|
685 "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
|
686 |
0495d3085f00
(find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents:
6562
diff
changeset
|
687 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
|
688 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
|
689 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
|
690 \(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
|
691 |
62251
5c40be16225d
(find-change-log): Fix typos in the docstring of function.
Masatake YAMATO <jet@gyve.org>
parents:
61342
diff
changeset
|
692 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
|
693 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
|
694 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
|
695 |
d3c9f0ad5964
(find-change-log): New function.
Roland McGrath <roland@gnu.org>
parents:
2307
diff
changeset
|
696 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
|
697 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
|
698 Optional arg BUFFER-FILE overrides `buffer-file-name'." |
98055
04b7a6119a88
(diff-find-source-location): Declare.
Glenn Morris <rgm@gnu.org>
parents:
98020
diff
changeset
|
699 ;; If we are called from a diff, first switch to the source buffer; |
04b7a6119a88
(diff-find-source-location): Declare.
Glenn Morris <rgm@gnu.org>
parents:
98020
diff
changeset
|
700 ;; in order to respect buffer-local settings of change-log-default-name, etc. |
111262
029e4783cbae
Merge changes from emacs-23 branch
Chong Yidong <cyd@stupidchicken.com>
parents:
110497
diff
changeset
|
701 (with-current-buffer (let ((buff (if (derived-mode-p 'diff-mode) |
98057 | 702 (car (ignore-errors |
703 (diff-find-source-location)))))) | |
704 (if (buffer-live-p buff) buff | |
705 (current-buffer))) | |
98055
04b7a6119a88
(diff-find-source-location): Declare.
Glenn Morris <rgm@gnu.org>
parents:
98020
diff
changeset
|
706 ;; If user specified a file name or if this buffer knows which one to use, |
04b7a6119a88
(diff-find-source-location): Declare.
Glenn Morris <rgm@gnu.org>
parents:
98020
diff
changeset
|
707 ;; just use that. |
98057 | 708 (or file-name |
709 (setq file-name (and change-log-default-name | |
710 (file-name-directory change-log-default-name) | |
711 change-log-default-name)) | |
712 (progn | |
713 ;; Chase links in the source file | |
714 ;; and use the change log in the dir where it points. | |
715 (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
|
716 (file-name-directory |
98057 | 717 (file-chase-links |
718 (or buffer-file buffer-file-name)))) | |
719 default-directory)) | |
720 (if (file-directory-p file-name) | |
721 (setq file-name (expand-file-name (change-log-name) file-name))) | |
722 ;; Chase links before visiting the file. | |
723 ;; This makes it easier to use a single change log file | |
724 ;; for several related directories. | |
725 (setq file-name (file-chase-links file-name)) | |
726 (setq file-name (expand-file-name file-name)) | |
727 ;; Move up in the dir hierarchy till we find a change log file. | |
728 (let ((file1 file-name) | |
729 parent-dir) | |
730 (while (and (not (or (get-file-buffer file1) (file-exists-p file1))) | |
731 (progn (setq parent-dir | |
732 (file-name-directory | |
733 (directory-file-name | |
734 (file-name-directory file1)))) | |
735 ;; Give up if we are already at the root dir. | |
736 (not (string= (file-name-directory file1) | |
737 parent-dir)))) | |
738 ;; Move up to the parent dir and try again. | |
739 (setq file1 (expand-file-name | |
740 (file-name-nondirectory (change-log-name)) | |
741 parent-dir))) | |
742 ;; If we found a change log in a parent, use that. | |
743 (if (or (get-file-buffer file1) (file-exists-p file1)) | |
744 (setq file-name file1))))) | |
745 ;; Make a local variable in this buffer so we needn't search again. | |
746 (set (make-local-variable 'change-log-default-name) file-name)) | |
8042
0495d3085f00
(find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents:
6562
diff
changeset
|
747 file-name) |
2463
d3c9f0ad5964
(find-change-log): New function.
Roland McGrath <roland@gnu.org>
parents:
2307
diff
changeset
|
748 |
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
|
749 (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
|
750 ;; 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
|
751 (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
|
752 (if add-log-file-name-function |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
753 (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
|
754 (setq buffer-file |
109907
88b82e3838f6
* lisp/vc/add-log.el (add-log-file-name): Don't get confused by symlinks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108971
diff
changeset
|
755 (let* ((dir (file-name-directory log-file)) |
88b82e3838f6
* lisp/vc/add-log.el (add-log-file-name): Don't get confused by symlinks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108971
diff
changeset
|
756 (rel (file-relative-name buffer-file dir))) |
88b82e3838f6
* lisp/vc/add-log.el (add-log-file-name): Don't get confused by symlinks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108971
diff
changeset
|
757 ;; Sometimes with symlinks, the two buffers may have names that |
88b82e3838f6
* lisp/vc/add-log.el (add-log-file-name): Don't get confused by symlinks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108971
diff
changeset
|
758 ;; appear to belong to different directory trees. So check the |
88b82e3838f6
* lisp/vc/add-log.el (add-log-file-name): Don't get confused by symlinks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108971
diff
changeset
|
759 ;; file-truenames, to see if we get a better result. |
88b82e3838f6
* lisp/vc/add-log.el (add-log-file-name): Don't get confused by symlinks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108971
diff
changeset
|
760 (if (not (string-match "\\`\\.\\./" rel)) |
88b82e3838f6
* lisp/vc/add-log.el (add-log-file-name): Don't get confused by symlinks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108971
diff
changeset
|
761 rel |
88b82e3838f6
* lisp/vc/add-log.el (add-log-file-name): Don't get confused by symlinks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108971
diff
changeset
|
762 (let ((new (file-relative-name (file-truename buffer-file) |
88b82e3838f6
* lisp/vc/add-log.el (add-log-file-name): Don't get confused by symlinks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108971
diff
changeset
|
763 (file-truename dir)))) |
88b82e3838f6
* lisp/vc/add-log.el (add-log-file-name): Don't get confused by symlinks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108971
diff
changeset
|
764 (if (< (length new) (length rel)) |
88b82e3838f6
* lisp/vc/add-log.el (add-log-file-name): Don't get confused by symlinks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108971
diff
changeset
|
765 new rel))))) |
32011
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
766 ;; 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
|
767 ;; 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
|
768 ;; 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
|
769 (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
|
770 (file-name-sans-versions buffer-file) |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
771 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
|
772 |
2463
d3c9f0ad5964
(find-change-log): New function.
Roland McGrath <roland@gnu.org>
parents:
2307
diff
changeset
|
773 ;;;###autoload |
96217
e5a55b8c9892
* add-log.el (add-change-log-entry): Add new arg to force each new
Dan Nicolaescu <dann@ics.uci.edu>
parents:
94989
diff
changeset
|
774 (defun add-change-log-entry (&optional whoami file-name other-window new-entry |
e5a55b8c9892
* add-log.el (add-change-log-entry): Add new arg to force each new
Dan Nicolaescu <dann@ics.uci.edu>
parents:
94989
diff
changeset
|
775 put-new-entry-on-new-line) |
39625
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
776 "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
|
777 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
|
778 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
|
779 |
39625
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
780 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
|
781 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
|
782 |
4157
d2316090d029
(prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents:
4154
diff
changeset
|
783 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
|
784 |
4157
d2316090d029
(prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents:
4154
diff
changeset
|
785 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
|
786 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
|
787 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
|
788 |
96217
e5a55b8c9892
* add-log.el (add-change-log-entry): Add new arg to force each new
Dan Nicolaescu <dann@ics.uci.edu>
parents:
94989
diff
changeset
|
789 Fifth arg PUT-NEW-ENTRY-ON-NEW-LINE non-nil means that if a new |
e5a55b8c9892
* add-log.el (add-change-log-entry): Add new arg to force each new
Dan Nicolaescu <dann@ics.uci.edu>
parents:
94989
diff
changeset
|
790 entry is created, put it on a new line by itself, do not put it |
e5a55b8c9892
* add-log.el (add-change-log-entry): Add new arg to force each new
Dan Nicolaescu <dann@ics.uci.edu>
parents:
94989
diff
changeset
|
791 after a comma on an existing line. |
e5a55b8c9892
* add-log.el (add-change-log-entry): Add new arg to force each new
Dan Nicolaescu <dann@ics.uci.edu>
parents:
94989
diff
changeset
|
792 |
40315
e41eca24ba8c
(add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents:
39625
diff
changeset
|
793 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
|
794 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
|
795 the same person. |
e41eca24ba8c
(add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents:
39625
diff
changeset
|
796 |
39625
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
797 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
|
798 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
|
799 notices. |
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
800 |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
801 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
|
802 non-nil, otherwise in local time." |
661 | 803 (interactive (list current-prefix-arg |
804 (prompt-for-change-log-name))) | |
32011
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
805 (let* ((defun (add-log-current-defun)) |
534b5a76bf8a
(find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31813
diff
changeset
|
806 (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
|
807 (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
|
808 (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
|
809 (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
|
810 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
|
811 (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
|
812 (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
|
813 ;; 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
|
814 (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
|
815 |
47828
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
816 (unless (equal file-name buffer-file-name) |
105995
d90116e2656a
(add-change-log-entry): Avoid displaying the changelog a second time.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105143
diff
changeset
|
817 (cond |
d90116e2656a
(add-change-log-entry): Avoid displaying the changelog a second time.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105143
diff
changeset
|
818 ((equal file-name (buffer-file-name (window-buffer (selected-window)))) |
d90116e2656a
(add-change-log-entry): Avoid displaying the changelog a second time.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105143
diff
changeset
|
819 ;; If the selected window already shows the desired buffer don't show |
d90116e2656a
(add-change-log-entry): Avoid displaying the changelog a second time.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105143
diff
changeset
|
820 ;; it again (particularly important if other-window is true). |
d90116e2656a
(add-change-log-entry): Avoid displaying the changelog a second time.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105143
diff
changeset
|
821 ;; This is important for diff-add-change-log-entries-other-window. |
d90116e2656a
(add-change-log-entry): Avoid displaying the changelog a second time.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105143
diff
changeset
|
822 (set-buffer (window-buffer (selected-window)))) |
d90116e2656a
(add-change-log-entry): Avoid displaying the changelog a second time.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105143
diff
changeset
|
823 ((or other-window (window-dedicated-p (selected-window))) |
d90116e2656a
(add-change-log-entry): Avoid displaying the changelog a second time.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105143
diff
changeset
|
824 (find-file-other-window file-name)) |
d90116e2656a
(add-change-log-entry): Avoid displaying the changelog a second time.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105143
diff
changeset
|
825 (t (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
|
826 (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
|
827 (change-log-mode)) |
661 | 828 (undo-boundary) |
829 (goto-char (point-min)) | |
39625
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
830 |
82003
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
831 (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
|
832 (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
|
833 |
82003
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
834 (when whoami |
82073 | 835 (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
|
836 ;; 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
|
837 ;; 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
|
838 ;; 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
|
839 ;; 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
|
840 (setq mailing-address |
82073 | 841 (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
|
842 |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
843 ;; 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
|
844 ;; 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
|
845 (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
|
846 (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
|
847 (skip-chars-forward "\n")) |
39625
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
848 |
82003
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
849 ;; 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
|
850 (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
|
851 (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
|
852 (concat |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
853 (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
|
854 (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
|
855 (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
|
856 (progn |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
857 (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
|
858 (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
|
859 (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
|
860 (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
|
861 " " 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
|
862 " <" addr ">")) |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
863 (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
|
864 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
|
865 (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
|
866 (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
|
867 (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
|
868 (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
|
869 (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
|
870 (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
|
871 (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
|
872 (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
|
873 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
|
874 (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
|
875 (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
|
876 (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
|
877 |
39625
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
878 ;; 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
|
879 ;; 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
|
880 (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
|
881 (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
|
882 (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
|
883 (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
|
884 (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
|
885 (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
|
886 (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
|
887 (point)))) |
39625
e441240482b2
(add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents:
38697
diff
changeset
|
888 |
82003
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
889 ;; 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
|
890 (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
|
891 ;; 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
|
892 (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
|
893 (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
|
894 ((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
|
895 (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
|
896 (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
|
897 (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
|
898 ;; 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
|
899 ;; 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
|
900 "\\(\\s \\|[(),:]\\)") |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
901 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
|
902 ;; 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
|
903 (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
|
904 (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
|
905 ;; 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
|
906 (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
|
907 (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
|
908 (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
|
909 (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
|
910 (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
|
911 (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
|
912 (t |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
913 ;; 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
|
914 (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
|
915 (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
|
916 (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
|
917 (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
|
918 (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
|
919 (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
|
920 (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
|
921 (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
|
922 (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
|
923 (insert "* ") |
571d99dbf19d
(add-change-log-entry): Delay reading add-log-(full-name|mailing-address)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82002
diff
changeset
|
924 (if item (insert item))))) |
837
a8aef92e0025
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
811
diff
changeset
|
925 ;; 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
|
926 ;; Point is at the item for this file, |
666
7fa6b835da67
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
661
diff
changeset
|
927 ;; 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
|
928 (if (not defun) |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
929 ;; 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
|
930 (unless (save-excursion |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
931 (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
|
932 (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
|
933 (insert ": ") |
63998
7651543ac34c
(change-log): Finish `defgroup' description with period.
Juanma Barranquero <lekktu@gmail.com>
parents:
63668
diff
changeset
|
934 (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
|
935 ;; 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
|
936 (undo-boundary) |
28446 | 937 (unless (save-excursion |
938 (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
|
939 (looking-at "\\s *$")) |
63998
7651543ac34c
(change-log): Finish `defgroup' description with period.
Juanma Barranquero <lekktu@gmail.com>
parents:
63668
diff
changeset
|
940 (insert ?\s)) |
49308
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
941 ;; 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
|
942 ;; 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
|
943 (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
|
944 (skip-syntax-backward " ") |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
945 (skip-chars-backward "):") |
96217
e5a55b8c9892
* add-log.el (add-change-log-entry): Add new arg to force each new
Dan Nicolaescu <dann@ics.uci.edu>
parents:
94989
diff
changeset
|
946 (if (and (not put-new-entry-on-new-line) |
e5a55b8c9892
* add-log.el (add-change-log-entry): Add new arg to force each new
Dan Nicolaescu <dann@ics.uci.edu>
parents:
94989
diff
changeset
|
947 (looking-at "):") |
50575
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
948 (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
|
949 (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
|
950 (delete-region pos (point))) |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
951 (> 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
|
952 (progn (skip-chars-backward ", ") |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
953 (delete-region (point) pos) |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
954 (unless (memq (char-before) '(?\()) (insert ", "))) |
96217
e5a55b8c9892
* add-log.el (add-change-log-entry): Add new arg to force each new
Dan Nicolaescu <dann@ics.uci.edu>
parents:
94989
diff
changeset
|
955 (when (and (not put-new-entry-on-new-line) (looking-at "):")) |
e5a55b8c9892
* add-log.el (add-change-log-entry): Add new arg to force each new
Dan Nicolaescu <dann@ics.uci.edu>
parents:
94989
diff
changeset
|
956 (delete-region (+ 1 (point)) (line-end-position))) |
49308
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
957 (goto-char pos) |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
958 (insert "(")) |
0e6cefe9e2d0
(add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48615
diff
changeset
|
959 (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
|
960 (insert defun "): ") |
63998
7651543ac34c
(change-log): Finish `defgroup' description with period.
Juanma Barranquero <lekktu@gmail.com>
parents:
63668
diff
changeset
|
961 (if version (insert version ?\s))))) |
661 | 962 |
963 ;;;###autoload | |
964 (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
|
965 "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
|
966 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
|
967 the change log file in another window." |
661 | 968 (interactive (if current-prefix-arg |
969 (list current-prefix-arg | |
970 (prompt-for-change-log-name)))) | |
971 (add-change-log-entry whoami file-name t)) | |
972 | |
82017
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
973 |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
974 (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
|
975 |
82017
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
976 (defun change-log-fill-parenthesized-list () |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
977 ;; 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
|
978 ;; * 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
|
979 ;; should be filled as |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
980 ;; * 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
|
981 ;; (very-long-foobar): |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
982 (save-excursion |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
983 (end-of-line 0) |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
984 (skip-chars-backward " \t") |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
985 (when (and (equal (char-before) ?\,) |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
986 (> (point) (1+ (point-min)))) |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
987 (condition-case nil |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
988 (when (save-excursion |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
989 (and (prog2 |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
990 (up-list -1) |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
991 (equal (char-after) ?\() |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
992 (skip-chars-backward " \t")) |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
993 (or (bolp) |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
994 ;; Skip everything but a whitespace or asterisk. |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
995 (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
|
996 (skip-chars-backward " \t") |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
997 ;; We want one asterisk here. |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
998 (= (skip-chars-backward "*") -1) |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
999 (skip-chars-backward " \t") |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
1000 (bolp))))) |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
1001 ;; Delete the comma. |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
1002 (delete-char -1) |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
1003 ;; Close list on previous line. |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
1004 (insert ")") |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
1005 (skip-chars-forward " \t\n") |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
1006 ;; Start list on new line. |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
1007 (insert-before-markers "(")) |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
1008 (error nil))))) |
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
1009 |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
1010 (defun change-log-indent () |
82017
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
1011 (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
|
1012 (let* ((indent |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
1013 (save-excursion |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
1014 (beginning-of-line) |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
1015 (skip-chars-forward " \t") |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
1016 (cond |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
1017 ((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
|
1018 ;; 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
|
1019 ;; 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
|
1020 (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
|
1021 0) |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
1022 ((looking-at "[^*(]") |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
1023 (+ (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
|
1024 (t (current-left-margin))))) |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
1025 (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
|
1026 (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
|
1027 |
caadcafadb0c
(change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49308
diff
changeset
|
1028 |
51580
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
1029 (defvar smerge-resolve-function) |
94225
1e25298a53bc
(top-level): Require 'cl when compiling.
Glenn Morris <rgm@gnu.org>
parents:
93890
diff
changeset
|
1030 (defvar copyright-at-end-flag) |
51580
d9592ff1371e
(add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50641
diff
changeset
|
1031 |
980
b62886fbf2a7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
953
diff
changeset
|
1032 ;;;###autoload |
47828
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
1033 (define-derived-mode change-log-mode text-mode "Change Log" |
100947
534e78fa3211
* add-log.el (change-log-search-tag-name): Reflow docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
1034 "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
|
1035 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
|
1036 New log entries are usually made with \\[add-change-log-entry] or \\[add-change-log-entry-other-window]. |
951 | 1037 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
|
1038 Runs `change-log-mode-hook'. |
100947
534e78fa3211
* add-log.el (change-log-search-tag-name): Reflow docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
1039 \n\\{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
|
1040 (setq left-margin 8 |
13706
ba34746d66fd
(change-log-mode): Defaults for `indent-tabs-mode'
Karl Heuer <kwzh@gnu.org>
parents:
13648
diff
changeset
|
1041 fill-column 74 |
15887
18c1dcf40139
(change-log-mode): Set fill-paragraph-function.
Karl Heuer <kwzh@gnu.org>
parents:
15299
diff
changeset
|
1042 indent-tabs-mode t |
81501
801606fb518b
(change-log-mode): Set `show-trailing-whitespace'.
Juanma Barranquero <lekktu@gmail.com>
parents:
75446
diff
changeset
|
1043 tab-width 8 |
801606fb518b
(change-log-mode): Set `show-trailing-whitespace'.
Juanma Barranquero <lekktu@gmail.com>
parents:
75446
diff
changeset
|
1044 show-trailing-whitespace t) |
105143
1afcc0df808d
(change-log-fill-forward-paragraph): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104778
diff
changeset
|
1045 (set (make-local-variable 'fill-forward-paragraph-function) |
1afcc0df808d
(change-log-fill-forward-paragraph): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104778
diff
changeset
|
1046 'change-log-fill-forward-paragraph) |
1afcc0df808d
(change-log-fill-forward-paragraph): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104778
diff
changeset
|
1047 ;; Make sure we call `change-log-indent' when filling. |
1afcc0df808d
(change-log-fill-forward-paragraph): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104778
diff
changeset
|
1048 (set (make-local-variable 'fill-indent-according-to-mode) t) |
81943
d32ff111504c
(change-log-mode): Use fill-nobreak-predicate to
Martin Rudalics <rudalics@gmx.at>
parents:
81501
diff
changeset
|
1049 ;; 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
|
1050 (add-hook 'fill-nobreak-predicate |
d32ff111504c
(change-log-mode): Use fill-nobreak-predicate to
Martin Rudalics <rudalics@gmx.at>
parents:
81501
diff
changeset
|
1051 '(lambda () |
94225
1e25298a53bc
(top-level): Require 'cl when compiling.
Glenn Morris <rgm@gnu.org>
parents:
93890
diff
changeset
|
1052 (looking-back "^\\s *\\*\\s *" (line-beginning-position))) |
81943
d32ff111504c
(change-log-mode): Use fill-nobreak-predicate to
Martin Rudalics <rudalics@gmx.at>
parents:
81501
diff
changeset
|
1053 nil t) |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
1054 (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
|
1055 (set (make-local-variable 'tab-always-indent) nil) |
94225
1e25298a53bc
(top-level): Require 'cl when compiling.
Glenn Morris <rgm@gnu.org>
parents:
93890
diff
changeset
|
1056 (set (make-local-variable 'copyright-at-end-flag) t) |
21719
c888284a54f7
(change-log-mode): Add `* ' to paragraph-start.
Dave Love <fx@gnu.org>
parents:
21629
diff
changeset
|
1057 ;; 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
|
1058 ;; 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
|
1059 ;; 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
|
1060 ;; between entries for different files. |
21749
84df514f7719
(change-log-mode): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
21719
diff
changeset
|
1061 (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
|
1062 (set (make-local-variable 'paragraph-separate) paragraph-start) |
1078
15b4ed20e524
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1062
diff
changeset
|
1063 ;; 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
|
1064 ;; 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
|
1065 (set (make-local-variable 'page-delimiter) "^\\<\\|^\f") |
678 | 1066 (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
|
1067 (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
|
1068 'change-log-resolve-conflict) |
678 | 1069 (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
|
1070 (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
|
1071 '(change-log-font-lock-keywords t nil nil backward-paragraph)) |
96953
df8cf5e076d6
(change-log-mode): Set `change-log-next-buffer' to
Juri Linkov <juri@jurta.org>
parents:
96659
diff
changeset
|
1072 (set (make-local-variable 'multi-isearch-next-buffer-function) |
85570
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
1073 'change-log-next-buffer) |
100947
534e78fa3211
* add-log.el (change-log-search-tag-name): Reflow docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
1074 (set (make-local-variable 'beginning-of-defun-function) |
85650
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1075 'change-log-beginning-of-defun) |
100947
534e78fa3211
* add-log.el (change-log-search-tag-name): Reflow docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
1076 (set (make-local-variable 'end-of-defun-function) |
97288
b0e0f868bbd7
(change-log-next-error, change-log-mode): Add support
Teodor Zlatanov <tzz@lifelogs.com>
parents:
97142
diff
changeset
|
1077 'change-log-end-of-defun) |
b0e0f868bbd7
(change-log-next-error, change-log-mode): Add support
Teodor Zlatanov <tzz@lifelogs.com>
parents:
97142
diff
changeset
|
1078 ;; next-error function glue |
b0e0f868bbd7
(change-log-next-error, change-log-mode): Add support
Teodor Zlatanov <tzz@lifelogs.com>
parents:
97142
diff
changeset
|
1079 (setq next-error-function 'change-log-next-error) |
b0e0f868bbd7
(change-log-next-error, change-log-mode): Add support
Teodor Zlatanov <tzz@lifelogs.com>
parents:
97142
diff
changeset
|
1080 (setq next-error-last-buffer (current-buffer))) |
85570
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
1081 |
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
1082 (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
|
1083 "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
|
1084 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
|
1085 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
|
1086 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
|
1087 file were isearch was started." |
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
1088 (let* ((name (change-log-name)) |
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
1089 (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
|
1090 (concat name "[-.][0-9]*")) |
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
1091 (lambda (a b) |
93890
5bd4e09f29d0
(change-log-next-buffer): Handle the case where version< signals an error.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93565
diff
changeset
|
1092 ;; The file's extension may not have a valid |
5bd4e09f29d0
(change-log-next-buffer): Handle the case where version< signals an error.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93565
diff
changeset
|
1093 ;; version form (e.g. VC backup revisions). |
5bd4e09f29d0
(change-log-next-buffer): Handle the case where version< signals an error.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93565
diff
changeset
|
1094 (ignore-errors |
5bd4e09f29d0
(change-log-next-buffer): Handle the case where version< signals an error.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93565
diff
changeset
|
1095 (version< (substring b (length name)) |
5bd4e09f29d0
(change-log-next-buffer): Handle the case where version< signals an error.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93565
diff
changeset
|
1096 (substring a (length name)))))))) |
85570
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
1097 (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
|
1098 (find-file-noselect |
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
1099 (if wrap |
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
1100 (car files) |
cd304d007007
(change-log-mode): Make and set buffer-local variable
Juri Linkov <juri@jurta.org>
parents:
85139
diff
changeset
|
1101 (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
|
1102 files)))))) |
666
7fa6b835da67
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
661
diff
changeset
|
1103 |
105143
1afcc0df808d
(change-log-fill-forward-paragraph): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104778
diff
changeset
|
1104 (defun change-log-fill-forward-paragraph (n) |
1afcc0df808d
(change-log-fill-forward-paragraph): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104778
diff
changeset
|
1105 "Cut paragraphs so filling preserves open parentheses at beginning of lines." |
1afcc0df808d
(change-log-fill-forward-paragraph): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104778
diff
changeset
|
1106 (let (;; Add lines starting with whitespace followed by a left paren or an |
82017
3ecefdb49ed0
(change-log-fill-parenthesized-list): New function.
Martin Rudalics <rudalics@gmx.at>
parents:
82007
diff
changeset
|
1107 ;; asterisk. |
105143
1afcc0df808d
(change-log-fill-forward-paragraph): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104778
diff
changeset
|
1108 (paragraph-start (concat paragraph-start "\\|\\s *\\(?:\\s(\\|\\*\\)"))) |
1afcc0df808d
(change-log-fill-forward-paragraph): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104778
diff
changeset
|
1109 (forward-paragraph n))) |
4157
d2316090d029
(prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents:
4154
diff
changeset
|
1110 |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
1111 (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
|
1112 "^\\([[:upper:]][[:upper:]_ ]*[[:upper:]_]\\|[-_[:alpha:]]+\\)[ \t]*[:=]" |
103722
6b137b54c7d3
* add-log.el (add-log-current-defun-header-regexp): Doc
Chong Yidong <cyd@stupidchicken.com>
parents:
100947
diff
changeset
|
1113 "Heuristic regexp used by `add-log-current-defun' for unknown major modes. |
6b137b54c7d3
* add-log.el (add-log-current-defun-header-regexp): Doc
Chong Yidong <cyd@stupidchicken.com>
parents:
100947
diff
changeset
|
1114 The regexp's first submatch is placed in the ChangeLog entry, in |
6b137b54c7d3
* add-log.el (add-log-current-defun-header-regexp): Doc
Chong Yidong <cyd@stupidchicken.com>
parents:
100947
diff
changeset
|
1115 parentheses." |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
1116 :type 'regexp |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16505
diff
changeset
|
1117 :group 'change-log) |
666
7fa6b835da67
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
661
diff
changeset
|
1118 |
6562
0541a368505c
(add-log-current-defun): Autoload this.
Roland McGrath <roland@gnu.org>
parents:
6309
diff
changeset
|
1119 ;;;###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
|
1120 (defvar add-log-lisp-like-modes |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
1121 '(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
|
1122 "*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
|
1123 |
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
|
1124 ;;;###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
|
1125 (defvar add-log-c-like-modes |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
1126 '(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
|
1127 "*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
|
1128 |
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
|
1129 ;;;###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
|
1130 (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
|
1131 '(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
|
1132 "*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
|
1133 |
93565
622e5fddb043
(c-beginning-of-defun, c-end-of-defun): Remove declarations; no longer used.
Glenn Morris <rgm@gnu.org>
parents:
93557
diff
changeset
|
1134 (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
|
1135 (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
|
1136 |
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
|
1137 ;;;###autoload |
666
7fa6b835da67
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
661
diff
changeset
|
1138 (defun add-log-current-defun () |
7fa6b835da67
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
661
diff
changeset
|
1139 "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
|
1140 |
3499
6428162f137c
(add-log-current-defun): Fix typos in last change.
Richard M. Stallman <rms@gnu.org>
parents:
3486
diff
changeset
|
1141 Understands C, Lisp, LaTeX (\"functions\" are chapters, sections, ...), |
28446 | 1142 Texinfo (@node titles) and Perl. |
666
7fa6b835da67
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
661
diff
changeset
|
1143 |
7fa6b835da67
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
661
diff
changeset
|
1144 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
|
1145 point for uppercase headings starting in the first column or |
28446 | 1146 identifiers followed by `:' or `='. See variables |
27277
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
1147 `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
|
1148 `add-log-current-defun-function'. |
666
7fa6b835da67
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
661
diff
changeset
|
1149 |
7fa6b835da67
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
661
diff
changeset
|
1150 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
|
1151 (condition-case nil |
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
1152 (save-excursion |
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
1153 (let ((location (point))) |
28446 | 1154 (cond (add-log-current-defun-function |
1155 (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
|
1156 ((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
|
1157 ;; 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
|
1158 ;; 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
|
1159 ;; rather than the previous one. |
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
1160 (or (eobp) (forward-char 1)) |
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
1161 (beginning-of-defun) |
28446 | 1162 ;; Make sure we are really inside the defun found, |
1163 ;; not after it. | |
21944
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
1164 (when (and (looking-at "\\s(") |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
1165 (progn (end-of-defun) |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
1166 (< location (point))) |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
1167 (progn (forward-sexp -1) |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
1168 (>= location (point)))) |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
1169 (if (looking-at "\\s(") |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
1170 (forward-char 1)) |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
1171 ;; Skip the defining construct name, typically "defun" |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
1172 ;; or "defvar". |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
1173 (forward-sexp 1) |
8e606f5208eb
(add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents:
21943
diff
changeset
|
1174 ;; 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
|
1175 ;; If it is not, use the first symbol in it. |
22018 | 1176 (skip-chars-forward " \t\n'(") |
28446 | 1177 (buffer-substring-no-properties (point) |
1178 (progn (forward-sexp 1) | |
1179 (point))))) | |
82005
0de2cd15c33d
(add-change-log-entry, add-log-current-defun, change-log-merge):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82003
diff
changeset
|
1180 ((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
|
1181 (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
|
1182 (c-defun-name))) |
111262
029e4783cbae
Merge changes from emacs-23 branch
Chong Yidong <cyd@stupidchicken.com>
parents:
110497
diff
changeset
|
1183 ((apply #'derived-mode-p 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
|
1184 (if (re-search-backward |
28446 | 1185 "\\\\\\(sub\\)*\\(section\\|paragraph\\|chapter\\)" |
1186 nil t) | |
1447
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
1187 (progn |
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
1188 (goto-char (match-beginning 0)) |
28446 | 1189 (buffer-substring-no-properties |
1190 (1+ (point)) ; without initial backslash | |
1191 (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
|
1192 ((derived-mode-p 'texinfo-mode) |
9397
eba13d81ba0b
(add-log-current-defun): In texinfo-mode,
Richard M. Stallman <rms@gnu.org>
parents:
9377
diff
changeset
|
1193 (if (re-search-backward "^@node[ \t]+\\([^,\n]+\\)" nil t) |
28446 | 1194 (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
|
1195 ((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
|
1196 (if (re-search-backward "^sub[ \t]+\\([^({ \t\n]+\\)" nil t) |
28446 | 1197 (match-string-no-properties 1))) |
1198 ;; Emacs's autoconf-mode installs its own | |
1199 ;; `add-log-current-defun-function'. This applies to | |
1200 ;; a different mode apparently for editing .m4 | |
1201 ;; 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
|
1202 ((derived-mode-p 'autoconf-mode) |
28446 | 1203 (if (re-search-backward |
1204 "^\\(\\(m4_\\)?define\\|A._DEFUN\\)(\\[?\\([A-Za-z0-9_]+\\)" nil t) | |
1205 (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
|
1206 (t |
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
1207 ;; If all else fails, try heuristics |
27277
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
1208 (let (case-fold-search |
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
1209 result) |
1447
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
1210 (end-of-line) |
27277
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
1211 (when (re-search-backward |
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
1212 add-log-current-defun-header-regexp |
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
1213 (- (point) 10000) |
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
1214 t) |
28446 | 1215 (setq result (or (match-string-no-properties 1) |
1216 (match-string-no-properties 0))) | |
27277
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
1217 ;; Strip whitespace away |
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
1218 (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
|
1219 result) |
28446 | 1220 (setq result (match-string-no-properties 1 result))) |
27277
9fdcfef41c64
(add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents:
27240
diff
changeset
|
1221 result)))))) |
1447
75fa9ad982a5
(add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents:
1369
diff
changeset
|
1222 (error nil))) |
999 | 1223 |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
1224 (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
|
1225 |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
1226 ;; 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
|
1227 ;; 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
|
1228 ;; 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
|
1229 (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
|
1230 (setq change-log-get-method-definition-md |
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
1231 (concat change-log-get-method-definition-md |
28446 | 1232 (match-string 1) |
13282
69fe836d7f02
(get-method-definition, get-method-definition-1):
Richard M. Stallman <rms@gnu.org>
parents:
13255
diff
changeset
|
1233 end)) |
11749
8da04214faed
(get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
11517
diff
changeset
|
1234 (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
|
1235 |
20402
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
1236 (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
|
1237 "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
|
1238 (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
|
1239 (save-excursion |
11816
2a8e1b01bc15
(get-method-definition): Fix regexps.
Karl Heuer <kwzh@gnu.org>
parents:
11757
diff
changeset
|
1240 (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
|
1241 (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
|
1242 (save-excursion |
8da04214faed
(get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
11517
diff
changeset
|
1243 (cond |
11816
2a8e1b01bc15
(get-method-definition): Fix regexps.
Karl Heuer <kwzh@gnu.org>
parents:
11757
diff
changeset
|
1244 ((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
|
1245 (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
|
1246 (while (not (looking-at "[{;]")) |
8da04214faed
(get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
11517
diff
changeset
|
1247 (looking-at |
11816
2a8e1b01bc15
(get-method-definition): Fix regexps.
Karl Heuer <kwzh@gnu.org>
parents:
11757
diff
changeset
|
1248 "\\([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
|
1249 (change-log-get-method-definition-1 "")) |
108100aa1991
(change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19904
diff
changeset
|
1250 (concat change-log-get-method-definition-md "]")))))) |
27240 | 1251 |
110497
f7314f69b999
Cosmetic changes for add-log.el.
Glenn Morris <rgm@gnu.org>
parents:
109907
diff
changeset
|
1252 (autoload 'timezone-make-date-sortable "timezone") |
f7314f69b999
Cosmetic changes for add-log.el.
Glenn Morris <rgm@gnu.org>
parents:
109907
diff
changeset
|
1253 |
27240 | 1254 (defun change-log-sortable-date-at () |
1255 "Return date of log entry in a consistent form for sorting. | |
1256 Point is assumed to be at the start of the entry." | |
85650
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1257 (if (looking-at change-log-start-entry-re) |
27240 | 1258 (let ((date (match-string-no-properties 0))) |
1259 (if date | |
1260 (if (string-match "\\(....\\)-\\(..\\)-\\(..\\)\\s-+" date) | |
1261 (concat (match-string 1 date) (match-string 2 date) | |
1262 (match-string 3 date)) | |
110497
f7314f69b999
Cosmetic changes for add-log.el.
Glenn Morris <rgm@gnu.org>
parents:
109907
diff
changeset
|
1263 (ignore-errors (timezone-make-date-sortable date))))) |
27240 | 1264 (error "Bad date"))) |
11749
8da04214faed
(get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
11517
diff
changeset
|
1265 |
47828
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
1266 (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
|
1267 "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
|
1268 (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
|
1269 (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
|
1270 (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
|
1271 (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
|
1272 (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
|
1273 (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
|
1274 (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
|
1275 (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
|
1276 (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
|
1277 (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
|
1278 (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
|
1279 (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
|
1280 (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
|
1281 (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
|
1282 (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
|
1283 (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
|
1284 (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
|
1285 ;; 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
|
1286 ;; 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
|
1287 (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
|
1288 (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
|
1289 (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
|
1290 (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
|
1291 (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
|
1292 (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
|
1293 (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
|
1294 |
27240 | 1295 ;;;###autoload |
1296 (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
|
1297 "Merge the contents of change log file OTHER-LOG with this buffer. |
27240 | 1298 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
|
1299 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
|
1300 or a buffer. |
27240 | 1301 |
30809 | 1302 Entries are inserted in chronological order. Both the current and |
1303 old-style time formats for entries are supported." | |
27240 | 1304 (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
|
1305 (if (not (derived-mode-p 'change-log-mode)) |
27240 | 1306 (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
|
1307 (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
|
1308 (find-file-noselect other-log))) |
27240 | 1309 (buf (current-buffer)) |
1310 date1 start end) | |
1311 (save-excursion | |
1312 (goto-char (point-min)) | |
1313 (set-buffer other-buf) | |
1314 (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
|
1315 (if (not (derived-mode-p 'change-log-mode)) |
27240 | 1316 (error "%s not found in Change Log mode" other-log)) |
1317 ;; Loop through all the entries in OTHER-LOG. | |
1318 (while (not (eobp)) | |
1319 (setq date1 (change-log-sortable-date-at)) | |
1320 (setq start (point) | |
1321 end (progn (forward-page) (point))) | |
1322 ;; Look for an entry in original buffer that isn't later. | |
1323 (with-current-buffer buf | |
1324 (while (and (not (eobp)) | |
1325 (string< date1 (change-log-sortable-date-at))) | |
1326 (forward-page)) | |
1327 (if (not (eobp)) | |
1328 (insert-buffer-substring other-buf start end) | |
1329 ;; At the end of the original buffer, insert a newline to | |
1330 ;; 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
|
1331 ;; merged. |
4944e0ddf992
(add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46637
diff
changeset
|
1332 (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
|
1333 (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
|
1334 (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
|
1335 (= ?\n (char-before (1- (point))))))) |
68182
faf3f34b2d1c
(add-change-log-entry, change-log-merge):
Romain Francoise <romain@orebokech.com>
parents:
66965
diff
changeset
|
1336 (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
|
1337 ;; 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
|
1338 (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
|
1339 (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
|
1340 (insert-buffer-substring other-buf start))))))) |
999 | 1341 |
85650
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1342 (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
|
1343 (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
|
1344 |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1345 (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
|
1346 ;; 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
|
1347 ;; 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
|
1348 (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
|
1349 (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
|
1350 |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1351 ;; 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
|
1352 ;; 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
|
1353 ;; 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
|
1354 ;; the same entry. |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1355 (forward-line 1) |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1356 |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1357 ;; 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
|
1358 (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
|
1359 (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
|
1360 (forward-line 1)) |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1361 |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1362 ;; 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
|
1363 ;; 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
|
1364 (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
|
1365 (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
|
1366 (forward-line -1))) |
437a25964d35
* emulation/edt-mapper.el (edt-emacs-variant): Replace the only
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85570
diff
changeset
|
1367 |
980
b62886fbf2a7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
953
diff
changeset
|
1368 (provide 'add-log) |
b62886fbf2a7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
953
diff
changeset
|
1369 |
70217
377548b8f095
Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69818
diff
changeset
|
1370 ;; arch-tag: 81eee6fc-088f-4372-a37f-80ad9620e762 |
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
678
diff
changeset
|
1371 ;;; add-log.el ends here |