chiark / gitweb /
stgit.el: Manually draw/erase the mark in stgit-{add,remove}-mark
authorGustav Hållberg <gustav@virtutech.com>
Fri, 13 Mar 2009 03:44:13 +0000 (04:44 +0100)
committerGustav Hållberg <gustav@virtutech.com>
Fri, 13 Mar 2009 03:44:13 +0000 (04:44 +0100)
This significantly reduces the time stgit-mark and similar takes.

Signed-off-by: Gustav Hållberg <gustav@virtutech.com>
Signed-off-by: Karl Hasselström <kha@treskal.com>
contrib/stgit.el

index 02e43e139772f7afc8434132659e9fdfd89326a8..de466db262fff891c7ff0b5072077ae36e4b06f8 100644 (file)
@@ -562,11 +562,23 @@ (defun stgit-mode ()
 
 (defun stgit-add-mark (patchsym)
   "Mark the patch PATCHSYM."
 
 (defun stgit-add-mark (patchsym)
   "Mark the patch PATCHSYM."
-  (setq stgit-marked-patches (cons patchsym stgit-marked-patches)))
+  (setq stgit-marked-patches (cons patchsym stgit-marked-patches))
+  (save-excursion
+    (when (stgit-goto-patch patchsym)
+      (move-to-column 1)
+      (let ((inhibit-read-only t))
+        (insert-and-inherit ?*)
+        (delete-char 1)))))
 
 (defun stgit-remove-mark (patchsym)
   "Unmark the patch PATCHSYM."
 
 (defun stgit-remove-mark (patchsym)
   "Unmark the patch PATCHSYM."
-  (setq stgit-marked-patches (delq patchsym stgit-marked-patches)))
+  (setq stgit-marked-patches (delq patchsym stgit-marked-patches))
+  (save-excursion
+    (when (stgit-goto-patch patchsym)
+      (move-to-column 1)
+      (let ((inhibit-read-only t))
+        (insert-and-inherit ? )
+        (delete-char 1)))))
 
 (defun stgit-clear-marks ()
   "Unmark all patches."
 
 (defun stgit-clear-marks ()
   "Unmark all patches."
@@ -636,22 +648,19 @@ (defun stgit-mark ()
   "Mark the patch under point."
   (interactive)
   (let ((patch (stgit-patch-at-point t)))
   "Mark the patch under point."
   (interactive)
   (let ((patch (stgit-patch-at-point t)))
-    (stgit-add-mark patch)
-    (stgit-reload))
+    (stgit-add-mark patch))
   (stgit-next-patch))
 
 (defun stgit-unmark-up ()
   "Remove mark from the patch on the previous line."
   (interactive)
   (stgit-previous-patch)
   (stgit-next-patch))
 
 (defun stgit-unmark-up ()
   "Remove mark from the patch on the previous line."
   (interactive)
   (stgit-previous-patch)
-  (stgit-remove-mark (stgit-patch-at-point t))
-  (stgit-reload))
+  (stgit-remove-mark (stgit-patch-at-point t)))
 
 (defun stgit-unmark-down ()
   "Remove mark from the patch on the current line."
   (interactive)
   (stgit-remove-mark (stgit-patch-at-point t))
 
 (defun stgit-unmark-down ()
   "Remove mark from the patch on the current line."
   (interactive)
   (stgit-remove-mark (stgit-patch-at-point t))
-  (stgit-reload)
   (stgit-next-patch))
 
 (defun stgit-rename (name)
   (stgit-next-patch))
 
 (defun stgit-rename (name)