Function: log-edit-insert-changelog
log-edit-insert-changelog is an interactive and byte-compiled function
defined in log-edit.el.gz.
Signature
(log-edit-insert-changelog &optional USE-FIRST)
Documentation
Insert a VC commit log message by looking at the ChangeLog.
The idea is to write your ChangeLog entries first, and then use this command to commit your changes with that log.
To select default log text, this command:
- finds the ChangeLog entries for the files to be checked in;
- verifies that the top entry in the ChangeLog is on the current date
and by the current user; if not, it doesn't provide any default text;
- searches the ChangeLog entry for paragraphs containing the names of
the files to be checked in; and finally
- uses those paragraphs as the log text.
If the optional prefix arg USE-FIRST is given (via C-u (universal-argument)),
or if the command is repeated, use the first log entry regardless of user
name or time.
Probably introduced at or before Emacs version 25.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/vc/log-edit.el.gz
(defun log-edit-insert-changelog (&optional use-first)
"Insert a VC commit log message by looking at the ChangeLog.
The idea is to write your ChangeLog entries first, and then use this
command to commit your changes with that log.
To select default log text, this command:
- finds the ChangeLog entries for the files to be checked in;
- verifies that the top entry in the ChangeLog is on the current date
and by the current user; if not, it doesn't provide any default text;
- searches the ChangeLog entry for paragraphs containing the names of
the files to be checked in; and finally
- uses those paragraphs as the log text.
If the optional prefix arg USE-FIRST is given (via \\[universal-argument]),
or if the command is repeated, use the first log entry regardless of user
name or time."
(interactive "P")
(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" (car author))
(log-edit-add-field "Summary" ""))
;; 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)))))
;; FIXME also add "Co-authored-by" when appropriate.
;; Bzr accepts multiple --author arguments, others (?) don't.
(and log-edit-rewrite-tiny-change
(eq 'tiny (cdr author))
(goto-char (point-max))
(insert "\nCopyright-paperwork-exempt: yes\n")))))