[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/substitute 2fa0edaa5a 29/39: Fix below/above way of ide
From: |
ELPA Syncer |
Subject: |
[elpa] externals/substitute 2fa0edaa5a 29/39: Fix below/above way of identifying current target |
Date: |
Mon, 16 Jan 2023 11:58:52 -0500 (EST) |
branch: externals/substitute
commit 2fa0edaa5ada0bc8d1af032bd082a8adee2fb0d9
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Fix below/above way of identifying current target
---
substitute.el | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/substitute.el b/substitute.el
index 551c4db2b4..b792d98bfc 100644
--- a/substitute.el
+++ b/substitute.el
@@ -33,6 +33,8 @@
;;; Code:
+(require 'thingatpt)
+
(defgroup substitute nil
"Efficiently replace targets in the buffer or context."
:group 'editing)
@@ -119,25 +121,23 @@ Pass to it the TARGET and SCOPE arguments."
target
scope))
-;; FIXME 2023-01-15: There still are cases where "current and
-;; above/below" miss the current target.
(defun substitute--scope-current-and-below (target)
- "Position point to match current TARGET and all below."
+ "Position point to match current TARGET and below."
(widen)
- (cond
- ((looking-at target)
- (goto-char (match-beginning 0)))
- ((save-excursion (looking-back target (beginning-of-line)))
- (goto-char (match-beginning 0)))))
+ (if-let* (((region-active-p))
+ (bounds (region-bounds)))
+ (goto-char (caar bounds))
+ (thing-at-point-looking-at target)
+ (goto-char (match-beginning 0))))
(defun substitute--scope-current-and-above (target)
- "Position point to match current TARGET and all above."
+ "Position point to match current TARGET and above."
(widen)
- (cond
- ((looking-at target)
- (goto-char (match-end 0)))
- ((save-excursion (looking-back target (beginning-of-line)))
- (goto-char (match-end 0)))))
+ (if-let* (((region-active-p))
+ (bounds (region-bounds)))
+ (goto-char (caadr bounds))
+ (thing-at-point-looking-at target)
+ (goto-char (match-end 0))))
(defun substitute--scope-current-defun ()
"Position point to the top after `narrow-to-defun'."
- [elpa] externals/substitute 86423acf44 37/39: Use correct word in a couple of places, (continued)
- [elpa] externals/substitute 86423acf44 37/39: Use correct word in a couple of places, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute 731cb688e2 39/39: Bump version to trigger GNU ELPA build, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute 3f2e429e2d 32/39: Refine substitute-command macro, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute b665f84d4b 14/39: Reuse code in substitute--prompt-with-highlight, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute 89c3389e1c 15/39: Rename local variable for clarity, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute 45096c23d2 16/39: Update symbol of command for clarity, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute f45d238078 21/39: Add missing word in doc string, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute 8ac3904158 23/39: Simplify substitute--setup-scope, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute 73a1904ea4 24/39: Do not check for fn in 'while' loop, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute cd757fd209 27/39: Remove needless lambdas, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute 2fa0edaa5a 29/39: Fix below/above way of identifying current target,
ELPA Syncer <=
- [elpa] externals/substitute af3472dc34 33/39: Do not operate on nil thing, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute 9ddf421c55 34/39: Rename private function for clarity, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute 673c22fe54 35/39: Rename private function for clarity and move it further up, ELPA Syncer, 2023/01/16
- [elpa] externals/substitute 18c9830a5c 36/39: Rename private function for clarity, ELPA Syncer, 2023/01/16