[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/jinx ccf8b6b255 4/9: Code cleanup, use save-excursion
From: |
ELPA Syncer |
Subject: |
[elpa] externals/jinx ccf8b6b255 4/9: Code cleanup, use save-excursion |
Date: |
Mon, 11 Sep 2023 12:58:18 -0400 (EDT) |
branch: externals/jinx
commit ccf8b6b25550874e778565b556bf1d6859c90599
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Code cleanup, use save-excursion
---
jinx.el | 36 ++++++++++++++++--------------------
1 file changed, 16 insertions(+), 20 deletions(-)
diff --git a/jinx.el b/jinx.el
index c2d6aba5c5..764cf7e293 100644
--- a/jinx.el
+++ b/jinx.el
@@ -880,18 +880,16 @@ With prefix argument GLOBAL change the languages
globally."
(defun jinx-correct-nearest ()
"Correct nearest misspelled word."
(interactive "*")
- (jinx--correct-guard
- (let* ((old-point (point-marker))
- (overlays (jinx--force-overlays (window-start) (window-end) :visible
t))
- (count (length overlays))
- (idx 0))
- (unwind-protect
- (while (when-let ((ov (nth idx overlays)))
- (if (overlay-buffer ov)
- (when-let ((skip (jinx--correct-overlay ov nil)))
- (setq idx (mod (+ idx skip) count)))
- (cl-incf idx)))) ;; Skip deleted overlay
- (goto-char old-point)))))
+ (save-excursion
+ (jinx--correct-guard
+ (let* ((overlays (jinx--force-overlays (window-start) (window-end)
:visible t))
+ (count (length overlays))
+ (idx 0))
+ (while (when-let ((ov (nth idx overlays)))
+ (if (overlay-buffer ov)
+ (when-let ((skip (jinx--correct-overlay ov nil)))
+ (setq idx (mod (+ idx skip) count)))
+ (cl-incf idx)))))))) ;; Skip deleted overlay
;;;###autoload
(defun jinx-correct-at-point (&optional beg end)
@@ -901,14 +899,12 @@ Suggest corrections even if the word is not misspelled."
(unless (and beg end)
(setf (cons beg end) (or (jinx--bounds-of-word)
(user-error "No word at point"))))
- (jinx--correct-guard
- (let ((old-point (point-marker)))
- (unwind-protect
- (while (when-let ((skip (jinx--correct-overlay (make-overlay beg end)
nil)))
- (forward-to-word skip)
- (setf (cons beg end) (jinx--bounds-of-word))
- beg))
- (goto-char old-point)))))
+ (save-excursion
+ (jinx--correct-guard
+ (while (when-let ((skip (jinx--correct-overlay (make-overlay beg end)
nil)))
+ (forward-to-word skip)
+ (setf (cons beg end) (jinx--bounds-of-word))
+ beg)))))
;;;###autoload
(defun jinx-correct (&optional arg)
- [elpa] externals/jinx updated (417d95002f -> 6f09016ea0), ELPA Syncer, 2023/09/11
- [elpa] externals/jinx 3f3c07b753 3/9: jinx-correct: Add dispatching to jinx-correct-at-point, ELPA Syncer, 2023/09/11
- [elpa] externals/jinx ccf8b6b255 4/9: Code cleanup, use save-excursion,
ELPA Syncer <=
- [elpa] externals/jinx e70214849f 5/9: Update README.org, ELPA Syncer, 2023/09/11
- [elpa] externals/jinx bf7d9f5144 1/9: Implement jinx-correct-at-point by faking an overlay (#89), ELPA Syncer, 2023/09/11
- [elpa] externals/jinx c891a7779f 7/9: Update CHANGELOG.org, ELPA Syncer, 2023/09/11
- [elpa] externals/jinx 0f62c68620 8/9: Improve jinx-correct-at-point, ELPA Syncer, 2023/09/11
- [elpa] externals/jinx 6f09016ea0 9/9: jinx-correct-*: Code cleanup, ELPA Syncer, 2023/09/11
- [elpa] externals/jinx 709d4fa387 6/9: Update CHANGELOG.org, ELPA Syncer, 2023/09/11
- [elpa] externals/jinx 5702e733eb 2/9: Refactoring, ELPA Syncer, 2023/09/11