[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: enhance flyspell for german language (+TeX)
From: |
Sebastian Meisel |
Subject: |
Re: enhance flyspell for german language (+TeX) |
Date: |
Fri, 10 Feb 2006 20:20:43 +0100 |
User-agent: |
KMail/1.9.1 |
> There is a flyspell-incorrect-hook, so you might use it to forward the
> word (or the sentence) to perl. It could also be used to enhance
> flyspell in lisp, I guess.
>
Well it took me some time, but finally I made it. I use (thank's for the tip)
the flyspell-incorrect-hook:
----------->
(add-hook 'flyspell-incorrect-hook 'flyspell-zusammen())
(defun flyspell-zusammen (beg end poss)
"This function is to be called by 'flyspell-incorrect-hook. It looks for
german hyphenationmarks (\"-) and
checks if the 'misspelled words could be correct parts of combined word in
german language."
(if (re-search-backward "\"-" (- beg 2) t)
(if (when (consp poss)
(setq temp-buffer (get-buffer-create " *flyspell-temp*"))
(save-excursion
(copy-to-buffer temp-buffer beg end)
(set-buffer temp-buffer)
(goto-char (point-min))
(setq word (capitalize (buffer-string)))
(when (member word (nth 2 poss)) t)
)) t) ;; (if (when (consp poss)
(if (and (re-search-forward "-" (+ end 2) t)
(or (re-search-backward "s" (1- end) t)
(re-search-backward "e" (1- end) t)))
(if (when (consp poss)
(setq temp-buffer (get-buffer-create " *flyspell-temp*"))
(save-excursion
(copy-to-buffer temp-buffer beg (1- end))
(set-buffer temp-buffer)
(goto-char (point-min))
(setq word (capitalize (buffer-string)))
(when (member word (nth 2 poss)) t)
)) t) nil)))
<---------
It considers Operations"-geräte, Frauen"-park"-platz, Mause"-loch as correct.
This could make life a bit easier for german writer using latex. There still
are some shortcomings however, but I think I can live with it:
When these words repeat in a text, they are highlighted yellow.
When a word is once marked as incorrect the hook is called no more.
The only workaround is to delete the word an paste it.
I hope someone is testing that, and shares her/his experiences with me.
--
Sebastian Meisel