Function: vc-finish-logentry

vc-finish-logentry is an interactive and byte-compiled function defined in vc-dispatcher.el.gz.

Signature

(vc-finish-logentry &optional NOCOMMENT)

Documentation

Complete the operation implied by the current log entry.

Use the contents of the current buffer as a check-in or registration comment. If the optional arg NOCOMMENT is non-nil, then don't check the buffer contents as a comment.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc-dispatcher.el.gz
;; vc-finish-logentry is typically called from a log-edit buffer (see
;; vc-start-logentry).
(defun vc-finish-logentry (&optional nocomment)
  "Complete the operation implied by the current log entry.
Use the contents of the current buffer as a check-in or registration
comment.  If the optional arg NOCOMMENT is non-nil, then don't check
the buffer contents as a comment."
  (interactive)
  ;; Check and record the comment, if any.
  (unless nocomment
    (run-hooks 'vc-logentry-check-hook))
  (unless vc-log-operation
    (error "No log operation is pending"))

  ;; save the parameters held in buffer-local variables
  (let ((logbuf (current-buffer))
        (log-operation vc-log-operation)
        (log-fileset vc-log-fileset)
        (log-entry (buffer-string))
        (after-hook vc-log-after-operation-hook)
        (parent vc-parent-buffer))
    ;; OK, do it to it
    (let ((log-operation-ret
           (with-current-buffer parent
             (let ((vc--inhibit-async-window t))
               (funcall log-operation log-fileset log-entry)))))

      (pop-to-buffer parent)
      (setq vc-log-operation nil)

      ;; Quit windows on logbuf.
      (cond ((not logbuf))
            (vc-delete-logbuf-window
             (quit-windows-on logbuf t (selected-frame)))
            (t
             (quit-windows-on logbuf nil 0)))

      (when (eq (car-safe log-operation-ret) 'async)
        (vc--display-async-command-buffer (process-buffer
                                           (cadr log-operation-ret))))

      ;; Now make sure we see the expanded headers.
      ;; If the `vc-log-operation' started an async operation then we
      ;; need to delay running the hooks.  It tells us whether it did
      ;; that with a special return value.
      (cl-flet ((resynch-and-hooks ()
                  (when (buffer-live-p parent)
                    (with-current-buffer parent
                      (mapc (lambda (file) (vc-resynch-buffer file t t))
                            log-fileset)
                      (run-hooks after-hook 'vc-finish-logentry-hook)))))
        (if (eq (car-safe log-operation-ret) 'async)
            (vc-exec-after #'resynch-and-hooks nil (cadr log-operation-ret))
          (resynch-and-hooks))))))