* Where is the mistake?
@ 2006-02-12 17:43 Sebastian Meisel
0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Meisel @ 2006-02-12 17:43 UTC (permalink / raw)
[-- Attachment #1.1: Type: text/plain, Size: 2483 bytes --]
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 #1.2: Type: application/pgp-signature, Size: 189 bytes --]
[-- Attachment #2: Type: text/plain, Size: 152 bytes --]
_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Where is the mistake?
[not found] <mailman.157.1139766172.2858.help-gnu-emacs@gnu.org>
@ 2006-02-12 23:18 ` Thien-Thi Nguyen
0 siblings, 0 replies; 2+ messages in thread
From: Thien-Thi Nguyen @ 2006-02-12 23:18 UTC (permalink / raw)
Sebastian Meisel <sebastianmeisel@web.de> writes:
> What did I do wrong?
there are many things you did suboptimally, so any single answer
will only partially satisfy. here is a suggestion, instead:
try placing point in the defun and typing `M-x edebug-defun RET'.
this will allow you to step through the next invocation of that
function by typing `SPC'. during execution, you can type `p' to
temporarily move the cursor to where point is. be sure to try to
predict where it should be (before typing `p') so that you can
determine whether or not your assumptions about the code's
behavior are supported.
in other words, answer this: what do you think you did right?
thi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-02-12 23:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.157.1139766172.2858.help-gnu-emacs@gnu.org>
2006-02-12 23:18 ` Where is the mistake? Thien-Thi Nguyen
2006-02-12 17:43 Sebastian Meisel
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.