From 243de6b58c4d4d103018bfb84ede2d3a1e9bac15 Mon Sep 17 00:00:00 2001 From: Phil Jackson Date: Mon, 31 May 2010 20:53:59 +0100 Subject: [PATCH 1/4] C-c C-c analogous to C-c # and C-c C-k analogous to a. --- rebase-mode.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rebase-mode.el b/rebase-mode.el index 83b011de..5cfc18a0 100644 --- a/rebase-mode.el +++ b/rebase-mode.el @@ -57,10 +57,14 @@ (defvar rebase-mode-map (let ((map (make-sparse-keymap))) (define-key map (kbd "q") 'server-edit) + (define-key map (kbd "C-c C-c") 'server-edit) + + (define-key map (kbd "a") 'rebase-mode-abort) + (define-key map (kbd "C-c C-k") 'rebase-mode-abort) + (define-key map (kbd "M-p") 'rebase-mode-move-line-up) (define-key map (kbd "M-n") 'rebase-mode-move-line-down) (define-key map (kbd "k") 'rebase-mode-kill-line) - (define-key map (kbd "a") 'rebase-mode-abort) map) "Keymap for rebase-mode. Note this will be added to by the top-level code which defines the edit functions.") From c2c15b67c4c7af6aac561e2c1c04112f6b769ef4 Mon Sep 17 00:00:00 2001 From: Phil Jackson Date: Mon, 31 May 2010 20:59:24 +0100 Subject: [PATCH 2/4] Only ask to abort when buffer is modified. --- rebase-mode.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rebase-mode.el b/rebase-mode.el index 5cfc18a0..0671f05b 100644 --- a/rebase-mode.el +++ b/rebase-mode.el @@ -133,7 +133,8 @@ current line down." "Abort this rebase (by emptying the buffer, saving and closing server connection)." (interactive) - (when (y-or-n-p "Abort this rebase? ") + (when (or (not (buffer-modified-p)) + (y-or-n-p "Abort this rebase? ")) (let ((buffer-read-only nil)) (delete-region (point-min) (point-max)) (save-buffer) From 6c9a49461cc0e35087e94c90d5a6c0deb5993ce6 Mon Sep 17 00:00:00 2001 From: Phil Jackson Date: Mon, 31 May 2010 20:59:52 +0100 Subject: [PATCH 3/4] c for pick, n and p for navigation. --- rebase-mode.el | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/rebase-mode.el b/rebase-mode.el index 0671f05b..fab1584d 100644 --- a/rebase-mode.el +++ b/rebase-mode.el @@ -47,11 +47,12 @@ '(2 font-lock-builtin-face))) "Font lock keywords for rebase-mode.") -(defvar key-to-action-map '(("p" . "pick") - ("r" . "reword") - ("e" . "edit") - ("s" . "squash") - ("f" . "fixup")) +(defvar key-to-action-map + '(("c" . "pick") + ("r" . "reword") + ("e" . "edit") + ("s" . "squash") + ("f" . "fixup")) "Mapping from key to action.") (defvar rebase-mode-map @@ -65,6 +66,10 @@ (define-key map (kbd "M-p") 'rebase-mode-move-line-up) (define-key map (kbd "M-n") 'rebase-mode-move-line-down) (define-key map (kbd "k") 'rebase-mode-kill-line) + + (define-key map (kbd "n") 'next-line) + (define-key map (kbd "p") 'previous-line) + map) "Keymap for rebase-mode. Note this will be added to by the top-level code which defines the edit functions.") From 6654af768df0c454fd1f5bf5d5e0078896d76822 Mon Sep 17 00:00:00 2001 From: Phil Jackson Date: Mon, 31 May 2010 21:03:11 +0100 Subject: [PATCH 4/4] Don't allow the editing of lines which aren't action lines. --- rebase-mode.el | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/rebase-mode.el b/rebase-mode.el index fab1584d..f1b74295 100644 --- a/rebase-mode.el +++ b/rebase-mode.el @@ -90,12 +90,13 @@ (defun rebase-mode-edit-line (change-to) "Change the keyword at the start of the current action line to that of CHANGE-TO." - (let ((buffer-read-only nil) - (start (point))) - (goto-char (point-at-bol)) - (kill-region (point) (progn (forward-word 1) (point))) - (insert change-to) - (goto-char start))) + (when (rebase-mode-looking-at-action) + (let ((buffer-read-only nil) + (start (point))) + (goto-char (point-at-bol)) + (kill-region (point) (progn (forward-word 1) (point))) + (insert change-to) + (goto-char start)))) (defun rebase-mode-looking-at-action () "Returns non-nil if looking at an action line."