emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r115345: Install the actual changes missing in previ


From: Dmitry Gutov
Subject: [Emacs-diffs] trunk r115345: Install the actual changes missing in previous revision
Date: Mon, 02 Dec 2013 02:26:12 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 115345
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Gutov <address@hidden>
branch nick: trunk
timestamp: Mon 2013-12-02 04:26:07 +0200
message:
  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.
modified:
  lisp/vc/log-edit.el            logedit.el-20091113204419-o5vbwnq5f7feedwu-1776
=== modified file 'lisp/vc/log-edit.el'
--- a/lisp/vc/log-edit.el       2013-12-01 04:13:50 +0000
+++ b/lisp/vc/log-edit.el       2013-12-02 02:26:07 +0000
@@ -56,6 +56,7 @@
     ("\C-c\C-a" . log-edit-insert-changelog)
     ("\C-c\C-d" . log-edit-show-diff)
     ("\C-c\C-f" . log-edit-show-files)
+    ("\C-c\C-k" . log-edit-kill-buffer)
     ("\C-a"     . log-edit-beginning-of-line)
     ("\M-n"    . log-edit-next-comment)
     ("\M-p"    . log-edit-previous-comment)
@@ -479,10 +480,18 @@
 
 (defun log-edit-hide-buf (&optional buf where)
   (when (setq buf (get-buffer (or buf log-edit-files-buf)))
+    ;; FIXME: Should use something like `quit-windows-on' here, but
+    ;; that function never deletes this buffer's window because it
+    ;; was created using `cvs-pop-to-buffer-same-frame'.
     (let ((win (get-buffer-window buf where)))
       (if win (ignore-errors (delete-window win))))
     (bury-buffer buf)))
 
+(defun log-edit-add-new-comment (comment)
+  (when (or (ring-empty-p log-edit-comment-ring)
+            (not (equal comment (ring-ref log-edit-comment-ring 0))))
+    (ring-insert log-edit-comment-ring comment)))
+
 (defun log-edit-done ()
   "Finish editing the log message and commit the files.
 If you want to abort the commit, simply delete the buffer."
@@ -514,10 +523,7 @@
       (save-excursion
        (goto-char (point-max))
        (insert ?\n)))
-  (let ((comment (buffer-string)))
-    (when (or (ring-empty-p log-edit-comment-ring)
-             (not (equal comment (ring-ref log-edit-comment-ring 0))))
-      (ring-insert log-edit-comment-ring comment)))
+  (log-edit-add-new-comment (buffer-string))
   (let ((win (get-buffer-window log-edit-files-buf)))
     (if (and log-edit-confirm
             (not (and (eq log-edit-confirm 'changed)
@@ -533,6 +539,18 @@
        (cvs-bury-buffer (current-buffer) log-edit-parent-buffer))
       (call-interactively log-edit-callback))))
 
+(defun log-edit-kill-buffer ()
+  "Kill the current buffer.
+Also saves its contents in the comment history and hides
+`log-edit-files-buf'."
+  (interactive)
+  (log-edit-add-new-comment (buffer-string))
+  (save-selected-window
+    (log-edit-hide-buf))
+  (let ((buf (current-buffer)))
+    (quit-windows-on buf)
+    (kill-buffer buf)))
+
 (defun log-edit-files ()
   "Return the list of files that are about to be committed."
   (ignore-errors (funcall log-edit-listfun)))
@@ -640,9 +658,7 @@
 (defun log-edit-add-to-changelog ()
   "Insert this log message into the appropriate ChangeLog file."
   (interactive)
-  ;; Yuck!
-  (unless (string= (buffer-string) (ring-ref log-edit-comment-ring 0))
-    (ring-insert log-edit-comment-ring (buffer-string)))
+  (log-edit-add-new-comment (buffer-string))
   (dolist (f (log-edit-files))
     (let ((buffer-file-name (expand-file-name f)))
       (save-excursion


reply via email to

[Prev in Thread] Current Thread [Next in Thread]