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

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

[elpa] externals/jinx 29a9e94ca3: jinx-correct-all: Restrict corrections


From: ELPA Syncer
Subject: [elpa] externals/jinx 29a9e94ca3: jinx-correct-all: Restrict corrections to marked region
Date: Wed, 28 Feb 2024 09:58:30 -0500 (EST)

branch: externals/jinx
commit 29a9e94ca3fe7068179384f2fc2929bcbc75b98c
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    jinx-correct-all: Restrict corrections to marked region
---
 CHANGELOG.org |  2 ++
 jinx.el       | 12 ++++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG.org b/CHANGELOG.org
index 04734184d8..af191e9e82 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -6,6 +6,8 @@
 
 - Bugfix: ~jinx-correct~ - Make sure that words are saved without text 
properties
   in the file-local variable ~jinx-local-words~.
+- ~jinx-correct~: If a region is marked, call ~jinx-correct-all~ and restrict
+  corrections to the marked region.
 
 * Version 1.3 (2024-02-23)
 
diff --git a/jinx.el b/jinx.el
index 88fbcf2463..d6f86447f7 100644
--- a/jinx.el
+++ b/jinx.el
@@ -930,9 +930,12 @@ buffers.  See also the variable `jinx-languages'."
   "Correct all misspelled words in the buffer."
   (interactive "*")
   (jinx--correct-guard
-   (let* ((overlays (jinx--force-overlays (point-min) (point-max) :check t))
+   (let* ((overlays (jinx--force-overlays (or (use-region-beginning) 
(point-min))
+                                          (or (use-region-end) (point-max))
+                                          :check t))
           (count (length overlays))
           (idx 0))
+     (deactivate-mark)
      (push-mark)
      (while-let ((ov (nth idx overlays)))
        (if-let (((overlay-buffer ov))
@@ -982,13 +985,14 @@ Optionally insert INITIAL input in the minibuffer."
 This command dispatches to the following commands:
   - `jinx-correct-nearest': If prefix ARG is nil, correct nearest
     misspelled word.
-  - `jinx-correct-all': If prefix ARG is 4, corresponding to
-    \\[universal-argument] pressed once, correct all misspelled words.
+  - `jinx-correct-all': If a region is marked, or if prefix ARG
+    is 4, corresponding to \\[universal-argument] pressed once,
+    correct all misspelled words.
   - `jinx-correct-word': If prefix ARG is 16, corresponding to
     \\[universal-argument] pressed twice, correct word before point."
   (interactive "*P")
   (pcase arg
-    ('nil (jinx-correct-nearest))
+    ('nil (if (use-region-p) (jinx-correct-all) (jinx-correct-nearest)))
     ('(16) (jinx-correct-word))
     (_ (jinx-correct-all))))
 



reply via email to

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