* flyspell: check repeated words in another way.
@ 2007-08-30 15:44 Michaël Cadilhac
2007-08-31 13:46 ` Michaël Cadilhac
0 siblings, 1 reply; 2+ messages in thread
From: Michaël Cadilhac @ 2007-08-30 15:44 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1.1.1: Type: text/plain, Size: 695 bytes --]
Hi folk!
You all know how French is a beautiful language, constructed with poetry
in mind, and has been for many years one of the thing the French are
proudest about.
However, such beautifulness doesn't come without a price. For instance,
when we write « we love each other », we say « nous nous aimons ». If
you have a close look, you'll see there's a repeated « nous », and this
is normal. Another example would be « vous vous battez », with a
doubled « vous ». Those are the only exceptions I can think of, but
anyway, the problem is that flyspell flags them as errors.
Maybe the following could be installed, and if it's too specific, it
could be useful for someone.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1.2: flyspell.patch --]
[-- Type: text/x-patch, Size: 1839 bytes --]
Index: flyspell.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/textmodes/flyspell.el,v
retrieving revision 1.122
diff -b -u -w -r1.122 flyspell.el
--- flyspell.el 13 Aug 2007 13:40:48 -0000 1.122
+++ flyspell.el 30 Aug 2007 15:33:39 -0000
@@ -66,12 +66,22 @@
:type 'boolean)
(defcustom flyspell-mark-duplications-flag t
- "Non-nil means Flyspell reports a repeated word as an error.
+ "Non-nil means Flyspell treats repeated words as errors.
+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 exception 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 @@
(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
[-- Attachment #1.1.3: Type: text/plain, Size: 339 bytes --]
So long!
--
| Michaël `Micha' Cadilhac | 21 seems like a good value: half of |
| http://michael.cadilhac.name | of 42 and just old enough to drink! |
| JID/MSN: | Why would you want to change it? |
`---- michael.cadilhac@gmail.com | -- Stefan Monnier - --'
[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]
[-- Attachment #2: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: flyspell: check repeated words in another way.
2007-08-30 15:44 flyspell: check repeated words in another way Michaël Cadilhac
@ 2007-08-31 13:46 ` Michaël Cadilhac
0 siblings, 0 replies; 2+ messages in thread
From: Michaël Cadilhac @ 2007-08-31 13:46 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1.1: Type: text/plain, Size: 1113 bytes --]
michael@cadilhac.name (Michaël Cadilhac) writes:
> Hi folk!
>
> You all know how French is a beautiful language, constructed with poetry
> in mind, and has been for many years one of the thing the French are
> proudest about.
>
> However, such beautifulness doesn't come without a price. For instance,
> when we write « we love each other », we say « nous nous aimons ». If
> you have a close look, you'll see there's a repeated « nous », and this
> is normal. Another example would be « vous vous battez », with a
> doubled « vous ». Those are the only exceptions I can think of, but
> anyway, the problem is that flyspell flags them as errors.
>
> Maybe the following could be installed, and if it's too specific, it
> could be useful for someone.
Installed.
--
| Michaël `Micha' Cadilhac | I'd be surprised if my fix doesn't |
| http://michael.cadilhac.name | address this problem as well. |
| JID/MSN: | PS: But I like surprises. |
`---- michael.cadilhac@gmail.com | -- Stefan Monnier - --'
[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]
[-- Attachment #2: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-08-31 13:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-30 15:44 flyspell: check repeated words in another way Michaël Cadilhac
2007-08-31 13:46 ` Michaël Cadilhac
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.