:type 'boolean
:safe 'booleanp)
-(defcustom log-edit-hook '(log-edit-insert-cvs-template
- log-edit-show-files
- log-edit-insert-changelog)
+(defcustom log-edit-hook '(log-edit-insert-message-template
+ log-edit-insert-cvs-template
+ log-edit-insert-changelog
+ log-edit-show-files)
"Hook run at the end of `log-edit'."
:group 'log-edit
- :type '(hook :options (log-edit-insert-changelog
- log-edit-insert-cvs-rcstemplate
- log-edit-insert-cvs-template
- log-edit-insert-filenames)))
+ :type '(hook :options (log-edit-insert-message-template
+ log-edit-insert-cvs-rcstemplate
+ log-edit-insert-cvs-template
+ log-edit-insert-changelog
+ log-edit-insert-filenames
+ log-edit-show-files)))
(defcustom log-edit-mode-hook (if (boundp 'vc-log-mode-hook) vc-log-mode-hook)
"Hook run when entering `log-edit-mode'."
(if mode
(funcall mode)
(log-edit-mode))
- (when setup
- (erase-buffer)
- (insert "Summary: ")
- (when log-edit-setup-add-author
- (insert "\nAuthor: "))
- (insert "\n\n"))
(set (make-local-variable 'log-edit-callback) callback)
(if (listp params)
(dolist (crt params)
(if buffer (set (make-local-variable 'log-edit-parent-buffer) parent))
(set (make-local-variable 'log-edit-initial-files) (log-edit-files))
- (when setup (run-hooks 'log-edit-hook))
- (if setup
- (message-position-point)
- (goto-char (point-min)))
+ (when setup
+ (erase-buffer)
+ (run-hooks 'log-edit-hook))
(push-mark (point-max))
(message "%s" (substitute-command-keys
"Press \\[log-edit-done] when you are done editing."))))
(zerop (forward-line 1))))
(eobp))))
+(defun log-edit-insert-message-template ()
+ "Insert the default template with Summary and Author."
+ (interactive)
+ (when (or (called-interactively-p 'interactive)
+ (log-edit-empty-buffer-p))
+ (insert "Summary: ")
+ (when log-edit-setup-add-author
+ (insert "\nAuthor: "))
+ (insert "\n\n")
+ (message-position-point)))
+
(defun log-edit-insert-cvs-template ()
"Insert the template specified by the CVS administrator, if any.
This simply uses the local CVS/Template file."
or if the command is repeated a second time in a row, use the first log entry
regardless of user name or time."
(interactive "P")
- (let ((eoh (save-excursion (rfc822-goto-eoh) (point))))
- (when (<= (point) eoh)
- (goto-char eoh)
- (if (looking-at "\n") (forward-char 1))))
- (let ((author
- (let ((log-edit-changelog-use-first
- (or use-first (eq last-command 'log-edit-insert-changelog))))
- (log-edit-insert-changelog-entries (log-edit-files)))))
- (log-edit-set-common-indentation)
- ;; Add an Author: field if appropriate.
- (when author (log-edit-add-field "Author" author))
- ;; Add a Fixes: field if applicable.
- (when (consp log-edit-rewrite-fixes)
- (rfc822-goto-eoh)
- (when (re-search-forward (car log-edit-rewrite-fixes) nil t)
- (let ((start (match-beginning 0))
- (end (match-end 0))
- (fixes (match-substitute-replacement
- (cdr log-edit-rewrite-fixes))))
- (delete-region start end)
- (log-edit-add-field "Fixes" fixes))))
- (and log-edit-strip-single-file-name
- (progn (rfc822-goto-eoh)
- (if (looking-at "\n") (forward-char 1))
- (looking-at "\\*\\s-+"))
- (let ((start (point)))
- (forward-line 1)
- (when (not (re-search-forward "^\\*\\s-+" nil t))
- (goto-char start)
- (skip-chars-forward "^():")
- (skip-chars-forward ": ")
- (delete-region start (point)))))
- (goto-char (point-min))))
+ (save-excursion
+ (let ((eoh (save-excursion (rfc822-goto-eoh) (point))))
+ (when (<= (point) eoh)
+ (goto-char eoh)
+ (if (looking-at "\n") (forward-char 1))))
+ (let ((author
+ (let ((log-edit-changelog-use-first
+ (or use-first (eq last-command 'log-edit-insert-changelog))))
+ (log-edit-insert-changelog-entries (log-edit-files)))))
+ (log-edit-set-common-indentation)
+ ;; Add an Author: field if appropriate.
+ (when author (log-edit-add-field "Author" author))
+ ;; Add a Fixes: field if applicable.
+ (when (consp log-edit-rewrite-fixes)
+ (rfc822-goto-eoh)
+ (when (re-search-forward (car log-edit-rewrite-fixes) nil t)
+ (let ((start (match-beginning 0))
+ (end (match-end 0))
+ (fixes (match-substitute-replacement
+ (cdr log-edit-rewrite-fixes))))
+ (delete-region start end)
+ (log-edit-add-field "Fixes" fixes))))
+ (and log-edit-strip-single-file-name
+ (progn (rfc822-goto-eoh)
+ (if (looking-at "\n") (forward-char 1))
+ (looking-at "\\*\\s-+"))
+ (let ((start (point)))
+ (forward-line 1)
+ (when (not (re-search-forward "^\\*\\s-+" nil t))
+ (goto-char start)
+ (skip-chars-forward "^():")
+ (skip-chars-forward ": ")
+ (delete-region start (point))))))))
;;;;
;;;; functions for getting commit message from ChangeLog a file...