aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Gutov2013-12-02 04:26:07 +0200
committerDmitry Gutov2013-12-02 04:26:07 +0200
commitd9dfe8ca078e22a94952cbbe4095b8209ed4f6c4 (patch)
tree31b77c16485117a2fed2dff9086c35f9a88aec79
parent47e8b74eb4c91f2a6d74849bf9ed88cf301e1ba4 (diff)
downloademacs-d9dfe8ca078e22a94952cbbe4095b8209ed4f6c4.tar.gz
emacs-d9dfe8ca078e22a94952cbbe4095b8209ed4f6c4.zip
Install the actual changes missing in previous revision
* lisp/vc/log-edit.el (log-edit-mode-map): Add binding for `log-edit-kill-biffer'. (log-edit-hide-buf): Add a FIXME comment. (log-edit-add-new-comment): New function, extracted from `log-edit-done'. (log-edit-done, log-edit-add-to-changelog): Use it. (log-edit-kill-buffer): New command.
-rw-r--r--lisp/vc/log-edit.el30
1 files changed, 23 insertions, 7 deletions
diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el
index ecec69489dc..3c15d9147b6 100644
--- a/lisp/vc/log-edit.el
+++ b/lisp/vc/log-edit.el
@@ -56,6 +56,7 @@
56 ("\C-c\C-a" . log-edit-insert-changelog) 56 ("\C-c\C-a" . log-edit-insert-changelog)
57 ("\C-c\C-d" . log-edit-show-diff) 57 ("\C-c\C-d" . log-edit-show-diff)
58 ("\C-c\C-f" . log-edit-show-files) 58 ("\C-c\C-f" . log-edit-show-files)
59 ("\C-c\C-k" . log-edit-kill-buffer)
59 ("\C-a" . log-edit-beginning-of-line) 60 ("\C-a" . log-edit-beginning-of-line)
60 ("\M-n" . log-edit-next-comment) 61 ("\M-n" . log-edit-next-comment)
61 ("\M-p" . log-edit-previous-comment) 62 ("\M-p" . log-edit-previous-comment)
@@ -479,10 +480,18 @@ commands (under C-x v for VC, for example).
479 480
480(defun log-edit-hide-buf (&optional buf where) 481(defun log-edit-hide-buf (&optional buf where)
481 (when (setq buf (get-buffer (or buf log-edit-files-buf))) 482 (when (setq buf (get-buffer (or buf log-edit-files-buf)))
483 ;; FIXME: Should use something like `quit-windows-on' here, but
484 ;; that function never deletes this buffer's window because it
485 ;; was created using `cvs-pop-to-buffer-same-frame'.
482 (let ((win (get-buffer-window buf where))) 486 (let ((win (get-buffer-window buf where)))
483 (if win (ignore-errors (delete-window win)))) 487 (if win (ignore-errors (delete-window win))))
484 (bury-buffer buf))) 488 (bury-buffer buf)))
485 489
490(defun log-edit-add-new-comment (comment)
491 (when (or (ring-empty-p log-edit-comment-ring)
492 (not (equal comment (ring-ref log-edit-comment-ring 0))))
493 (ring-insert log-edit-comment-ring comment)))
494
486(defun log-edit-done () 495(defun log-edit-done ()
487 "Finish editing the log message and commit the files. 496 "Finish editing the log message and commit the files.
488If you want to abort the commit, simply delete the buffer." 497If you want to abort the commit, simply delete the buffer."
@@ -514,10 +523,7 @@ If you want to abort the commit, simply delete the buffer."
514 (save-excursion 523 (save-excursion
515 (goto-char (point-max)) 524 (goto-char (point-max))
516 (insert ?\n))) 525 (insert ?\n)))
517 (let ((comment (buffer-string))) 526 (log-edit-add-new-comment (buffer-string))
518 (when (or (ring-empty-p log-edit-comment-ring)
519 (not (equal comment (ring-ref log-edit-comment-ring 0))))
520 (ring-insert log-edit-comment-ring comment)))
521 (let ((win (get-buffer-window log-edit-files-buf))) 527 (let ((win (get-buffer-window log-edit-files-buf)))
522 (if (and log-edit-confirm 528 (if (and log-edit-confirm
523 (not (and (eq log-edit-confirm 'changed) 529 (not (and (eq log-edit-confirm 'changed)
@@ -533,6 +539,18 @@ If you want to abort the commit, simply delete the buffer."
533 (cvs-bury-buffer (current-buffer) log-edit-parent-buffer)) 539 (cvs-bury-buffer (current-buffer) log-edit-parent-buffer))
534 (call-interactively log-edit-callback)))) 540 (call-interactively log-edit-callback))))
535 541
542(defun log-edit-kill-buffer ()
543 "Kill the current buffer.
544Also saves its contents in the comment history and hides
545`log-edit-files-buf'."
546 (interactive)
547 (log-edit-add-new-comment (buffer-string))
548 (save-selected-window
549 (log-edit-hide-buf))
550 (let ((buf (current-buffer)))
551 (quit-windows-on buf)
552 (kill-buffer buf)))
553
536(defun log-edit-files () 554(defun log-edit-files ()
537 "Return the list of files that are about to be committed." 555 "Return the list of files that are about to be committed."
538 (ignore-errors (funcall log-edit-listfun))) 556 (ignore-errors (funcall log-edit-listfun)))
@@ -640,9 +658,7 @@ can thus take some time."
640(defun log-edit-add-to-changelog () 658(defun log-edit-add-to-changelog ()
641 "Insert this log message into the appropriate ChangeLog file." 659 "Insert this log message into the appropriate ChangeLog file."
642 (interactive) 660 (interactive)
643 ;; Yuck! 661 (log-edit-add-new-comment (buffer-string))
644 (unless (string= (buffer-string) (ring-ref log-edit-comment-ring 0))
645 (ring-insert log-edit-comment-ring (buffer-string)))
646 (dolist (f (log-edit-files)) 662 (dolist (f (log-edit-files))
647 (let ((buffer-file-name (expand-file-name f))) 663 (let ((buffer-file-name (expand-file-name f)))
648 (save-excursion 664 (save-excursion