Function: log-edit-done

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

Signature

(log-edit-done)

Documentation

Finish editing the VC commit log message, and commit the files.

If you want to abort the commit, simply delete the buffer.

View in manual

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/vc/log-edit.el.gz
(defun log-edit-done ()
  "Finish editing the VC commit log message, and commit the files.
If you want to abort the commit, simply delete the buffer."
  (interactive)
  ;; Clean up empty headers.
  (goto-char (point-min))
  (while (looking-at (concat "^[a-z]*:" log-edit-header-contents-regexp))
    (let ((beg (match-beginning 0)))
      (goto-char (match-end 0))
      (if (string-match "\\`[ \n\t]*\\'" (match-string 1))
          (delete-region beg (point)))))
  ;; Get rid of leading empty lines.
  (goto-char (point-min))
  (when (looking-at "\\([ \t]*\n\\)+")
    (delete-region (match-beginning 0) (match-end 0)))
  ;; Get rid of trailing empty lines
  (goto-char (point-max))
  (skip-syntax-backward " ")
  (when (equal (char-after) ?\n) (forward-char 1))
  (delete-region (point) (point-max))
  ;; Check for final newline
  (if (and (> (point-max) (point-min))
	   (/= (char-before (point-max)) ?\n)
	   (or (eq log-edit-require-final-newline t)
	       (and log-edit-require-final-newline
		    (y-or-n-p
		     (format "Buffer %s does not end in newline.  Add one? "
			     (buffer-name))))))
      (save-excursion
	(goto-char (point-max))
	(insert ?\n)))
  (log-edit-remember-comment)
  (let ((win (get-buffer-window log-edit-files-buf)))
    (if (and log-edit-confirm
	     (not (and (eq log-edit-confirm 'changed)
		       (equal (log-edit-files) log-edit-initial-files)))
	     (progn
	       (log-edit-show-files)
	       (not (y-or-n-p "Really commit? "))))
	(progn (when (not win) (log-edit-hide-buf))
	       (message "Oh, well!  Later maybe?"))
      (run-hooks 'log-edit-done-hook)
      (log-edit-hide-buf)
      (unless (or log-edit-keep-buffer (not log-edit-parent-buffer))
	(cvs-bury-buffer (current-buffer) log-edit-parent-buffer))
      (call-interactively log-edit-callback))))