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

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

[nongnu] elpa/evil-numbers b2397f278a 094/145: Cleanup: move forward cha


From: ELPA Syncer
Subject: [nongnu] elpa/evil-numbers b2397f278a 094/145: Cleanup: move forward character check in evil-numbers--search-number
Date: Thu, 6 Jan 2022 03:00:21 -0500 (EST)

branch: elpa/evil-numbers
commit b2397f278a6ad0cf4879440855fcd5d10f09206f
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>

    Cleanup: move forward character check in evil-numbers--search-number
    
    This check relates to an implementation detail of how looking-back works,
    the caller should not have to be aware of this.
---
 evil-numbers.el | 37 ++++++++++++++++++-------------------
 1 file changed, 18 insertions(+), 19 deletions(-)

diff --git a/evil-numbers.el b/evil-numbers.el
index 7da0ef82eb..22a3bab989 100644
--- a/evil-numbers.el
+++ b/evil-numbers.el
@@ -204,17 +204,6 @@ NO-OFFSET don't apply offsets, expected  for VIM like 
behavior.
     (let ((point-next nil))
       (save-excursion
         (save-match-data
-
-          (unless no-offset
-            ;; `forward-char' so that we do not match the number
-            ;; directly behind us.
-            ;;
-            ;; Check the range to avoid end-of-buffer warning.
-            ;; Harmless but happens with block selection every
-            ;; time which is unreasonably noisy.
-            (unless (>= (1+ (point)) (point-max))
-              (forward-char)))
-
           (cond
            ((not (evil-numbers--search-number
                   (or beg (point-at-bol))
@@ -334,14 +323,24 @@ note that searching still starts at POINT."
   (or
    ;; Numbers or format specifier in front.
    (and (> (point) beg)
-        (looking-back
-         (rx (or (+? digit)
-                 (in "⁰¹²³⁴⁵⁶⁷⁸⁹")
-                 (in "₀₁₂₃₄₅₆₇₈₉" )
-                 (and "0" (or (and (in "bB") (*? (in "01")))
-                              (and (in "oO") (*? (in "0-7")))
-                              (and (in "xX") (*? (in digit "A-Fa-f")))))))
-         beg))
+        (save-excursion
+          ;; `forward-char' so that we do not match the number
+          ;; directly behind us.
+          ;;
+          ;; Check the range to avoid end-of-buffer warning.
+          ;; Harmless but happens with block selection every
+          ;; time which is unreasonably noisy.
+          (unless (>= (1+ (point)) (point-max))
+            (forward-char))
+          (looking-back
+           (rx (or (+? digit)
+                   (in "⁰¹²³⁴⁵⁶⁷⁸⁹")
+                   (in "₀₁₂₃₄₅₆₇₈₉" )
+                   (and "0"
+                        (or (and (in "bB") (*? (in "01")))
+                            (and (in "oO") (*? (in "0-7")))
+                            (and (in "xX") (*? (in digit "A-Fa-f")))))))
+           beg)))
    ;; Search for number in rest of line match 0 of specifier or digit,
    ;; being in a literal and after specifier is handled above.
    (and



reply via email to

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