(realize_default_face): Do not abort if lface is non-existent -
[emacs.git] / lisp / log-edit.el
blob28da8d8217c381c8db6a246649251e326b50970a
1 ;;; log-edit.el --- Major mode for editing CVS commit messages
3 ;; Copyright (C) 1999,2000,2003 Free Software Foundation, Inc.
5 ;; Author: Stefan Monnier <monnier@cs.yale.edu>
6 ;; Keywords: pcl-cvs cvs commit log
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
25 ;;; Commentary:
27 ;; Todo:
29 ;; - Move in VC's code
30 ;; - Add compatibility for VC's hook variables
32 ;;; Code:
34 (eval-when-compile (require 'cl))
35 (require 'add-log) ; for all the ChangeLog goodies
36 (require 'pcvs-util)
37 (require 'ring)
39 ;;;;
40 ;;;; Global Variables
41 ;;;;
43 (defgroup log-edit nil
44 "Major mode for editing RCS and CVS commit messages."
45 :group 'pcl-cvs
46 :group 'vc ; It's used by VC.
47 :version "21.1"
48 :prefix "log-edit-")
50 ;; compiler pacifiers
51 (defvar cvs-buffer)
54 ;; The main keymap
56 (easy-mmode-defmap log-edit-mode-map
57 `(("\C-c\C-c" . log-edit-done)
58 ("\C-c\C-a" . log-edit-insert-changelog)
59 ("\C-c\C-f" . log-edit-show-files)
60 ("\M-n" . vc-next-comment)
61 ("\M-p" . vc-previous-comment)
62 ("\M-r" . vc-comment-search-reverse)
63 ("\M-s" . vc-comment-search-forward)
64 ("\C-c?" . log-edit-mode-help))
65 "Keymap for the `log-edit-mode' (to edit version control log messages)."
66 :group 'log-edit)
68 ;; Compatibility with old names. Should we bother ?
69 (defvar vc-log-mode-map log-edit-mode-map)
70 (defvar vc-log-entry-mode vc-log-mode-map)
72 (easy-menu-define log-edit-menu log-edit-mode-map
73 "Menu used for `log-edit-mode'."
74 '("Log-Edit"
75 ["Done" log-edit-done
76 :help "Exit log-edit and proceed with the actual action."]
77 "--"
78 ["Insert ChangeLog" log-edit-insert-changelog]
79 ["Add to ChangeLog" log-edit-add-to-changelog]
80 "--"
81 ["List files" log-edit-show-files
82 :help "Show the list of relevant files."]
83 "--"
84 ["Previous comment" vc-previous-comment]
85 ["Next comment" vc-next-comment]
86 ["Search comment forward" vc-comment-search-forward]
87 ["Search comment backward" vc-comment-search-reverse]))
89 (defcustom log-edit-confirm 'changed
90 "*If non-nil, `log-edit-done' will request confirmation.
91 If 'changed, only request confirmation if the list of files has
92 changed since the beginning of the log-edit session."
93 :group 'log-edit
94 :type '(choice (const changed) (const t) (const nil)))
96 (defcustom log-edit-keep-buffer nil
97 "*If non-nil, don't hide the buffer after `log-edit-done'."
98 :group 'log-edit
99 :type 'boolean)
101 (defvar cvs-commit-buffer-require-final-newline t)
102 (make-obsolete-variable 'cvs-commit-buffer-require-final-newline
103 'log-edit-require-final-newline)
105 (defcustom log-edit-require-final-newline
106 cvs-commit-buffer-require-final-newline
107 "*Enforce a newline at the end of commit log messages.
108 Enforce it silently if t, query if non-nil and don't do anything if nil."
109 :group 'log-edit
110 :type '(choice (const ask) (const t) (const nil)))
112 (defcustom log-edit-setup-invert nil
113 "*Non-nil means `log-edit' should invert the meaning of its SETUP arg.
114 If SETUP is 'force, this variable has no effect."
115 :group 'log-edit
116 :type 'boolean)
118 (defcustom log-edit-hook '(log-edit-insert-cvs-template
119 log-edit-insert-changelog)
120 "*Hook run at the end of `log-edit'."
121 :group 'log-edit
122 :type '(hook :options (log-edit-insert-cvs-template
123 log-edit-insert-changelog)))
125 (defcustom log-edit-mode-hook (if (boundp 'vc-log-mode-hook) vc-log-mode-hook)
126 "*Hook run when entering `log-edit-mode'."
127 :group 'log-edit
128 :type 'hook)
130 (defcustom log-edit-done-hook nil
131 "*Hook run before doing the actual commit.
132 This hook can be used to cleanup the message, enforce various
133 conventions, or to allow recording the message in some other database,
134 such as a bug-tracking system. The list of files about to be committed
135 can be obtained from `log-edit-files'."
136 :group 'log-edit
137 :type '(hook :options (log-edit-set-common-indentation
138 log-edit-add-to-changelog)))
140 (defvar cvs-changelog-full-paragraphs t)
141 (make-obsolete-variable 'cvs-changelog-full-paragraphs
142 'log-edit-changelog-full-paragraphs)
144 (defvar log-edit-changelog-full-paragraphs cvs-changelog-full-paragraphs
145 "*If non-nil, include full ChangeLog paragraphs in the log.
146 This may be set in the ``local variables'' section of a ChangeLog, to
147 indicate the policy for that ChangeLog.
149 A ChangeLog paragraph is a bunch of log text containing no blank lines;
150 a paragraph usually describes a set of changes with a single purpose,
151 but perhaps spanning several functions in several files. Changes in
152 different paragraphs are unrelated.
154 You could argue that the log entry for a file should contain the
155 full ChangeLog paragraph mentioning the change to the file, even though
156 it may mention other files, because that gives you the full context you
157 need to understand the change. This is the behaviour you get when this
158 variable is set to t.
160 On the other hand, you could argue that the log entry for a change
161 should contain only the text for the changes which occurred in that
162 file, because the log is per-file. This is the behaviour you get
163 when this variable is set to nil.")
165 ;;;; Internal global or buffer-local vars
167 (defconst log-edit-files-buf "*log-edit-files*")
168 (defvar log-edit-initial-files nil)
169 (defvar log-edit-callback nil)
170 (defvar log-edit-listfun nil)
171 (defvar log-edit-parent-buffer nil)
173 ;;; Taken from VC-Log mode
175 (defconst vc-maximum-comment-ring-size 32
176 "Maximum number of saved comments in the comment ring.")
177 (defvar vc-comment-ring (make-ring vc-maximum-comment-ring-size))
178 (defvar vc-comment-ring-index nil)
179 (defvar vc-last-comment-match "")
181 (defun vc-new-comment-index (stride len)
182 "Return the comment index STRIDE elements from the current one.
183 LEN is the length of `vc-comment-ring'."
184 (mod (cond
185 (vc-comment-ring-index (+ vc-comment-ring-index stride))
186 ;; Initialize the index on the first use of this command
187 ;; so that the first M-p gets index 0, and the first M-n gets
188 ;; index -1.
189 ((> stride 0) (1- stride))
190 (t stride))
191 len))
193 (defun vc-previous-comment (arg)
194 "Cycle backwards through comment history.
195 With a numeric prefix ARG, go back ARG comments."
196 (interactive "*p")
197 (let ((len (ring-length vc-comment-ring)))
198 (if (<= len 0)
199 (progn (message "Empty comment ring") (ding))
200 ;; Don't use `erase-buffer' because we don't want to `widen'.
201 (delete-region (point-min) (point-max))
202 (setq vc-comment-ring-index (vc-new-comment-index arg len))
203 (message "Comment %d" (1+ vc-comment-ring-index))
204 (insert (ring-ref vc-comment-ring vc-comment-ring-index)))))
206 (defun vc-next-comment (arg)
207 "Cycle forwards through comment history.
208 With a numeric prefix ARG, go forward ARG comments."
209 (interactive "*p")
210 (vc-previous-comment (- arg)))
212 (defun vc-comment-search-reverse (str &optional stride)
213 "Search backwards through comment history for substring match of STR.
214 If the optional argument STRIDE is present, that is a step-width to use
215 when going through the comment ring."
216 ;; Why substring rather than regexp ? -sm
217 (interactive
218 (list (read-string "Comment substring: " nil nil vc-last-comment-match)))
219 (unless stride (setq stride 1))
220 (if (string= str "")
221 (setq str vc-last-comment-match)
222 (setq vc-last-comment-match str))
223 (let* ((str (regexp-quote str))
224 (len (ring-length vc-comment-ring))
225 (n (vc-new-comment-index stride len)))
226 (while (progn (when (or (>= n len) (< n 0)) (error "Not found"))
227 (not (string-match str (ring-ref vc-comment-ring n))))
228 (setq n (+ n stride)))
229 (setq vc-comment-ring-index n)
230 (vc-previous-comment 0)))
232 (defun vc-comment-search-forward (str)
233 "Search forwards through comment history for a substring match of STR."
234 (interactive
235 (list (read-string "Comment substring: " nil nil vc-last-comment-match)))
236 (vc-comment-search-reverse str -1))
240 (defun vc-comment-to-change-log (&optional whoami file-name)
241 "Enter last VC comment into the change log for the current file.
242 WHOAMI (interactive prefix) non-nil means prompt for user name
243 and site. FILE-NAME is the name of the change log; if nil, use
244 `change-log-default-name'.
246 This may be useful as a `vc-checkin-hook' to update change logs
247 automatically."
248 (interactive (if current-prefix-arg
249 (list current-prefix-arg
250 (prompt-for-change-log-name))))
251 (let (;; Extract the comment first so we get any error before doing anything.
252 (comment (ring-ref vc-comment-ring 0))
253 ;; Don't let add-change-log-entry insert a defun name.
254 (add-log-current-defun-function 'ignore)
255 end)
256 ;; Call add-log to do half the work.
257 (add-change-log-entry whoami file-name t t)
258 ;; Insert the VC comment, leaving point before it.
259 (setq end (save-excursion (insert comment) (point-marker)))
260 (if (looking-at "\\s *\\s(")
261 ;; It starts with an open-paren, as in "(foo): Frobbed."
262 ;; So remove the ": " add-log inserted.
263 (delete-char -2))
264 ;; Canonicalize the white space between the file name and comment.
265 (just-one-space)
266 ;; Indent rest of the text the same way add-log indented the first line.
267 (let ((indentation (current-indentation)))
268 (save-excursion
269 (while (< (point) end)
270 (forward-line 1)
271 (indent-to indentation))
272 (setq end (point))))
273 ;; Fill the inserted text, preserving open-parens at bol.
274 (let ((paragraph-start (concat paragraph-start "\\|\\s *\\s(")))
275 (beginning-of-line)
276 (fill-region (point) end))
277 ;; Canonicalize the white space at the end of the entry so it is
278 ;; separated from the next entry by a single blank line.
279 (skip-syntax-forward " " end)
280 (delete-char (- (skip-syntax-backward " ")))
281 (or (eobp) (looking-at "\n\n")
282 (insert "\n"))))
285 ;;; Actual code
288 ;;;###autoload
289 (defun log-edit (callback &optional setup listfun buffer &rest ignore)
290 "Setup a buffer to enter a log message.
291 \\<log-edit-mode-map>The buffer will be put in `log-edit-mode'.
292 If SETUP is non-nil, the buffer is then erased and `log-edit-hook' is run.
293 Mark and point will be set around the entire contents of the
294 buffer so that it is easy to kill the contents of the buffer with \\[kill-region].
295 Once you're done editing the message, pressing \\[log-edit-done] will call
296 `log-edit-done' which will end up calling CALLBACK to do the actual commit.
297 LISTFUN if non-nil is a function of no arguments returning the list of files
298 that are concerned by the current operation (using relative names).
299 If BUFFER is non-nil `log-edit' will jump to that buffer, use it to edit the
300 log message and go back to the current buffer when done. Otherwise, it
301 uses the current buffer."
302 (let ((parent (current-buffer)))
303 (if buffer (pop-to-buffer buffer))
304 (when (and log-edit-setup-invert (not (eq setup 'force)))
305 (setq setup (not setup)))
306 (when setup (erase-buffer))
307 (log-edit-mode)
308 (set (make-local-variable 'log-edit-callback) callback)
309 (set (make-local-variable 'log-edit-listfun) listfun)
310 (if buffer (set (make-local-variable 'log-edit-parent-buffer) parent))
311 (set (make-local-variable 'log-edit-initial-files) (log-edit-files))
312 (when setup (run-hooks 'log-edit-hook))
313 (goto-char (point-min)) (push-mark (point-max))
314 (message (substitute-command-keys
315 "Press \\[log-edit-done] when you are done editing."))))
317 (define-derived-mode log-edit-mode text-mode "Log-Edit"
318 "Major mode for editing version-control log messages.
319 When done editing the log entry, just type \\[log-edit-done] which
320 will trigger the actual commit of the file(s).
321 Several other handy support commands are provided of course and
322 the package from which this is used might also provide additional
323 commands (under C-x v for VC, for example).
325 \\{log-edit-mode-map}"
326 (make-local-variable 'vc-comment-ring-index))
328 (defun log-edit-hide-buf (&optional buf where)
329 (when (setq buf (get-buffer (or buf log-edit-files-buf)))
330 (let ((win (get-buffer-window buf where)))
331 (if win (ignore-errors (delete-window win))))
332 (bury-buffer buf)))
334 (defun log-edit-done ()
335 "Finish editing the log message and commit the files.
336 If you want to abort the commit, simply delete the buffer."
337 (interactive)
338 ;; Get rid of trailing empty lines
339 (goto-char (point-max))
340 (skip-syntax-backward " ")
341 (when (equal (char-after) ?\n) (forward-char 1))
342 (delete-region (point) (point-max))
343 ;; Check for final newline
344 (if (and (> (point-max) (point-min))
345 (/= (char-before (point-max)) ?\n)
346 (or (eq log-edit-require-final-newline t)
347 (and log-edit-require-final-newline
348 (y-or-n-p
349 (format "Buffer %s does not end in newline. Add one? "
350 (buffer-name))))))
351 (save-excursion
352 (goto-char (point-max))
353 (insert ?\n)))
354 (let ((comment (buffer-string)))
355 (when (or (ring-empty-p vc-comment-ring)
356 (not (equal comment (ring-ref vc-comment-ring 0))))
357 (ring-insert vc-comment-ring comment)))
358 (let ((win (get-buffer-window log-edit-files-buf)))
359 (if (and log-edit-confirm
360 (not (and (eq log-edit-confirm 'changed)
361 (equal (log-edit-files) log-edit-initial-files)))
362 (progn
363 (log-edit-show-files)
364 (not (y-or-n-p "Really commit ? "))))
365 (progn (when (not win) (log-edit-hide-buf))
366 (message "Oh, well! Later maybe?"))
367 (run-hooks 'log-edit-done-hook)
368 (log-edit-hide-buf)
369 (unless (or log-edit-keep-buffer (not log-edit-parent-buffer))
370 (cvs-bury-buffer (current-buffer) log-edit-parent-buffer))
371 (call-interactively log-edit-callback))))
373 (defun log-edit-files ()
374 "Return the list of files that are about to be committed."
375 (ignore-errors (funcall log-edit-listfun)))
378 (defun log-edit-insert-changelog ()
379 "Insert a log message by looking at the ChangeLog.
380 The idea is to write your ChangeLog entries first, and then use this
381 command to commit your changes.
383 To select default log text, we:
384 - find the ChangeLog entries for the files to be checked in,
385 - verify that the top entry in the ChangeLog is on the current date
386 and by the current user; if not, we don't provide any default text,
387 - search the ChangeLog entry for paragraphs containing the names of
388 the files we're checking in, and finally
389 - use those paragraphs as the log text."
390 (interactive)
391 (log-edit-insert-changelog-entries (log-edit-files))
392 (log-edit-set-common-indentation)
393 (goto-char (point-min))
394 (when (looking-at "\\*\\s-+")
395 (forward-line 1)
396 (when (not (re-search-forward "^\\*\\s-+" nil t))
397 (goto-char (point-min))
398 (skip-chars-forward "^():")
399 (skip-chars-forward ": ")
400 (delete-region (point-min) (point)))))
402 (defun log-edit-mode-help ()
403 "Provide help for the `log-edit-mode-map'."
404 (interactive)
405 (if (eq last-command 'log-edit-mode-help)
406 (describe-function major-mode)
407 (message
408 (substitute-command-keys
409 "Type `\\[log-edit-done]' to finish commit. Try `\\[describe-function] log-edit-done' for more help."))))
411 (defcustom log-edit-common-indent 0
412 "Minimum indentation to use in `log-edit-set-common-indentation'."
413 :group 'log-edit
414 :type 'integer)
416 (defun log-edit-set-common-indentation ()
417 "(Un)Indent the current buffer rigidly to `log-edit-common-indent'."
418 (save-excursion
419 (let ((common (point-max)))
420 (goto-char (point-min))
421 (while (< (point) (point-max))
422 (if (not (looking-at "^[ \t]*$"))
423 (setq common (min common (current-indentation))))
424 (forward-line 1))
425 (indent-rigidly (point-min) (point-max)
426 (- log-edit-common-indent common)))))
428 (defun log-edit-show-files ()
429 "Show the list of files to be committed."
430 (interactive)
431 (let* ((files (log-edit-files))
432 (buf (get-buffer-create log-edit-files-buf)))
433 (with-current-buffer buf
434 (log-edit-hide-buf buf 'all)
435 (setq buffer-read-only nil)
436 (erase-buffer)
437 (cvs-insert-strings files)
438 (setq buffer-read-only t)
439 (goto-char (point-min))
440 (save-selected-window
441 (cvs-pop-to-buffer-same-frame buf)
442 (shrink-window-if-larger-than-buffer)
443 (selected-window)))))
445 (defun log-edit-insert-cvs-template ()
446 "Insert the template specified by the CVS administrator, if any."
447 (interactive)
448 (when (file-readable-p "CVS/Template")
449 (insert-file-contents "CVS/Template")))
452 (defun log-edit-add-to-changelog ()
453 "Insert this log message into the appropriate ChangeLog file."
454 (interactive)
455 ;; Yuck!
456 (unless (string= (buffer-string) (ring-ref vc-comment-ring 0))
457 (ring-insert vc-comment-ring (buffer-string)))
458 (dolist (f (log-edit-files))
459 (let ((buffer-file-name (expand-file-name f)))
460 (save-excursion
461 (vc-comment-to-change-log)))))
463 ;;;;
464 ;;;; functions for getting commit message from ChangeLog a file...
465 ;;;; Courtesy Jim Blandy
466 ;;;;
468 (defun log-edit-narrow-changelog ()
469 "Narrow to the top page of the current buffer, a ChangeLog file.
470 Actually, the narrowed region doesn't include the date line.
471 A \"page\" in a ChangeLog file is the area between two dates."
472 (or (eq major-mode 'change-log-mode)
473 (error "log-edit-narrow-changelog: current buffer isn't a ChangeLog"))
475 (goto-char (point-min))
477 ;; Skip date line and subsequent blank lines.
478 (forward-line 1)
479 (if (looking-at "[ \t\n]*\n")
480 (goto-char (match-end 0)))
482 (let ((start (point)))
483 (forward-page 1)
484 (narrow-to-region start (point))
485 (goto-char (point-min))))
487 (defun log-edit-changelog-paragraph ()
488 "Return the bounds of the ChangeLog paragraph containing point.
489 If we are between paragraphs, return the previous paragraph."
490 (save-excursion
491 (beginning-of-line)
492 (if (looking-at "^[ \t]*$")
493 (skip-chars-backward " \t\n" (point-min)))
494 (list (progn
495 (if (re-search-backward "^[ \t]*\n" nil 'or-to-limit)
496 (goto-char (match-end 0)))
497 (point))
498 (if (re-search-forward "^[ \t\n]*$" nil t)
499 (match-beginning 0)
500 (point)))))
502 (defun log-edit-changelog-subparagraph ()
503 "Return the bounds of the ChangeLog subparagraph containing point.
504 A subparagraph is a block of non-blank lines beginning with an asterisk.
505 If we are between sub-paragraphs, return the previous subparagraph."
506 (save-excursion
507 (end-of-line)
508 (if (search-backward "*" nil t)
509 (list (progn (beginning-of-line) (point))
510 (progn
511 (forward-line 1)
512 (if (re-search-forward "^[ \t]*[\n*]" nil t)
513 (match-beginning 0)
514 (point-max))))
515 (list (point) (point)))))
517 (defun log-edit-changelog-entry ()
518 "Return the bounds of the ChangeLog entry containing point.
519 The variable `log-edit-changelog-full-paragraphs' decides whether an
520 \"entry\" is a paragraph or a subparagraph; see its documentation string
521 for more details."
522 (if log-edit-changelog-full-paragraphs
523 (log-edit-changelog-paragraph)
524 (log-edit-changelog-subparagraph)))
526 (defvar user-full-name)
527 (defvar user-mail-address)
528 (defun log-edit-changelog-ours-p ()
529 "See if ChangeLog entry at point is for the current user, today.
530 Return non-nil iff it is."
531 ;; Code adapted from add-change-log-entry.
532 (let ((name (or (and (boundp 'add-log-full-name) add-log-full-name)
533 (and (fboundp 'user-full-name) (user-full-name))
534 (and (boundp 'user-full-name) user-full-name)))
535 (mail (or (and (boundp 'add-log-mailing-address) add-log-mailing-address)
536 ;;(and (fboundp 'user-mail-address) (user-mail-address))
537 (and (boundp 'user-mail-address) user-mail-address)))
538 (time (or (and (boundp 'add-log-time-format)
539 (functionp add-log-time-format)
540 (funcall add-log-time-format))
541 (format-time-string "%Y-%m-%d"))))
542 (looking-at (regexp-quote (format "%s %s <%s>" time name mail)))))
544 (defun log-edit-changelog-entries (file)
545 "Return the ChangeLog entries for FILE, and the ChangeLog they came from.
546 The return value looks like this:
547 (LOGBUFFER (ENTRYSTART . ENTRYEND) ...)
548 where LOGBUFFER is the name of the ChangeLog buffer, and each
549 \(ENTRYSTART . ENTRYEND\) pair is a buffer region."
550 (save-excursion
551 (let ((changelog-file-name
552 (let ((default-directory
553 (file-name-directory (expand-file-name file))))
554 ;; `find-change-log' uses `change-log-default-name' if set
555 ;; and sets it before exiting, so we need to work around
556 ;; that memoizing which is undesired here
557 (setq change-log-default-name nil)
558 (find-change-log))))
559 (set-buffer (find-file-noselect changelog-file-name))
560 (unless (eq major-mode 'change-log-mode) (change-log-mode))
561 (goto-char (point-min))
562 (if (looking-at "\\s-*\n") (goto-char (match-end 0)))
563 (if (not (log-edit-changelog-ours-p))
564 (list (current-buffer))
565 (save-restriction
566 (log-edit-narrow-changelog)
567 (goto-char (point-min))
569 ;; Search for the name of FILE relative to the ChangeLog. If that
570 ;; doesn't occur anywhere, they're not using full relative
571 ;; filenames in the ChangeLog, so just look for FILE; we'll accept
572 ;; some false positives.
573 (let ((pattern (file-relative-name
574 file (file-name-directory changelog-file-name))))
575 (if (or (string= pattern "")
576 (not (save-excursion
577 (search-forward pattern nil t))))
578 (setq pattern (file-name-nondirectory file)))
580 (let (texts)
581 (while (search-forward pattern nil t)
582 (let ((entry (log-edit-changelog-entry)))
583 (push entry texts)
584 (goto-char (elt entry 1))))
586 (cons (current-buffer) texts))))))))
588 (defun log-edit-changelog-insert-entries (buffer regions)
589 "Insert those regions in BUFFER specified in REGIONS.
590 Sort REGIONS front-to-back first."
591 (let ((regions (sort regions 'car-less-than-car))
592 (last))
593 (dolist (region regions)
594 (when (and last (< last (car region))) (newline))
595 (setq last (elt region 1))
596 (apply 'insert-buffer-substring buffer region))))
598 (defun log-edit-insert-changelog-entries (files)
599 "Given a list of files FILES, insert the ChangeLog entries for them."
600 (let ((buffer-entries nil))
602 ;; Add each buffer to buffer-entries, and associate it with the list
603 ;; of entries we want from that file.
604 (dolist (file files)
605 (let* ((entries (log-edit-changelog-entries file))
606 (pair (assq (car entries) buffer-entries)))
607 (if pair
608 (setcdr pair (cvs-union (cdr pair) (cdr entries)))
609 (push entries buffer-entries))))
611 ;; Now map over each buffer in buffer-entries, sort the entries for
612 ;; each buffer, and extract them as strings.
613 (dolist (buffer-entry buffer-entries)
614 (log-edit-changelog-insert-entries (car buffer-entry) (cdr buffer-entry))
615 (when (cdr buffer-entry) (newline)))))
617 (provide 'log-edit)
619 ;;; log-edit.el ends here