emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/speedrect b743b42208 55/90: Add x:corners and M:multipl


From: ELPA Syncer
Subject: [elpa] externals/speedrect b743b42208 55/90: Add x:corners and M:multiple-cursors support
Date: Fri, 6 Dec 2024 18:59:15 -0500 (EST)

branch: externals/speedrect
commit b743b42208dff33298bf4a397028736d2bdf39c3
Author: JD Smith <93749+jdtsmith@users.noreply.github.com>
Commit: JD Smith <93749+jdtsmith@users.noreply.github.com>

    Add x:corners and M:multiple-cursors support
---
 README.md    | 22 ++++++++++++++--------
 speedrect.el | 34 ++++++++++++++++++++++++++--------
 2 files changed, 40 insertions(+), 16 deletions(-)

diff --git a/README.md b/README.md
index 4aefc9ffe5..f395da9b26 100644
--- a/README.md
+++ b/README.md
@@ -18,6 +18,10 @@ Quick key bindings and other tools for Emacs' 
`rectangle-mark-mode`.
 - Two-way interaction with Calc: send sums or tables of data into calc, and 
yank processed matrix data back into the rectangle from the top of calc's stack.
 - A useful help page (`?`). 
 
+## News
+
+v0.4: 
+
 ## Installation
 
 Just download, add to path, and arrange to `(require 'speedrect)`.  For users 
of `use-package`:
@@ -40,9 +44,9 @@ Start `rectangle-mark-mode` as usual (`C-x SPC`, by default). 
 Hit `?` to summon
 
 ## Hints
 
-A rectangle is just a _region_ (point and mark), specially interpreted.  While 
marking rectangles, you can `C-x C-x` to cycle point among any of the 
rectangle's four corners.  This is useful to make changes to the appropriate 
side of the selected region.
+A rectangle is just a _region_ (point and mark), specially interpreted.  While 
marking rectangles, you can use `x` to cycle point among any of the rectangles 
four corners.  This is useful to make changes to the appropriate side of the 
selected region.
 
-Use calc, it's super-powerful:
+Use calc, it's super-powerful...
 
 ### Using Calc
 
@@ -77,10 +81,10 @@ Killing:
   [c] clear     clear rectangle area by overwriting with spaces
   [r] rest      delete the rest of the columns, keeping the marked rectangle
 
-Change Rectangle:
+Copy/Yank:
 
-  [n] new       start a new rectangle from this location
-  [l] last      restore the last used rectangle position, if possible
+  [w] copy      copy rectangle for future yanking
+  [y] yank      yank rectangle, inserting at point
 
 Shift Rectangle (can use numeric prefixes):
 
@@ -93,10 +97,11 @@ Shift Rectangle (can use numeric prefixes):
   [M-S-up]      move the rectangle up 5 columns
   [M-S-down]    move the rectangle down 5 lines
 
-Copy/Yank:
+Change Rectangle:
 
-  [w] copy      copy rectangle for future yanking
-  [y] yank      yank rectangle, inserting at point
+  [x] corners   move point around corners of the rectangle
+  [n] new       start a new rectangle from this location
+  [l] last      restore the last used rectangle, if possible
 
 Numerical:
 
@@ -108,6 +113,7 @@ Numerical:
 
 Etc:
 
+  [M] multiple-cursors   add cursors at current column
   [?] help      view this Help buffer
   [q] quit      exit rectangle-mark-mode
 ```
diff --git a/speedrect.el b/speedrect.el
index 15f3be9dd6..1ef5f91a3a 100644
--- a/speedrect.el
+++ b/speedrect.el
@@ -2,8 +2,8 @@
 ;; Copyright (C) 2023 J.D. Smith
 
 ;; Author: JD Smith
-;; Created: 2023
-;; Version: 0.3.1
+;; Created: 2023-2024
+;; Version: 0.4.0
 ;; Package-Requires: ((emacs "25.1") (compat "29.1.4.0"))
 ;; Homepage: https://github.com/jdtsmith/speedrect
 ;; Keywords: convenience
@@ -202,6 +202,20 @@ each side of the inserted text."
                      (length crect) height)))
     (user-error "Calc rectangle yank not possible here")))
 
+(declare-function mc/edit-lines "mc-edit-lines")
+(defun speedrect-multiple-cursors ()
+  "Add multiple cursors on each line at the current column."
+  (interactive)
+  (condition-case nil
+      (require 'multiple-cursors)
+    (error (user-error "Multiple-cursors not found"))
+    (:success
+     (let ((col (current-column)))
+       (speedrect-stash)
+       (exchange-point-and-mark)
+       (move-to-column col)
+       (mc/edit-lines)))))
+
 (defun speedrect-transient-map-info ()
   "Documentation window for speedrect."
   (interactive)
@@ -218,9 +232,9 @@ each side of the inserted text."
             "  [SPC] del-ws  delete all whitespace, starting from left 
column\n"
             "  [c] clear     clear rectangle area by overwriting with spaces\n"
             "  [r] rest      delete the rest of the columns, keeping the 
marked rectangle\n\n"
-            "Change Rectangle:\n\n"
-            "  [n] new       start a new rectangle from this location\n"
-            "  [l] last      restore the last used rectangle position, if 
possible\n\n"
+            "Copy/Yank:\n\n"
+            "  [w] copy      copy rectangle for future yanking\n"
+            "  [y] yank      yank rectangle, inserting at point\n\n"
             "Shift Rectangle (can use numeric prefixes):\n\n"
             "  [S-left]      move the rectangle left\n"
             "  [S-right]     move the rectangle right\n"
@@ -230,9 +244,10 @@ each side of the inserted text."
             "  [M-S-right]   move the rectangle right 5 columns\n"
             "  [M-S-up]      move the rectangle up 5 columns\n"
             "  [M-S-down]    move the rectangle down 5 lines\n\n"
-            "Copy/Yank:\n\n"
-            "  [w] copy      copy rectangle for future yanking\n"
-            "  [y] yank      yank rectangle, inserting at point\n\n"
+            "Change Rectangle:\n\n"
+            "  [x] corners   move point around corners of the rectangle\n"
+            "  [n] new       start a new rectangle from this location\n"
+            "  [l] last      restore the last used rectangle, if possible\n\n"
             "Numerical:\n\n"
             "  [N] numbers   fill the rectangle with numbers (prefix to set 
start)\n"
             "  [#] grab      grab the rectangle as a matrix in calc\n"
@@ -240,6 +255,7 @@ each side of the inserted text."
             "  [:] down      sum down the columns and grab result in calc\n"
             "  [m] yank-mat  yank matrix from top of calc stack, overwriting 
selected rect\n\n"
             "Etc:\n\n"
+            "  [M] multiple-cursors   add cursors at current column\n"
             "  [?] help      view this Help buffer\n"
             "  [q] quit      exit rectangle-mark-mode"))
       (princ l))))
@@ -281,6 +297,7 @@ prior to deactivating mark."
      ("y" speedrect-yank-rectangle-dwim t) ("c" clear-rectangle t)
      ("d" delete-rectangle after)  ("N" rectangle-number-lines t)
      ("r" speedrect-delete-rest t) ("SPC" delete-whitespace-rectangle t)
+     ("x" rectangle-exchange-point-and-mark)
      ;; Shift rect
      ("S-<right>" speedrect-shift-right)
      ("S-<left>" speedrect-shift-left)
@@ -295,6 +312,7 @@ prior to deactivating mark."
      ("m" speedrect-yank-from-calc after)
      ;; Special
      ("n" speedrect-restart) ("l" speedrect-recall-last)
+     ("M" speedrect-multiple-cursors)
      ("?" speedrect-transient-map-info) ("q" speedrect-quit))
    for bind = (if wrap (speedrect--wrap-command def (eq wrap 'after)) def)
    do (define-key rectangle-mark-mode-map (kbd key) bind))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]