branch: elpa/evil-numbers
commit bce451b700b5f6d565442b6f4213a17221772ea5
Author: Campbell Barton <[email protected]>
Commit: Campbell Barton <[email protected]>
Use message instead of error when no number is found
---
CHANGELOG.org | 4 ++++
evil-numbers.el | 13 ++++++++-----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/CHANGELOG.org b/CHANGELOG.org
index 14ff0c5c98..c9a1c6400b 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -6,6 +6,10 @@
+ =evil-numbers-use-cursor-at-end-of-number= option to match numbers
directly before the cursor
(diverging from VIM's default behavior).
+** Changes
+ + Use =message= instead of =error= when no number is found
+ (don't error since VIM doesn't use an error in this case).
+
** Fixes
+ Fix #27 Number directly before the cursor manipulated when the cursor
can't move forward.
diff --git a/evil-numbers.el b/evil-numbers.el
index afdd2513a7..b41986fb21 100644
--- a/evil-numbers.el
+++ b/evil-numbers.el
@@ -324,7 +324,7 @@ Each item in MATCH-CHARS is a cons pair.
(evil-numbers--skip-chars-impl
ch-skip ch-sep-optional dir 1 limit))
(t
- (error (format "Unknown type %S" ch-skip))))
+ (error (format "Unknown type %S (internal error)" ch-skip))))
;; End of the match.
(when do-match
@@ -643,13 +643,16 @@ result in a number with a + sign."
(lambda (_beg end) (< point-init end))))))
(point)))))
- (if (null point-next)
- (error "No number at point or until end of line")
-
+ (cond
+ ((null point-next)
+ ;; Point not found, note that VIM doesn't report anything in this case.
+ (message "No number at point or until end of line")
+ nil)
+ (t
;; Moves point one position back to conform with VIM,
;; see `evil-adjust-cursor' for details.
(goto-char (1- point-next))
- t)))))
+ t))))))
;;;###autoload (autoload 'evil-numbers/dec-at-pt "evil-numbers" nil t)
(evil-define-operator evil-numbers/dec-at-pt