[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/speedrect d2af235ca3 60/90: stash: save point and mark
From: |
ELPA Syncer |
Subject: |
[elpa] externals/speedrect d2af235ca3 60/90: stash: save point and mark crutches to stash |
Date: |
Fri, 6 Dec 2024 18:59:15 -0500 (EST) |
branch: externals/speedrect
commit d2af235ca3fdd90163f8a065a927ca7f63eb587b
Author: JD Smith <93749+jdtsmith@users.noreply.github.com>
Commit: JD Smith <93749+jdtsmith@users.noreply.github.com>
stash: save point and mark crutches to stash
Crutches are extensions from point and mark that allow rectangle to
cover areas where point can't go, like middle of tab or past EOL.
---
speedrect.el | 34 +++++++++++++++++++++-------------
1 file changed, 21 insertions(+), 13 deletions(-)
diff --git a/speedrect.el b/speedrect.el
index 24fb720b14..95961efd5d 100644
--- a/speedrect.el
+++ b/speedrect.el
@@ -50,27 +50,34 @@
"Last rectangle position.
Stored as (point-line point-col mark-line mark-col)")
-(defun speedrect-stash ()
- "Stash the line and column of point and mark."
- (when rectangle-mark-mode
- (setq speedrect-last
- (list (point) (mark)
- (window-parameter nil 'rectangle--point-crutches)
- rectangle--mark-crutches))))
-
(defun speedrect-recall-last ()
"Restore last saved rectangle position."
(interactive)
(pcase speedrect-last
- (`(,point ,mark ,point-crutches ,mark-crutches)
- (set-mark mark)
+ (`((,point . ,mark) ,point-crutches ,mark-crutches)
+ (set-mark (marker-position mark))
(goto-char point)
(setf (window-parameter nil 'rectangle--point-crutches) point-crutches)
(setq-local rectangle--mark-crutches mark-crutches)
(if (called-interactively-p 'interactive)
- (message "Restored last rectangle %d %d" point mark)))
+ (message "Restored last rectangle %d %d"
+ (marker-position point) (marker-position mark))))
(_ (message "No stored rectangle position"))))
+(defun speedrect-stash ()
+ "Stash the line and column of point and mark."
+ (when rectangle-mark-mode
+ (let ((pm (car speedrect-last)))
+ (if pm
+ (progn
+ (move-marker (car pm) (point))
+ (move-marker (cdr pm) (mark)))
+ (setq pm (cons (point-marker) (copy-marker (mark-marker)))))
+ (setq speedrect-last
+ (list pm
+ (window-parameter nil 'rectangle--point-crutches)
+ rectangle--mark-crutches)))))
+
(defun speedrect-restart ()
"Start a new rectangle, setting mark at the current position."
(interactive)
@@ -322,9 +329,10 @@ prior to deactivating mark."
(message "%s: [?] for help%s"
(propertize "SpeedRect" 'face 'success)
(if speedrect-last
- (format " %s:%S"
+ (format " %s:%d->%d"
(propertize "last-rect" 'face 'bold)
- speedrect-last)
+ (marker-position (caar speedrect-last))
+ (marker-position (cdar speedrect-last)))
""))))
;;; autoload
- [elpa] externals/speedrect f81a17461d 53/90: Update README.md, (continued)
- [elpa] externals/speedrect f81a17461d 53/90: Update README.md, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect d4d89acb50 27/90: yank-from-calc: preserve at least one space padding each side, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect a8b179b738 41/90: Remove superfluous \n, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect 1ffb2c76ca 30/90: Update README.md, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect 3cab9dfcc5 35/90: Update README.md, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect d9d7f79977 36/90: calc-grab-sum-down/across: switch to `_` and `:` to mirror calc, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect 1e732a5b35 44/90: bump version, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect a9086d65e5 45/90: speedrect-right-char: correct rectangle-right logic, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect 6867945e0b 54/90: Update README.md, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect 2a4d4f0bcd 59/90: Properly handle point/mark crutches for saving rects, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect d2af235ca3 60/90: stash: save point and mark crutches to stash,
ELPA Syncer <=
- [elpa] externals/speedrect 6dc047f54b 64/90: bump version, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect 4321fef672 40/90: Mention phi-rectangle, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect 4f9d3020e2 32/90: Update README.md, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect 0fa8964ce2 46/90: wrap commands for stash and restart, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect e7c0ca81cc 49/90: Bump version, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect 540dc4e790 58/90: Update README.md, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect 0f00af4c67 62/90: docstring tweak, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect 6982a08d25 11/90: doc: open uses tabs/spaces, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect 7bb4633c90 29/90: Update README.md, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect b743b42208 55/90: Add x:corners and M:multiple-cursors support, ELPA Syncer, 2024/12/06