Function: log-edit-generate-changelog-from-diff

log-edit-generate-changelog-from-diff is an interactive and byte-compiled function defined in log-edit.el.gz.

Signature

(log-edit-generate-changelog-from-diff)

Documentation

Insert a VC commit log message by looking at the current diffs.

This command is intended to be used in the "*vc-log*" buffer. This command will generate ChangeLog entries listing the modified files and functions changed in those files, based on the diffs you are about to commit. You can then add a description for each change where needed, and use M-q (fill-paragraph) to join consecutive function names into a single entry where they all share the same description. Should you need to look at the diffs themselves, they can be found in the "*vc-diff*" buffer produced by this command.

View in manual

Probably introduced at or before Emacs version 27.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/vc/log-edit.el.gz
(defun log-edit-generate-changelog-from-diff ()
  "Insert a VC commit log message by looking at the current diffs.
This command is intended to be used in the \"*vc-log*\" buffer.
This command will generate ChangeLog entries listing the modified
files and functions changed in those files, based on the diffs
you are about to commit.  You can then add a description for each
change where needed, and use \\[fill-paragraph] to join consecutive function
names into a single entry where they all share the same description.
Should you need to look at the diffs themselves, they can be found
in the \"*vc-diff*\" buffer produced by this command."
  (interactive)
  (let* ((entries
          (with-current-buffer
              (let* ((diff-buf nil)
                     ;; Unfortunately, `log-edit-show-diff' doesn't have a
                     ;; NO-SHOW option, so we try to work around it via
                     ;; display-buffer machinery.
                     (display-buffer-overriding-action
                      `(,(lambda (buf alist)
                           (setq diff-buf buf)
                           (display-buffer-no-window buf alist))
                        . ((allow-no-window . t)))))
                (log-edit-show-diff)
                diff-buf)
            (diff-add-log-current-defuns)))
         (single-line-summary
          (and (length= entries 1)
               (length< (cdar entries) 2)
               (< (point) (save-excursion (rfc822-goto-eoh) (point)))
               (save-excursion (forward-line 0) (looking-at "Summary:")))))
    (change-log-insert-entries entries)
    (when single-line-summary
      (delete-char -1)
      (insert " "))))