From 9938acaf7136dc85a8c9b5d6b6f85a2ee35cc4c2 Mon Sep 17 00:00:00 2001 From: Magnar Sveen Date: Thu, 7 Jun 2012 07:45:38 +0200 Subject: [PATCH] Save er/history for each cursor, to be able to contract. --- multiple-cursors.el | 6 +++++- todo.org | 12 +++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/multiple-cursors.el b/multiple-cursors.el index 7148f6b..6cad9e0 100644 --- a/multiple-cursors.el +++ b/multiple-cursors.el @@ -119,6 +119,7 @@ Also makes a copy of the kill-ring to be used by this cursor." (overlay-put overlay 'mark-ring mark-ring) (overlay-put overlay 'mark-active mark-active) (overlay-put overlay 'mark (set-marker (make-marker) (mark))) + (overlay-put overlay 'er/history er/history) (when (use-region-p) (overlay-put overlay 'region-overlay (mc/make-region-overlay-between-point-and-mark))) @@ -133,6 +134,7 @@ cursor with updated info." (let ((current-kill-ring kill-ring) (current-mark-ring mark-ring) (current-mark-active mark-active) + (current-er/history er/history) (annoying-arrows-mode nil)) (save-excursion (mapc #'(lambda (o) @@ -143,6 +145,7 @@ cursor with updated info." (set-marker (overlay-get o 'mark) nil) (setq mark-ring (overlay-get o 'mark-ring)) (setq mark-active (overlay-get o 'mark-active)) + (setq er/history (overlay-get o 'er/history)) (delete-region-overlay o) (delete-overlay o) (ignore-errors @@ -152,7 +155,8 @@ cursor with updated info." (overlays-in (point-min) (point-max)))) (setq kill-ring current-kill-ring) (setq mark-ring current-mark-ring) - (setq mark-active current-mark-active))) + (setq mark-active current-mark-active) + (setq er/history current-er/history))) (defun delete-region-overlay (o) (ignore-errors diff --git a/todo.org b/todo.org index 86b2b8e..c8f4ef4 100644 --- a/todo.org +++ b/todo.org @@ -1,10 +1,16 @@ -* TODO: [2/8] +* TODO: [3/9] ** DONE (set-marker MARKER nil) for performance ** DONE C-g deactivates regions first, before disabling multiple-cursors -** TODO remove mark-multiple integration +** DONE more state to save per cursor: er/history ** TODO refactor an object with all the current state, used for both overlays and current ** TODO add tests -** TODO more state to save per cursor: er/history ** TODO collapse cursors at same point ** TODO unknown command: (t)ry all or (i)gnore -> (did that work ok? (k)eep doing that or (d)on't) +** TODO separate mark-multiple and multiple-cursors + mark-multiple goes back to being the util? or just dies? + given the problem with extract-var and undo, may just kill mark-multiple. + problem with that is: C-g when doing rename-tag shouldn't go to multiple-cursors. + +** TODO there's something going wrong with last-command/this-command? + expand-region works nicely, even collapse when we save er/history, but last collapse puts all cursors in same spot