From 4535033952dce38ee77ba1b856b5744a3f6e1559 Mon Sep 17 00:00:00 2001 From: Zach Kost-Smith Date: Thu, 16 May 2013 15:24:00 -0500 Subject: [PATCH] Added a new function mc/mark-pop that sets cursors by popping marks off the mark stack. --- mc-mark-pop.el | 23 +++++++++++++++++++++++ multiple-cursors.el | 1 + 2 files changed, 24 insertions(+) create mode 100644 mc-mark-pop.el diff --git a/mc-mark-pop.el b/mc-mark-pop.el new file mode 100644 index 0000000..b93a267 --- /dev/null +++ b/mc-mark-pop.el @@ -0,0 +1,23 @@ +;;; mc-mark-pop.el --- Pop cursors off of the mark stack + +(require 'multiple-cursors-core) + +;;;###autoload +(defun mc/mark-pop () + "Add one cursor to each line of the active region. +Starts from mark and moves in straight down or up towards the +line point is on." + (interactive) + ;; If the mark happens to be at the current point, just pop that one off. + (while (eql (mark) (point)) + (pop-mark)) + (mc/create-fake-cursor-at-point) + (exchange-point-and-mark) + (pop-mark) + (mc/maybe-multiple-cursors-mode)) + +;; A good key binding for this feature is perhaps "C-S-p" ('p' for pop). + +(provide 'mc-mark-pop) + +;;; mc-mark-pop.el ends here diff --git a/multiple-cursors.el b/multiple-cursors.el index 4b5c6f8..84fde33 100644 --- a/multiple-cursors.el +++ b/multiple-cursors.el @@ -182,6 +182,7 @@ (require 'mc-edit-lines) (require 'mc-cycle-cursors) (require 'mc-mark-more) +(require 'mc-mark-pop) (require 'rectangular-region-mode) (require 'mc-separate-operations)