From d11e0621dad259315ef587ac50aa3f1bd54032e2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gustav=20H=C3=A5llberg?= Date: Fri, 14 Aug 2009 10:54:05 +0200 Subject: [PATCH] stgit.el: Add stgit-toggle-mark MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Preparation for upcoming menu bar patch Signed-off-by: Gustav HÃ¥llberg --- contrib/stgit.el | 45 ++++++++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/contrib/stgit.el b/contrib/stgit.el index 27b1744..81222f6 100644 --- a/contrib/stgit.el +++ b/contrib/stgit.el @@ -812,8 +812,8 @@ file for (applied) copies and renames." (setq stgit-mode-map (make-keymap)) (suppress-keymap stgit-mode-map) (mapc (lambda (arg) (define-key stgit-mode-map (car arg) (cdr arg))) - `((" " . stgit-mark) - ("m" . stgit-mark) + `((" " . stgit-mark-down) + ("m" . stgit-mark-down) ("\d" . stgit-unmark-up) ("u" . stgit-unmark-down) ("?" . stgit-help) @@ -885,7 +885,7 @@ Movement commands: \\[stgit-previous-patch] Move to previous patch \\[stgit-next-patch] Move to next patch -\\[stgit-mark] Mark patch +\\[stgit-mark-down] Mark patch and move down \\[stgit-unmark-up] Unmark patch and move up \\[stgit-unmark-down] Unmark patch and move down @@ -1057,6 +1057,14 @@ PATCHSYM." (stgit-run "init")) (stgit-reload)) +(defun stgit-toggle-mark () + "Toggle mark on the patch under point." + (interactive) + (stgit-assert-mode) + (if (memq (stgit-patch-name-at-point t t) stgit-marked-patches) + (stgit-unmark) + (stgit-mark))) + (defun stgit-mark () "Mark the patch under point." (interactive) @@ -1069,28 +1077,39 @@ PATCHSYM." (when (eq name :index) (error "Cannot mark the index")) (stgit-add-mark (stgit-patch-name patch)) - (ewoc-invalidate stgit-ewoc node)) + (let ((column (current-column))) + (ewoc-invalidate stgit-ewoc node) + (move-to-column column)))) + +(defun stgit-mark-down () + "Mark the patch under point and move to the next patch." + (interactive) + (stgit-mark) (stgit-next-patch)) -(defun stgit-unmark-up () - "Remove mark from the patch on the previous line." +(defun stgit-unmark () + "Remove mark from the patch on the current line." (interactive) (stgit-assert-mode) - (stgit-previous-patch) (let* ((node (ewoc-locate stgit-ewoc)) (patch (ewoc-data node))) (stgit-remove-mark (stgit-patch-name patch)) - (ewoc-invalidate stgit-ewoc node)) - (move-to-column (stgit-goal-column))) + (let ((column (current-column))) + (ewoc-invalidate stgit-ewoc node) + (move-to-column column)))) + +(defun stgit-unmark-up () + "Remove mark from the patch on the previous line." + (interactive) + (stgit-assert-mode) + (stgit-previous-patch) + (stgit-unmark)) (defun stgit-unmark-down () "Remove mark from the patch on the current line." (interactive) (stgit-assert-mode) - (let* ((node (ewoc-locate stgit-ewoc)) - (patch (ewoc-data node))) - (stgit-remove-mark (stgit-patch-name patch)) - (ewoc-invalidate stgit-ewoc node)) + (stgit-unmark) (stgit-next-patch)) (defun stgit-rename (name) -- 2.11.0