comparison lisp/vc.el @ 4158:469c093061bf

(vc-comment-to-change-log): Copy interactive spec from add-change-log-entry-other-window. Call add-change-log-entry instead of add-change-log-entry-other-window; pass it t for OTHER-WINDOW and NEW-ENTRY args. Go to bol before filling.
author Roland McGrath <roland@gnu.org>
date Mon, 19 Jul 1993 01:01:17 +0000
parents 0000c3af1836
children f1441ca7277e
comparison
equal deleted inserted replaced
4157:d2316090d029 4158:469c093061bf
587 (defun vc-comment-to-change-log (&optional whoami file-name) 587 (defun vc-comment-to-change-log (&optional whoami file-name)
588 "Enter last VC comment into change log file for current buffer's file. 588 "Enter last VC comment into change log file for current buffer's file.
589 Optional arg (interactive prefix) non-nil means prompt for user name and site. 589 Optional arg (interactive prefix) non-nil means prompt for user name and site.
590 Second arg is file name of change log. \ 590 Second arg is file name of change log. \
591 If nil, uses `change-log-default-name'." 591 If nil, uses `change-log-default-name'."
592 (interactive) 592 (interactive (if current-prefix-arg
593 (list current-prefix-arg
594 (prompt-for-change-log-name))))
593 (let (;; Extract the comment first so we get any error before doing anything. 595 (let (;; Extract the comment first so we get any error before doing anything.
594 (comment (ring-ref vc-comment-ring 0)) 596 (comment (ring-ref vc-comment-ring 0))
595 ;; Don't let add-change-log-entry insert anything but the file name. 597 ;; Don't let add-change-log-entry insert a defun name.
596 (add-log-current-defun-function 'ignore) 598 (add-log-current-defun-function 'ignore)
597 end) 599 end)
598 ;; Call add-log to do half the work. 600 ;; Call add-log to do half the work.
599 (if (interactive-p) 601 (add-change-log-entry whoami file-name t t)
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. 602 ;; Insert the VC comment, leaving point before it.
604 (setq end (save-excursion (insert comment) (point-marker))) 603 (setq end (save-excursion (insert comment) (point-marker)))
605 (if (looking-at "\\s *\\s(") 604 (if (looking-at "\\s *\\s(")
606 ;; It starts with an open-paren, as in "(foo): Frobbed." 605 ;; It starts with an open-paren, as in "(foo): Frobbed."
607 ;; So remove the ": " add-change-log-entry-other-window inserted. 606 ;; So remove the ": " add-log inserted.
608 (delete-char -2)) 607 (delete-char -2))
609 ;; Canonicalize the white space between the file name and comment. 608 ;; Canonicalize the white space between the file name and comment.
610 (just-one-space) 609 (just-one-space)
611 ;; Indent rest of the text the same way add-log indented the first line. 610 ;; Indent rest of the text the same way add-log indented the first line.
612 (let ((indentation (current-indentation))) 611 (let ((indentation (current-indentation)))
616 (indent-to indentation)) 615 (indent-to indentation))
617 (setq end (point)))) 616 (setq end (point))))
618 ;; Fill the inserted text, preserving open-parens at bol. 617 ;; Fill the inserted text, preserving open-parens at bol.
619 (let ((paragraph-separate (concat paragraph-separate "\\|^\\s *\\s(")) 618 (let ((paragraph-separate (concat paragraph-separate "\\|^\\s *\\s("))
620 (paragraph-start (concat paragraph-start "\\|^\\s *\\s("))) 619 (paragraph-start (concat paragraph-start "\\|^\\s *\\s(")))
620 (beginning-of-line)
621 (fill-region (point) end)) 621 (fill-region (point) end))
622 ;; Canonicalize the white space at the end of the entry so it is 622 ;; Canonicalize the white space at the end of the entry so it is
623 ;; separated from the next entry by a single blank line. 623 ;; separated from the next entry by a single blank line.
624 (skip-syntax-forward " " end) 624 (skip-syntax-forward " " end)
625 (delete-char (- (skip-syntax-backward " "))) 625 (delete-char (- (skip-syntax-backward " ")))