Function: log-edit

log-edit is an autoloaded and byte-compiled function defined in log-edit.el.gz.

Signature

(log-edit CALLBACK &optional SETUP PARAMS BUFFER MODE &rest IGNORE)

Documentation

Setup a buffer to enter a VC commit log message.

The buffer is put in mode MODE, or log-edit-mode if MODE is nil. If SETUP is non-nil, erase the buffer and run log-edit-hook. Set mark and point around the entire contents of the buffer, so that it is easy to kill the contents of the buffer with C-w (kill-region). Once the user is done editing the message, he or she is expected to invoke the command C-c C-c (log-edit-done) (log-edit-done), which will call CALLBACK, a function to do the actual commit.

PARAMS, if non-nil, is an alist of variables and buffer-local values to give to those variables in the Log Edit buffer. Possible keys and associated values are:
 log-edit-listfun -- function taking no arguments that returns the list of
    files that are concerned by the current operation (using relative names);
 log-edit-diff-function -- function taking no arguments that
    displays a diff of the files concerned by the current operation.
 vc-log-fileset -- the VC fileset to be committed (if any).

If BUFFER is non-nil, log-edit will switch to that buffer, use it to edit the log message and go back to the current buffer when done. Otherwise, this function will use the current buffer.

Probably introduced at or before Emacs version 29.1.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/log-edit.el.gz
;;;###autoload
(defun log-edit (callback &optional setup params buffer mode &rest _ignore)
  "Setup a buffer to enter a VC commit log message.
The buffer is put in mode MODE, or `log-edit-mode' if MODE is nil.
\\<log-edit-mode-map>
If SETUP is non-nil, erase the buffer and run `log-edit-hook'.
Set mark and point around the entire contents of the buffer, so
that it is easy to kill the contents of the buffer with
\\[kill-region].  Once the user is done editing the message, he
or she is expected to invoke the command \\[log-edit-done] (`log-edit-done'),
which will call CALLBACK, a function to do the actual commit.

PARAMS, if non-nil, is an alist of variables and buffer-local
values to give to those variables in the Log Edit buffer.  Possible
keys and associated values are:
 `log-edit-listfun' -- function taking no arguments that returns the list of
    files that are concerned by the current operation (using relative names);
 `log-edit-diff-function' -- function taking no arguments that
    displays a diff of the files concerned by the current operation.
 `vc-log-fileset' -- the VC fileset to be committed (if any).

If BUFFER is non-nil, `log-edit' will switch to that buffer, use it
to edit the log message and go back to the current buffer when
done.  Otherwise, this function will use the current buffer."
  (let ((parent (current-buffer)))
    (if buffer (pop-to-buffer buffer))
    (when (and log-edit-setup-invert (not (eq setup 'force)))
      (setq setup (not setup)))
    (if mode
	(funcall mode)
      (log-edit-mode))
    (setq-local log-edit-callback callback)
    (if (listp params)
	(dolist (crt params)
	  (set (make-local-variable (car crt)) (cdr crt)))
      ;; For backward compatibility with log-edit up to version 22.2
      ;; accept non-list PARAMS to mean `log-edit-list'.
      (setq-local log-edit-listfun params))

    (if buffer (setq-local log-edit-parent-buffer parent))
    (setq-local log-edit-initial-files (log-edit-files))
    (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."))))