diff --git a/cvs-commit-patch-buffer.el b/cvs-commit-patch-buffer.el new file mode 100644 index 0000000..a8ebac6 --- /dev/null +++ b/cvs-commit-patch-buffer.el @@ -0,0 +1,26 @@ +;; Copyright 2003 Jim Radford and David Caldwell + +(defun cvs-commit-patch-buffer (buffer directory) + "Still need to get the list of modified files and tell them to revert" + (interactive "bBuffer to commit: \nDDirectory: ") + (log-edit `(lambda () (interactive) + (let ((file (make-temp-file "commit-buffer" nil)) + (comment (buffer-string)) status + (cvs-commit-buffer (window-buffer (display-buffer (get-buffer-create "*cvs-commit-patch*"))))) + (with-current-buffer cvs-commit-buffer (erase-buffer)) + (unwind-protect + (progn + (with-current-buffer ,buffer + (write-region (point-min) (point-max) file)) + (with-current-buffer cvs-commit-buffer + (let ((default-directory ,directory)) + (unless (eq (setq status (call-process "commit-patch" nil cvs-commit-buffer 'display "-m" comment file)) 0) + (message "Commit patch failed with a status of '%S'." status)))) + (delete-file file))))) + nil nil "*cvs-commit*")) + +(when (require 'diff-mode) + (setq diff-default-read-only nil) + (define-key diff-mode-map "\C-c\C-c" 'cvs-commit-patch-buffer)) + +(provide 'cvs-commit-patch-buffer)