Add flyspell option to ignore duplicates of different case

* lisp/textmodes/flyspell.el (flyspell-case-fold-duplications): Add
  option.
This commit is contained in:
Reuben Thomas 2018-09-10 15:06:02 +01:00
parent 80ca2b8109
commit 61f3a4b4fc
2 changed files with 15 additions and 1 deletions

View file

@ -231,6 +231,13 @@ characters that quote text "like this" are replaced by double
typographic quotes, “like this”, in text modes, and in comments in typographic quotes, “like this”, in text modes, and in comments in
non-text modes. non-text modes.
---
** New user option 'flyspell-case-fold-duplications'.
This option controls whether Flyspell mode considers consecutive words
to be duplicates if they are not in the same case. If non-nil, the
default, words are considered to be duplicates even if their letters'
case does not match.
--- ---
** 'write-abbrev-file' now includes special properties. ** 'write-abbrev-file' now includes special properties.
'write-abbrev-file' now writes special properties like ':case-fixed' 'write-abbrev-file' now writes special properties like ':case-fixed'

View file

@ -68,6 +68,12 @@ Detection of repeated words is not implemented in
:group 'flyspell :group 'flyspell
:type 'boolean) :type 'boolean)
(defcustom flyspell-case-fold-duplications t
"Non-nil means Flyspell matches duplicate words case-insensitively."
:group 'flyspell
:type 'boolean
:version 27.1)
(defcustom flyspell-mark-duplications-exceptions (defcustom flyspell-mark-duplications-exceptions
'((nil . ("that" "had")) ; Common defaults for English. '((nil . ("that" "had")) ; Common defaults for English.
("\\`francais" . ("nous" "vous"))) ("\\`francais" . ("nous" "vous")))
@ -1154,7 +1160,8 @@ spell-check."
(- (save-excursion (- (save-excursion
(skip-chars-backward " \t\n\f"))))) (skip-chars-backward " \t\n\f")))))
(p (when (>= bound (point-min)) (p (when (>= bound (point-min))
(flyspell-word-search-backward word bound t)))) (flyspell-word-search-backward
word bound flyspell-case-fold-duplications))))
(and p (/= p start))))) (and p (/= p start)))))
;; yes, this is a doublon ;; yes, this is a doublon
(flyspell-highlight-incorrect-region start end 'doublon) (flyspell-highlight-incorrect-region start end 'doublon)