[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/jinx 72006bc660 1/3: jinx-correct: Show number of missp
From: |
ELPA Syncer |
Subject: |
[elpa] externals/jinx 72006bc660 1/3: jinx-correct: Show number of misspellings |
Date: |
Sun, 26 Mar 2023 16:59:04 -0400 (EDT) |
branch: externals/jinx
commit 72006bc660eea95b21179171b58da7f66285a4b4
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
jinx-correct: Show number of misspellings
---
CHANGELOG.org | 1 +
README.org | 2 +-
jinx.el | 26 +++++++++++++++-----------
3 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/CHANGELOG.org b/CHANGELOG.org
index 8691201194..0ee0d861cc 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -6,6 +6,7 @@
- Add =jinx-misspelled-map=.
- =jinx-correct=: Unfold invisible line when correcting misspellings.
+- =jinx-correct=: Show number of misspellings.
* Version 0.2 (2023-03-26)
diff --git a/README.org b/README.org
index 58be9182b7..17b1bea18e 100644
--- a/README.org
+++ b/README.org
@@ -39,7 +39,7 @@ Ubuntu, install the packages =libenchant-2-2=,
=libenchant-2-dev= and =pkg-confi
* Usage
-Jinx offers three autoloaded entry points , the modes =global-jinx-mode=,
+Jinx offers three auto-loaded entry points , the modes =global-jinx-mode=,
=jinx-mode= and the command =jinx-correct=. You can either enable
=global-jinx-mode=
or add =jinx-mode= to the hooks of the modes.
diff --git a/jinx.el b/jinx.el
index 6cbe136fef..81126d1172 100644
--- a/jinx.el
+++ b/jinx.el
@@ -49,7 +49,7 @@
;; and programmable predicates. Jinx comes preconfigured for the most
;; important major modes.
;;
-;; Jinx offers three autoloaded entry points , the modes
+;; Jinx offers three auto-loaded entry points , the modes
;; `global-jinx-mode', `jinx-mode' and the command `jinx-correct'.
;; You can either enable `global-jinx-mode' or add `jinx-mode' to the
;; hooks of the modes.
@@ -182,7 +182,7 @@ checking."
'((emacs-lisp-mode "Package-Requires:.*$")
(t "[A-Z]+\\>" ;; Uppercase words
"\\w*?[0-9]\\w*\\>" ;; Words with numbers, hex codes
- "[a-z]+://\\w*\\>" ;; URI
+ "[a-z]+://\\S-+" ;; URI
"<?[-+_.~a-zA-Z][-+_.~:a-zA-Z0-9]*@[-.a-zA-Z0-9]+>?")) ;; Email
"List of excluded regexps."
:type '(alist :key-type symbol :value-type (repeat regexp)))
@@ -565,14 +565,14 @@ Return list of overlays, see `jinx--get-overlays'."
(when (jinx--word-valid-p (overlay-start ov))
(delete-overlay ov)))))
-(defun jinx--correct (overlay &optional recenter)
- "Correct word at OVERLAY, optionally RECENTER."
+(defun jinx--correct (overlay &optional recenter info)
+ "Correct word at OVERLAY with optional RECENTER and prompt INFO."
(let* ((word (buffer-substring-no-properties
(overlay-start overlay) (overlay-end overlay)))
(selected
(jinx--with-highlight overlay recenter
(lambda ()
- (or (completing-read (format "Correct ā%sā (RET to skip): " word)
+ (or (completing-read (format "Correct ā%sā%s: " word (or info
""))
(jinx--suggestion-table word)
nil nil nil t word)
word)))))
@@ -620,12 +620,16 @@ If predicate argument ALL is given correct all
misspellings."
(save-excursion
(cl-letf (((symbol-function #'jinx--timer-handler) #'ignore)) ;;
Inhibit
(if all
- (dolist (overlay
- (sort (or (jinx--force-overlays (point-min)
(point-max))
- (user-error "No misspellings in whole
buffer"))
- (lambda (a b) (< (overlay-start a)
(overlay-start b)))))
- (when (overlay-buffer overlay) ;; Could be already deleted
- (jinx--correct overlay 'recenter)))
+ (let* ((overlays
+ (or (sort (jinx--force-overlays (point-min)
(point-max))
+ (lambda (a b) (< (overlay-start a)
(overlay-start b))))
+ (user-error "No misspellings in whole buffer")))
+ (count (length overlays)))
+ (cl-loop for ov in overlays for idx from 1
+ if (overlay-buffer ov) do ;; Could be already
deleted
+ (jinx--correct ov 'recenter
+ (format " (%d of %d, RET to skip)"
+ idx count))))
(jinx--correct (or (jinx--nearest-overlay)
(user-error "No misspelling in visible
text")))))))
(jit-lock-refontify)))