Permit cancelling log edits.
* magit.el: Permit cancelling log edits. magit-log-edit-confirm-cancellation: New defcustom. magit-log-edit-map: New keybinding: C-c C-k to cancel the log. magit-log-edit-cancel-log-message: New function. magit-pop-to-log-edit: Indicate that cancellation is possible.
This commit is contained in:
parent
5c42f45f53
commit
44763451f1
1 changed files with 18 additions and 1 deletions
19
magit.el
19
magit.el
|
@ -101,6 +101,11 @@ Setting this to nil will make it do nothing, setting it to t will arrange things
|
|||
(const :tag "Immediately" 0)
|
||||
(integer :tag "After this many seconds")))
|
||||
|
||||
(defcustom magit-log-edit-confirm-cancellation nil
|
||||
"Require acknowledgement before cancelling the log edit buffer."
|
||||
:group 'magit
|
||||
:type 'boolean)
|
||||
|
||||
(defface magit-header
|
||||
'((t))
|
||||
"Face for generic header lines.
|
||||
|
@ -2167,6 +2172,7 @@ in log buffer."
|
|||
(define-key map (kbd "C-c C-a") 'magit-log-edit-toggle-amending)
|
||||
(define-key map (kbd "M-p") 'log-edit-previous-comment)
|
||||
(define-key map (kbd "M-n") 'log-edit-next-comment)
|
||||
(define-key map (kbd "C-c C-k") 'magit-log-edit-cancel-log-message)
|
||||
map))
|
||||
|
||||
(defvar magit-pre-log-edit-window-configuration nil)
|
||||
|
@ -2306,6 +2312,17 @@ Prefix arg means justify as well."
|
|||
(set-window-configuration magit-pre-log-edit-window-configuration)
|
||||
(setq magit-pre-log-edit-window-configuration nil))))
|
||||
|
||||
(defun magit-log-edit-cancel-log-message ()
|
||||
(interactive)
|
||||
(when (or (not magit-log-edit-confirm-cancellation)
|
||||
(yes-or-no-p
|
||||
"Really cancel editing the log (any changes will be lost)?"))
|
||||
(erase-buffer)
|
||||
(bury-buffer)
|
||||
(when magit-pre-log-edit-window-configuration
|
||||
(set-window-configuration magit-pre-log-edit-window-configuration)
|
||||
(setq magit-pre-log-edit-window-configuration nil))))
|
||||
|
||||
(defun magit-log-edit-toggle-amending ()
|
||||
(interactive)
|
||||
(let* ((fields (magit-log-edit-get-fields))
|
||||
|
@ -2325,7 +2342,7 @@ Prefix arg means justify as well."
|
|||
(pop-to-buffer buf)
|
||||
(setq default-directory dir)
|
||||
(magit-log-edit-mode)
|
||||
(message "Type C-c C-c to %s." operation)))
|
||||
(message "Type C-c C-c to %s (C-c C-k to cancel)." operation)))
|
||||
|
||||
(defun magit-log-edit ()
|
||||
(interactive)
|
||||
|
|
Loading…
Add table
Reference in a new issue