[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/speedrect f0de893e1a 14/90: kill-rest: added on "r"
From: |
ELPA Syncer |
Subject: |
[elpa] externals/speedrect f0de893e1a 14/90: kill-rest: added on "r" |
Date: |
Fri, 6 Dec 2024 18:59:08 -0500 (EST) |
branch: externals/speedrect
commit f0de893e1af70c405a91154a9b6e8bc653e19c61
Author: JD Smith <93749+jdtsmith@users.noreply.github.com>
Commit: JD Smith <93749+jdtsmith@users.noreply.github.com>
kill-rest: added on "r"
---
README.md | 1 +
speedrect.el | 18 ++++++++++++++----
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index 69c96ff7dd..980d945029 100644
--- a/README.md
+++ b/README.md
@@ -41,6 +41,7 @@ Killing:
[d] delete kill rectangle without saving
[SPC] del-ws delete all whitespace, starting from left column
[c] clear clear rectangle area by overwriting with spaces
+ [r] rest delete the rest of the lines, keeping the marked rectangle
Change Rectangle:
[n] new start a new rectangle from this location
[l] last restore the last used rectangle position, if possible
diff --git a/speedrect.el b/speedrect.el
index 7f1762bf77..15df85acfd 100644
--- a/speedrect.el
+++ b/speedrect.el
@@ -3,7 +3,7 @@
;; Author: JD Smith
;; Created: 2023
-;; Version: 0.1.1
+;; Version: 0.1.2
;; Package-Requires: ((emacs "25.1") (compat "29.1.4.0"))
;; Homepage: https://github.com/jdtsmith/speedrect
;; Keywords: convenience
@@ -101,10 +101,19 @@ Note that point and mark will not move beyond the end of
text on their lines."
(interactive "P")
(speedrect-shift (- (or columns 5))))
+(defun speedrect-kill-rest (start end)
+ "Keep rectangle between START and END, removing the rest of the affected
lines."
+ (interactive "r")
+ (speedrect-stash)
+ (let ((rect (extract-rectangle start end)))
+ (delete-region (progn (goto-char start) (line-beginning-position))
+ (progn (goto-char end) (line-beginning-position 2)))
+ (insert-rectangle rect)))
+
(defun speedrect-transient-map-info ()
"Documentation window for speedrect."
(interactive)
- (with-help-window "Rectangle Mark Command Help"
+ (with-help-window "SpeedRect Command Key Help"
(dolist
(l '("SpeedRect Rectangle Mark Mode Commands\n"
"======================================================================\n\n"
@@ -115,7 +124,8 @@ Note that point and mark will not move beyond the end of
text on their lines."
" [k] kill kill and save rectangle for yanking\n"
" [d] delete kill rectangle without saving\n"
" [SPC] del-ws delete all whitespace, starting from left
column\n"
- " [c] clear clear rectangle area by overwriting with
spaces\n\n"
+ " [c] clear clear rectangle area by overwriting with spaces\n"
+ " [r] rest delete the rest of the lines, 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"
@@ -152,7 +162,7 @@ prior to deactivating mark."
("o" open-rectangle) ("w" copy-rectangle-as-kill)
("y" yank-rectangle) ("c" clear-rectangle)
("d" delete-rectangle) ("N" rectangle-number-lines)
- ("SPC" delete-whitespace-rectangle)
+ ("r" speedrect-kill-rest) ("SPC" delete-whitespace-rectangle)
;; Shift rect
("S-<right>" speedrect-shift)
("S-<left>" speedrect-shift-left)
- [elpa] externals/speedrect 8902387c85 28/90: README: describe operation with calc, (continued)
- [elpa] externals/speedrect 8902387c85 28/90: README: describe operation with calc, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect 7c77c5832f 02/90: Update README.md, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect 7f9293882d 04/90: Initial commit, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect 48dcbdf02c 12/90: use compat to reach older Emacs versions; bump version, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect 0f7fc6904d 13/90: Update README.md, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect e8169e86df 15/90: delete-rest: renamed and fixed insertion/end logic, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect 83a60fa26e 18/90: Update README.md, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect 9bd1354dee 22/90: Mention straight install, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect 0ea0dba568 20/90: more doc tweaks, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect 2aac618746 26/90: speedrect-yank-from-calc: added, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect f0de893e1a 14/90: kill-rest: added on "r",
ELPA Syncer <=
- [elpa] externals/speedrect 1e9b598017 21/90: Update README.md, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect 952899587f 24/90: doc: extend bar, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect 395c578693 25/90: doc tweaks, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect 496f6e7473 31/90: Update README.md, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect 0d899fc06d 34/90: Update README.md, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect 7abd0d9337 33/90: Update README.md, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect bb9d61cba6 39/90: Update README.md, ELPA Syncer, 2024/12/06
- [elpa] externals/speedrect 629e9d935b 42/90: add move up/down commands and [M-]S-<up>/<down>, ELPA Syncer, 2024/12/06
- [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