diff options
| author | Roland McGrath | 1993-07-18 23:54:45 +0000 |
|---|---|---|
| committer | Roland McGrath | 1993-07-18 23:54:45 +0000 |
| commit | 3b4dd9a931d1ca2ca2e8a5147261dcbe7eed65d6 (patch) | |
| tree | 6a7ac4caf831e390bea88fae1da158b38b3a9fc7 | |
| parent | 6258d3afe15818786d4700c0009247f53703b0da (diff) | |
| download | emacs-3b4dd9a931d1ca2ca2e8a5147261dcbe7eed65d6.tar.gz emacs-3b4dd9a931d1ca2ca2e8a5147261dcbe7eed65d6.zip | |
(vc-comment-to-change-log): Complete rewrite. Do not use
vc-update-change-log. Instead, snarf last comment from vc-comment-ring and
insert it with add-change-log-entry-other-window.
| -rw-r--r-- | lisp/vc.el | 47 |
1 files changed, 39 insertions, 8 deletions
diff --git a/lisp/vc.el b/lisp/vc.el index 6670ed68e9a..886576091e1 100644 --- a/lisp/vc.el +++ b/lisp/vc.el | |||
| @@ -584,15 +584,46 @@ popped up to accept a comment." | |||
| 584 | 584 | ||
| 585 | ;;; Here is a checkin hook that may prove useful to sites using the | 585 | ;;; Here is a checkin hook that may prove useful to sites using the |
| 586 | ;;; ChangeLog facility supported by Emacs. | 586 | ;;; ChangeLog facility supported by Emacs. |
| 587 | (defun vc-comment-to-change-log () | 587 | (defun vc-comment-to-change-log (&optional whoami file-name) |
| 588 | "Update change log from VC change comments entered for the current file. | 588 | "Enter last VC comment into change log file for current buffer's file. |
| 589 | See `vc-update-change-log'." | 589 | Optional arg (interactive prefix) non-nil means prompt for user name and site. |
| 590 | Second arg is file name of change log. \ | ||
| 591 | If nil, uses `change-log-default-name'." | ||
| 590 | (interactive) | 592 | (interactive) |
| 591 | (let ((log (find-change-log))) | 593 | (let (;; Extract the comment first so we get any error before doing anything. |
| 592 | (if log | 594 | (comment (ring-ref vc-comment-ring 0)) |
| 593 | (vc-update-change-log | 595 | ;; Don't let add-change-log-entry insert anything but the file name. |
| 594 | (file-relative-name buffer-file-name | 596 | (add-log-current-defun-function 'ignore) |
| 595 | (file-name-directory (expand-file-name log))))))) | 597 | end) |
| 598 | ;; Call add-log to do half the work. | ||
| 599 | (if (interactive-p) | ||
| 600 | ;; This is better than repeating its interactive spec here. | ||
| 601 | (call-interactively 'add-change-log-entry-other-window) | ||
| 602 | (add-change-log-entry-other-window whoami file-name)) | ||
| 603 | ;; Insert the VC comment, leaving point before it. | ||
| 604 | (setq end (save-excursion (insert comment) (point-marker))) | ||
| 605 | (if (looking-at "\\s *\\s(") | ||
| 606 | ;; It starts with an open-paren, as in "(foo): Frobbed." | ||
| 607 | ;; So remove the ": " add-change-log-entry-other-window inserted. | ||
| 608 | (delete-char -2)) | ||
| 609 | ;; Canonicalize the white space between the file name and comment. | ||
| 610 | (just-one-space) | ||
| 611 | ;; Indent rest of the text the same way add-log indented the first line. | ||
| 612 | (let ((indentation (current-indentation))) | ||
| 613 | (save-excursion | ||
| 614 | (while (< (point) end) | ||
| 615 | (forward-line 1) | ||
| 616 | (indent-to indentation)) | ||
| 617 | ;; Canonicalize the white space at the end of the entry so it is | ||
| 618 | ;; separated from the next entry by a single blank line. | ||
| 619 | (delete-char (- (skip-syntax-backward " "))) | ||
| 620 | (or (eobp) (looking-at "\n\n") | ||
| 621 | (insert "\n")))) | ||
| 622 | ;; Fill the inserted text, preserving open-parens at bol. | ||
| 623 | (let ((paragraph-separate (concat paragraph-separate "\\|^\\s *\\s(")) | ||
| 624 | (paragraph-start (concat paragraph-start "\\|^\\s *\\s("))) | ||
| 625 | (fill-region (point) end)))) | ||
| 626 | |||
| 596 | 627 | ||
| 597 | (defun vc-finish-logentry (&optional nocomment) | 628 | (defun vc-finish-logentry (&optional nocomment) |
| 598 | "Complete the operation implied by the current log entry." | 629 | "Complete the operation implied by the current log entry." |