Mercurial > emacs
annotate lisp/vc/log-edit.el @ 111502:df6573cbdd34
* lisp/emacs-lisp/pcase.el (pcase-let*, pcase-let): Add debug and
indentation specs.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Thu, 11 Nov 2010 20:35:06 -0500 |
parents | 88ac54c22b2b |
children | 141d3f14d8c3 |
rev | line source |
---|---|
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1 ;;; log-edit.el --- Major mode for editing CVS commit messages |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2 |
107019
441df431f2d6
(log-edit-strip-single-file-name): Add missing :safe, :group, and
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
3 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, |
441df431f2d6
(log-edit-strip-single-file-name): Add missing :safe, :group, and
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
4 ;; 2008, 2009, 2010 Free Software Foundation, Inc. |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
5 |
70292
2b77fa42947f
Update my email address.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68651
diff
changeset
|
6 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca> |
108971
d928a6a7c3f2
* lisp/finder.el (finder-known-keywords): Add keyword "vc"
Juri Linkov <juri@jurta.org>
parents:
108970
diff
changeset
|
7 ;; Keywords: pcl-cvs cvs commit log vc |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
8 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
9 ;; This file is part of GNU Emacs. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
10 |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94161
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94161
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94161
diff
changeset
|
14 ;; (at your option) any later version. |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
15 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
16 ;; GNU Emacs is distributed in the hope that it will be useful, |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
19 ;; GNU General Public License for more details. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
20 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
21 ;; You should have received a copy of the GNU General Public License |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94161
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
23 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
24 ;;; Commentary: |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
25 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
26 ;; Todo: |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
27 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
28 ;; - Move in VC's code |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
29 ;; - Add compatibility for VC's hook variables |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
30 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
31 ;;; Code: |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
32 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
33 (eval-when-compile (require 'cl)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
34 (require 'add-log) ; for all the ChangeLog goodies |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
35 (require 'pcvs-util) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
36 (require 'ring) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
37 |
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40478
diff
changeset
|
38 ;;;; |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
39 ;;;; Global Variables |
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40478
diff
changeset
|
40 ;;;; |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
41 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
42 (defgroup log-edit nil |
32816
f4923452ea45
(log-edit): Add :version and a :group for vc.
Dave Love <fx@gnu.org>
parents:
29398
diff
changeset
|
43 "Major mode for editing RCS and CVS commit messages." |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
44 :group 'pcl-cvs |
32816
f4923452ea45
(log-edit): Add :version and a :group for vc.
Dave Love <fx@gnu.org>
parents:
29398
diff
changeset
|
45 :group 'vc ; It's used by VC. |
f4923452ea45
(log-edit): Add :version and a :group for vc.
Dave Love <fx@gnu.org>
parents:
29398
diff
changeset
|
46 :version "21.1" |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
47 :prefix "log-edit-") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
48 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
49 ;; compiler pacifiers |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
50 (defvar cvs-buffer) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
51 |
51063
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
52 |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
53 ;; The main keymap |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
54 |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
55 (easy-mmode-defmap log-edit-mode-map |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
56 `(("\C-c\C-c" . log-edit-done) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
57 ("\C-c\C-a" . log-edit-insert-changelog) |
86908
6e9e38d61817
* log-edit.el (log-edit-show-diff): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82365
diff
changeset
|
58 ("\C-c\C-d" . log-edit-show-diff) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
59 ("\C-c\C-f" . log-edit-show-files) |
51368
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
60 ("\M-n" . log-edit-next-comment) |
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
61 ("\M-p" . log-edit-previous-comment) |
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
62 ("\M-r" . log-edit-comment-search-backward) |
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
63 ("\M-s" . log-edit-comment-search-forward) |
51065
35933dc8e248
Don't require vc.el anymore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51063
diff
changeset
|
64 ("\C-c?" . log-edit-mode-help)) |
34405
ef4ba02580f0
(log-edit-parent-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34304
diff
changeset
|
65 "Keymap for the `log-edit-mode' (to edit version control log messages)." |
51065
35933dc8e248
Don't require vc.el anymore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51063
diff
changeset
|
66 :group 'log-edit) |
35933dc8e248
Don't require vc.el anymore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51063
diff
changeset
|
67 |
35933dc8e248
Don't require vc.el anymore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51063
diff
changeset
|
68 ;; Compatibility with old names. Should we bother ? |
35933dc8e248
Don't require vc.el anymore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51063
diff
changeset
|
69 (defvar vc-log-mode-map log-edit-mode-map) |
35933dc8e248
Don't require vc.el anymore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51063
diff
changeset
|
70 (defvar vc-log-entry-mode vc-log-mode-map) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
71 |
33180
8700cd9cdd26
(log-edit-menu): New menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33061
diff
changeset
|
72 (easy-menu-define log-edit-menu log-edit-mode-map |
8700cd9cdd26
(log-edit-menu): New menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33061
diff
changeset
|
73 "Menu used for `log-edit-mode'." |
8700cd9cdd26
(log-edit-menu): New menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33061
diff
changeset
|
74 '("Log-Edit" |
8700cd9cdd26
(log-edit-menu): New menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33061
diff
changeset
|
75 ["Done" log-edit-done |
8700cd9cdd26
(log-edit-menu): New menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33061
diff
changeset
|
76 :help "Exit log-edit and proceed with the actual action."] |
8700cd9cdd26
(log-edit-menu): New menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33061
diff
changeset
|
77 "--" |
93893
ff99dcb2b31b
* outline.el (outline-mode-menu-bar-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87765
diff
changeset
|
78 ["Insert ChangeLog" log-edit-insert-changelog |
ff99dcb2b31b
* outline.el (outline-mode-menu-bar-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87765
diff
changeset
|
79 :help "Insert a log message by looking at the ChangeLog"] |
ff99dcb2b31b
* outline.el (outline-mode-menu-bar-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87765
diff
changeset
|
80 ["Add to ChangeLog" log-edit-add-to-changelog |
ff99dcb2b31b
* outline.el (outline-mode-menu-bar-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87765
diff
changeset
|
81 :help "Insert this log message into the appropriate ChangeLog file"] |
33180
8700cd9cdd26
(log-edit-menu): New menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33061
diff
changeset
|
82 "--" |
86908
6e9e38d61817
* log-edit.el (log-edit-show-diff): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82365
diff
changeset
|
83 ["Show diff" log-edit-show-diff |
6e9e38d61817
* log-edit.el (log-edit-show-diff): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82365
diff
changeset
|
84 :help "Show the diff for the files to be committed."] |
33180
8700cd9cdd26
(log-edit-menu): New menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33061
diff
changeset
|
85 ["List files" log-edit-show-files |
8700cd9cdd26
(log-edit-menu): New menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33061
diff
changeset
|
86 :help "Show the list of relevant files."] |
8700cd9cdd26
(log-edit-menu): New menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33061
diff
changeset
|
87 "--" |
93893
ff99dcb2b31b
* outline.el (outline-mode-menu-bar-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87765
diff
changeset
|
88 ["Previous comment" log-edit-previous-comment |
ff99dcb2b31b
* outline.el (outline-mode-menu-bar-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87765
diff
changeset
|
89 :help "Cycle backwards through comment history"] |
ff99dcb2b31b
* outline.el (outline-mode-menu-bar-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87765
diff
changeset
|
90 ["Next comment" log-edit-next-comment |
ff99dcb2b31b
* outline.el (outline-mode-menu-bar-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87765
diff
changeset
|
91 :help "Cycle forwards through comment history."] |
ff99dcb2b31b
* outline.el (outline-mode-menu-bar-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87765
diff
changeset
|
92 ["Search comment forward" log-edit-comment-search-forward |
ff99dcb2b31b
* outline.el (outline-mode-menu-bar-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87765
diff
changeset
|
93 :help "Search forwards through comment history for a substring match of str"] |
ff99dcb2b31b
* outline.el (outline-mode-menu-bar-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87765
diff
changeset
|
94 ["Search comment backward" log-edit-comment-search-backward |
ff99dcb2b31b
* outline.el (outline-mode-menu-bar-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87765
diff
changeset
|
95 :help "Search backwards through comment history for substring match of str"])) |
33180
8700cd9cdd26
(log-edit-menu): New menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33061
diff
changeset
|
96 |
33061
3cbd3cc4cc8b
(log-edit-confirm): Fix the default.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32816
diff
changeset
|
97 (defcustom log-edit-confirm 'changed |
100171 | 98 "If non-nil, `log-edit-done' will request confirmation. |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
99 If 'changed, only request confirmation if the list of files has |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
100 changed since the beginning of the log-edit session." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
101 :group 'log-edit |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
102 :type '(choice (const changed) (const t) (const nil))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
103 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
104 (defcustom log-edit-keep-buffer nil |
100171 | 105 "If non-nil, don't hide the buffer after `log-edit-done'." |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
106 :group 'log-edit |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
107 :type 'boolean) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
108 |
49616
43c9ef374660
(cvs-commit-buffer-require-final-newline, cvs-changelog-full-paragraphs): Add
Juanma Barranquero <lekktu@gmail.com>
parents:
49597
diff
changeset
|
109 (defvar cvs-commit-buffer-require-final-newline t) |
43c9ef374660
(cvs-commit-buffer-require-final-newline, cvs-changelog-full-paragraphs): Add
Juanma Barranquero <lekktu@gmail.com>
parents:
49597
diff
changeset
|
110 (make-obsolete-variable 'cvs-commit-buffer-require-final-newline |
94161
f6a929751bfd
(cvs-commit-buffer-require-final-newline, cvs-changelog-full-paragraphs):
Juanma Barranquero <lekktu@gmail.com>
parents:
93893
diff
changeset
|
111 'log-edit-require-final-newline |
f6a929751bfd
(cvs-commit-buffer-require-final-newline, cvs-changelog-full-paragraphs):
Juanma Barranquero <lekktu@gmail.com>
parents:
93893
diff
changeset
|
112 "21.1") |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
113 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
114 (defcustom log-edit-require-final-newline |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
115 cvs-commit-buffer-require-final-newline |
100171 | 116 "Enforce a newline at the end of commit log messages. |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
117 Enforce it silently if t, query if non-nil and don't do anything if nil." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
118 :group 'log-edit |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
119 :type '(choice (const ask) (const t) (const nil))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
120 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
121 (defcustom log-edit-setup-invert nil |
100171 | 122 "Non-nil means `log-edit' should invert the meaning of its SETUP arg. |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
123 If SETUP is 'force, this variable has no effect." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
124 :group 'log-edit |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
125 :type 'boolean) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
126 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
127 (defcustom log-edit-hook '(log-edit-insert-cvs-template |
108009
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
128 log-edit-show-files |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
129 log-edit-insert-changelog) |
100171 | 130 "Hook run at the end of `log-edit'." |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
131 :group 'log-edit |
67183
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
132 :type '(hook :options (log-edit-insert-changelog |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
133 log-edit-insert-cvs-rcstemplate |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
134 log-edit-insert-cvs-template |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
135 log-edit-insert-filenames))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
136 |
28340
b90fe8a937ae
(log-edit-mode-hook): Fix typo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28338
diff
changeset
|
137 (defcustom log-edit-mode-hook (if (boundp 'vc-log-mode-hook) vc-log-mode-hook) |
100171 | 138 "Hook run when entering `log-edit-mode'." |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
139 :group 'log-edit |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
140 :type 'hook) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
141 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
142 (defcustom log-edit-done-hook nil |
100171 | 143 "Hook run before doing the actual commit. |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
144 This hook can be used to cleanup the message, enforce various |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
145 conventions, or to allow recording the message in some other database, |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
146 such as a bug-tracking system. The list of files about to be committed |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
147 can be obtained from `log-edit-files'." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
148 :group 'log-edit |
36616
61f696f7e5f9
(log-edit-common-indent): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34652
diff
changeset
|
149 :type '(hook :options (log-edit-set-common-indentation |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
150 log-edit-add-to-changelog))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
151 |
108782
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
152 (defcustom log-edit-strip-single-file-name nil |
104369
5744c85d533a
* log-edit.el (log-edit-strip-single-file-name): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
100908
diff
changeset
|
153 "If non-nil, remove file name from single-file log entries." |
107019
441df431f2d6
(log-edit-strip-single-file-name): Add missing :safe, :group, and
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
154 :type 'boolean |
441df431f2d6
(log-edit-strip-single-file-name): Add missing :safe, :group, and
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
155 :safe 'booleanp |
441df431f2d6
(log-edit-strip-single-file-name): Add missing :safe, :group, and
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
156 :group 'log-edit |
108782
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
157 :version "24.1") |
104369
5744c85d533a
* log-edit.el (log-edit-strip-single-file-name): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
100908
diff
changeset
|
158 |
49616
43c9ef374660
(cvs-commit-buffer-require-final-newline, cvs-changelog-full-paragraphs): Add
Juanma Barranquero <lekktu@gmail.com>
parents:
49597
diff
changeset
|
159 (defvar cvs-changelog-full-paragraphs t) |
43c9ef374660
(cvs-commit-buffer-require-final-newline, cvs-changelog-full-paragraphs): Add
Juanma Barranquero <lekktu@gmail.com>
parents:
49597
diff
changeset
|
160 (make-obsolete-variable 'cvs-changelog-full-paragraphs |
94161
f6a929751bfd
(cvs-commit-buffer-require-final-newline, cvs-changelog-full-paragraphs):
Juanma Barranquero <lekktu@gmail.com>
parents:
93893
diff
changeset
|
161 'log-edit-changelog-full-paragraphs |
f6a929751bfd
(cvs-commit-buffer-require-final-newline, cvs-changelog-full-paragraphs):
Juanma Barranquero <lekktu@gmail.com>
parents:
93893
diff
changeset
|
162 "21.1") |
28860
40a22b85650e
(cvs-changelog-full-paragraphs): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28340
diff
changeset
|
163 |
40a22b85650e
(cvs-changelog-full-paragraphs): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28340
diff
changeset
|
164 (defvar log-edit-changelog-full-paragraphs cvs-changelog-full-paragraphs |
40a22b85650e
(cvs-changelog-full-paragraphs): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28340
diff
changeset
|
165 "*If non-nil, include full ChangeLog paragraphs in the log. |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
166 This may be set in the ``local variables'' section of a ChangeLog, to |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
167 indicate the policy for that ChangeLog. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
168 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
169 A ChangeLog paragraph is a bunch of log text containing no blank lines; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
170 a paragraph usually describes a set of changes with a single purpose, |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
171 but perhaps spanning several functions in several files. Changes in |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
172 different paragraphs are unrelated. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
173 |
28860
40a22b85650e
(cvs-changelog-full-paragraphs): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28340
diff
changeset
|
174 You could argue that the log entry for a file should contain the |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
175 full ChangeLog paragraph mentioning the change to the file, even though |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
176 it may mention other files, because that gives you the full context you |
63255
4f2b9ea9b006
(log-edit-changelog-full-paragraphs): Fix spellings in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
62707
diff
changeset
|
177 need to understand the change. This is the behavior you get when this |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
178 variable is set to t. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
179 |
28860
40a22b85650e
(cvs-changelog-full-paragraphs): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28340
diff
changeset
|
180 On the other hand, you could argue that the log entry for a change |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
181 should contain only the text for the changes which occurred in that |
63255
4f2b9ea9b006
(log-edit-changelog-full-paragraphs): Fix spellings in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
62707
diff
changeset
|
182 file, because the log is per-file. This is the behavior you get |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
183 when this variable is set to nil.") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
184 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
185 ;;;; Internal global or buffer-local vars |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
186 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
187 (defconst log-edit-files-buf "*log-edit-files*") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
188 (defvar log-edit-initial-files nil) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
189 (defvar log-edit-callback nil) |
86908
6e9e38d61817
* log-edit.el (log-edit-show-diff): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82365
diff
changeset
|
190 (defvar log-edit-diff-function nil) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
191 (defvar log-edit-listfun nil) |
107482
1161bde4ebd6
* log-edit.el (log-edit-before-checkin-process): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
107430
diff
changeset
|
192 |
34405
ef4ba02580f0
(log-edit-parent-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34304
diff
changeset
|
193 (defvar log-edit-parent-buffer nil) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
194 |
51368
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
195 ;;; Originally taken from VC-Log mode |
51063
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
196 |
51368
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
197 (defconst log-edit-maximum-comment-ring-size 32 |
51063
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
198 "Maximum number of saved comments in the comment ring.") |
51368
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
199 (defvar log-edit-comment-ring (make-ring log-edit-maximum-comment-ring-size)) |
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
200 (defvar log-edit-comment-ring-index nil) |
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
201 (defvar log-edit-last-comment-match "") |
51063
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
202 |
51368
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
203 (defun log-edit-new-comment-index (stride len) |
51063
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
204 "Return the comment index STRIDE elements from the current one. |
51368
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
205 LEN is the length of `log-edit-comment-ring'." |
51063
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
206 (mod (cond |
51368
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
207 (log-edit-comment-ring-index (+ log-edit-comment-ring-index stride)) |
51063
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
208 ;; Initialize the index on the first use of this command |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
209 ;; so that the first M-p gets index 0, and the first M-n gets |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
210 ;; index -1. |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
211 ((> stride 0) (1- stride)) |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
212 (t stride)) |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
213 len)) |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
214 |
51368
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
215 (defun log-edit-previous-comment (arg) |
51063
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
216 "Cycle backwards through comment history. |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
217 With a numeric prefix ARG, go back ARG comments." |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
218 (interactive "*p") |
51368
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
219 (let ((len (ring-length log-edit-comment-ring))) |
51063
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
220 (if (<= len 0) |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
221 (progn (message "Empty comment ring") (ding)) |
51065
35933dc8e248
Don't require vc.el anymore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51063
diff
changeset
|
222 ;; Don't use `erase-buffer' because we don't want to `widen'. |
35933dc8e248
Don't require vc.el anymore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51063
diff
changeset
|
223 (delete-region (point-min) (point-max)) |
51368
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
224 (setq log-edit-comment-ring-index (log-edit-new-comment-index arg len)) |
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
225 (message "Comment %d" (1+ log-edit-comment-ring-index)) |
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
226 (insert (ring-ref log-edit-comment-ring log-edit-comment-ring-index))))) |
51063
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
227 |
51368
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
228 (defun log-edit-next-comment (arg) |
51063
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
229 "Cycle forwards through comment history. |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
230 With a numeric prefix ARG, go forward ARG comments." |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
231 (interactive "*p") |
51368
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
232 (log-edit-previous-comment (- arg))) |
51063
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
233 |
51368
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
234 (defun log-edit-comment-search-backward (str &optional stride) |
51063
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
235 "Search backwards through comment history for substring match of STR. |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
236 If the optional argument STRIDE is present, that is a step-width to use |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
237 when going through the comment ring." |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
238 ;; Why substring rather than regexp ? -sm |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
239 (interactive |
51368
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
240 (list (read-string "Comment substring: " nil nil log-edit-last-comment-match))) |
51063
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
241 (unless stride (setq stride 1)) |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
242 (if (string= str "") |
51368
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
243 (setq str log-edit-last-comment-match) |
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
244 (setq log-edit-last-comment-match str)) |
51063
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
245 (let* ((str (regexp-quote str)) |
51368
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
246 (len (ring-length log-edit-comment-ring)) |
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
247 (n (log-edit-new-comment-index stride len))) |
51063
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
248 (while (progn (when (or (>= n len) (< n 0)) (error "Not found")) |
51368
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
249 (not (string-match str (ring-ref log-edit-comment-ring n)))) |
51063
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
250 (setq n (+ n stride))) |
51368
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
251 (setq log-edit-comment-ring-index n) |
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
252 (log-edit-previous-comment 0))) |
51063
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
253 |
51368
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
254 (defun log-edit-comment-search-forward (str) |
51063
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
255 "Search forwards through comment history for a substring match of STR." |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
256 (interactive |
51368
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
257 (list (read-string "Comment substring: " nil nil log-edit-last-comment-match))) |
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
258 (log-edit-comment-search-backward str -1)) |
51063
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
259 |
51368
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
260 (defun log-edit-comment-to-change-log (&optional whoami file-name) |
51063
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
261 "Enter last VC comment into the change log for the current file. |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
262 WHOAMI (interactive prefix) non-nil means prompt for user name |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
263 and site. FILE-NAME is the name of the change log; if nil, use |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
264 `change-log-default-name'. |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
265 |
51368
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
266 This may be useful as a `log-edit-checkin-hook' to update change logs |
51063
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
267 automatically." |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
268 (interactive (if current-prefix-arg |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
269 (list current-prefix-arg |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
270 (prompt-for-change-log-name)))) |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
271 (let (;; Extract the comment first so we get any error before doing anything. |
51368
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
272 (comment (ring-ref log-edit-comment-ring 0)) |
51063
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
273 ;; Don't let add-change-log-entry insert a defun name. |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
274 (add-log-current-defun-function 'ignore) |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
275 end) |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
276 ;; Call add-log to do half the work. |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
277 (add-change-log-entry whoami file-name t t) |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
278 ;; Insert the VC comment, leaving point before it. |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
279 (setq end (save-excursion (insert comment) (point-marker))) |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
280 (if (looking-at "\\s *\\s(") |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
281 ;; It starts with an open-paren, as in "(foo): Frobbed." |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
282 ;; So remove the ": " add-log inserted. |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
283 (delete-char -2)) |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
284 ;; Canonicalize the white space between the file name and comment. |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
285 (just-one-space) |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
286 ;; Indent rest of the text the same way add-log indented the first line. |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
287 (let ((indentation (current-indentation))) |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
288 (save-excursion |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
289 (while (< (point) end) |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
290 (forward-line 1) |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
291 (indent-to indentation)) |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
292 (setq end (point)))) |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
293 ;; Fill the inserted text, preserving open-parens at bol. |
51065
35933dc8e248
Don't require vc.el anymore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51063
diff
changeset
|
294 (let ((paragraph-start (concat paragraph-start "\\|\\s *\\s("))) |
51063
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
295 (beginning-of-line) |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
296 (fill-region (point) end)) |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
297 ;; Canonicalize the white space at the end of the entry so it is |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
298 ;; separated from the next entry by a single blank line. |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
299 (skip-syntax-forward " " end) |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
300 (delete-char (- (skip-syntax-backward " "))) |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
301 (or (eobp) (looking-at "\n\n") |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
302 (insert "\n")))) |
66dd7f2dd70a
(vc-log-mode-map, vc-maximum-comment-ring-size, vc-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49616
diff
changeset
|
303 |
51368
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
304 ;; Compatibility with old names. |
67183
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
305 (define-obsolete-variable-alias 'vc-comment-ring 'log-edit-comment-ring "22.1") |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
306 (define-obsolete-variable-alias 'vc-comment-ring-index 'log-edit-comment-ring-index "22.1") |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
307 (define-obsolete-function-alias 'vc-previous-comment 'log-edit-previous-comment "22.1") |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
308 (define-obsolete-function-alias 'vc-next-comment 'log-edit-next-comment "22.1") |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
309 (define-obsolete-function-alias 'vc-comment-search-reverse 'log-edit-comment-search-backward "22.1") |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
310 (define-obsolete-function-alias 'vc-comment-search-forward 'log-edit-comment-search-forward "22.1") |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
311 (define-obsolete-function-alias 'vc-comment-to-change-log 'log-edit-comment-to-change-log "22.1") |
51368
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
312 |
34405
ef4ba02580f0
(log-edit-parent-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34304
diff
changeset
|
313 ;;; |
ef4ba02580f0
(log-edit-parent-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34304
diff
changeset
|
314 ;;; Actual code |
ef4ba02580f0
(log-edit-parent-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34304
diff
changeset
|
315 ;;; |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
316 |
108009
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
317 (defface log-edit-summary '((t :inherit font-lock-function-name-face)) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
318 "Face for the summary in `log-edit-mode' buffers.") |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
319 |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
320 (defface log-edit-header '((t :inherit font-lock-keyword-face)) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
321 "Face for the headers in `log-edit-mode' buffers.") |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
322 |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
323 (defface log-edit-unknown-header '((t :inherit font-lock-comment-face)) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
324 "Face for unknown headers in `log-edit-mode' buffers.") |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
325 |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
326 (defvar log-edit-headers-alist '(("Summary" . log-edit-summary) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
327 ("Fixes") ("Author")) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
328 "AList of known headers and the face to use to highlight them.") |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
329 |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
330 (defconst log-edit-header-contents-regexp |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
331 "[ \t]*\\(.*\\(\n[ \t].*\\)*\\)\n?") |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
332 |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
333 (defun log-edit-match-to-eoh (limit) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
334 ;; FIXME: copied from message-match-to-eoh. |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
335 (let ((start (point))) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
336 (rfc822-goto-eoh) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
337 ;; Typical situation: some temporary change causes the header to be |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
338 ;; incorrect, so EOH comes earlier than intended: the last lines of the |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
339 ;; intended headers are now not considered part of the header any more, |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
340 ;; so they don't have the multiline property set. When the change is |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
341 ;; completed and the header has its correct shape again, the lack of the |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
342 ;; multiline property means we won't rehighlight the last lines of |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
343 ;; the header. |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
344 (if (< (point) start) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
345 nil ;No header within start..limit. |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
346 ;; Here we disregard LIMIT so that we may extend the area again. |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
347 (set-match-data (list start (point))) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
348 (point)))) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
349 |
54422
4f7b9dbf832e
(log-edit-font-lock-keywords): Typo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54417
diff
changeset
|
350 (defvar log-edit-font-lock-keywords |
108009
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
351 ;; Copied/inspired by message-font-lock-keywords. |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
352 `((log-edit-match-to-eoh |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
353 (,(concat "^\\(\\([a-z]+\\):\\)" log-edit-header-contents-regexp |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
354 "\\|\\(.*\\)") |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
355 (progn (goto-char (match-beginning 0)) (match-end 0)) nil |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
356 (1 (if (assoc (match-string 2) log-edit-headers-alist) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
357 'log-edit-header |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
358 'log-edit-unknown-header) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
359 nil lax) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
360 (3 (or (cdr (assoc (match-string 2) log-edit-headers-alist)) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
361 'log-edit-header) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
362 nil lax) |
108980
c3dddc8e5767
Revert 2010-06-02 change to log-edit-font-lock-keywords (Bug#6343).
Chong Yidong <cyd@stupidchicken.com>
parents:
108971
diff
changeset
|
363 (4 font-lock-warning-face))))) |
54417
ae0720c5c65c
(log-edit-font-lock-keywords): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52791
diff
changeset
|
364 |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
365 ;;;###autoload |
107430
1918e70c8b37
Add special markup processing for commit logs.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107374
diff
changeset
|
366 (defun log-edit (callback &optional setup params buffer mode &rest ignore) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
367 "Setup a buffer to enter a log message. |
107430
1918e70c8b37
Add special markup processing for commit logs.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107374
diff
changeset
|
368 \\<log-edit-mode-map>The buffer will be put in mode MODE or `log-edit-mode' |
1918e70c8b37
Add special markup processing for commit logs.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107374
diff
changeset
|
369 if MODE is nil. |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
370 If SETUP is non-nil, the buffer is then erased and `log-edit-hook' is run. |
87765 | 371 Mark and point will be set around the entire contents of the buffer so |
372 that it is easy to kill the contents of the buffer with \\[kill-region]. | |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
373 Once you're done editing the message, pressing \\[log-edit-done] will call |
34405
ef4ba02580f0
(log-edit-parent-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34304
diff
changeset
|
374 `log-edit-done' which will end up calling CALLBACK to do the actual commit. |
87765 | 375 |
376 PARAMS if non-nil is an alist. Possible keys and associated values: | |
377 `log-edit-listfun' -- function taking no arguments that returns the list of | |
378 files that are concerned by the current operation (using relative names); | |
379 `log-edit-diff-function' -- function taking no arguments that | |
380 displays a diff of the files concerned by the current operation. | |
381 | |
34405
ef4ba02580f0
(log-edit-parent-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34304
diff
changeset
|
382 If BUFFER is non-nil `log-edit' will jump to that buffer, use it to edit the |
87765 | 383 log message and go back to the current buffer when done. Otherwise, it |
384 uses the current buffer." | |
34405
ef4ba02580f0
(log-edit-parent-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34304
diff
changeset
|
385 (let ((parent (current-buffer))) |
ef4ba02580f0
(log-edit-parent-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34304
diff
changeset
|
386 (if buffer (pop-to-buffer buffer)) |
ef4ba02580f0
(log-edit-parent-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34304
diff
changeset
|
387 (when (and log-edit-setup-invert (not (eq setup 'force))) |
ef4ba02580f0
(log-edit-parent-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34304
diff
changeset
|
388 (setq setup (not setup))) |
108009
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
389 (when setup |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
390 (erase-buffer) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
391 (insert "Summary: ") |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
392 (save-excursion (insert "\n\n"))) |
107430
1918e70c8b37
Add special markup processing for commit logs.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107374
diff
changeset
|
393 (if mode |
1918e70c8b37
Add special markup processing for commit logs.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107374
diff
changeset
|
394 (funcall mode) |
1918e70c8b37
Add special markup processing for commit logs.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107374
diff
changeset
|
395 (log-edit-mode)) |
34405
ef4ba02580f0
(log-edit-parent-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34304
diff
changeset
|
396 (set (make-local-variable 'log-edit-callback) callback) |
86908
6e9e38d61817
* log-edit.el (log-edit-show-diff): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82365
diff
changeset
|
397 (if (listp params) |
6e9e38d61817
* log-edit.el (log-edit-show-diff): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82365
diff
changeset
|
398 (dolist (crt params) |
6e9e38d61817
* log-edit.el (log-edit-show-diff): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82365
diff
changeset
|
399 (set (make-local-variable (car crt)) (cdr crt))) |
6e9e38d61817
* log-edit.el (log-edit-show-diff): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82365
diff
changeset
|
400 ;; For backward compatibility with log-edit up to version 22.2 |
6e9e38d61817
* log-edit.el (log-edit-show-diff): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82365
diff
changeset
|
401 ;; accept non-list PARAMS to mean `log-edit-list'. |
6e9e38d61817
* log-edit.el (log-edit-show-diff): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82365
diff
changeset
|
402 (set (make-local-variable 'log-edit-listfun) params)) |
6e9e38d61817
* log-edit.el (log-edit-show-diff): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82365
diff
changeset
|
403 |
34405
ef4ba02580f0
(log-edit-parent-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34304
diff
changeset
|
404 (if buffer (set (make-local-variable 'log-edit-parent-buffer) parent)) |
40478
4d0323a1ed72
(log-edit): Run hook after `log-edit-files'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37694
diff
changeset
|
405 (set (make-local-variable 'log-edit-initial-files) (log-edit-files)) |
34405
ef4ba02580f0
(log-edit-parent-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34304
diff
changeset
|
406 (when setup (run-hooks 'log-edit-hook)) |
ef4ba02580f0
(log-edit-parent-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34304
diff
changeset
|
407 (goto-char (point-min)) (push-mark (point-max)) |
65582
4d1085b02d64
Message format spec fixes (1)
Deepak Goel <deego@gnufans.org>
parents:
64762
diff
changeset
|
408 (message "%s" (substitute-command-keys |
34405
ef4ba02580f0
(log-edit-parent-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34304
diff
changeset
|
409 "Press \\[log-edit-done] when you are done editing.")))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
410 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
411 (define-derived-mode log-edit-mode text-mode "Log-Edit" |
28338
8da42323f5d5
(log-edit-mode-map): Inherit from vc-log-mode-map
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
412 "Major mode for editing version-control log messages. |
8da42323f5d5
(log-edit-mode-map): Inherit from vc-log-mode-map
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
413 When done editing the log entry, just type \\[log-edit-done] which |
8da42323f5d5
(log-edit-mode-map): Inherit from vc-log-mode-map
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
414 will trigger the actual commit of the file(s). |
8da42323f5d5
(log-edit-mode-map): Inherit from vc-log-mode-map
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
415 Several other handy support commands are provided of course and |
8da42323f5d5
(log-edit-mode-map): Inherit from vc-log-mode-map
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
416 the package from which this is used might also provide additional |
8da42323f5d5
(log-edit-mode-map): Inherit from vc-log-mode-map
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
417 commands (under C-x v for VC, for example). |
8da42323f5d5
(log-edit-mode-map): Inherit from vc-log-mode-map
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
418 |
29375
429ae71326c2
(log-edit-mode): Make vc-comment-ring-index local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29042
diff
changeset
|
419 \\{log-edit-mode-map}" |
54417
ae0720c5c65c
(log-edit-font-lock-keywords): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52791
diff
changeset
|
420 (set (make-local-variable 'font-lock-defaults) |
108009
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
421 '(log-edit-font-lock-keywords t t)) |
107374
dc9565b08f10
Add .dir-locals.el support for file-less buffers.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107019
diff
changeset
|
422 (make-local-variable 'log-edit-comment-ring-index) |
dc9565b08f10
Add .dir-locals.el support for file-less buffers.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107019
diff
changeset
|
423 (hack-dir-local-variables-non-file-buffer)) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
424 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
425 (defun log-edit-hide-buf (&optional buf where) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
426 (when (setq buf (get-buffer (or buf log-edit-files-buf))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
427 (let ((win (get-buffer-window buf where))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
428 (if win (ignore-errors (delete-window win)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
429 (bury-buffer buf))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
430 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
431 (defun log-edit-done () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
432 "Finish editing the log message and commit the files. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
433 If you want to abort the commit, simply delete the buffer." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
434 (interactive) |
108009
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
435 ;; Clean up empty headers. |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
436 (goto-char (point-min)) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
437 (while (looking-at (concat "^[a-z]*:" log-edit-header-contents-regexp)) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
438 (let ((beg (match-beginning 0))) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
439 (goto-char (match-end 0)) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
440 (if (string-match "\\`[ \n\t]*\\'" (match-string 1)) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
441 (delete-region beg (point))))) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
442 ;; Get rid of leading empty lines. |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
443 (goto-char (point-min)) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
444 (when (looking-at "\\([ \t]*\n\\)+") |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
445 (delete-region (match-beginning 0) (match-end 0))) |
29042
09b4758f4aea
(log-edit-done): Cleanup trailing empty lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28860
diff
changeset
|
446 ;; Get rid of trailing empty lines |
09b4758f4aea
(log-edit-done): Cleanup trailing empty lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28860
diff
changeset
|
447 (goto-char (point-max)) |
09b4758f4aea
(log-edit-done): Cleanup trailing empty lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28860
diff
changeset
|
448 (skip-syntax-backward " ") |
09b4758f4aea
(log-edit-done): Cleanup trailing empty lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28860
diff
changeset
|
449 (when (equal (char-after) ?\n) (forward-char 1)) |
09b4758f4aea
(log-edit-done): Cleanup trailing empty lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28860
diff
changeset
|
450 (delete-region (point) (point-max)) |
09b4758f4aea
(log-edit-done): Cleanup trailing empty lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28860
diff
changeset
|
451 ;; Check for final newline |
34405
ef4ba02580f0
(log-edit-parent-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34304
diff
changeset
|
452 (if (and (> (point-max) (point-min)) |
ef4ba02580f0
(log-edit-parent-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34304
diff
changeset
|
453 (/= (char-before (point-max)) ?\n) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
454 (or (eq log-edit-require-final-newline t) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
455 (and log-edit-require-final-newline |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
456 (y-or-n-p |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
457 (format "Buffer %s does not end in newline. Add one? " |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
458 (buffer-name)))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
459 (save-excursion |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
460 (goto-char (point-max)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
461 (insert ?\n))) |
29375
429ae71326c2
(log-edit-mode): Make vc-comment-ring-index local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29042
diff
changeset
|
462 (let ((comment (buffer-string))) |
51368
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
463 (when (or (ring-empty-p log-edit-comment-ring) |
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
464 (not (equal comment (ring-ref log-edit-comment-ring 0)))) |
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
465 (ring-insert log-edit-comment-ring comment))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
466 (let ((win (get-buffer-window log-edit-files-buf))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
467 (if (and log-edit-confirm |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
468 (not (and (eq log-edit-confirm 'changed) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
469 (equal (log-edit-files) log-edit-initial-files))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
470 (progn |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
471 (log-edit-show-files) |
65689
96187e7edd1b
2005-09-25 Romain Francoise <romain@orebokech.com>
Romain Francoise <romain@orebokech.com>
parents:
65582
diff
changeset
|
472 (not (y-or-n-p "Really commit? ")))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
473 (progn (when (not win) (log-edit-hide-buf)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
474 (message "Oh, well! Later maybe?")) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
475 (run-hooks 'log-edit-done-hook) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
476 (log-edit-hide-buf) |
34405
ef4ba02580f0
(log-edit-parent-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34304
diff
changeset
|
477 (unless (or log-edit-keep-buffer (not log-edit-parent-buffer)) |
ef4ba02580f0
(log-edit-parent-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34304
diff
changeset
|
478 (cvs-bury-buffer (current-buffer) log-edit-parent-buffer)) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
479 (call-interactively log-edit-callback)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
480 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
481 (defun log-edit-files () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
482 "Return the list of files that are about to be committed." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
483 (ignore-errors (funcall log-edit-listfun))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
484 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
485 (defun log-edit-mode-help () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
486 "Provide help for the `log-edit-mode-map'." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
487 (interactive) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
488 (if (eq last-command 'log-edit-mode-help) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
489 (describe-function major-mode) |
65582
4d1085b02d64
Message format spec fixes (1)
Deepak Goel <deego@gnufans.org>
parents:
64762
diff
changeset
|
490 (message "%s" |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
491 (substitute-command-keys |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
492 "Type `\\[log-edit-done]' to finish commit. Try `\\[describe-function] log-edit-done' for more help.")))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
493 |
36616
61f696f7e5f9
(log-edit-common-indent): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34652
diff
changeset
|
494 (defcustom log-edit-common-indent 0 |
61f696f7e5f9
(log-edit-common-indent): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34652
diff
changeset
|
495 "Minimum indentation to use in `log-edit-set-common-indentation'." |
61f696f7e5f9
(log-edit-common-indent): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34652
diff
changeset
|
496 :group 'log-edit |
61f696f7e5f9
(log-edit-common-indent): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34652
diff
changeset
|
497 :type 'integer) |
61f696f7e5f9
(log-edit-common-indent): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34652
diff
changeset
|
498 |
61f696f7e5f9
(log-edit-common-indent): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34652
diff
changeset
|
499 (defun log-edit-set-common-indentation () |
61f696f7e5f9
(log-edit-common-indent): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34652
diff
changeset
|
500 "(Un)Indent the current buffer rigidly to `log-edit-common-indent'." |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
501 (save-excursion |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
502 (let ((common (point-max))) |
108009
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
503 (rfc822-goto-eoh) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
504 (while (< (point) (point-max)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
505 (if (not (looking-at "^[ \t]*$")) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
506 (setq common (min common (current-indentation)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
507 (forward-line 1)) |
108009
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
508 (rfc822-goto-eoh) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
509 (indent-rigidly (point) (point-max) |
36616
61f696f7e5f9
(log-edit-common-indent): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34652
diff
changeset
|
510 (- log-edit-common-indent common))))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
511 |
86908
6e9e38d61817
* log-edit.el (log-edit-show-diff): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82365
diff
changeset
|
512 (defun log-edit-show-diff () |
6e9e38d61817
* log-edit.el (log-edit-show-diff): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82365
diff
changeset
|
513 "Show the diff for the files to be committed." |
6e9e38d61817
* log-edit.el (log-edit-show-diff): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82365
diff
changeset
|
514 (interactive) |
86909
71145ecef766
* (log-edit-show-diff): Error out if the diff function is not set.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
86908
diff
changeset
|
515 (if (functionp log-edit-diff-function) |
71145ecef766
* (log-edit-show-diff): Error out if the diff function is not set.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
86908
diff
changeset
|
516 (funcall log-edit-diff-function) |
71145ecef766
* (log-edit-show-diff): Error out if the diff function is not set.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
86908
diff
changeset
|
517 (error "Diff functionality has not been setup"))) |
86908
6e9e38d61817
* log-edit.el (log-edit-show-diff): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82365
diff
changeset
|
518 |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
519 (defun log-edit-show-files () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
520 "Show the list of files to be committed." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
521 (interactive) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
522 (let* ((files (log-edit-files)) |
34405
ef4ba02580f0
(log-edit-parent-buffer): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34304
diff
changeset
|
523 (buf (get-buffer-create log-edit-files-buf))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
524 (with-current-buffer buf |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
525 (log-edit-hide-buf buf 'all) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
526 (setq buffer-read-only nil) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
527 (erase-buffer) |
33232
abfd948c10d4
(log-edit-show-files): Use cvs-insert-strings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33180
diff
changeset
|
528 (cvs-insert-strings files) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
529 (setq buffer-read-only t) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
530 (goto-char (point-min)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
531 (save-selected-window |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
532 (cvs-pop-to-buffer-same-frame buf) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
533 (shrink-window-if-larger-than-buffer) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
534 (selected-window))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
535 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
536 (defun log-edit-insert-cvs-template () |
67183
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
537 "Insert the template specified by the CVS administrator, if any. |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
538 This simply uses the local CVS/Template file." |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
539 (interactive) |
105372
bd2966850aac
Use `called-interactively-p' instead of `interactive-p'.
Juanma Barranquero <lekktu@gmail.com>
parents:
105201
diff
changeset
|
540 (when (or (called-interactively-p 'interactive) |
bd2966850aac
Use `called-interactively-p' instead of `interactive-p'.
Juanma Barranquero <lekktu@gmail.com>
parents:
105201
diff
changeset
|
541 (= (point-min) (point-max))) |
67183
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
542 (when (file-readable-p "CVS/Template") |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
543 (insert-file-contents "CVS/Template")))) |
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40478
diff
changeset
|
544 |
67183
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
545 (defun log-edit-insert-cvs-rcstemplate () |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
546 "Insert the rcstemplate from the CVS repository. |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
547 This contacts the repository to get the rcstemplate file and |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
548 can thus take some time." |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
549 (interactive) |
105372
bd2966850aac
Use `called-interactively-p' instead of `interactive-p'.
Juanma Barranquero <lekktu@gmail.com>
parents:
105201
diff
changeset
|
550 (when (or (called-interactively-p 'interactive) |
bd2966850aac
Use `called-interactively-p' instead of `interactive-p'.
Juanma Barranquero <lekktu@gmail.com>
parents:
105201
diff
changeset
|
551 (= (point-min) (point-max))) |
67194
b4ad6ef2b752
(log-edit-insert-cvs-rcstemplate): Ignore stderr.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67183
diff
changeset
|
552 (when (file-readable-p "CVS/Root") |
b4ad6ef2b752
(log-edit-insert-cvs-rcstemplate): Ignore stderr.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67183
diff
changeset
|
553 ;; Ignore the stderr stuff, even if it's an error. |
b4ad6ef2b752
(log-edit-insert-cvs-rcstemplate): Ignore stderr.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67183
diff
changeset
|
554 (call-process "cvs" nil '(t nil) nil |
b4ad6ef2b752
(log-edit-insert-cvs-rcstemplate): Ignore stderr.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67183
diff
changeset
|
555 "checkout" "-p" "CVSROOT/rcstemplate")))) |
67183
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
556 |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
557 (defun log-edit-insert-filenames () |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
558 "Insert the list of files that are to be committed." |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
559 (interactive) |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
560 (insert "Affected files: \n" |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
561 (mapconcat 'identity (log-edit-files) " \n"))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
562 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
563 (defun log-edit-add-to-changelog () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
564 "Insert this log message into the appropriate ChangeLog file." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
565 (interactive) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
566 ;; Yuck! |
51368
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
567 (unless (string= (buffer-string) (ring-ref log-edit-comment-ring 0)) |
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
568 (ring-insert log-edit-comment-ring (buffer-string))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
569 (dolist (f (log-edit-files)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
570 (let ((buffer-file-name (expand-file-name f))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
571 (save-excursion |
51368
cc73795bc08a
(log-edit-maximum-comment-ring-size, log-edit-comment-ring)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51065
diff
changeset
|
572 (log-edit-comment-to-change-log))))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
573 |
67183
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
574 (defvar log-edit-changelog-use-first nil) |
111208
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
575 |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
576 (defvar log-edit-rewrite-fixes nil |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
577 "Rule to rewrite bug numbers into Fixes: headers. |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
578 The value should be of the form (REGEXP . REPLACEMENT) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
579 where REGEXP should match the expression referring to a bug number |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
580 in the text, and REPLACEMENT is an expression to pass to `replace-match' |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
581 to build the Fixes: header.") |
111219
88ac54c22b2b
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): State its safety pred.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111208
diff
changeset
|
582 (put 'log-edit-rewrite-fixes 'safe-local-variable |
88ac54c22b2b
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): State its safety pred.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111208
diff
changeset
|
583 (lambda (v) (and (stringp (car-safe v)) (stringp (cdr v))))) |
111208
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
584 |
67183
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
585 (defun log-edit-insert-changelog (&optional use-first) |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
586 "Insert a log message by looking at the ChangeLog. |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
587 The idea is to write your ChangeLog entries first, and then use this |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
588 command to commit your changes. |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
589 |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
590 To select default log text, we: |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
591 - find the ChangeLog entries for the files to be checked in, |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
592 - verify that the top entry in the ChangeLog is on the current date |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
593 and by the current user; if not, we don't provide any default text, |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
594 - search the ChangeLog entry for paragraphs containing the names of |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
595 the files we're checking in, and finally |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
596 - use those paragraphs as the log text. |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
597 |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
598 If the optional prefix arg USE-FIRST is given (via \\[universal-argument]), |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
599 or if the command is repeated a second time in a row, use the first log entry |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
600 regardless of user name or time." |
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
601 (interactive "P") |
108009
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
602 (let ((eoh (save-excursion (rfc822-goto-eoh) (point)))) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
603 (when (<= (point) eoh) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
604 (goto-char eoh) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
605 (if (looking-at "\n") (forward-char 1)))) |
111208
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
606 (let ((author |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
607 (let ((log-edit-changelog-use-first |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
608 (or use-first (eq last-command 'log-edit-insert-changelog)))) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
609 (log-edit-insert-changelog-entries (log-edit-files))))) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
610 (log-edit-set-common-indentation) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
611 ;; Add an Author: field if appropriate. |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
612 (when author |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
613 (rfc822-goto-eoh) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
614 (insert "Author: " author "\n" (if (looking-at "\n") "" "\n"))) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
615 ;; Add a Fixes: field if applicable. |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
616 (when (consp log-edit-rewrite-fixes) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
617 (rfc822-goto-eoh) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
618 (when (re-search-forward (car log-edit-rewrite-fixes) nil t) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
619 (let ((start (match-beginning 0)) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
620 (end (match-end 0)) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
621 (fixes (match-substitute-replacement |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
622 (cdr log-edit-rewrite-fixes)))) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
623 (delete-region start end) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
624 (rfc822-goto-eoh) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
625 (insert "Fixes: " fixes "\n" (if (looking-at "\n") "" "\n"))))) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
626 (goto-char (point-min)) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
627 (when (and log-edit-strip-single-file-name (looking-at "\\*\\s-+")) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
628 (forward-line 1) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
629 (when (not (re-search-forward "^\\*\\s-+" nil t)) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
630 (goto-char (point-min)) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
631 (skip-chars-forward "^():") |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
632 (skip-chars-forward ": ") |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
633 (delete-region (point-min) (point)))))) |
67183
2ff424a9019b
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65689
diff
changeset
|
634 |
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40478
diff
changeset
|
635 ;;;; |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
636 ;;;; functions for getting commit message from ChangeLog a file... |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
637 ;;;; Courtesy Jim Blandy |
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40478
diff
changeset
|
638 ;;;; |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
639 |
28860
40a22b85650e
(cvs-changelog-full-paragraphs): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28340
diff
changeset
|
640 (defun log-edit-narrow-changelog () |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
641 "Narrow to the top page of the current buffer, a ChangeLog file. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
642 Actually, the narrowed region doesn't include the date line. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
643 A \"page\" in a ChangeLog file is the area between two dates." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
644 (or (eq major-mode 'change-log-mode) |
28860
40a22b85650e
(cvs-changelog-full-paragraphs): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28340
diff
changeset
|
645 (error "log-edit-narrow-changelog: current buffer isn't a ChangeLog")) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
646 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
647 (goto-char (point-min)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
648 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
649 ;; Skip date line and subsequent blank lines. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
650 (forward-line 1) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
651 (if (looking-at "[ \t\n]*\n") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
652 (goto-char (match-end 0))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
653 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
654 (let ((start (point))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
655 (forward-page 1) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
656 (narrow-to-region start (point)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
657 (goto-char (point-min)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
658 |
28860
40a22b85650e
(cvs-changelog-full-paragraphs): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28340
diff
changeset
|
659 (defun log-edit-changelog-paragraph () |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
660 "Return the bounds of the ChangeLog paragraph containing point. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
661 If we are between paragraphs, return the previous paragraph." |
105201
cdc275504289
(log-edit-changelog-entries): Avoid inf-loops.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104369
diff
changeset
|
662 (beginning-of-line) |
cdc275504289
(log-edit-changelog-entries): Avoid inf-loops.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104369
diff
changeset
|
663 (if (looking-at "^[ \t]*$") |
cdc275504289
(log-edit-changelog-entries): Avoid inf-loops.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104369
diff
changeset
|
664 (skip-chars-backward " \t\n" (point-min))) |
cdc275504289
(log-edit-changelog-entries): Avoid inf-loops.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104369
diff
changeset
|
665 (list (progn |
cdc275504289
(log-edit-changelog-entries): Avoid inf-loops.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104369
diff
changeset
|
666 (if (re-search-backward "^[ \t]*\n" nil 'or-to-limit) |
cdc275504289
(log-edit-changelog-entries): Avoid inf-loops.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104369
diff
changeset
|
667 (goto-char (match-end 0))) |
cdc275504289
(log-edit-changelog-entries): Avoid inf-loops.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104369
diff
changeset
|
668 (point)) |
cdc275504289
(log-edit-changelog-entries): Avoid inf-loops.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104369
diff
changeset
|
669 (if (re-search-forward "^[ \t\n]*$" nil t) |
cdc275504289
(log-edit-changelog-entries): Avoid inf-loops.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104369
diff
changeset
|
670 (match-beginning 0) |
cdc275504289
(log-edit-changelog-entries): Avoid inf-loops.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104369
diff
changeset
|
671 (point-max)))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
672 |
28860
40a22b85650e
(cvs-changelog-full-paragraphs): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28340
diff
changeset
|
673 (defun log-edit-changelog-subparagraph () |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
674 "Return the bounds of the ChangeLog subparagraph containing point. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
675 A subparagraph is a block of non-blank lines beginning with an asterisk. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
676 If we are between sub-paragraphs, return the previous subparagraph." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
677 (end-of-line) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
678 (if (search-backward "*" nil t) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
679 (list (progn (beginning-of-line) (point)) |
32816
f4923452ea45
(log-edit): Add :version and a :group for vc.
Dave Love <fx@gnu.org>
parents:
29398
diff
changeset
|
680 (progn |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
681 (forward-line 1) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
682 (if (re-search-forward "^[ \t]*[\n*]" nil t) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
683 (match-beginning 0) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
684 (point-max)))) |
105201
cdc275504289
(log-edit-changelog-entries): Avoid inf-loops.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104369
diff
changeset
|
685 (list (point) (point)))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
686 |
28860
40a22b85650e
(cvs-changelog-full-paragraphs): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28340
diff
changeset
|
687 (defun log-edit-changelog-entry () |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
688 "Return the bounds of the ChangeLog entry containing point. |
28860
40a22b85650e
(cvs-changelog-full-paragraphs): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28340
diff
changeset
|
689 The variable `log-edit-changelog-full-paragraphs' decides whether an |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
690 \"entry\" is a paragraph or a subparagraph; see its documentation string |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
691 for more details." |
105201
cdc275504289
(log-edit-changelog-entries): Avoid inf-loops.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104369
diff
changeset
|
692 (save-excursion |
cdc275504289
(log-edit-changelog-entries): Avoid inf-loops.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104369
diff
changeset
|
693 (if log-edit-changelog-full-paragraphs |
cdc275504289
(log-edit-changelog-entries): Avoid inf-loops.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104369
diff
changeset
|
694 (log-edit-changelog-paragraph) |
cdc275504289
(log-edit-changelog-entries): Avoid inf-loops.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104369
diff
changeset
|
695 (log-edit-changelog-subparagraph)))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
696 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
697 (defvar user-full-name) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
698 (defvar user-mail-address) |
111208
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
699 |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
700 (defvar log-edit-author) ;Dynamically scoped. |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
701 |
28860
40a22b85650e
(cvs-changelog-full-paragraphs): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28340
diff
changeset
|
702 (defun log-edit-changelog-ours-p () |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
703 "See if ChangeLog entry at point is for the current user, today. |
78492
7c8949dbfa0d
Replace `iff' in doc-strings and comments.
Glenn Morris <rgm@gnu.org>
parents:
78236
diff
changeset
|
704 Return non-nil if it is." |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
705 ;; Code adapted from add-change-log-entry. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
706 (let ((name (or (and (boundp 'add-log-full-name) add-log-full-name) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
707 (and (fboundp 'user-full-name) (user-full-name)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
708 (and (boundp 'user-full-name) user-full-name))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
709 (mail (or (and (boundp 'add-log-mailing-address) add-log-mailing-address) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
710 ;;(and (fboundp 'user-mail-address) (user-mail-address)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
711 (and (boundp 'user-mail-address) user-mail-address))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
712 (time (or (and (boundp 'add-log-time-format) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
713 (functionp add-log-time-format) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
714 (funcall add-log-time-format)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
715 (format-time-string "%Y-%m-%d")))) |
111208
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
716 (if (null log-edit-changelog-use-first) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
717 (looking-at (regexp-quote (format "%s %s <%s>" time name mail))) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
718 ;; Check the author, to potentially add it as a "Author: " header. |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
719 (when (looking-at "[^ \t]") |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
720 (when (and (boundp 'log-edit-author) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
721 (not (looking-at (format ".+ .+ <%s>" |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
722 (regexp-quote mail)))) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
723 (looking-at ".+ \\(.+ <.+>\\)")) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
724 (let ((author (replace-regexp-in-string " " " " |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
725 (match-string 1)))) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
726 (unless (and log-edit-author |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
727 (string-match (regexp-quote author) log-edit-author)) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
728 (setq log-edit-author |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
729 (if log-edit-author |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
730 (concat log-edit-author ", " author) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
731 author))))) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
732 t)))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
733 |
28860
40a22b85650e
(cvs-changelog-full-paragraphs): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28340
diff
changeset
|
734 (defun log-edit-changelog-entries (file) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
735 "Return the ChangeLog entries for FILE, and the ChangeLog they came from. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
736 The return value looks like this: |
108782
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
737 (LOGBUFFER (ENTRYSTART ENTRYEND) ...) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
738 where LOGBUFFER is the name of the ChangeLog buffer, and each |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
739 \(ENTRYSTART . ENTRYEND\) pair is a buffer region." |
81618
42755149d51d
(log-edit-changelog-entries): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77816
diff
changeset
|
740 (let ((changelog-file-name |
42755149d51d
(log-edit-changelog-entries): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77816
diff
changeset
|
741 (let ((default-directory |
42755149d51d
(log-edit-changelog-entries): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77816
diff
changeset
|
742 (file-name-directory (expand-file-name file))) |
42755149d51d
(log-edit-changelog-entries): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77816
diff
changeset
|
743 (visiting-buffer (find-buffer-visiting file))) |
42755149d51d
(log-edit-changelog-entries): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77816
diff
changeset
|
744 ;; If there is a buffer visiting FILE, and it has a local |
42755149d51d
(log-edit-changelog-entries): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77816
diff
changeset
|
745 ;; value for `change-log-default-name', use that. |
42755149d51d
(log-edit-changelog-entries): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77816
diff
changeset
|
746 (if (and visiting-buffer |
42755149d51d
(log-edit-changelog-entries): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77816
diff
changeset
|
747 (local-variable-p 'change-log-default-name |
42755149d51d
(log-edit-changelog-entries): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77816
diff
changeset
|
748 visiting-buffer)) |
42755149d51d
(log-edit-changelog-entries): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77816
diff
changeset
|
749 (with-current-buffer visiting-buffer |
42755149d51d
(log-edit-changelog-entries): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77816
diff
changeset
|
750 change-log-default-name) |
42755149d51d
(log-edit-changelog-entries): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77816
diff
changeset
|
751 ;; `find-change-log' uses `change-log-default-name' if set |
42755149d51d
(log-edit-changelog-entries): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77816
diff
changeset
|
752 ;; and sets it before exiting, so we need to work around |
42755149d51d
(log-edit-changelog-entries): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77816
diff
changeset
|
753 ;; that memoizing which is undesired here |
42755149d51d
(log-edit-changelog-entries): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77816
diff
changeset
|
754 (setq change-log-default-name nil) |
42755149d51d
(log-edit-changelog-entries): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77816
diff
changeset
|
755 (find-change-log))))) |
42755149d51d
(log-edit-changelog-entries): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77816
diff
changeset
|
756 (with-current-buffer (find-file-noselect changelog-file-name) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
757 (unless (eq major-mode 'change-log-mode) (change-log-mode)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
758 (goto-char (point-min)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
759 (if (looking-at "\\s-*\n") (goto-char (match-end 0))) |
28860
40a22b85650e
(cvs-changelog-full-paragraphs): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28340
diff
changeset
|
760 (if (not (log-edit-changelog-ours-p)) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
761 (list (current-buffer)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
762 (save-restriction |
28860
40a22b85650e
(cvs-changelog-full-paragraphs): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28340
diff
changeset
|
763 (log-edit-narrow-changelog) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
764 (goto-char (point-min)) |
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40478
diff
changeset
|
765 |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
766 ;; Search for the name of FILE relative to the ChangeLog. If that |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
767 ;; doesn't occur anywhere, they're not using full relative |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
768 ;; filenames in the ChangeLog, so just look for FILE; we'll accept |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
769 ;; some false positives. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
770 (let ((pattern (file-relative-name |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
771 file (file-name-directory changelog-file-name)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
772 (if (or (string= pattern "") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
773 (not (save-excursion |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
774 (search-forward pattern nil t)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
775 (setq pattern (file-name-nondirectory file))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
776 |
62707
08bad0f3de3f
(log-edit-changelog-entries): Distinguish between
Nick Roberts <nickrob@snap.net.nz>
parents:
59996
diff
changeset
|
777 (setq pattern (concat "\\(^\\|[^[:alnum:]]\\)" |
08bad0f3de3f
(log-edit-changelog-entries): Distinguish between
Nick Roberts <nickrob@snap.net.nz>
parents:
59996
diff
changeset
|
778 pattern |
08bad0f3de3f
(log-edit-changelog-entries): Distinguish between
Nick Roberts <nickrob@snap.net.nz>
parents:
59996
diff
changeset
|
779 "\\($\\|[^[:alnum:]]\\)")) |
08bad0f3de3f
(log-edit-changelog-entries): Distinguish between
Nick Roberts <nickrob@snap.net.nz>
parents:
59996
diff
changeset
|
780 |
105201
cdc275504289
(log-edit-changelog-entries): Avoid inf-loops.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104369
diff
changeset
|
781 (let (texts |
cdc275504289
(log-edit-changelog-entries): Avoid inf-loops.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104369
diff
changeset
|
782 (pos (point))) |
cdc275504289
(log-edit-changelog-entries): Avoid inf-loops.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104369
diff
changeset
|
783 (while (and (not (eobp)) (re-search-forward pattern nil t)) |
28860
40a22b85650e
(cvs-changelog-full-paragraphs): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28340
diff
changeset
|
784 (let ((entry (log-edit-changelog-entry))) |
105201
cdc275504289
(log-edit-changelog-entries): Avoid inf-loops.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104369
diff
changeset
|
785 (if (< (elt entry 1) (max (1+ pos) (point))) |
cdc275504289
(log-edit-changelog-entries): Avoid inf-loops.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104369
diff
changeset
|
786 ;; This is not relevant, actually. |
cdc275504289
(log-edit-changelog-entries): Avoid inf-loops.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104369
diff
changeset
|
787 nil |
cdc275504289
(log-edit-changelog-entries): Avoid inf-loops.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104369
diff
changeset
|
788 (push entry texts)) |
cdc275504289
(log-edit-changelog-entries): Avoid inf-loops.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104369
diff
changeset
|
789 ;; Make sure we make progress. |
cdc275504289
(log-edit-changelog-entries): Avoid inf-loops.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104369
diff
changeset
|
790 (setq pos (max (1+ pos) (elt entry 1))) |
cdc275504289
(log-edit-changelog-entries): Avoid inf-loops.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104369
diff
changeset
|
791 (goto-char pos))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
792 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
793 (cons (current-buffer) texts)))))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
794 |
108782
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
795 (defun log-edit-changelog-insert-entries (buffer beg end &rest files) |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
796 "Insert the text from BUFFER between BEG and END. |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
797 Rename relative filenames in the ChangeLog entry as FILES." |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
798 (let ((opoint (point)) |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
799 (log-name (buffer-file-name buffer)) |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
800 (case-fold-search nil) |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
801 bound) |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
802 (insert-buffer-substring buffer beg end) |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
803 (setq bound (point-marker)) |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
804 (when log-name |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
805 (dolist (f files) |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
806 (save-excursion |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
807 (goto-char opoint) |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
808 (when (re-search-forward |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
809 (concat "\\(^\\|[ \t]\\)\\(" |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
810 (file-relative-name f (file-name-directory log-name)) |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
811 "\\)[, :\n]") |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
812 bound t) |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
813 (replace-match f t t nil 2))))) |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
814 ;; Eliminate tabs at the beginning of the line. |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
815 (save-excursion |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
816 (goto-char opoint) |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
817 (while (re-search-forward "^\\(\t+\\)" bound t) |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
818 (replace-match ""))))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
819 |
28860
40a22b85650e
(cvs-changelog-full-paragraphs): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28340
diff
changeset
|
820 (defun log-edit-insert-changelog-entries (files) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
821 "Given a list of files FILES, insert the ChangeLog entries for them." |
111208
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
822 (let ((log-entries nil) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
823 (log-edit-author nil)) |
108782
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
824 ;; Note that any ChangeLog entry can apply to more than one file. |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
825 ;; Here we construct a log-entries list with elements of the form |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
826 ;; ((LOGBUFFER ENTRYSTART ENTRYEND) FILE1 FILE2...) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
827 (dolist (file files) |
28860
40a22b85650e
(cvs-changelog-full-paragraphs): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28340
diff
changeset
|
828 (let* ((entries (log-edit-changelog-entries file)) |
108782
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
829 (buf (car entries)) |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
830 key entry) |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
831 (dolist (region (cdr entries)) |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
832 (setq key (cons buf region)) |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
833 (if (setq entry (assoc key log-entries)) |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
834 (setcdr entry (append (cdr entry) (list file))) |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
835 (push (list key file) log-entries))))) |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
836 ;; Now map over log-entries, and extract the strings. |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
837 (dolist (log-entry (nreverse log-entries)) |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
838 (apply 'log-edit-changelog-insert-entries |
549433326e7e
Rename relative filenames in ChangeLog entries according to root.
Chong Yidong <cyd@stupidchicken.com>
parents:
108009
diff
changeset
|
839 (append (car log-entry) (cdr log-entry))) |
111208
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
840 (insert "\n")) |
7608f4a2422d
* lisp/vc/log-edit.el (log-edit-rewrite-fixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108980
diff
changeset
|
841 log-edit-author)) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
842 |
108009
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
843 (defun log-edit-extract-headers (headers comment) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
844 "Extract headers from COMMENT to form command line arguments. |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
845 HEADERS should be an alist with elements of the form (HEADER . CMDARG) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
846 associating header names to the corresponding cmdline option name and the |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
847 result is then a list of the form (MSG CMDARG1 HDRTEXT1 CMDARG2 HDRTEXT2...). |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
848 where MSG is the remaining text from STRING. |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
849 If \"Summary\" is not in HEADERS, then the \"Summary\" header is extracted |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
850 anyway and put back as the first line of MSG." |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
851 (with-temp-buffer |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
852 (insert comment) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
853 (rfc822-goto-eoh) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
854 (narrow-to-region (point-min) (point)) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
855 (let ((case-fold-search t) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
856 (summary ()) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
857 (res ())) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
858 (dolist (header (if (assoc "Summary" headers) headers |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
859 (cons '("Summary" . t) headers))) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
860 (goto-char (point-min)) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
861 (while (re-search-forward (concat "^" (car header) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
862 ":" log-edit-header-contents-regexp) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
863 nil t) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
864 (if (eq t (cdr header)) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
865 (setq summary (match-string 1)) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
866 (push (match-string 1) res) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
867 (push (or (cdr header) (car header)) res)) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
868 (replace-match "" t t))) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
869 ;; Remove header separator if the header is empty. |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
870 (widen) |
107430
1918e70c8b37
Add special markup processing for commit logs.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107374
diff
changeset
|
871 (goto-char (point-min)) |
108009
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
872 (when (looking-at "\\([ \t]*\n\\)+") |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
873 (delete-region (match-beginning 0) (match-end 0))) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
874 (if summary (insert summary "\n")) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107482
diff
changeset
|
875 (cons (buffer-string) res)))) |
107430
1918e70c8b37
Add special markup processing for commit logs.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107374
diff
changeset
|
876 |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
877 (provide 'log-edit) |
28338
8da42323f5d5
(log-edit-mode-map): Inherit from vc-log-mode-map
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
878 |
62707
08bad0f3de3f
(log-edit-changelog-entries): Distinguish between
Nick Roberts <nickrob@snap.net.nz>
parents:
59996
diff
changeset
|
879 ;; arch-tag: 8089b39c-983b-4e83-93cd-ed0a64c7fdcc |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
880 ;;; log-edit.el ends here |