help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Where is the mistake?


From: Sebastian Meisel
Subject: Where is the mistake?
Date: Sun, 12 Feb 2006 18:43:15 +0100
User-agent: KMail/1.9.1

I worked on on my flyspell-incorrect-hook, and again it doesn't work as 
aspected, but I can't find the error. Maybe someone can have a look:

-->
(add-hook 'flyspell-incorrect-hook 'flyspell-zusammen())

(setq ispell-dictionary-alist 
      '(("english" "[A-Za-z]" "[^A-Za-z]" "[']" nil
         ("-B")
         nil iso-8859-1)
        ("german8" "[a-zA-ZÄÖÜäößü]" "[^a-zA-ZÄÖÜäößü]" "[']" t
         ("-S" "-d" "german")
         "~latin1" iso-8859-1)))

(setq ispell-dictionary "german8")

(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."
(save-excursion
  (when (consp poss)
    (if (re-search-backward "\"-" (- beg 2) t) 
        (save-excursion 
          (setq temp-buffer (get-buffer-create " *flyspell-temp*"))
          (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) 
          ) 
      (if (and (re-search-forward "-" (+ end 2) t)  
               (re-search-backward "[se]" (1- end) t))
          (save-excursion 
            (message "hi here")
            (setq temp-buffer (get-buffer-create " *flyspell-temp*"))
            (copy-to-buffer temp-buffer beg (1- end))
            (set-buffer temp-buffer)
            (goto-char (point-min))
            (setq word (capitalize (buffer-string)))
            (if (when (member word (nth 2 poss)) t)
                t (when (member (concat word "e") (nth 2 poss)) t))
            )
        (if (and (re-search-forward "-" (+ end 2) t)  
                 (re-search-backward "[lr]" (1- end) t))
            (save-excursion 
              (message "hi there") 
              (setq temp-buffer (get-buffer-create " *flyspell-temp*"))
              (copy-to-buffer temp-buffer beg end)
              (set-buffer temp-buffer)
              (goto-char (point-min))
              (setq word (capitalize (buffer-string)))
              (if (when (member (concat word "e") (nth 2 poss)) t) 
                  t nil)
              ) 
          (progn (message "not there") nil)) 
        )))))
<--

In Geschichts"-wissenschaft 

      (if (and (re-search-forward "-" (+ end 2) t)  
               (re-search-backward "[se]" (1- end) t))

correctly recognizes that within 2 chars after Geschichts there is a "-,
while with Erzähl"-rahmen 

        (if (and (re-search-forward "-" (+ end 2) t)  
                 (re-search-backward "[lr]" (1- end) t))

doesn't match the Erzähl"-. What did I do wrong?

-- 
Sebastian Meisel

Attachment: pgpqRAjaHf1PO.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]