diff options
| author | Dmitry Gutov <dgutov@yandex.ru> | 2019-04-21 00:39:36 +0300 |
|---|---|---|
| committer | Dmitry Gutov <dgutov@yandex.ru> | 2019-04-21 00:39:36 +0300 |
| commit | 70f3175738225252acc5041b210c5b39376af1a1 (patch) | |
| tree | 2e54a2eb90aa3647b28f3794e96d374fc2bf11ec /lisp/vc/log-edit.el | |
| parent | 6d1025f944128391a27b388d4cb34d187a0a26b9 (diff) | |
| download | emacs-70f3175738225252acc5041b210c5b39376af1a1.tar.gz | |
Support amending the last commit using VC-Hg
* lisp/vc/log-edit.el (log-edit--toggle-amend): Extract from
vc-git-log-edit-toggle-amend (bug#34944).
* lisp/vc/vc-hg.el (vc-hg-log-edit-toggle-amend): New function.
Use the aforementioned.
(vc-hg-log-edit-mode-map): New variable.
(vc-hg-log-edit-mode): New major mode.
Diffstat (limited to 'lisp/vc/log-edit.el')
| -rw-r--r-- | lisp/vc/log-edit.el | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el index ba5a1a3d572..91e18c1ec5c 100644 --- a/lisp/vc/log-edit.el +++ b/lisp/vc/log-edit.el @@ -1087,6 +1087,22 @@ line of MSG." (if summary (insert summary "\n\n")) (cons (buffer-string) res)))) +(defun log-edit--toggle-amend (last-msg-fn) + (when (log-edit-toggle-header "Amend" "yes") + (goto-char (point-max)) + (unless (bolp) (insert "\n")) + (insert (funcall last-msg-fn)) + (save-excursion + (rfc822-goto-eoh) + (forward-line 1) + (let ((pt (point))) + (and (zerop (forward-line 1)) + (looking-at "\n\\|\\'") + (let ((summary (buffer-substring-no-properties pt (1- (point))))) + (skip-chars-forward " \n") + (delete-region pt (point)) + (log-edit-set-header "Summary" summary))))))) + (provide 'log-edit) ;;; log-edit.el ends here |
