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

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

[nongnu] elpa/evil-numbers e0f4ba3d13 004/145: Fix number search.


From: ELPA Syncer
Subject: [nongnu] elpa/evil-numbers e0f4ba3d13 004/145: Fix number search.
Date: Thu, 6 Jan 2022 03:00:13 -0500 (EST)

branch: elpa/evil-numbers
commit e0f4ba3d135ddc87e3911bb2f1ae97ce033d2db4
Author: Michael Markert <markert.michael@googlemail.com>
Commit: Michael Markert <markert.michael@googlemail.com>

    Fix number search.
    
    Signed-off-by: Michael Markert <markert.michael@googlemail.com>
---
 evil-numbers.el | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/evil-numbers.el b/evil-numbers.el
index d679970654..17b29046c6 100644
--- a/evil-numbers.el
+++ b/evil-numbers.el
@@ -39,18 +39,19 @@
   (save-match-data
     (if (not (or
               ;; numbers or format specifier in front
-              (looking-back (rx (or (+? digit)
-                                    (and "0" (or (and (in "bB") (*? (in "01")))
-                                                 (and (in "oO") (*? (in 
"0-7")))
-                                                 (and (in "xX") (*? (in 
"0-9A-Fa-f"))))))))
+              (and
+               (looking-back (rx (or (+? digit)
+                                     (and "0" (or (and (in "bB") (*? (in 
"01")))
+                                                  (and (in "oO") (*? (in 
"0-7")))
+                                                  (and (in "xX") (*? (in digit 
"A-Fa-f"))))))))
+               ;; being on a specifier is handled in progn
+               (not (looking-at "[bBoOxX]")))
               ;; search for number in rest of line
-              (re-search-forward (rx
-                                  (or
-                                   (and "0" (in "bB") (+? (in "01")))
-                                   (and "0" (in "oO") (+? (in "0-7")))
-                                   (and "0" (in "xX") (+? (in digit "a-fA-F")))
-                                   (or (and "0" (not (in "bBoOxX"))) (+? 
digit))))
-                                 (point-at-eol) t)))
+              (progn
+               ;; match 0 of specifier or digit, being in a literal and after 
specifier is handled above
+               (re-search-forward "[[:digit:]]" (point-at-eol) t)
+               ;; skip format specifiers
+               (skip-chars-forward "bBoOxX"))))
         (error "No number at point or until end of line")
       (or
        ;; find binary literals



reply via email to

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