emacs-devel
[Top][All Lists]
Advanced

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

Re: trunk r115265: * lisp/vc/vc-dispatcher.el (vc-log-edit): Setup the S


From: Dmitry Gutov
Subject: Re: trunk r115265: * lisp/vc/vc-dispatcher.el (vc-log-edit): Setup the Summary&Author headers.
Date: Tue, 03 Dec 2013 01:02:00 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1

On 02.12.2013 15:53, Stefan Monnier wrote:
Go to your nearest file buffer and type: SPC C-x k RET
As you can see, you did choose the buffer to kill and yet you get
prompted to confirm you want to kill that buffer despite its
unsaved changes.

Ah, thanks, now I get it. This issue is not new, so it didn't seem too important.

I think it's good to try and make the *VC-Log* (and the *mail*) buffers
behave similarly to file buffers in this respect.

I don't see this problem with mail. When I'm in a message-mode buffer (say, writing a reply from Gnus), and I press C-x k RET, Emacs warns me that the buffer is modified and asks for confirmation.

See the small patch at the bottom for log-edit. It seems to work, but I fear it may complicate some scenarios where buffers are killed automatically.

It's probably the case that log-edit-hide-buf needs to be revisited,
since it dates to before the rewrite of display-buffer, where Martin
arranged to better be able to "undo" a display-buffer (via bury-buffer
or quit-window).

Guess so.

=== modified file 'lisp/vc/log-edit.el'
--- lisp/vc/log-edit.el 2013-12-02 22:13:51 +0000
+++ lisp/vc/log-edit.el 2013-12-02 22:54:52 +0000
@@ -476,6 +476,7 @@
   (set (make-local-variable 'font-lock-defaults)
        '(log-edit-font-lock-keywords t))
   (make-local-variable 'log-edit-comment-ring-index)
+  (add-hook 'kill-buffer-hook 'log-edit-kill-buffer-prompt nil t)
   (hack-dir-local-variables-non-file-buffer))

 (defun log-edit-hide-buf (&optional buf where)
@@ -551,6 +552,11 @@
     (quit-windows-on buf)
     (kill-buffer buf)))

+(defun log-edit-kill-buffer-prompt ()
+  (unless (ring-member log-edit-comment-ring (buffer-string))
+    (or (yes-or-no-p "Discard the comment?")
+        (user-error "Aborted"))))
+
 (defun log-edit-files ()
   "Return the list of files that are about to be committed."
   (ignore-errors (funcall log-edit-listfun)))





reply via email to

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