[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil-numbers 9841266544 113/145: Cleanup: replace catch/th
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil-numbers 9841266544 113/145: Cleanup: replace catch/throw with a 'found' variable |
Date: |
Thu, 6 Jan 2022 03:00:23 -0500 (EST) |
branch: elpa/evil-numbers
commit 984126654414e2631cac6f61bcc34ed9a951e361
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>
Cleanup: replace catch/throw with a 'found' variable
---
evil-numbers.el | 58 +++++++++++++++++++++++++++++----------------------------
1 file changed, 30 insertions(+), 28 deletions(-)
diff --git a/evil-numbers.el b/evil-numbers.el
index 87e7723706..8ec10e1615 100644
--- a/evil-numbers.el
+++ b/evil-numbers.el
@@ -400,35 +400,37 @@ Return non-nil on success, leaving the point at the end
of the number."
Keep padding when PADDED is non-nil.
Return non-nil on success, leaving the point at the end of the number."
- (catch 'result
+ (let ((found nil))
(save-match-data
- (let ((point-last (1- (point))))
- ;; Search for any text that might be part of a number,
- ;; if `evil-numbers--search-and-replace' cannot parse it - that's fine,
- ;; keep searching until `end'
- ;; This avoids doubling up on number parsing logic.
- (while (< point-last (point))
- (when (evil-numbers--inc-at-pt-impl
- amount
- ;; Clamp limits to line bounds.
- ;; The caller may use a range that spans lines to
- ;; allow searching and finding items across
- ;; multiple lines (currently used for selection).
- (max beg (point-at-bol))
- (min end (point-at-eol))
- padded)
- (throw 'result t))
-
- (setq point-last (point))
- (unless (re-search-forward
- (concat "["
- "[:xdigit:]"
- evil-numbers--chars-superscript
- evil-numbers--chars-subscript
- "]")
- end t)
- (throw 'result nil)))))))
-
+ ;; Search for any text that might be part of a number,
+ ;; if `evil-numbers--search-and-replace' cannot parse it - that's fine,
+ ;; keep searching until `end'
+ ;; This avoids doubling up on number parsing logic.
+ (while (and
+ ;; Found item, exit the loop.
+ (null
+ (when (evil-numbers--inc-at-pt-impl
+ amount
+ ;; Clamp limits to line bounds.
+ ;; The caller may use a range that spans lines to
+ ;; allow searching and finding items across
+ ;; multiple lines (currently used for selection).
+ (max beg (point-at-bol))
+ (min end (point-at-eol))
+ padded)
+ (setq found t)))
+
+ ;; Search failed, exit the loop.
+ (re-search-forward
+ (concat "["
+ "[:xdigit:]"
+ evil-numbers--chars-superscript
+ evil-numbers--chars-subscript
+ "]")
+ end t))
+ ;; Empty while body.
+ nil))
+ found))
;; ---------------------------------------------------------------------------
;; Public Functions
- [nongnu] elpa/evil-numbers 1bf577af5c 132/145: Fix #26: Optionally match characters directly before the cursor, (continued)
- [nongnu] elpa/evil-numbers 1bf577af5c 132/145: Fix #26: Optionally match characters directly before the cursor, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers 43ae06047c 115/145: README.org: keypad can be used for other platforms too, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers 83e98f9fe2 096/145: Correct invalid limit argument to `looking-back', ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers a6cf01fd90 090/145: Fix #21 increment w/ selection ignores items before the cursor, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers 11fc45c760 086/145: Cleanup: move subscript encode/decode into utility functions, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers bea0c102af 088/145: Cleanup: use term amount for both decimal/(hex/bin/octal) functions, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers f33d0137ac 072/145: Cleanup: quiet package-lint warnings, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers 48b528baec 131/145: Refactor: instead of passing an amount, pass in a function, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers fd742943fd 127/145: README.org use definition lists for options, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers cd23a7b458 136/145: README.org: update poor wording, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers 9841266544 113/145: Cleanup: replace catch/throw with a 'found' variable,
ELPA Syncer <=
- [nongnu] elpa/evil-numbers 9cf802c29d 119/145: Fix #24 hexadecimal values case when incrementing/decrementing, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers 6ea1c8c3a9 036/145: Use list for contributers., ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers a2ce896e05 049/145: Update documentation, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers ac4101f0e4 052/145: Explicitly require evil., ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers 4fd2d402fe 050/145: Add CHANGELOG, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers 8b59acf267 059/145: fix: handle hyphen-separated numbers correctly, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers e0f4ba3d13 004/145: Fix number search., ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers 221ceb6177 001/145: Initial commit., ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers 7e7e2e42f3 005/145: Remove "support" for negative non-decimal literals., ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers 4466368c6d 008/145: Adjust error messages., ELPA Syncer, 2022/01/06