annotate lisp/add-log.el @ 83383:2a679c81f552

Merged from miles@gnu.org--gnu-2005 (patch 118-132, 551-577) Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-551 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-552 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-553 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-554 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-555 Remove CVS keywords from newsticker files * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-556 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-557 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-558 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-559 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-560 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-561 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-562 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-563 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-564 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-565 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-566 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-567 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-568 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-569 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-570 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-571 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-572 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-573 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-574 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-575 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-576 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-577 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-118 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-119 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-120 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-121 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-122 Update from CVS: lisp/mm-url.el (mm-url-decode-entities): Fix regexp. * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-123 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-124 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-125 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-126 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-127 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-128 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-129 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-130 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-131 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-132 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-423
author Karoly Lorentey <lorentey@elte.hu>
date Sun, 09 Oct 2005 20:00:17 +0000
parents 41bb365f41c4
children 1e2706559fdf 2d92f5c9d6ae
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22388
2d0bece94ee7 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 22018
diff changeset
1 ;;; add-log.el --- change log maintenance commands for Emacs
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
2
64762
41bb365f41c4 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64315
diff changeset
3 ;; Copyright (C) 1985, 1986, 1988, 1993, 1994, 1997, 1998, 2000, 2002,
41bb365f41c4 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64315
diff changeset
4 ;; 2003, 2004, 2005 Free Software Foundation, Inc.
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
5
38697
a19197c6442f Keyword added and FSF specified as Maintainer.
Pavel Janík <Pavel@Janik.cz>
parents: 36604
diff changeset
6 ;; Maintainer: FSF
18277
7509948b0121 (add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17923
diff changeset
7 ;; Keywords: tools
2247
2c7997f249eb Add or correct keywords
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1999
diff changeset
8
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
10
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
811
e694e0879463 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 678
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
14 ;; any later version.
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
15
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
19 ;; GNU General Public License for more details.
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
20
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13706
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64091
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63998
diff changeset
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63998
diff changeset
24 ;; Boston, MA 02110-1301, USA.
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
25
2307
10e417efb12a Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2247
diff changeset
26 ;;; Commentary:
10e417efb12a Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2247
diff changeset
27
10e417efb12a Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2247
diff changeset
28 ;; This facility is documented in the Emacs Manual.
10e417efb12a Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2247
diff changeset
29
811
e694e0879463 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 678
diff changeset
30 ;;; Code:
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
31
27003
f6f431fc901b (change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents: 26618
diff changeset
32 (eval-when-compile
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
33 (require 'timezone))
21629
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
34
17413
9fa0ed8da0b1 Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 16505
diff changeset
35 (defgroup change-log nil
63998
7651543ac34c (change-log): Finish `defgroup' description with period.
Juanma Barranquero <lekktu@gmail.com>
parents: 63668
diff changeset
36 "Change log maintenance."
17413
9fa0ed8da0b1 Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 16505
diff changeset
37 :group 'tools
21629
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
38 :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
39 :prefix "change-log-"
9fa0ed8da0b1 Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 16505
diff changeset
40 :prefix "add-log-")
9fa0ed8da0b1 Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 16505
diff changeset
41
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
42
17413
9fa0ed8da0b1 Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 16505
diff changeset
43 (defcustom change-log-default-name nil
9fa0ed8da0b1 Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 16505
diff changeset
44 "*Name of a change log file for \\[add-change-log-entry]."
9fa0ed8da0b1 Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 16505
diff changeset
45 :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
46 string)
9fa0ed8da0b1 Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 16505
diff changeset
47 :group 'change-log)
9fa0ed8da0b1 Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 16505
diff changeset
48
26613
7f7e6de546ac (change-log-mode-hook): Customize.
Dave Love <fx@gnu.org>
parents: 25273
diff changeset
49 (defcustom change-log-mode-hook nil
7f7e6de546ac (change-log-mode-hook): Customize.
Dave Love <fx@gnu.org>
parents: 25273
diff changeset
50 "Normal hook run by `change-log-mode'."
7f7e6de546ac (change-log-mode-hook): Customize.
Dave Love <fx@gnu.org>
parents: 25273
diff changeset
51 :type 'hook
7f7e6de546ac (change-log-mode-hook): Customize.
Dave Love <fx@gnu.org>
parents: 25273
diff changeset
52 :group 'change-log)
7f7e6de546ac (change-log-mode-hook): Customize.
Dave Love <fx@gnu.org>
parents: 25273
diff changeset
53
50641
7ae78cd3ce2e (add-log-current-defun-function): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents: 50575
diff changeset
54 ;; 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
55 ;;;###autoload
17413
9fa0ed8da0b1 Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 16505
diff changeset
56 (defcustom add-log-current-defun-function nil
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
57 "*If non-nil, function to guess name of surrounding function.
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
58 It is used by `add-log-current-defun' in preference to built-in rules.
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
59 Returns function's name as a string, or nil if outside a function."
35936
61d0887bbd4e (add-log-current-defun-function)
Dave Love <fx@gnu.org>
parents: 34576
diff changeset
60 :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
61 :group 'change-log)
4154
20a0593431b7 (add-log-current-defun-function): New defvar.
Roland McGrath <roland@gnu.org>
parents: 3897
diff changeset
62
14856
f64fa743c80f (add-log-full-name, add-log-mailing-address): Add autoload cookies.
Richard M. Stallman <rms@gnu.org>
parents: 14528
diff changeset
63 ;;;###autoload
17413
9fa0ed8da0b1 Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 16505
diff changeset
64 (defcustom add-log-full-name nil
4741
c0ea0009268a add-log-full-name, add-log-mailing-address: new varialbes
Brian Fox <bfox@gnu.org>
parents: 4380
diff changeset
65 "*Full name of user, for inclusion in ChangeLog daily headers.
27240
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
66 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
67 :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
68 string)
9fa0ed8da0b1 Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 16505
diff changeset
69 :group 'change-log)
4741
c0ea0009268a add-log-full-name, add-log-mailing-address: new varialbes
Brian Fox <bfox@gnu.org>
parents: 4380
diff changeset
70
14856
f64fa743c80f (add-log-full-name, add-log-mailing-address): Add autoload cookies.
Richard M. Stallman <rms@gnu.org>
parents: 14528
diff changeset
71 ;;;###autoload
17413
9fa0ed8da0b1 Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 16505
diff changeset
72 (defcustom add-log-mailing-address nil
64315
b12b140acf8b (add-log-mailing-address, change-log-merge): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 64091
diff changeset
73 "*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
74 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
75 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
76 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
77 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
78 :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
79 (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
80 (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
81 :group 'change-log)
9fa0ed8da0b1 Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 16505
diff changeset
82
18277
7509948b0121 (add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17923
diff changeset
83 (defcustom add-log-time-format 'add-log-iso8601-time-string
7509948b0121 (add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17923
diff changeset
84 "*Function that defines the time format.
7509948b0121 (add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17923
diff changeset
85 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
86 date in international ISO 8601 format,
7509948b0121 (add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17923
diff changeset
87 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
88 :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
89 add-log-iso8601-time-string)
7509948b0121 (add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17923
diff changeset
90 (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
91 current-time-string)
7509948b0121 (add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17923
diff changeset
92 (function :tag "Other"))
7509948b0121 (add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17923
diff changeset
93 :group 'change-log)
4741
c0ea0009268a add-log-full-name, add-log-mailing-address: new varialbes
Brian Fox <bfox@gnu.org>
parents: 4380
diff changeset
94
20402
108100aa1991 (change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19904
diff changeset
95 (defcustom add-log-keep-changes-together nil
21629
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
96 "*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
97
21629
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
98 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
99 \\[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
100 for that file made
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
101 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
102 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
103 original log:
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
104
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
105 * foo (...): ...
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
106 * bar (...): change 1
20402
108100aa1991 (change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19904
diff changeset
107
21629
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
108 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
109 buffer visiting `bar', yields:
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
110
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
111 * bar (...): -!-
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 and in the former:
20402
108100aa1991 (change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19904
diff changeset
116
21629
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
117 * foo (...): ...
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
118 * bar (...): change 1
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
119 (...): -!-
20402
108100aa1991 (change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19904
diff changeset
120
21629
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
121 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
122 this variable."
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
123 :version "20.3"
20402
108100aa1991 (change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19904
diff changeset
124 :type 'boolean
108100aa1991 (change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19904
diff changeset
125 :group 'change-log)
108100aa1991 (change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19904
diff changeset
126
40315
e41eca24ba8c (add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents: 39625
diff changeset
127 (defcustom add-log-always-start-new-record nil
e41eca24ba8c (add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents: 39625
diff changeset
128 "*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
129 :version "22.1"
40315
e41eca24ba8c (add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents: 39625
diff changeset
130 :type 'boolean
e41eca24ba8c (add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents: 39625
diff changeset
131 :group 'change-log)
e41eca24ba8c (add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents: 39625
diff changeset
132
32011
534b5a76bf8a (find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31813
diff changeset
133 (defcustom add-log-buffer-file-name-function nil
534b5a76bf8a (find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31813
diff changeset
134 "*If non-nil, function to call to identify the full filename of a buffer.
534b5a76bf8a (find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31813
diff changeset
135 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
136 use `buffer-file-name'."
35936
61d0887bbd4e (add-log-current-defun-function)
Dave Love <fx@gnu.org>
parents: 34576
diff changeset
137 :type '(choice (const nil) function)
32011
534b5a76bf8a (find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31813
diff changeset
138 :group 'change-log)
534b5a76bf8a (find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31813
diff changeset
139
24289
7917ac967ee5 (add-log-file-name-function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 23215
diff changeset
140 (defcustom add-log-file-name-function nil
7917ac967ee5 (add-log-file-name-function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 23215
diff changeset
141 "*If non-nil, function to call to identify the filename for a ChangeLog entry.
27240
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
142 This function is called with one argument, the value of variable
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
143 `buffer-file-name' in that buffer. If this is nil, the default is to
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
144 use the file's name relative to the directory of the change log file."
35936
61d0887bbd4e (add-log-current-defun-function)
Dave Love <fx@gnu.org>
parents: 34576
diff changeset
145 :type '(choice (const nil) function)
24289
7917ac967ee5 (add-log-file-name-function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 23215
diff changeset
146 :group 'change-log)
7917ac967ee5 (add-log-file-name-function): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 23215
diff changeset
147
27003
f6f431fc901b (change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents: 26618
diff changeset
148
f6f431fc901b (change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents: 26618
diff changeset
149 (defcustom change-log-version-info-enabled nil
f6f431fc901b (change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents: 26618
diff changeset
150 "*If non-nil, enable recording version numbers with the changes."
f6f431fc901b (change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents: 26618
diff changeset
151 :version "21.1"
f6f431fc901b (change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents: 26618
diff changeset
152 :type 'boolean
f6f431fc901b (change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents: 26618
diff changeset
153 :group 'change-log)
f6f431fc901b (change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents: 26618
diff changeset
154
f6f431fc901b (change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents: 26618
diff changeset
155 (defcustom change-log-version-number-regexp-list
f6f431fc901b (change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents: 26618
diff changeset
156 (let ((re "\\([0-9]+\.[0-9.]+\\)"))
f6f431fc901b (change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents: 26618
diff changeset
157 (list
f6f431fc901b (change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents: 26618
diff changeset
158 ;; (defconst ad-version "2.15"
f6f431fc901b (change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents: 26618
diff changeset
159 (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
160 ;; Revision: pcl-cvs.el,v 1.72 1999/09/05 20:21:54 monnier Exp
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
161 (concat "^;+ *Revision: +[^ \t\n]+[ \t]+" re)))
27003
f6f431fc901b (change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents: 26618
diff changeset
162 "*List of regexps to search for version number.
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
163 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
164 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
165 :version "21.1"
f6f431fc901b (change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents: 26618
diff changeset
166 :type '(repeat regexp)
f6f431fc901b (change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents: 26618
diff changeset
167 :group 'change-log)
f6f431fc901b (change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents: 26618
diff changeset
168
63195
d4857c25a45b Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents: 62877
diff changeset
169 (defface change-log-date
31813
b7491dcc3530 (change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents: 31794
diff changeset
170 '((t (:inherit font-lock-string-face)))
b7491dcc3530 (change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents: 31794
diff changeset
171 "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
172 :version "21.1"
b7491dcc3530 (change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents: 31794
diff changeset
173 :group 'change-log)
63195
d4857c25a45b Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents: 62877
diff changeset
174 ;; backward-compatibility alias
d4857c25a45b Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents: 62877
diff changeset
175 (put 'change-log-date-face 'face-alias 'change-log-date)
31813
b7491dcc3530 (change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents: 31794
diff changeset
176
63195
d4857c25a45b Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents: 62877
diff changeset
177 (defface change-log-name
31813
b7491dcc3530 (change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents: 31794
diff changeset
178 '((t (:inherit font-lock-constant-face)))
b7491dcc3530 (change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents: 31794
diff changeset
179 "Face for highlighting author names."
b7491dcc3530 (change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents: 31794
diff changeset
180 :version "21.1"
b7491dcc3530 (change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents: 31794
diff changeset
181 :group 'change-log)
63195
d4857c25a45b Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents: 62877
diff changeset
182 ;; backward-compatibility alias
d4857c25a45b Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents: 62877
diff changeset
183 (put 'change-log-name-face 'face-alias 'change-log-name)
31813
b7491dcc3530 (change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents: 31794
diff changeset
184
63195
d4857c25a45b Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents: 62877
diff changeset
185 (defface change-log-email
31813
b7491dcc3530 (change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents: 31794
diff changeset
186 '((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
187 "Face for highlighting author email addresses."
b7491dcc3530 (change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents: 31794
diff changeset
188 :version "21.1"
b7491dcc3530 (change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents: 31794
diff changeset
189 :group 'change-log)
63195
d4857c25a45b Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents: 62877
diff changeset
190 ;; backward-compatibility alias
d4857c25a45b Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents: 62877
diff changeset
191 (put 'change-log-email-face 'face-alias 'change-log-email)
31813
b7491dcc3530 (change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents: 31794
diff changeset
192
63195
d4857c25a45b Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents: 62877
diff changeset
193 (defface change-log-file
31813
b7491dcc3530 (change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents: 31794
diff changeset
194 '((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
195 "Face for highlighting file names."
b7491dcc3530 (change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents: 31794
diff changeset
196 :version "21.1"
b7491dcc3530 (change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents: 31794
diff changeset
197 :group 'change-log)
63195
d4857c25a45b Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents: 62877
diff changeset
198 ;; backward-compatibility alias
d4857c25a45b Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents: 62877
diff changeset
199 (put 'change-log-file-face 'face-alias 'change-log-file)
31813
b7491dcc3530 (change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents: 31794
diff changeset
200
63195
d4857c25a45b Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents: 62877
diff changeset
201 (defface change-log-list
31813
b7491dcc3530 (change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents: 31794
diff changeset
202 '((t (:inherit font-lock-keyword-face)))
b7491dcc3530 (change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents: 31794
diff changeset
203 "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
204 :version "21.1"
b7491dcc3530 (change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents: 31794
diff changeset
205 :group 'change-log)
63195
d4857c25a45b Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents: 62877
diff changeset
206 ;; backward-compatibility alias
d4857c25a45b Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents: 62877
diff changeset
207 (put 'change-log-list-face 'face-alias 'change-log-list)
40315
e41eca24ba8c (add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents: 39625
diff changeset
208
63195
d4857c25a45b Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents: 62877
diff changeset
209 (defface change-log-conditionals
31813
b7491dcc3530 (change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents: 31794
diff changeset
210 '((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
211 "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
212 :version "21.1"
b7491dcc3530 (change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents: 31794
diff changeset
213 :group 'change-log)
63195
d4857c25a45b Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents: 62877
diff changeset
214 ;; backward-compatibility alias
d4857c25a45b Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents: 62877
diff changeset
215 (put 'change-log-conditionals-face 'face-alias 'change-log-conditionals)
31813
b7491dcc3530 (change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents: 31794
diff changeset
216
63195
d4857c25a45b Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents: 62877
diff changeset
217 (defface change-log-function
31813
b7491dcc3530 (change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents: 31794
diff changeset
218 '((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
219 "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
220 :version "21.1"
b7491dcc3530 (change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents: 31794
diff changeset
221 :group 'change-log)
63195
d4857c25a45b Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents: 62877
diff changeset
222 ;; backward-compatibility alias
d4857c25a45b Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents: 62877
diff changeset
223 (put 'change-log-function-face 'face-alias 'change-log-function)
31813
b7491dcc3530 (change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents: 31794
diff changeset
224
63195
d4857c25a45b Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents: 62877
diff changeset
225 (defface change-log-acknowledgement
31813
b7491dcc3530 (change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents: 31794
diff changeset
226 '((t (:inherit font-lock-comment-face)))
b7491dcc3530 (change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents: 31794
diff changeset
227 "Face for highlighting acknowledgments."
b7491dcc3530 (change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents: 31794
diff changeset
228 :version "21.1"
b7491dcc3530 (change-log-date-face, change-log-name-face)
Gerd Moellmann <gerd@gnu.org>
parents: 31794
diff changeset
229 :group 'change-log)
63195
d4857c25a45b Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents: 62877
diff changeset
230 ;; backward-compatibility alias
d4857c25a45b Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents: 62877
diff changeset
231 (put 'change-log-acknowledgement-face 'face-alias 'change-log-acknowledgement)
27003
f6f431fc901b (change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents: 26618
diff changeset
232
9377
45228a0f6b78 (change-log-mode): Set font-lock-keywords locally.
Richard M. Stallman <rms@gnu.org>
parents: 9347
diff changeset
233 (defvar change-log-font-lock-keywords
16450
82b0566ece27 Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents: 16035
diff changeset
234 '(;;
63668
a7098c7b8f0f (change-log-font-lock-keywords): Make the regexp for
Kenichi Handa <handa@m17n.org>
parents: 63195
diff changeset
235 ;; 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
236 ;; 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
237 ;; 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
238 ;; 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
239 ;; work if a user customizes add-log-time-format.
a7098c7b8f0f (change-log-font-lock-keywords): Make the regexp for
Kenichi Handa <handa@m17n.org>
parents: 63195
diff changeset
240 ("^[0-9-]+ +\\|^\\(Sun\\|Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\) [A-z][a-z][a-z] [0-9:+ ]+"
a7098c7b8f0f (change-log-font-lock-keywords): Make the regexp for
Kenichi Handa <handa@m17n.org>
parents: 63195
diff changeset
241 (0 'change-log-date-face)
23215
c06f07cf6bba (change-log-font-lock-keywords): Do parenthesized
Dave Love <fx@gnu.org>
parents: 22388
diff changeset
242 ;; 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
243 ("\\([^<(]+?\\)[ \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
244 (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
245 (2 'change-log-email)))
16450
82b0566ece27 Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents: 16035
diff changeset
246 ;;
82b0566ece27 Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents: 16035
diff changeset
247 ;; File names.
61342
2a3ffd4954e2 (change-log-font-lock-keywords): Complete 2005-04-03 change.
Lute Kamstra <lute@gnu.org>
parents: 61265
diff changeset
248 ("^\\( +\\|\t\\)\\* \\([^ ,:([\n]+\\)"
63195
d4857c25a45b Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents: 62877
diff changeset
249 (2 'change-log-file)
23215
c06f07cf6bba (change-log-font-lock-keywords): Do parenthesized
Dave Love <fx@gnu.org>
parents: 22388
diff changeset
250 ;; 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
251 ("\\=, \\([^ ,:([\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
252 ;; 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
253 ("\\= (\\([^(),\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
254 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
255 ("\\=, *\\([^(),\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
256 nil nil (1 'change-log-list)))
16450
82b0566ece27 Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents: 16035
diff changeset
257 ;;
82b0566ece27 Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents: 16035
diff changeset
258 ;; 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
259 ("^\\( +\\|\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
260 (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
261 ("\\=, *\\([^(),\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
262 (1 'change-log-list)))
16450
82b0566ece27 Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents: 16035
diff changeset
263 ;;
82b0566ece27 Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents: 16035
diff changeset
264 ;; Conditionals.
63195
d4857c25a45b Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Miles Bader <miles@gnu.org>
parents: 62877
diff changeset
265 ("\\[!?\\([^]\n]+\\)\\]\\(:\\| (\\)" (1 'change-log-conditionals))
16450
82b0566ece27 Tweak change-log-font-lock-keywords
Simon Marshall <simon@gnu.org>
parents: 16035
diff changeset
266 ;;
29329
5b85d9e700da (change-log-font-lock-keywords) <function>: Add
Dave Love <fx@gnu.org>
parents: 29243
diff changeset
267 ;; 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
268 ("<\\([^>\n]+\\)>\\(:\\| (\\)" (1 'change-log-function))
29329
5b85d9e700da (change-log-font-lock-keywords) <function>: Add
Dave Love <fx@gnu.org>
parents: 29243
diff changeset
269 ;;
19439
854e48d82a01 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 19325
diff changeset
270 ;; Acknowledgements.
59355
448dec90812c (change-log-font-lock-keywords): Don't match just "From".
Richard M. Stallman <rms@gnu.org>
parents: 58737
diff changeset
271 ;; 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
272 ;; we want to encourage people to say something more specific.
62255
14a8632a734e Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 62251
diff changeset
273 ;; Note that the FSF does not use "Patches by"; our convention
14a8632a734e Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 62251
diff changeset
274 ;; is to put the name of the author of the changes at the top
14a8632a734e Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 62251
diff changeset
275 ;; 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
276 ("\\(^\\( +\\|\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
277 3 'change-log-acknowledgement))
9377
45228a0f6b78 (change-log-mode): Set font-lock-keywords locally.
Richard M. Stallman <rms@gnu.org>
parents: 9347
diff changeset
278 "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
279
51580
d9592ff1371e (add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50641
diff changeset
280 (defvar change-log-mode-map
d9592ff1371e (add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50641
diff changeset
281 (let ((map (make-sparse-keymap)))
d9592ff1371e (add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50641
diff changeset
282 (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
283 (define-key map [?\C-c ?\C-n] '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
284 map)
15889
ca8f142ef5d2 [fixing previous change]
Karl Heuer <kwzh@gnu.org>
parents: 15887
diff changeset
285 "Keymap for Change Log major mode.")
ca8f142ef5d2 [fixing previous change]
Karl Heuer <kwzh@gnu.org>
parents: 15887
diff changeset
286
15909
088510eef043 Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents: 15889
diff changeset
287 (defvar change-log-time-zone-rule nil
088510eef043 Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents: 15889
diff changeset
288 "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
289 It takes the same format as the TZ argument of `set-time-zone-rule'.
088510eef043 Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents: 15889
diff changeset
290 If nil, use local time.")
088510eef043 Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents: 15889
diff changeset
291
18277
7509948b0121 (add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17923
diff changeset
292 (defun add-log-iso8601-time-zone (time)
15909
088510eef043 Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents: 15889
diff changeset
293 (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
294 (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
295 (sec (abs utc-offset))
088510eef043 Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents: 15889
diff changeset
296 (ss (% sec 60))
088510eef043 Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents: 15889
diff changeset
297 (min (/ sec 60))
088510eef043 Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents: 15889
diff changeset
298 (mm (% min 60))
088510eef043 Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents: 15889
diff changeset
299 (hh (/ min 60)))
088510eef043 Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents: 15889
diff changeset
300 (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
301 ((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
302 (t "%c%02d"))
088510eef043 Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents: 15889
diff changeset
303 sign hh mm ss)))
088510eef043 Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents: 15889
diff changeset
304
18277
7509948b0121 (add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17923
diff changeset
305 (defun add-log-iso8601-time-string ()
7509948b0121 (add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17923
diff changeset
306 (if change-log-time-zone-rule
7509948b0121 (add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17923
diff changeset
307 (let ((tz (getenv "TZ"))
7509948b0121 (add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17923
diff changeset
308 (now (current-time)))
7509948b0121 (add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17923
diff changeset
309 (unwind-protect
7509948b0121 (add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17923
diff changeset
310 (progn
30809
3aa7c156087a (change-log-merge): Doc fix.
Dave Love <fx@gnu.org>
parents: 29329
diff changeset
311 (set-time-zone-rule change-log-time-zone-rule)
18277
7509948b0121 (add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17923
diff changeset
312 (concat
7509948b0121 (add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17923
diff changeset
313 (format-time-string "%Y-%m-%d " now)
7509948b0121 (add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17923
diff changeset
314 (add-log-iso8601-time-zone now)))
7509948b0121 (add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17923
diff changeset
315 (set-time-zone-rule tz)))
7509948b0121 (add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17923
diff changeset
316 (format-time-string "%Y-%m-%d")))
7509948b0121 (add-log-time-format): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17923
diff changeset
317
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
318 (defun change-log-name ()
27240
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
319 "Return (system-dependent) default name for a change log file."
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
320 (or change-log-default-name
19477
a9629283bc4c (change-log-font-lock-keywords): Recognize "Patch by".
Richard M. Stallman <rms@gnu.org>
parents: 19439
diff changeset
321 (if (eq system-type 'vax-vms)
16035
9d8b374b5bb1 (change-log-name): Don't treat MSDOS, NT specially.
Richard M. Stallman <rms@gnu.org>
parents: 15909
diff changeset
322 "$CHANGE_LOG$.TXT"
9d8b374b5bb1 (change-log-name): Don't treat MSDOS, NT specially.
Richard M. Stallman <rms@gnu.org>
parents: 15909
diff changeset
323 "ChangeLog")))
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
324
51580
d9592ff1371e (add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50641
diff changeset
325 (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
326 "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
327 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
328 (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
329 (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
330 (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
331 (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
332 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
333 (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
334 (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
335 (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
336 (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
337 (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
338 (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
339 (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
340 (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
341 (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
342 (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
343
d9592ff1371e (add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50641
diff changeset
344 (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
345 "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
346 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
347 (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
348 (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
349
4157
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
350 ;;;###autoload
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
351 (defun prompt-for-change-log-name ()
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
352 "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
353 (let* ((default (change-log-name))
f4a8265756e7 (prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents: 11816
diff changeset
354 (name (expand-file-name
f4a8265756e7 (prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents: 11816
diff changeset
355 (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
356 nil default))))
f4a8265756e7 (prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents: 11816
diff changeset
357 ;; 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
358 ;; 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
359 (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
360 (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
361 name)
f4a8265756e7 (prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents: 11816
diff changeset
362 ;; 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
363 (if (file-directory-p name)
f4a8265756e7 (prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents: 11816
diff changeset
364 (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
365 (file-name-as-directory name))
f4a8265756e7 (prompt-for-change-log-name): Handle the case where
Karl Heuer <kwzh@gnu.org>
parents: 11816
diff changeset
366 name))))
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
367
27003
f6f431fc901b (change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents: 26618
diff changeset
368 (defun change-log-version-number-search ()
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
369 "Return version number of current buffer's file.
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
370 This is the value returned by `vc-workfile-version' or, if that is
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
371 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
372 (let* ((size (buffer-size))
50575
caadcafadb0c (change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49308
diff changeset
373 (limit
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
374 ;; The version number can be anywhere in the file, but
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
375 ;; restrict search to the file beginning: 10% should be
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
376 ;; enough to prevent some mishits.
27003
f6f431fc901b (change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents: 26618
diff changeset
377 ;;
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
378 ;; Apply percentage only if buffer size is bigger than
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
379 ;; approx 100 lines.
50575
caadcafadb0c (change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49308
diff changeset
380 (if (> size (* 100 80)) (+ (point) (/ size 10)))))
32011
534b5a76bf8a (find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31813
diff changeset
381 (or (and buffer-file-name (vc-workfile-version buffer-file-name))
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
382 (save-restriction
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
383 (widen)
50575
caadcafadb0c (change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49308
diff changeset
384 (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
385 version)
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
386 (while regexps
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
387 (save-excursion
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
388 (goto-char (point-min))
50575
caadcafadb0c (change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49308
diff changeset
389 (when (re-search-forward (pop regexps) limit t)
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
390 (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
391 regexps nil))))
caadcafadb0c (change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49308
diff changeset
392 version)))))
27003
f6f431fc901b (change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents: 26618
diff changeset
393
f6f431fc901b (change-log-version-number-regexp-list)
Gerd Moellmann <gerd@gnu.org>
parents: 26618
diff changeset
394
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
395 ;;;###autoload
32011
534b5a76bf8a (find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31813
diff changeset
396 (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
397 "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
398
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
399 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
400 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
401 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
402 \(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
403
62251
5c40be16225d (find-change-log): Fix typos in the docstring of function.
Masatake YAMATO <jet@gyve.org>
parents: 61342
diff changeset
404 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
405 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
406 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
407
d3c9f0ad5964 (find-change-log): New function.
Roland McGrath <roland@gnu.org>
parents: 2307
diff changeset
408 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
409 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
410 Optional arg BUFFER-FILE overrides `buffer-file-name'."
8042
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
411 ;; If user specified a file name or if this buffer knows which one to use,
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
412 ;; just use that.
2463
d3c9f0ad5964 (find-change-log): New function.
Roland McGrath <roland@gnu.org>
parents: 2307
diff changeset
413 (or file-name
9886
f54af6fe889e (find-change-log): If change-log-default-name
Richard M. Stallman <rms@gnu.org>
parents: 9774
diff changeset
414 (setq file-name (and change-log-default-name
f54af6fe889e (find-change-log): If change-log-default-name
Richard M. Stallman <rms@gnu.org>
parents: 9774
diff changeset
415 (file-name-directory change-log-default-name)
f54af6fe889e (find-change-log): If change-log-default-name
Richard M. Stallman <rms@gnu.org>
parents: 9774
diff changeset
416 change-log-default-name))
8042
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
417 (progn
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
418 ;; Chase links in the source file
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
419 ;; and use the change log in the dir where it points.
32011
534b5a76bf8a (find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31813
diff changeset
420 (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
421 (file-name-directory
32011
534b5a76bf8a (find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31813
diff changeset
422 (file-chase-links
534b5a76bf8a (find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31813
diff changeset
423 (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
424 default-directory))
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
425 (if (file-directory-p file-name)
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
426 (setq file-name (expand-file-name (change-log-name) file-name)))
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
427 ;; Chase links before visiting the file.
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
428 ;; This makes it easier to use a single change log file
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
429 ;; for several related directories.
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
430 (setq file-name (file-chase-links file-name))
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
431 (setq file-name (expand-file-name file-name))
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
432 ;; Move up in the dir hierarchy till we find a change log file.
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
433 (let ((file1 file-name)
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
434 parent-dir)
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
435 (while (and (not (or (get-file-buffer file1) (file-exists-p file1)))
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
436 (progn (setq parent-dir
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
437 (file-name-directory
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
438 (directory-file-name
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
439 (file-name-directory file1))))
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
440 ;; Give up if we are already at the root dir.
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
441 (not (string= (file-name-directory file1)
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
442 parent-dir))))
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
443 ;; Move up to the parent dir and try again.
19477
a9629283bc4c (change-log-font-lock-keywords): Recognize "Patch by".
Richard M. Stallman <rms@gnu.org>
parents: 19439
diff changeset
444 (setq file1 (expand-file-name
8042
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
445 (file-name-nondirectory (change-log-name))
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
446 parent-dir)))
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
447 ;; If we found a change log in a parent, use that.
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
448 (if (or (get-file-buffer file1) (file-exists-p file1))
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
449 (setq file-name file1)))))
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
450 ;; Make a local variable in this buffer so we needn't search again.
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
451 (set (make-local-variable 'change-log-default-name) file-name)
0495d3085f00 (find-change-log): If file name specified, just use it.
Richard M. Stallman <rms@gnu.org>
parents: 6562
diff changeset
452 file-name)
2463
d3c9f0ad5964 (find-change-log): New function.
Roland McGrath <roland@gnu.org>
parents: 2307
diff changeset
453
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
454 (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
455 ;; 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
456 (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
457 (if add-log-file-name-function
534b5a76bf8a (find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31813
diff changeset
458 (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
459 (setq buffer-file
534b5a76bf8a (find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31813
diff changeset
460 (if (string-match
534b5a76bf8a (find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31813
diff changeset
461 (concat "^" (regexp-quote (file-name-directory log-file)))
534b5a76bf8a (find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31813
diff changeset
462 buffer-file)
534b5a76bf8a (find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31813
diff changeset
463 (substring buffer-file (match-end 0))
534b5a76bf8a (find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31813
diff changeset
464 (file-name-nondirectory buffer-file)))
534b5a76bf8a (find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31813
diff changeset
465 ;; 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
466 ;; 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
467 ;; 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
468 (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
469 (file-name-sans-versions buffer-file)
534b5a76bf8a (find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31813
diff changeset
470 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
471
2463
d3c9f0ad5964 (find-change-log): New function.
Roland McGrath <roland@gnu.org>
parents: 2307
diff changeset
472 ;;;###autoload
4157
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
473 (defun add-change-log-entry (&optional whoami file-name other-window new-entry)
39625
e441240482b2 (add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents: 38697
diff changeset
474 "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
475 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
476 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
477
39625
e441240482b2 (add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents: 38697
diff changeset
478 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
479 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
480
4157
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
481 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
482
4157
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
483 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
484 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
485 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
486
40315
e41eca24ba8c (add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents: 39625
diff changeset
487 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
488 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
489 the same person.
e41eca24ba8c (add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents: 39625
diff changeset
490
39625
e441240482b2 (add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents: 38697
diff changeset
491 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
492 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
493 notices.
e441240482b2 (add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents: 38697
diff changeset
494
21629
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
495 Today's date is calculated according to `change-log-time-zone-rule' if
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
496 non-nil, otherwise in local time."
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
497 (interactive (list current-prefix-arg
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
498 (prompt-for-change-log-name)))
32011
534b5a76bf8a (find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31813
diff changeset
499 (let* ((defun (add-log-current-defun))
534b5a76bf8a (find-change-log): New arg BUFFER-FILE.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31813
diff changeset
500 (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
501 (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
502 (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
503 (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
504 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
505 (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
506 (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
507 ;; Set ITEM to the file name to use in the new item.
e441240482b2 (add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents: 38697
diff changeset
508 (item (add-log-file-name buffer-file file-name))
57752
d0dbcba62472 (add-change-log-entry): Set up mailing address and full name later,
Richard M. Stallman <rms@gnu.org>
parents: 56250
diff changeset
509 bound
d0dbcba62472 (add-change-log-entry): Set up mailing address and full name later,
Richard M. Stallman <rms@gnu.org>
parents: 56250
diff changeset
510 (full-name (or add-log-full-name (user-full-name)))
d0dbcba62472 (add-change-log-entry): Set up mailing address and full name later,
Richard M. Stallman <rms@gnu.org>
parents: 56250
diff changeset
511 (mailing-address (or add-log-mailing-address user-mail-address)))
d0dbcba62472 (add-change-log-entry): Set up mailing address and full name later,
Richard M. Stallman <rms@gnu.org>
parents: 56250
diff changeset
512
d0dbcba62472 (add-change-log-entry): Set up mailing address and full name later,
Richard M. Stallman <rms@gnu.org>
parents: 56250
diff changeset
513 (if whoami
d0dbcba62472 (add-change-log-entry): Set up mailing address and full name later,
Richard M. Stallman <rms@gnu.org>
parents: 56250
diff changeset
514 (progn
62458
2c228409c44d Replace `read-input' by `read-string'.
Juanma Barranquero <lekktu@gmail.com>
parents: 62255
diff changeset
515 (setq full-name (read-string "Full name: " full-name))
57752
d0dbcba62472 (add-change-log-entry): Set up mailing address and full name later,
Richard M. Stallman <rms@gnu.org>
parents: 56250
diff changeset
516 ;; Note that some sites have room and phone number fields in
d0dbcba62472 (add-change-log-entry): Set up mailing address and full name later,
Richard M. Stallman <rms@gnu.org>
parents: 56250
diff changeset
517 ;; full name which look silly when inserted. Rather than do
d0dbcba62472 (add-change-log-entry): Set up mailing address and full name later,
Richard M. Stallman <rms@gnu.org>
parents: 56250
diff changeset
518 ;; anything about that here, let user give prefix argument so that
d0dbcba62472 (add-change-log-entry): Set up mailing address and full name later,
Richard M. Stallman <rms@gnu.org>
parents: 56250
diff changeset
519 ;; s/he can edit the full name field in prompter if s/he wants.
d0dbcba62472 (add-change-log-entry): Set up mailing address and full name later,
Richard M. Stallman <rms@gnu.org>
parents: 56250
diff changeset
520 (setq mailing-address
62458
2c228409c44d Replace `read-input' by `read-string'.
Juanma Barranquero <lekktu@gmail.com>
parents: 62255
diff changeset
521 (read-string "Mailing address: " mailing-address))))
1727
d6cc12c97a59 (add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents: 1644
diff changeset
522
47828
4944e0ddf992 (add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46637
diff changeset
523 (unless (equal file-name buffer-file-name)
4944e0ddf992 (add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46637
diff changeset
524 (if (or other-window (window-dedicated-p (selected-window)))
4944e0ddf992 (add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46637
diff changeset
525 (find-file-other-window file-name)
4944e0ddf992 (add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46637
diff changeset
526 (find-file file-name)))
5150
60fa14264c3b (add-change-log-entry): put buffer in change-log-mode.
Richard M. Stallman <rms@gnu.org>
parents: 5038
diff changeset
527 (or (eq major-mode 'change-log-mode)
60fa14264c3b (add-change-log-entry): put buffer in change-log-mode.
Richard M. Stallman <rms@gnu.org>
parents: 5038
diff changeset
528 (change-log-mode))
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
529 (undo-boundary)
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
530 (goto-char (point-min))
39625
e441240482b2 (add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents: 38697
diff changeset
531
e441240482b2 (add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents: 38697
diff changeset
532 ;; If file starts with a copyright and permission notice, skip them.
e441240482b2 (add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents: 38697
diff changeset
533 ;; Assume they end at first blank line.
e441240482b2 (add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents: 38697
diff changeset
534 (when (looking-at "Copyright")
e441240482b2 (add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents: 38697
diff changeset
535 (search-forward "\n\n")
e441240482b2 (add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents: 38697
diff changeset
536 (skip-chars-forward "\n"))
e441240482b2 (add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents: 38697
diff changeset
537
e441240482b2 (add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents: 38697
diff changeset
538 ;; Advance into first entry if it is usable; else make new one.
45267
c9022ab03c89 (add-log-mailing-address): Can be a list, too.
Colin Walters <walters@gnu.org>
parents: 45255
diff changeset
539 (let ((new-entries (mapcar (lambda (addr)
c9022ab03c89 (add-log-mailing-address): Can be a list, too.
Colin Walters <walters@gnu.org>
parents: 45255
diff changeset
540 (concat (funcall add-log-time-format)
57752
d0dbcba62472 (add-change-log-entry): Set up mailing address and full name later,
Richard M. Stallman <rms@gnu.org>
parents: 56250
diff changeset
541 " " full-name
45267
c9022ab03c89 (add-log-mailing-address): Can be a list, too.
Colin Walters <walters@gnu.org>
parents: 45255
diff changeset
542 " <" addr ">"))
57752
d0dbcba62472 (add-change-log-entry): Set up mailing address and full name later,
Richard M. Stallman <rms@gnu.org>
parents: 56250
diff changeset
543 (if (consp mailing-address)
d0dbcba62472 (add-change-log-entry): Set up mailing address and full name later,
Richard M. Stallman <rms@gnu.org>
parents: 56250
diff changeset
544 mailing-address
d0dbcba62472 (add-change-log-entry): Set up mailing address and full name later,
Richard M. Stallman <rms@gnu.org>
parents: 56250
diff changeset
545 (list mailing-address)))))
40315
e41eca24ba8c (add-log-always-start-new-record): New user option.
Sam Steingold <sds@gnu.org>
parents: 39625
diff changeset
546 (if (and (not add-log-always-start-new-record)
45267
c9022ab03c89 (add-log-mailing-address): Can be a list, too.
Colin Walters <walters@gnu.org>
parents: 45255
diff changeset
547 (let ((hit nil))
c9022ab03c89 (add-log-mailing-address): Can be a list, too.
Colin Walters <walters@gnu.org>
parents: 45255
diff changeset
548 (dolist (entry new-entries hit)
c9022ab03c89 (add-log-mailing-address): Can be a list, too.
Colin Walters <walters@gnu.org>
parents: 45255
diff changeset
549 (when (looking-at (regexp-quote entry))
c9022ab03c89 (add-log-mailing-address): Can be a list, too.
Colin Walters <walters@gnu.org>
parents: 45255
diff changeset
550 (setq hit t)))))
15909
088510eef043 Change to ISO 8601 date formats, without time of day.
Erik Naggum <erik@naggum.no>
parents: 15889
diff changeset
551 (forward-line 1)
45267
c9022ab03c89 (add-log-mailing-address): Can be a list, too.
Colin Walters <walters@gnu.org>
parents: 45255
diff changeset
552 (insert (nth (random (length new-entries))
c9022ab03c89 (add-log-mailing-address): Can be a list, too.
Colin Walters <walters@gnu.org>
parents: 45255
diff changeset
553 new-entries)
c9022ab03c89 (add-log-mailing-address): Can be a list, too.
Colin Walters <walters@gnu.org>
parents: 45255
diff changeset
554 "\n\n")
39625
e441240482b2 (add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents: 38697
diff changeset
555 (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
556
39625
e441240482b2 (add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents: 38697
diff changeset
557 ;; 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
558 ;; item to add to, within this entry.
21629
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
559 (setq bound
39625
e441240482b2 (add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents: 38697
diff changeset
560 (save-excursion
21629
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
561 (if (looking-at "\n*[^\n* \t]")
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
562 (skip-chars-forward "\n")
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
563 (if add-log-keep-changes-together
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
564 (forward-page) ; page delimits entries for date
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
565 (forward-paragraph))) ; paragraph delimits entries for file
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
566 (point)))
39625
e441240482b2 (add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents: 38697
diff changeset
567
e441240482b2 (add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents: 38697
diff changeset
568 ;; Now insert the new line for this item.
21629
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
569 (cond ((re-search-forward "^\\s *\\*\\s *$" bound t)
39625
e441240482b2 (add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents: 38697
diff changeset
570 ;; Put this file name into the existing empty item.
e441240482b2 (add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents: 38697
diff changeset
571 (if item
e441240482b2 (add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents: 38697
diff changeset
572 (insert item)))
4157
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
573 ((and (not new-entry)
12551
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
574 (let (case-fold-search)
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
575 (re-search-forward
39625
e441240482b2 (add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents: 38697
diff changeset
576 (concat (regexp-quote (concat "* " item))
12551
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
577 ;; Don't accept `foo.bar' when
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
578 ;; looking for `foo':
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
579 "\\(\\s \\|[(),:]\\)")
21629
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
580 bound t)))
39625
e441240482b2 (add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents: 38697
diff changeset
581 ;; Add to the existing item for the same file.
1727
d6cc12c97a59 (add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents: 1644
diff changeset
582 (re-search-forward "^\\s *$\\|^\\s \\*")
12551
572a8ef6b1f4 (add-log-current-defun): Handle C struct definitions.
Karl Heuer <kwzh@gnu.org>
parents: 12157
diff changeset
583 (goto-char (match-beginning 0))
21629
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
584 ;; Delete excess empty lines; make just 2.
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
585 (while (and (not (eobp)) (looking-at "^\\s *$"))
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
586 (delete-region (point) (line-beginning-position 2)))
30809
3aa7c156087a (change-log-merge): Doc fix.
Dave Love <fx@gnu.org>
parents: 29329
diff changeset
587 (insert-char ?\n 2)
21629
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
588 (forward-line -2)
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
589 (indent-relative-maybe))
666
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
590 (t
39625
e441240482b2 (add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents: 38697
diff changeset
591 ;; Make a new item.
678
8cff3b3bd089 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 666
diff changeset
592 (while (looking-at "\\sW")
8cff3b3bd089 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 666
diff changeset
593 (forward-line 1))
912
1c37c99856de *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
594 (while (and (not (eobp)) (looking-at "^\\s *$"))
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
595 (delete-region (point) (line-beginning-position 2)))
30809
3aa7c156087a (change-log-merge): Doc fix.
Dave Love <fx@gnu.org>
parents: 29329
diff changeset
596 (insert-char ?\n 3)
837
a8aef92e0025 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 811
diff changeset
597 (forward-line -2)
678
8cff3b3bd089 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 666
diff changeset
598 (indent-to left-margin)
30809
3aa7c156087a (change-log-merge): Doc fix.
Dave Love <fx@gnu.org>
parents: 29329
diff changeset
599 (insert "* ")
39625
e441240482b2 (add-change-log-entry): Skip copyright notice
Richard M. Stallman <rms@gnu.org>
parents: 38697
diff changeset
600 (if item (insert item))))
837
a8aef92e0025 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 811
diff changeset
601 ;; 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
602 ;; Point is at the item for this file,
666
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
603 ;; 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
604 (if (not defun)
0e6cefe9e2d0 (add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48615
diff changeset
605 ;; 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
606 (unless (save-excursion
0e6cefe9e2d0 (add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48615
diff changeset
607 (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
608 (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
609 (insert ": ")
63998
7651543ac34c (change-log): Finish `defgroup' description with period.
Juanma Barranquero <lekktu@gmail.com>
parents: 63668
diff changeset
610 (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
611 ;; 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
612 (undo-boundary)
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
613 (unless (save-excursion
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
614 (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
615 (looking-at "\\s *$"))
63998
7651543ac34c (change-log): Finish `defgroup' description with period.
Juanma Barranquero <lekktu@gmail.com>
parents: 63668
diff changeset
616 (insert ?\s))
49308
0e6cefe9e2d0 (add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48615
diff changeset
617 ;; 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
618 ;; 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
619 (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
620 (skip-syntax-backward " ")
0e6cefe9e2d0 (add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48615
diff changeset
621 (skip-chars-backward "):")
0e6cefe9e2d0 (add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48615
diff changeset
622 (if (and (looking-at "):")
50575
caadcafadb0c (change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49308
diff changeset
623 (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
624 (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
625 (delete-region pos (point)))
caadcafadb0c (change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49308
diff changeset
626 (> 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
627 (progn (skip-chars-backward ", ")
caadcafadb0c (change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49308
diff changeset
628 (delete-region (point) pos)
caadcafadb0c (change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49308
diff changeset
629 (unless (memq (char-before) '(?\()) (insert ", ")))
49308
0e6cefe9e2d0 (add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48615
diff changeset
630 (if (looking-at "):")
0e6cefe9e2d0 (add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48615
diff changeset
631 (delete-region (+ 1 (point)) (line-end-position)))
0e6cefe9e2d0 (add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48615
diff changeset
632 (goto-char pos)
0e6cefe9e2d0 (add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48615
diff changeset
633 (insert "("))
0e6cefe9e2d0 (add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48615
diff changeset
634 (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
635 (insert defun "): ")
63998
7651543ac34c (change-log): Finish `defgroup' description with period.
Juanma Barranquero <lekktu@gmail.com>
parents: 63668
diff changeset
636 (if version (insert version ?\s)))))
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
637
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
638 ;;;###autoload
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
639 (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
640 "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
641 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
642 the change log file in another window."
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
643 (interactive (if current-prefix-arg
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
644 (list current-prefix-arg
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
645 (prompt-for-change-log-name))))
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
646 (add-change-log-entry whoami file-name t))
1727
d6cc12c97a59 (add-change-log-entry): Notice when ENTRY is equal to FILE-NAME,
Roland McGrath <roland@gnu.org>
parents: 1644
diff changeset
647 ;;;###autoload (define-key ctl-x-4-map "a" 'add-change-log-entry-other-window)
661
36fbc3f71803 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
648
50575
caadcafadb0c (change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49308
diff changeset
649 (defvar add-log-indent-text 0)
caadcafadb0c (change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49308
diff changeset
650
caadcafadb0c (change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49308
diff changeset
651 (defun add-log-indent ()
caadcafadb0c (change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49308
diff changeset
652 (let* ((indent
caadcafadb0c (change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49308
diff changeset
653 (save-excursion
caadcafadb0c (change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49308
diff changeset
654 (beginning-of-line)
caadcafadb0c (change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49308
diff changeset
655 (skip-chars-forward " \t")
caadcafadb0c (change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49308
diff changeset
656 (cond
caadcafadb0c (change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49308
diff changeset
657 ((and (looking-at "\\(.*\\) [^ \n].*[^ \n] <.*>$")
caadcafadb0c (change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49308
diff changeset
658 ;; 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
659 ;; 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
660 (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
661 0)
caadcafadb0c (change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49308
diff changeset
662 ((looking-at "[^*(]")
caadcafadb0c (change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49308
diff changeset
663 (+ (current-left-margin) add-log-indent-text))
caadcafadb0c (change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49308
diff changeset
664 (t (current-left-margin)))))
caadcafadb0c (change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49308
diff changeset
665 (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
666 (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
667
caadcafadb0c (change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49308
diff changeset
668
51580
d9592ff1371e (add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50641
diff changeset
669 (defvar smerge-resolve-function)
d9592ff1371e (add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50641
diff changeset
670
980
b62886fbf2a7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 953
diff changeset
671 ;;;###autoload
47828
4944e0ddf992 (add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46637
diff changeset
672 (define-derived-mode change-log-mode text-mode "Change Log"
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 3499
diff changeset
673 "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
674 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
675 New log entries are usually made with \\[add-change-log-entry] or \\[add-change-log-entry-other-window].
951
c23539669808 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 947
diff changeset
676 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
677 Runs `change-log-mode-hook'.
d9592ff1371e (add-log-edit-prev-comment, add-log-edit-next-comment): New commands.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50641
diff changeset
678 \\{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
679 (setq left-margin 8
13706
ba34746d66fd (change-log-mode): Defaults for `indent-tabs-mode'
Karl Heuer <kwzh@gnu.org>
parents: 13648
diff changeset
680 fill-column 74
15887
18c1dcf40139 (change-log-mode): Set fill-paragraph-function.
Karl Heuer <kwzh@gnu.org>
parents: 15299
diff changeset
681 indent-tabs-mode t
18c1dcf40139 (change-log-mode): Set fill-paragraph-function.
Karl Heuer <kwzh@gnu.org>
parents: 15299
diff changeset
682 tab-width 8)
18c1dcf40139 (change-log-mode): Set fill-paragraph-function.
Karl Heuer <kwzh@gnu.org>
parents: 15299
diff changeset
683 (set (make-local-variable 'fill-paragraph-function)
18c1dcf40139 (change-log-mode): Set fill-paragraph-function.
Karl Heuer <kwzh@gnu.org>
parents: 15299
diff changeset
684 'change-log-fill-paragraph)
50575
caadcafadb0c (change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49308
diff changeset
685 (set (make-local-variable 'indent-line-function) 'add-log-indent)
caadcafadb0c (change-log-version-number-search): Fix old bug.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49308
diff changeset
686 (set (make-local-variable 'tab-always-indent) nil)
21719
c888284a54f7 (change-log-mode): Add `* ' to paragraph-start.
Dave Love <fx@gnu.org>
parents: 21629
diff changeset
687 ;; 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
688 ;; 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
689 ;; 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
690 ;; between entries for different files.
21749
84df514f7719 (change-log-mode): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents: 21719
diff changeset
691 (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
692 (set (make-local-variable 'paragraph-separate) paragraph-start)
1078
15b4ed20e524 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1062
diff changeset
693 ;; 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
694 ;; 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
695 (set (make-local-variable 'page-delimiter) "^\\<\\|^\f")
678
8cff3b3bd089 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 666
diff changeset
696 (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
697 (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
698 'change-log-resolve-conflict)
678
8cff3b3bd089 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 666
diff changeset
699 (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
700 (set (make-local-variable 'font-lock-defaults)
47828
4944e0ddf992 (add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46637
diff changeset
701 '(change-log-font-lock-keywords t nil nil backward-paragraph)))
666
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
702
4157
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
703 ;; It might be nice to have a general feature to replace this. The idea I
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
704 ;; have is a variable giving a regexp matching text which should not be
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
705 ;; moved from bol by filling. change-log-mode would set this to "^\\s *\\s(".
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
706 ;; But I don't feel up to implementing that today.
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
707 (defun change-log-fill-paragraph (&optional justify)
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
708 "Fill the paragraph, but preserve open parentheses at beginning of lines.
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
709 Prefix arg means justify as well."
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
710 (interactive "P")
16505
39efcea11aad (change-log-fill-paragraph): Return non-nil so
Richard M. Stallman <rms@gnu.org>
parents: 16450
diff changeset
711 (let ((end (progn (forward-paragraph) (point)))
39efcea11aad (change-log-fill-paragraph): Return non-nil so
Richard M. Stallman <rms@gnu.org>
parents: 16450
diff changeset
712 (beg (progn (backward-paragraph) (point)))
13505
86470b361571 (change-log-mode): Remove incorrect "^" anchors from
Richard M. Stallman <rms@gnu.org>
parents: 13282
diff changeset
713 (paragraph-start (concat paragraph-start "\\|\\s *\\s(")))
16505
39efcea11aad (change-log-fill-paragraph): Return non-nil so
Richard M. Stallman <rms@gnu.org>
parents: 16450
diff changeset
714 (fill-region beg end justify)
39efcea11aad (change-log-fill-paragraph): Return non-nil so
Richard M. Stallman <rms@gnu.org>
parents: 16450
diff changeset
715 t))
4157
d2316090d029 (prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log).
Roland McGrath <roland@gnu.org>
parents: 4154
diff changeset
716
17413
9fa0ed8da0b1 Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 16505
diff changeset
717 (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
718 "^\\([[:upper:]][[:upper:]_ ]*[[:upper:]_]\\|[-_[:alpha:]]+\\)[ \t]*[:=]"
17413
9fa0ed8da0b1 Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 16505
diff changeset
719 "*Heuristic regexp used by `add-log-current-defun' for unknown major modes."
9fa0ed8da0b1 Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 16505
diff changeset
720 :type 'regexp
9fa0ed8da0b1 Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 16505
diff changeset
721 :group 'change-log)
666
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
722
6562
0541a368505c (add-log-current-defun): Autoload this.
Roland McGrath <roland@gnu.org>
parents: 6309
diff changeset
723 ;;;###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
724 (defvar add-log-lisp-like-modes
21629
2da609ac7ab1 (change-log-mode): Revert 1997-12-03 doc change.
Dave Love <fx@gnu.org>
parents: 21009
diff changeset
725 '(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
726 "*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
727
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
728 ;;;###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
729 (defvar add-log-c-like-modes
653987823f79 (add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents: 17413
diff changeset
730 '(c-mode c++-mode c++-c-mode objc-mode)
653987823f79 (add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents: 17413
diff changeset
731 "*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
732
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
733 ;;;###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
734 (defvar add-log-tex-like-modes
653987823f79 (add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents: 17413
diff changeset
735 '(TeX-mode plain-TeX-mode LaTeX-mode plain-tex-mode latex-mode)
653987823f79 (add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents: 17413
diff changeset
736 "*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
737
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
738 ;;;###autoload
666
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
739 (defun add-log-current-defun ()
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
740 "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
741
3499
6428162f137c (add-log-current-defun): Fix typos in last change.
Richard M. Stallman <rms@gnu.org>
parents: 3486
diff changeset
742 Understands C, Lisp, LaTeX (\"functions\" are chapters, sections, ...),
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
743 Texinfo (@node titles) and Perl.
666
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
744
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
745 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
746 point for uppercase headings starting in the first column or
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
747 identifiers followed by `:' or `='. See variables
27277
9fdcfef41c64 (add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents: 27240
diff changeset
748 `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
749 `add-log-current-defun-function'.
666
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
750
7fa6b835da67 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 661
diff changeset
751 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
752 (condition-case nil
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
753 (save-excursion
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
754 (let ((location (point)))
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
755 (cond (add-log-current-defun-function
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
756 (funcall add-log-current-defun-function))
27277
9fdcfef41c64 (add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents: 27240
diff changeset
757 ((memq major-mode add-log-lisp-like-modes)
13086
1bc6075184d7 (add-log-current-defun): Ignore quotes before fcn name.
Richard M. Stallman <rms@gnu.org>
parents: 12551
diff changeset
758 ;; 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
759 ;; 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
760 ;; rather than the previous one.
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
761 (or (eobp) (forward-char 1))
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
762 (beginning-of-defun)
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
763 ;; Make sure we are really inside the defun found,
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
764 ;; not after it.
21944
8e606f5208eb (add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents: 21943
diff changeset
765 (when (and (looking-at "\\s(")
8e606f5208eb (add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents: 21943
diff changeset
766 (progn (end-of-defun)
8e606f5208eb (add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents: 21943
diff changeset
767 (< location (point)))
8e606f5208eb (add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents: 21943
diff changeset
768 (progn (forward-sexp -1)
8e606f5208eb (add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents: 21943
diff changeset
769 (>= location (point))))
8e606f5208eb (add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents: 21943
diff changeset
770 (if (looking-at "\\s(")
8e606f5208eb (add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents: 21943
diff changeset
771 (forward-char 1))
8e606f5208eb (add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents: 21943
diff changeset
772 ;; Skip the defining construct name, typically "defun"
8e606f5208eb (add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents: 21943
diff changeset
773 ;; or "defvar".
8e606f5208eb (add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents: 21943
diff changeset
774 (forward-sexp 1)
8e606f5208eb (add-log-current-defun) <lisp>:
Richard M. Stallman <rms@gnu.org>
parents: 21943
diff changeset
775 ;; 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
776 ;; If it is not, use the first symbol in it.
22018
6e80b7be8ac9 Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents: 22016
diff changeset
777 (skip-chars-forward " \t\n'(")
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
778 (buffer-substring-no-properties (point)
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
779 (progn (forward-sexp 1)
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
780 (point)))))
17912
653987823f79 (add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents: 17413
diff changeset
781 ((and (memq major-mode add-log-c-like-modes)
653987823f79 (add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents: 17413
diff changeset
782 (save-excursion
653987823f79 (add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents: 17413
diff changeset
783 (beginning-of-line)
653987823f79 (add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents: 17413
diff changeset
784 ;; Use eq instead of = here to avoid
653987823f79 (add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents: 17413
diff changeset
785 ;; error when at bob and char-after
653987823f79 (add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents: 17413
diff changeset
786 ;; returns nil.
653987823f79 (add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents: 17413
diff changeset
787 (while (eq (char-after (- (point) 2)) ?\\)
653987823f79 (add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents: 17413
diff changeset
788 (forward-line -1))
653987823f79 (add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents: 17413
diff changeset
789 (looking-at "[ \t]*#[ \t]*define[ \t]")))
1447
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
790 ;; Handle a C macro definition.
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
791 (beginning-of-line)
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
792 (while (eq (char-after (- (point) 2)) ?\\) ;not =; note above
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
793 (forward-line -1))
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
794 (search-forward "define")
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
795 (skip-chars-forward " \t")
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
796 (buffer-substring-no-properties (point)
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
797 (progn (forward-sexp 1)
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
798 (point))))
17912
653987823f79 (add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents: 17413
diff changeset
799 ((memq major-mode add-log-c-like-modes)
1447
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
800 (beginning-of-line)
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
801 ;; See if we are in the beginning part of a function,
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
802 ;; before the open brace. If so, advance forward.
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
803 (while (not (looking-at "{\\|\\(\\s *$\\)"))
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
804 (forward-line 1))
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
805 (or (eobp)
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
806 (forward-char 1))
58737
a67575cbdd93 (add-log-current-defun): Handle the case where point
Richard M. Stallman <rms@gnu.org>
parents: 57752
diff changeset
807 (let (maybe-beg)
a67575cbdd93 (add-log-current-defun): Handle the case where point
Richard M. Stallman <rms@gnu.org>
parents: 57752
diff changeset
808 ;; Try to find the containing defun.
a67575cbdd93 (add-log-current-defun): Handle the case where point
Richard M. Stallman <rms@gnu.org>
parents: 57752
diff changeset
809 (beginning-of-defun)
a67575cbdd93 (add-log-current-defun): Handle the case where point
Richard M. Stallman <rms@gnu.org>
parents: 57752
diff changeset
810 (end-of-defun)
a67575cbdd93 (add-log-current-defun): Handle the case where point
Richard M. Stallman <rms@gnu.org>
parents: 57752
diff changeset
811 ;; If the defun we found ends before the desired position,
a67575cbdd93 (add-log-current-defun): Handle the case where point
Richard M. Stallman <rms@gnu.org>
parents: 57752
diff changeset
812 ;; see if there's a DEFUN construct
a67575cbdd93 (add-log-current-defun): Handle the case where point
Richard M. Stallman <rms@gnu.org>
parents: 57752
diff changeset
813 ;; between that end and the desired position.
a67575cbdd93 (add-log-current-defun): Handle the case where point
Richard M. Stallman <rms@gnu.org>
parents: 57752
diff changeset
814 (when (save-excursion
a67575cbdd93 (add-log-current-defun): Handle the case where point
Richard M. Stallman <rms@gnu.org>
parents: 57752
diff changeset
815 (and (> location (point))
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59355
diff changeset
816 (re-search-forward "^DEFUN"
58737
a67575cbdd93 (add-log-current-defun): Handle the case where point
Richard M. Stallman <rms@gnu.org>
parents: 57752
diff changeset
817 (save-excursion
a67575cbdd93 (add-log-current-defun): Handle the case where point
Richard M. Stallman <rms@gnu.org>
parents: 57752
diff changeset
818 (goto-char location)
a67575cbdd93 (add-log-current-defun): Handle the case where point
Richard M. Stallman <rms@gnu.org>
parents: 57752
diff changeset
819 (line-end-position))
a67575cbdd93 (add-log-current-defun): Handle the case where point
Richard M. Stallman <rms@gnu.org>
parents: 57752
diff changeset
820 t)
a67575cbdd93 (add-log-current-defun): Handle the case where point
Richard M. Stallman <rms@gnu.org>
parents: 57752
diff changeset
821 (re-search-forward "^{" nil t)
a67575cbdd93 (add-log-current-defun): Handle the case where point
Richard M. Stallman <rms@gnu.org>
parents: 57752
diff changeset
822 (setq maybe-beg (point))))
a67575cbdd93 (add-log-current-defun): Handle the case where point
Richard M. Stallman <rms@gnu.org>
parents: 57752
diff changeset
823 ;; If so, go to the end of that instead.
a67575cbdd93 (add-log-current-defun): Handle the case where point
Richard M. Stallman <rms@gnu.org>
parents: 57752
diff changeset
824 (goto-char maybe-beg)
a67575cbdd93 (add-log-current-defun): Handle the case where point
Richard M. Stallman <rms@gnu.org>
parents: 57752
diff changeset
825 (end-of-defun)))
a67575cbdd93 (add-log-current-defun): Handle the case where point
Richard M. Stallman <rms@gnu.org>
parents: 57752
diff changeset
826 ;; If the desired position is within the defun we found,
a67575cbdd93 (add-log-current-defun): Handle the case where point
Richard M. Stallman <rms@gnu.org>
parents: 57752
diff changeset
827 ;; find the function name.
a67575cbdd93 (add-log-current-defun): Handle the case where point
Richard M. Stallman <rms@gnu.org>
parents: 57752
diff changeset
828 (when (< location (point))
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
829 (backward-sexp 1)
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
830 (let (beg tem)
1447
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
831
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
832 (forward-line -1)
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
833 ;; Skip back over typedefs of arglist.
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
834 (while (and (not (bobp))
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
835 (looking-at "[ \t\n]"))
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
836 (forward-line -1))
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
837 ;; See if this is using the DEFUN macro used in Emacs,
60769
a974294c56fa (add-log-current-defun): Support more C DEFUN forms.
Sam Steingold <sds@gnu.org>
parents: 59996
diff changeset
838 ;; or the DEFUN macro used by the C library:
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
839 (if (condition-case nil
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
840 (and (save-excursion
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
841 (end-of-line)
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
842 (while (= (preceding-char) ?\\)
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
843 (end-of-line 2))
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
844 (backward-sexp 1)
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
845 (beginning-of-line)
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
846 (setq tem (point))
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
847 (looking-at "DEFUN\\b"))
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
848 (>= location tem))
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
849 (error nil))
60769
a974294c56fa (add-log-current-defun): Support more C DEFUN forms.
Sam Steingold <sds@gnu.org>
parents: 59996
diff changeset
850 ;; DEFUN ("file-name-directory", Ffile_name_directory, Sfile_name_directory, ...) ==> Ffile_name_directory
a974294c56fa (add-log-current-defun): Support more C DEFUN forms.
Sam Steingold <sds@gnu.org>
parents: 59996
diff changeset
851 ;; DEFUN(POSIX::STREAM-LOCK, stream lockp &key BLOCK SHARED START LENGTH) ==> POSIX::STREAM-LOCK
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
852 (progn
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
853 (goto-char tem)
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
854 (down-list 1)
60769
a974294c56fa (add-log-current-defun): Support more C DEFUN forms.
Sam Steingold <sds@gnu.org>
parents: 59996
diff changeset
855 (when (= (char-after (point)) ?\")
a974294c56fa (add-log-current-defun): Support more C DEFUN forms.
Sam Steingold <sds@gnu.org>
parents: 59996
diff changeset
856 (forward-sexp 1)
a974294c56fa (add-log-current-defun): Support more C DEFUN forms.
Sam Steingold <sds@gnu.org>
parents: 59996
diff changeset
857 (search-forward ","))
a974294c56fa (add-log-current-defun): Support more C DEFUN forms.
Sam Steingold <sds@gnu.org>
parents: 59996
diff changeset
858 (skip-syntax-forward " ")
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
859 (buffer-substring-no-properties
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
860 (point)
60769
a974294c56fa (add-log-current-defun): Support more C DEFUN forms.
Sam Steingold <sds@gnu.org>
parents: 59996
diff changeset
861 (progn (search-forward ",")
a974294c56fa (add-log-current-defun): Support more C DEFUN forms.
Sam Steingold <sds@gnu.org>
parents: 59996
diff changeset
862 (forward-char -1)
a974294c56fa (add-log-current-defun): Support more C DEFUN forms.
Sam Steingold <sds@gnu.org>
parents: 59996
diff changeset
863 (skip-syntax-backward " ")
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
864 (point))))
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
865 (if (looking-at "^[+-]")
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
866 (change-log-get-method-definition)
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
867 ;; Ordinary C function syntax.
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
868 (setq beg (point))
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
869 (if (and
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
870 ;; Protect against "Unbalanced parens" error.
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
871 (condition-case nil
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
872 (progn
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
873 (down-list 1) ; into arglist
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
874 (backward-up-list 1)
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
875 (skip-chars-backward " \t")
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
876 t)
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
877 (error nil))
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
878 ;; Verify initial pos was after
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
879 ;; real start of function.
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
880 (save-excursion
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
881 (goto-char beg)
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
882 ;; For this purpose, include the line
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
883 ;; that has the decl keywords. This
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
884 ;; may also include some of the
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
885 ;; comments before the function.
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
886 (while (and (not (bobp))
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
887 (save-excursion
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
888 (forward-line -1)
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
889 (looking-at "[^\n\f]")))
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
890 (forward-line -1))
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
891 (>= location (point)))
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
892 ;; Consistency check: going down and up
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
893 ;; shouldn't take us back before BEG.
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
894 (> (point) beg))
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
895 (let (end middle)
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
896 ;; Don't include any final whitespace
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
897 ;; in the name we use.
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
898 (skip-chars-backward " \t\n")
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
899 (setq end (point))
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
900 (backward-sexp 1)
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
901 ;; Now find the right beginning of the name.
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
902 ;; Include certain keywords if they
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
903 ;; precede the name.
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
904 (setq middle (point))
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
905 (forward-word -1)
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
906 ;; Ignore these subparts of a class decl
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
907 ;; and move back to the class name itself.
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
908 (while (looking-at "public \\|private ")
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
909 (skip-chars-backward " \t:")
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
910 (setq end (point))
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
911 (backward-sexp 1)
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
912 (setq middle (point))
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
913 (forward-word -1))
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
914 (and (bolp)
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
915 (looking-at
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
916 "enum \\|struct \\|union \\|class ")
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
917 (setq middle (point)))
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
918 (goto-char end)
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
919 (when (eq (preceding-char) ?=)
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
920 (forward-char -1)
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
921 (skip-chars-backward " \t")
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
922 (setq end (point)))
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
923 (buffer-substring-no-properties
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
924 middle end))))))))
17912
653987823f79 (add-log-lisp-like-modes, add-log-c-like-modes, add-log-tex-like-modes):
Erik Naggum <erik@naggum.no>
parents: 17413
diff changeset
925 ((memq major-mode add-log-tex-like-modes)
1447
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
926 (if (re-search-backward
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
927 "\\\\\\(sub\\)*\\(section\\|paragraph\\|chapter\\)"
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
928 nil t)
1447
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
929 (progn
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
930 (goto-char (match-beginning 0))
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
931 (buffer-substring-no-properties
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
932 (1+ (point)) ; without initial backslash
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
933 (line-end-position)))))
1447
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
934 ((eq major-mode 'texinfo-mode)
9397
eba13d81ba0b (add-log-current-defun): In texinfo-mode,
Richard M. Stallman <rms@gnu.org>
parents: 9377
diff changeset
935 (if (re-search-backward "^@node[ \t]+\\([^,\n]+\\)" nil t)
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
936 (match-string-no-properties 1)))
36604
9a50e930a703 (add-log-current-defun): Check major-mode for `cperl-mode' as well.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 35936
diff changeset
937 ((memq major-mode '(perl-mode cperl-mode))
49308
0e6cefe9e2d0 (add-change-log-entry): Don't leave space at eol.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48615
diff changeset
938 (if (re-search-backward "^sub[ \t]+\\([^({ \t\n]+\\)" nil t)
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
939 (match-string-no-properties 1)))
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
940 ;; Emacs's autoconf-mode installs its own
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
941 ;; `add-log-current-defun-function'. This applies to
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
942 ;; a different mode apparently for editing .m4
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
943 ;; autoconf source.
27945
c11a0bbb5c88 (add-log-current-defun): Add support for
Gerd Moellmann <gerd@gnu.org>
parents: 27310
diff changeset
944 ((eq major-mode 'autoconf-mode)
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
945 (if (re-search-backward
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
946 "^\\(\\(m4_\\)?define\\|A._DEFUN\\)(\\[?\\([A-Za-z0-9_]+\\)" nil t)
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
947 (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
948 (t
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
949 ;; If all else fails, try heuristics
27277
9fdcfef41c64 (add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents: 27240
diff changeset
950 (let (case-fold-search
9fdcfef41c64 (add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents: 27240
diff changeset
951 result)
1447
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
952 (end-of-line)
27277
9fdcfef41c64 (add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents: 27240
diff changeset
953 (when (re-search-backward
9fdcfef41c64 (add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents: 27240
diff changeset
954 add-log-current-defun-header-regexp
9fdcfef41c64 (add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents: 27240
diff changeset
955 (- (point) 10000)
9fdcfef41c64 (add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents: 27240
diff changeset
956 t)
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
957 (setq result (or (match-string-no-properties 1)
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
958 (match-string-no-properties 0)))
27277
9fdcfef41c64 (add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents: 27240
diff changeset
959 ;; Strip whitespace away
9fdcfef41c64 (add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents: 27240
diff changeset
960 (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
961 result)
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
962 (setq result (match-string-no-properties 1 result)))
27277
9fdcfef41c64 (add-log-current-defun): Call
Gerd Moellmann <gerd@gnu.org>
parents: 27240
diff changeset
963 result))))))
1447
75fa9ad982a5 (add-log-current-defun): Add condition-case around
Richard M. Stallman <rms@gnu.org>
parents: 1369
diff changeset
964 (error nil)))
999
d8d503897aa5 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 980
diff changeset
965
20402
108100aa1991 (change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19904
diff changeset
966 (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
967
20402
108100aa1991 (change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19904
diff changeset
968 ;; 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
969 ;; 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
970 ;; 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
971 (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
972 (setq change-log-get-method-definition-md
108100aa1991 (change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19904
diff changeset
973 (concat change-log-get-method-definition-md
28446
28009885f082 Don't require cl, fortran.
Dave Love <fx@gnu.org>
parents: 27945
diff changeset
974 (match-string 1)
13282
69fe836d7f02 (get-method-definition, get-method-definition-1):
Richard M. Stallman <rms@gnu.org>
parents: 13255
diff changeset
975 end))
11749
8da04214faed (get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 11517
diff changeset
976 (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
977
20402
108100aa1991 (change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19904
diff changeset
978 (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
979 "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
980 (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
981 (save-excursion
11816
2a8e1b01bc15 (get-method-definition): Fix regexps.
Karl Heuer <kwzh@gnu.org>
parents: 11757
diff changeset
982 (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
983 (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
984 (save-excursion
8da04214faed (get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 11517
diff changeset
985 (cond
11816
2a8e1b01bc15 (get-method-definition): Fix regexps.
Karl Heuer <kwzh@gnu.org>
parents: 11757
diff changeset
986 ((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
987 (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
988 (while (not (looking-at "[{;]"))
8da04214faed (get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 11517
diff changeset
989 (looking-at
11816
2a8e1b01bc15 (get-method-definition): Fix regexps.
Karl Heuer <kwzh@gnu.org>
parents: 11757
diff changeset
990 "\\([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
991 (change-log-get-method-definition-1 ""))
108100aa1991 (change-log-add-make-room): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19904
diff changeset
992 (concat change-log-get-method-definition-md "]"))))))
27240
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
993
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
994 (defun change-log-sortable-date-at ()
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
995 "Return date of log entry in a consistent form for sorting.
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
996 Point is assumed to be at the start of the entry."
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
997 (require 'timezone)
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
998 (if (looking-at "^\\sw.........[0-9:+ ]*")
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
999 (let ((date (match-string-no-properties 0)))
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1000 (if date
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1001 (if (string-match "\\(....\\)-\\(..\\)-\\(..\\)\\s-+" date)
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1002 (concat (match-string 1 date) (match-string 2 date)
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1003 (match-string 3 date))
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1004 (condition-case nil
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1005 (timezone-make-date-sortable date)
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1006 (error nil)))))
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1007 (error "Bad date")))
11749
8da04214faed (get-method-definition, get-method-definition-1): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 11517
diff changeset
1008
47828
4944e0ddf992 (add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46637
diff changeset
1009 (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
1010 "Function to be used in `smerge-resolve-function'."
4944e0ddf992 (add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46637
diff changeset
1011 (let ((buf (current-buffer)))
4944e0ddf992 (add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46637
diff changeset
1012 (with-temp-buffer
4944e0ddf992 (add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46637
diff changeset
1013 (insert-buffer-substring buf (match-beginning 1) (match-end 1))
4944e0ddf992 (add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46637
diff changeset
1014 (save-match-data (change-log-mode))
4944e0ddf992 (add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46637
diff changeset
1015 (let ((other-buf (current-buffer)))
4944e0ddf992 (add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46637
diff changeset
1016 (with-current-buffer buf
4944e0ddf992 (add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46637
diff changeset
1017 (save-excursion
4944e0ddf992 (add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46637
diff changeset
1018 (save-restriction
4944e0ddf992 (add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46637
diff changeset
1019 (narrow-to-region (match-beginning 0) (match-end 0))
4944e0ddf992 (add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46637
diff changeset
1020 (replace-match (match-string 3) t t)
4944e0ddf992 (add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46637
diff changeset
1021 (change-log-merge other-buf))))))))
4944e0ddf992 (add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46637
diff changeset
1022
27240
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1023 ;;;###autoload
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1024 (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
1025 "Merge the contents of change log file OTHER-LOG with this buffer.
27240
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1026 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
1027 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
1028 or a buffer.
27240
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1029
30809
3aa7c156087a (change-log-merge): Doc fix.
Dave Love <fx@gnu.org>
parents: 29329
diff changeset
1030 Entries are inserted in chronological order. Both the current and
3aa7c156087a (change-log-merge): Doc fix.
Dave Love <fx@gnu.org>
parents: 29329
diff changeset
1031 old-style time formats for entries are supported."
27240
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1032 (interactive "*fLog file name to merge: ")
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1033 (if (not (eq major-mode 'change-log-mode))
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1034 (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
1035 (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
1036 (find-file-noselect other-log)))
27240
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1037 (buf (current-buffer))
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1038 date1 start end)
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1039 (save-excursion
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1040 (goto-char (point-min))
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1041 (set-buffer other-buf)
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1042 (goto-char (point-min))
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1043 (if (not (eq major-mode 'change-log-mode))
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1044 (error "%s not found in Change Log mode" other-log))
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1045 ;; Loop through all the entries in OTHER-LOG.
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1046 (while (not (eobp))
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1047 (setq date1 (change-log-sortable-date-at))
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1048 (setq start (point)
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1049 end (progn (forward-page) (point)))
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1050 ;; Look for an entry in original buffer that isn't later.
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1051 (with-current-buffer buf
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1052 (while (and (not (eobp))
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1053 (string< date1 (change-log-sortable-date-at)))
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1054 (forward-page))
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1055 (if (not (eobp))
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1056 (insert-buffer-substring other-buf start end)
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1057 ;; At the end of the original buffer, insert a newline to
d7748c3e79ad (add-log-debugging): Deleted.
Dave Love <fx@gnu.org>
parents: 27003
diff changeset
1058 ;; 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
1059 ;; merged.
4944e0ddf992 (add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46637
diff changeset
1060 (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
1061 (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
1062 (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
1063 (= ?\n (char-before (1- (point)))))))
4944e0ddf992 (add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46637
diff changeset
1064 (insert "\n"))
4944e0ddf992 (add-change-log-entry): Don't call find-file at all
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46637
diff changeset
1065 ;; 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
1066 (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
1067 (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
1068 (insert-buffer-substring other-buf start)))))))
999
d8d503897aa5 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 980
diff changeset
1069
30809
3aa7c156087a (change-log-merge): Doc fix.
Dave Love <fx@gnu.org>
parents: 29329
diff changeset
1070 ;;;###autoload
3aa7c156087a (change-log-merge): Doc fix.
Dave Love <fx@gnu.org>
parents: 29329
diff changeset
1071 (defun change-log-redate ()
3aa7c156087a (change-log-merge): Doc fix.
Dave Love <fx@gnu.org>
parents: 29329
diff changeset
1072 "Fix any old-style date entries in the current log file to default format."
3aa7c156087a (change-log-merge): Doc fix.
Dave Love <fx@gnu.org>
parents: 29329
diff changeset
1073 (interactive)
3aa7c156087a (change-log-merge): Doc fix.
Dave Love <fx@gnu.org>
parents: 29329
diff changeset
1074 (require 'timezone)
3aa7c156087a (change-log-merge): Doc fix.
Dave Love <fx@gnu.org>
parents: 29329
diff changeset
1075 (save-excursion
3aa7c156087a (change-log-merge): Doc fix.
Dave Love <fx@gnu.org>
parents: 29329
diff changeset
1076 (goto-char (point-min))
3aa7c156087a (change-log-merge): Doc fix.
Dave Love <fx@gnu.org>
parents: 29329
diff changeset
1077 (while (re-search-forward "^\\sw.........[0-9:+ ]*" nil t)
3aa7c156087a (change-log-merge): Doc fix.
Dave Love <fx@gnu.org>
parents: 29329
diff changeset
1078 (unless (= 12 (- (match-end 0) (match-beginning 0)))
3aa7c156087a (change-log-merge): Doc fix.
Dave Love <fx@gnu.org>
parents: 29329
diff changeset
1079 (let* ((date (save-match-data
3aa7c156087a (change-log-merge): Doc fix.
Dave Love <fx@gnu.org>
parents: 29329
diff changeset
1080 (timezone-fix-time (match-string 0) nil nil)))
3aa7c156087a (change-log-merge): Doc fix.
Dave Love <fx@gnu.org>
parents: 29329
diff changeset
1081 (zone (if (consp (aref date 6))
3aa7c156087a (change-log-merge): Doc fix.
Dave Love <fx@gnu.org>
parents: 29329
diff changeset
1082 (nth 1 (aref date 6)))))
3aa7c156087a (change-log-merge): Doc fix.
Dave Love <fx@gnu.org>
parents: 29329
diff changeset
1083 (replace-match (format-time-string
3aa7c156087a (change-log-merge): Doc fix.
Dave Love <fx@gnu.org>
parents: 29329
diff changeset
1084 "%Y-%m-%d "
3aa7c156087a (change-log-merge): Doc fix.
Dave Love <fx@gnu.org>
parents: 29329
diff changeset
1085 (encode-time (aref date 5)
3aa7c156087a (change-log-merge): Doc fix.
Dave Love <fx@gnu.org>
parents: 29329
diff changeset
1086 (aref date 4)
3aa7c156087a (change-log-merge): Doc fix.
Dave Love <fx@gnu.org>
parents: 29329
diff changeset
1087 (aref date 3)
3aa7c156087a (change-log-merge): Doc fix.
Dave Love <fx@gnu.org>
parents: 29329
diff changeset
1088 (aref date 2)
3aa7c156087a (change-log-merge): Doc fix.
Dave Love <fx@gnu.org>
parents: 29329
diff changeset
1089 (aref date 1)
3aa7c156087a (change-log-merge): Doc fix.
Dave Love <fx@gnu.org>
parents: 29329
diff changeset
1090 (aref date 0)
3aa7c156087a (change-log-merge): Doc fix.
Dave Love <fx@gnu.org>
parents: 29329
diff changeset
1091 zone))))))))
3aa7c156087a (change-log-merge): Doc fix.
Dave Love <fx@gnu.org>
parents: 29329
diff changeset
1092
980
b62886fbf2a7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 953
diff changeset
1093 (provide 'add-log)
b62886fbf2a7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 953
diff changeset
1094
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 51580
diff changeset
1095 ;;; arch-tag: 81eee6fc-088f-4372-a37f-80ad9620e762
811
e694e0879463 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 678
diff changeset
1096 ;;; add-log.el ends here