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

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

Re: flyspell: local abbrev in different languages


From: Andreas Röhler
Subject: Re: flyspell: local abbrev in different languages
Date: Wed, 26 Sep 2007 18:28:30 +0200
User-agent: KMail/1.8.2

Am Mittwoch, 26. September 2007 10:31 schrieb Uwe Brauer:
> Hello
>
> Some time ago I asked this the maintainer of flyspell. Alas flyspell
> is no longer maintained. But may be someone with a good understanding
> of the abbrev mechanism could answer the following question:
>
>
> I am using flyspell for quite a time and like it very much. However
> there is a small inconvenience.
>
> I prefer to have flyspell-use-global-abbrev-table-p set to nil, in
> order to have the abbrev saved in the local abbrev table.
>
> However I use 3 languages, english, german and spanish.
>
> Take the word region:
>
> In spanish it is región but in english it is region.
> In order  that the word is corrected  according to the  language used,
> using the abbrev table, the only possibility would be to have
> a english, a spanish and a german abbrev table.
>
> Could that be included in flyspell?
>
> Thanks and regards
>
> Uwe Brauer


I created an English-mode for this occasion - my common
text-mode is used for abbrevs in German. With
`englisch-mode' abbrevs are locally stored with this
mode without further precautions. Flyspell works too.

You could do the respective thing for Spanish.

(defun englisch-mode ()
  "Major mode for editing englisch written for humans to read.
In this mode, paragraphs are delimited only by blank or white lines.
You can thus get the full benefit of adaptive filling
 (see the variable `adaptive-fill-mode').
\\{englisch-mode-map}
Turning on Text mode runs the normal hook `englisch-mode-hook'."
  (interactive)
  (kill-all-local-variables)
  (use-local-map englisch-mode-map)
  (setq local-abbrev-table englisch-mode-abbrev-table)
  (set-syntax-table englisch-mode-syntax-table)
  (make-local-variable 'paragraph-start)
  (setq paragraph-start (concat page-delimiter "\\|[ \t]*$"))
  (if (eq ?^ (aref paragraph-start 0))
      (setq paragraph-start (substring paragraph-start 1)))
  (make-local-variable 'paragraph-separate)
  (setq paragraph-separate paragraph-start)
  (make-local-variable 'indent-line-function)
  (setq indent-line-function 'indent-relative-maybe)
  (setq mode-name "Englisch")
  (setq major-mode 'englisch-mode)
  (ispell-change-dictionary "english")
  (setq common-abbrevs-list 'common-english-abbrevs)
  (abbrev-mode 1)
  (run-hooks 'englisch-mode-hook))

HTH

Andreas Röhler




reply via email to

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