[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/multiple-cursors 49c9f7f 340/434: Merge remote-tracking br
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/multiple-cursors 49c9f7f 340/434: Merge remote-tracking branch 'upstream/master' |
Date: |
Sat, 7 Aug 2021 09:20:55 -0400 (EDT) |
branch: elpa/multiple-cursors
commit 49c9f7f6bf332c89cf4071a14549f0bf005dc56f
Merge: c90bb62 2588cce
Author: Justin Dove <dove@mit.edu>
Commit: Justin Dove <dove@mit.edu>
Merge remote-tracking branch 'upstream/master'
---
features/vertical-align.feature | 27 +++++++++++++++++++++
mc-hide-unmatched-lines-mode.el | 2 +-
mc-mark-more.el | 52 +++++++++++++++++++----------------------
mc-separate-operations.el | 31 ++++++++++++++++++++++++
multiple-cursors-core.el | 2 +-
5 files changed, 84 insertions(+), 30 deletions(-)
diff --git a/features/vertical-align.feature b/features/vertical-align.feature
new file mode 100644
index 0000000..3a5a124
--- /dev/null
+++ b/features/vertical-align.feature
@@ -0,0 +1,27 @@
+Feature: Align cursors with whitespaces
+
+ Scenario: Vertical aligning with `x'
+ Given I have cursors at "word" in :
+ """
+ One word
+ Another word
+ """
+ And I press "<<mc/vertical-align>> \170"
+ Then I should see:
+ """
+ One xxxxword
+ Another word
+ """
+
+ Scenario: Vertical aligning with space
+ Given I have cursors at "word" in :
+ """
+ One word
+ Another word
+ """
+ And I press "<<mc/vertical-align-with-space>>"
+ Then I should see:
+ """
+ One word
+ Another word
+ """
diff --git a/mc-hide-unmatched-lines-mode.el b/mc-hide-unmatched-lines-mode.el
index 5221ef8..18e1688 100644
--- a/mc-hide-unmatched-lines-mode.el
+++ b/mc-hide-unmatched-lines-mode.el
@@ -49,7 +49,7 @@
;;;###autoload
(define-minor-mode mc-hide-unmatched-lines-mode
- "Minor mode when enabled hides all lines where no cursos (and
+ "Minor mode when enabled hides all lines where no cursors (and
also hum/lines-to-expand below and above) To make use of this
mode press \"C-'\" while multiple-cursor-mode is active. You can
still edit lines while you are in mc-hide-unmatched-lines
diff --git a/mc-mark-more.el b/mc-mark-more.el
index 0069dd3..fc8a9af 100644
--- a/mc-mark-more.el
+++ b/mc-mark-more.el
@@ -127,14 +127,14 @@ Use like case-fold-search, don't recommend setting it
globally.")
With negative ARG, delete the last one instead.
With zero ARG, skip the last one and mark next."
(interactive "p")
- (if (< arg 0)
- (let ((cursor (mc/furthest-cursor-after-point)))
- (if cursor
- (mc/remove-fake-cursor cursor)
- (error "No cursors to be unmarked")))
- (if (region-active-p)
- (mc/mark-more-like-this (= arg 0) 'forwards)
- (mc/mark-lines arg 'forwards)))
+ (if (region-active-p)
+ (if (< arg 0)
+ (let ((cursor (mc/furthest-cursor-after-point)))
+ (if cursor
+ (mc/remove-fake-cursor cursor)
+ (error "No cursors to be unmarked")))
+ (mc/mark-more-like-this (= arg 0) 'forwards))
+ (mc/mark-lines arg 'forwards))
(mc/maybe-multiple-cursors-mode))
;;;###autoload
@@ -155,14 +155,14 @@ With zero ARG, skip the last one and mark next."
With negative ARG, delete the last one instead.
With zero ARG, skip the last one and mark next."
(interactive "p")
- (if (< arg 0)
- (let ((cursor (mc/furthest-cursor-before-point)))
- (if cursor
- (mc/remove-fake-cursor cursor)
- (error "No cursors to be unmarked")))
- (if (region-active-p)
- (mc/mark-more-like-this (= arg 0) 'backwards)
- (mc/mark-lines arg 'backwards)))
+ (if (region-active-p)
+ (if (< arg 0)
+ (let ((cursor (mc/furthest-cursor-before-point)))
+ (if cursor
+ (mc/remove-fake-cursor cursor)
+ (error "No cursors to be unmarked")))
+ (mc/mark-more-like-this (= arg 0) 'backwards))
+ (mc/mark-lines arg 'backwards))
(mc/maybe-multiple-cursors-mode))
;;;###autoload
@@ -179,16 +179,12 @@ With zero ARG, skip the last one and mark next."
(defun mc/mark-lines (num-lines direction)
(dotimes (i num-lines)
- (mc/save-excursion
- (let ((furthest-cursor (ecase direction
- (forwards (mc/furthest-cursor-after-point))
- (backwards (mc/furthest-cursor-before-point)))))
- (if (overlayp furthest-cursor)
- (goto-char (overlay-get furthest-cursor 'point))))
- (ecase direction
- (forwards (next-logical-line 1 nil))
- (backwards (previous-logical-line 1 nil)))
- (mc/create-fake-cursor-at-point))))
+ (mc/create-fake-cursor-at-point)
+ (ecase direction
+ (forwards (loop do (next-logical-line 1 nil)
+ while (mc/all-fake-cursors (point) (1+ (point)))))
+ (backwards (loop do (previous-logical-line 1 nil)
+ while (mc/all-fake-cursors (point) (1+ (point))))))))
;;;###autoload
(defun mc/mark-next-lines (arg)
@@ -275,10 +271,10 @@ With zero ARG, skip the last one and mark next."
(mc/mark-all-like-this)))
;;;###autoload
-(defun mc/mark-all-in-region (beg end)
+(defun mc/mark-all-in-region (beg end &optional search)
"Find and mark all the parts in the region matching the given search"
(interactive "r")
- (let ((search (read-from-minibuffer "Mark all in region: "))
+ (let ((search (or search (read-from-minibuffer "Mark all in region: ")))
(case-fold-search nil))
(if (string= search "")
(message "Mark aborted")
diff --git a/mc-separate-operations.el b/mc-separate-operations.el
index abbfaee..b587530 100644
--- a/mc-separate-operations.el
+++ b/mc-separate-operations.el
@@ -86,5 +86,36 @@
(setq mc--strings-to-replace (sort (mc--ordered-region-strings) 'string<))
(mc--replace-region-strings))
+
+;;;###autoload
+(defun mc/vertical-align (character)
+ "Aligns all cursors vertically with a given CHARACTER to the one with the
+highest colum number (the rightest).
+Might not behave as intended if more than one cursors are on the same line."
+ (interactive "c")
+ (let ((rightest-column (current-column)))
+ (mc/execute-command-for-all-cursors
+ (lambda () "get the rightest cursor"
+ (interactive)
+ (setq rightest-column (max (current-column) rightest-column))
+ ))
+ (mc/execute-command-for-all-cursors
+ (lambda ()
+ (interactive)
+ (let ((missing-spaces (- rightest-column (current-column))))
+ (save-excursion (insert (make-string missing-spaces character)))
+ (forward-char missing-spaces)
+ )
+ ))
+ )
+ )
+
+;;;###autoload
+(defun mc/vertical-align-with-space ()
+ "Aligns all cursors with whitespace like `mc/vertical-align' does"
+ (interactive)
+ (mc/vertical-align 32)
+ )
+
(provide 'mc-separate-operations)
;;; mc-separate-operations.el ends here
diff --git a/multiple-cursors-core.el b/multiple-cursors-core.el
index 54a993f..8971a42 100644
--- a/multiple-cursors-core.el
+++ b/multiple-cursors-core.el
@@ -524,7 +524,7 @@ from being executed if in multiple-cursors-mode."
(overlay-put cursor 'kill-ring kill-ring)
(overlay-put cursor 'kill-ring-yank-pointer
kill-ring-yank-pointer)))))))
-(defvar mc/list-file "~/.emacs.d/.mc-lists.el"
+(defvar mc/list-file (locate-user-emacs-file ".mc-lists.el")
"The position of the file that keeps track of your preferences
for running commands with multiple cursors.")
- [nongnu] elpa/multiple-cursors d1ad51f 296/434: Gitignore *.elc, (continued)
- [nongnu] elpa/multiple-cursors d1ad51f 296/434: Gitignore *.elc, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors a3e6ec7 297/434: Merge pull request #135 from jistr/gitignore_elc, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors fc39dab 299/434: Adds jedi-mode to list of unsupported minor modes, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors da2a9ab 298/434: Add mc/mark-all-in-region-regexp, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 7ddda85 312/434: Added vertical align commands, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 912342e 315/434: Add missing ###autoload markers, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 66eefa2 317/434: Add cperl-electric-backspace to default run-for-all list, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors dc1bfbf 325/434: Add cua-delete-region to default run-for-all, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 89e360e 333/434: Merge pull request #193 from dovej/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 4969d38 331/434: Move mc/list-file to the user-emacs-directory, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 49c9f7f 340/434: Merge remote-tracking branch 'upstream/master',
ELPA Syncer <=
- [nongnu] elpa/multiple-cursors 9b53e89 344/434: Merge pull request #203 from dovej/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors ca822cd 347/434: Add mc/insert-letters function and test cases, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 54c05c3 356/434: Add more aliases for cl stuff, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 40eb74e 357/434: Extend mc/add-cursor-on-click to toggle fake cursors, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 06a2985 362/434: * mc-mark-more.el (mc/mark-all-in-region-regexp): Don't infloop when regexp matches empty string, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 4bf9860 364/434: Use cl-lib instead of shimming, which breaks in older emacsen, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors d5b544e 365/434: Merge pull request #246 from purcell/cl-lib, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors b3bd49c 372/434: Bump version to 1.4.0, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 741eec6 374/434: Update some copyright years, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors a9daac1 375/434: Add/fix docstring to functions. fix #161, ELPA Syncer, 2021/08/07