1 ;;; babel.el --- AUCTeX style for `babel.sty'
3 ;; Copyright (C) 2005 Free Software Foundation, Inc.
5 ;; Author: Ralf Angeli <angeli@iwi.uni-sb.de>
6 ;; Maintainer: auctex-devel@gnu.org
10 ;; This file is part of AUCTeX.
12 ;; AUCTeX is free software; you can redistribute it and/or modify it
13 ;; under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 3, or (at your option)
17 ;; AUCTeX is distributed in the hope that it will be useful, but
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 ;; General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with AUCTeX; see the file COPYING. If not, write to the Free
24 ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
29 ;; This file adds support for `babel.sty'.
33 (defvar LaTeX-babel-language-list
34 '("acadian" "afrikaans" "american" "austrian""bahasa" "basque" "brazil"
35 "brazilian" "breton" "british" "bulgarian" "canadian" "canadien"
36 "catalan" "croatian" "czech" "danish" "dutch" "english" "esperanto"
37 "estonian" "finnish" "francais" "frenchb" "french" "galician"
38 "german" "germanb" "greek" "polutonikogreek" "hebrew" "hungarian"
39 "icelandic" "irish" "italian" "latin" "lowersorbian" "magyar"
40 "naustrian" "ngerman" "norsk" "samin" "nynorsk" "polish" "portuges"
41 "portuguese" "romanian" "russian" "scottish" "serbian" "slovak"
42 "slovene" "spanish" "swedish" "turkish" "ukrainian" "uppersorbian"
43 "welsh" "UKenglish" "USenglish")
44 "List of languages supported by the babel LaTeX package.")
46 (if (fboundp 'defvaralias)
47 (defvaralias 'LaTeX-babel-package-options 'LaTeX-babel-language-list)
48 (defvar LaTeX-babel-package-options LaTeX-babel-language-list
49 "Package options for the babel package."))
51 (defun LaTeX-babel-active-languages ()
52 "Return a list of languages used in the document."
53 (let (active-languages)
54 (dolist (elt LaTeX-babel-language-list)
55 (when (member elt TeX-active-styles)
56 (add-to-list 'active-languages (list elt))))
59 (defun TeX-arg-babel-lang (optional &optional prompt)
60 "Prompt for a language with completion and insert it as an argument."
62 (completing-read "Language: " (LaTeX-babel-active-languages)) nil))
64 (defun LaTeX-env-babel-lang (env)
65 "Prompt for a language and insert it as an argument of ENV."
66 (LaTeX-insert-environment
67 env (format "{%s}" (completing-read "Language: "
68 (LaTeX-babel-active-languages)))))
75 '("selectlanguage" TeX-arg-babel-lang)
76 '("foreignlanguage" TeX-arg-babel-lang t)
78 '("iflanguage" TeX-arg-babel-lang t nil)
80 '("defineshorthand" t nil)
81 '("aliasshorthand" t nil)
82 '("languageshorthands" TeX-arg-babel-lang)
85 '("languageattribute" TeX-arg-babel-lang t))
87 (LaTeX-add-environments
88 '("otherlanguage" LaTeX-env-babel-lang)
89 '("otherlanguage*" LaTeX-env-babel-lang)
90 '("hyphenrules" LaTeX-env-babel-lang))
92 (when (and (featurep 'font-latex)
93 (eq TeX-install-font-lock 'font-latex-setup))
94 (font-latex-add-keywords '(("selectlanguage" "{")
95 ("foreignlanguage" "{{")
99 ("languageshorthands" "{")
101 ("shorthandoff" "{"))
103 (font-latex-add-keywords '(("defineshorthand" "{{")
104 ("aliasshorthand" "{{")
105 ("languageattribute" "{{"))
108 ;;; babel.el ends here