diff options
| author | Dmitry Gutov | 2013-12-04 02:37:33 +0200 |
|---|---|---|
| committer | Dmitry Gutov | 2013-12-04 02:37:33 +0200 |
| commit | dda619164336f0a4b18c785e28f2ab0d7c6e65d9 (patch) | |
| tree | a83ff3b7a4a2996b26edf85cfc1f6be4e61c54f5 | |
| parent | c085e5b909ea10f8e593f35f2d4a57df147c0591 (diff) | |
| download | emacs-dda619164336f0a4b18c785e28f2ab0d7c6e65d9.tar.gz emacs-dda619164336f0a4b18c785e28f2ab0d7c6e65d9.zip | |
Remember log-edit comment when the buffer is killed
* lisp/vc/log-edit.el (log-edit-add-new-comment): Rename to
`log-edit-remember-comment', make argument optional. Adjust all
callers.
(log-edit-mode): Add `log-edit-remember-comment' to
`kill-buffer-hook' locally.
(log-edit-kill-buffer): Don't remember comment explicitly since
the buffer is killed anyway.
| -rw-r--r-- | lisp/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/vc/log-edit.el | 9 |
2 files changed, 15 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 530a7012f6f..b18de86df20 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2013-12-04 Dmitry Gutov <dgutov@yandex.ru> | ||
| 2 | |||
| 3 | * vc/log-edit.el (log-edit-add-new-comment): Rename to | ||
| 4 | `log-edit-remember-comment', make argument optional. Adjust all | ||
| 5 | callers. | ||
| 6 | (log-edit-mode): Add `log-edit-remember-comment' to | ||
| 7 | `kill-buffer-hook' locally. | ||
| 8 | (log-edit-kill-buffer): Don't remember comment explicitly since | ||
| 9 | the buffer is killed anyway. | ||
| 10 | |||
| 1 | 2013-12-04 Juri Linkov <juri@jurta.org> | 11 | 2013-12-04 Juri Linkov <juri@jurta.org> |
| 2 | 12 | ||
| 3 | * isearch.el (isearch-mode, isearch-done): Don't set arg LOCAL in | 13 | * isearch.el (isearch-mode, isearch-done): Don't set arg LOCAL in |
diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el index 7f66f73e9d9..91390fa1123 100644 --- a/lisp/vc/log-edit.el +++ b/lisp/vc/log-edit.el | |||
| @@ -476,6 +476,7 @@ commands (under C-x v for VC, for example). | |||
| 476 | (set (make-local-variable 'font-lock-defaults) | 476 | (set (make-local-variable 'font-lock-defaults) |
| 477 | '(log-edit-font-lock-keywords t)) | 477 | '(log-edit-font-lock-keywords t)) |
| 478 | (make-local-variable 'log-edit-comment-ring-index) | 478 | (make-local-variable 'log-edit-comment-ring-index) |
| 479 | (add-hook 'kill-buffer-hook 'log-edit-remember-comment nil t) | ||
| 479 | (hack-dir-local-variables-non-file-buffer)) | 480 | (hack-dir-local-variables-non-file-buffer)) |
| 480 | 481 | ||
| 481 | (defun log-edit-hide-buf (&optional buf where) | 482 | (defun log-edit-hide-buf (&optional buf where) |
| @@ -488,7 +489,8 @@ commands (under C-x v for VC, for example). | |||
| 488 | (if win (ignore-errors (delete-window win)))) | 489 | (if win (ignore-errors (delete-window win)))) |
| 489 | (bury-buffer buf)))) | 490 | (bury-buffer buf)))) |
| 490 | 491 | ||
| 491 | (defun log-edit-add-new-comment (comment) | 492 | (defun log-edit-remember-comment (&optional comment) |
| 493 | (unless comment (setq comment (buffer-string))) | ||
| 492 | (when (or (ring-empty-p log-edit-comment-ring) | 494 | (when (or (ring-empty-p log-edit-comment-ring) |
| 493 | (not (equal comment (ring-ref log-edit-comment-ring 0)))) | 495 | (not (equal comment (ring-ref log-edit-comment-ring 0)))) |
| 494 | (ring-insert log-edit-comment-ring comment))) | 496 | (ring-insert log-edit-comment-ring comment))) |
| @@ -524,7 +526,7 @@ If you want to abort the commit, simply delete the buffer." | |||
| 524 | (save-excursion | 526 | (save-excursion |
| 525 | (goto-char (point-max)) | 527 | (goto-char (point-max)) |
| 526 | (insert ?\n))) | 528 | (insert ?\n))) |
| 527 | (log-edit-add-new-comment (buffer-string)) | 529 | (log-edit-remember-comment) |
| 528 | (let ((win (get-buffer-window log-edit-files-buf))) | 530 | (let ((win (get-buffer-window log-edit-files-buf))) |
| 529 | (if (and log-edit-confirm | 531 | (if (and log-edit-confirm |
| 530 | (not (and (eq log-edit-confirm 'changed) | 532 | (not (and (eq log-edit-confirm 'changed) |
| @@ -545,7 +547,6 @@ If you want to abort the commit, simply delete the buffer." | |||
| 545 | Also saves its contents in the comment history and hides | 547 | Also saves its contents in the comment history and hides |
| 546 | `log-edit-files-buf'." | 548 | `log-edit-files-buf'." |
| 547 | (interactive) | 549 | (interactive) |
| 548 | (log-edit-add-new-comment (buffer-string)) | ||
| 549 | (log-edit-hide-buf) | 550 | (log-edit-hide-buf) |
| 550 | (let ((buf (current-buffer))) | 551 | (let ((buf (current-buffer))) |
| 551 | (quit-windows-on buf) | 552 | (quit-windows-on buf) |
| @@ -659,7 +660,7 @@ can thus take some time." | |||
| 659 | (defun log-edit-add-to-changelog () | 660 | (defun log-edit-add-to-changelog () |
| 660 | "Insert this log message into the appropriate ChangeLog file." | 661 | "Insert this log message into the appropriate ChangeLog file." |
| 661 | (interactive) | 662 | (interactive) |
| 662 | (log-edit-add-new-comment (buffer-string)) | 663 | (log-edit-remember-comment) |
| 663 | (dolist (f (log-edit-files)) | 664 | (dolist (f (log-edit-files)) |
| 664 | (let ((buffer-file-name (expand-file-name f))) | 665 | (let ((buffer-file-name (expand-file-name f))) |
| 665 | (save-excursion | 666 | (save-excursion |