]> code.delx.au - gnu-emacs/commitdiff
(flyspell-mark-duplications-exceptions): New variable. List of
authorMichaël Cadilhac <michael.cadilhac@lrde.org>
Fri, 31 Aug 2007 13:41:31 +0000 (13:41 +0000)
committerMichaël Cadilhac <michael.cadilhac@lrde.org>
Fri, 31 Aug 2007 13:41:31 +0000 (13:41 +0000)
exceptions for the duplicated word rule.
(flyspell-mark-duplications-flag): Mention it.
(flyspell-word): Treat it.

lisp/ChangeLog
lisp/textmodes/flyspell.el

index 6a3447dc01e0c87b3bed9c37689709fc3e6c9448..255aad43bc4faf7fa3cb59cf0b24458a797a0194 100644 (file)
@@ -1,5 +1,10 @@
 2007-08-31  Micha\e,Ak\e(Bl Cadilhac  <michael@cadilhac.name>
 
+       * textmodes/flyspell.el (flyspell-mark-duplications-exceptions):
+       New variable.  List of exceptions for the duplicated word rule.
+       (flyspell-mark-duplications-flag): Mention it.
+       (flyspell-word): Treat it.
+
        * files.el (create-file-buffer): If the filename sans directory starts
        with spaces, remove them.
 
index 0b5dfa4cc54ba30fc93648de75a6e926a615a470..9d5c7868d13bf917132ad9127b324a4d87c369a3 100644 (file)
@@ -67,11 +67,21 @@ Non-nil means use highlight, nil means use minibuffer messages."
 
 (defcustom flyspell-mark-duplications-flag t
   "Non-nil means Flyspell reports a repeated word as an error.
+See `flyspell-mark-duplications-exceptions' to add exceptions to this rule.
 Detection of repeated words is not implemented in
 \"large\" regions; see `flyspell-large-region'."
   :group 'flyspell
   :type 'boolean)
 
+(defcustom flyspell-mark-duplications-exceptions
+  '(("francais" . ("nous" "vous")))
+  "A list of exceptions for duplicated words.
+It should be a list of (LANGUAGE . EXCEPTION-LIST).  LANGUAGE is matched
+against the current dictionary and EXCEPTION-LIST is a list of strings.
+The duplicated word is downcased before it is compared with the exceptions."
+  :group 'flyspell
+  :type '(alist :key-type string :value-type (repeat string)))
+
 (defcustom flyspell-sort-corrections nil
   "Non-nil means, sort the corrections alphabetically before popping them."
   :group 'flyspell
@@ -1022,6 +1032,13 @@ Mostly we check word delimiters."
                     (and (> start (point-min))
                          (not (memq (char-after (1- start)) '(?\} ?\\)))))
                 flyspell-mark-duplications-flag
+                (not (catch 'exception
+                       (dolist (except flyspell-mark-duplications-exceptions)
+                         (and (string= (or ispell-local-dictionary
+                                           ispell-dictionary)
+                                       (car except))
+                              (member (downcase word) (cdr except))
+                              (throw 'exception t)))))
                 (save-excursion
                   (goto-char start)
                   (let* ((bound