unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Sebastian Meisel <sebastianmeisel@web.de>
Subject: Re: enhance flyspell for german language (+TeX)
Date: Fri, 10 Feb 2006 20:20:43 +0100	[thread overview]
Message-ID: <200602102020.43931.sebastianmeisel@web.de> (raw)
In-Reply-To: <20060209113752.GA6532@free.fr>

> 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

      reply	other threads:[~2006-02-10 19:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-08 15:12 enhance flyspell for german language (+TeX) Sebastian Meisel
2006-02-09  0:38 ` François Gannaz
2006-02-09  9:36   ` Peter Dyballa
2006-02-09 10:15   ` Sebastian Meisel
2006-02-09 11:37     ` François Gannaz
2006-02-10 19:20       ` Sebastian Meisel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200602102020.43931.sebastianmeisel@web.de \
    --to=sebastianmeisel@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).