aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2001-11-16 13:06:51 +0000
committerStefan Monnier2001-11-16 13:06:51 +0000
commit5f395df3b03409674d3ecf81a93409058970baa2 (patch)
treeca628b693ffc21393610259535e8313f1e9ede48
parent33c34beaa5784bf3d4402982b67c0d7a5101a461 (diff)
downloademacs-5f395df3b03409674d3ecf81a93409058970baa2.tar.gz
emacs-5f395df3b03409674d3ecf81a93409058970baa2.zip
(describe-input-method): Setup xref.
(set-language-environment): Use functionp. (locale-language-names, locale-charset-language-names) (locale-preferred-coding-systems): Defconst and purecopy.
-rw-r--r--lisp/international/mule-cmds.el120
1 files changed, 73 insertions, 47 deletions
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el
index 5b49552123b..17ed570036f 100644
--- a/lisp/international/mule-cmds.el
+++ b/lisp/international/mule-cmds.el
@@ -167,10 +167,10 @@
167;; but it won't be used that frequently. 167;; but it won't be used that frequently.
168(define-key global-map "\C-\\" 'toggle-input-method) 168(define-key global-map "\C-\\" 'toggle-input-method)
169 169
170;;; This is no good because people often type Shift-SPC 170;; This is no good because people often type Shift-SPC
171;;; meaning to type SPC. -- rms. 171;; meaning to type SPC. -- rms.
172;;; ;; Here's an alternative key binding for X users (Shift-SPACE). 172;; ;; Here's an alternative key binding for X users (Shift-SPACE).
173;;; (define-key global-map [?\S- ] 'toggle-input-method) 173;; (define-key global-map [?\S- ] 'toggle-input-method)
174 174
175;;; Mule related hyperlinks. 175;;; Mule related hyperlinks.
176(defconst help-xref-mule-regexp-template 176(defconst help-xref-mule-regexp-template
@@ -1155,7 +1155,9 @@ and enable that one. The default is the most recent input method specified
1155 (activate-input-method current)) 1155 (activate-input-method current))
1156 (error 1156 (error
1157 (activate-input-method current) 1157 (activate-input-method current)
1158 (with-output-to-temp-buffer "*Help*" 1158 (help-setup-xref (list #'describe-input-method input-method)
1159 (interactive-p))
1160 (with-output-to-temp-buffer (help-buffer)
1159 (let ((elt (assoc input-method input-method-alist))) 1161 (let ((elt (assoc input-method input-method-alist)))
1160 (princ (format 1162 (princ (format
1161 "Input method: %s (`%s' in mode line) for %s\n %s\n" 1163 "Input method: %s (`%s' in mode line) for %s\n %s\n"
@@ -1389,8 +1391,8 @@ The default status is as follows:
1389 ;; Don't alter the terminal and keyboard coding systems here. 1391 ;; Don't alter the terminal and keyboard coding systems here.
1390 ;; The terminal still supports the same coding system 1392 ;; The terminal still supports the same coding system
1391 ;; that it supported a minute ago. 1393 ;; that it supported a minute ago.
1392;;; (set-terminal-coding-system-internal nil) 1394;; (set-terminal-coding-system-internal nil)
1393;;; (set-keyboard-coding-system-internal nil) 1395;; (set-keyboard-coding-system-internal nil)
1394 1396
1395 (setq nonascii-translation-table nil 1397 (setq nonascii-translation-table nil
1396 nonascii-insert-offset 0)) 1398 nonascii-insert-offset 0))
@@ -1426,7 +1428,7 @@ specifies the character set for the major languages of Western Europe."
1426 (let ((func (get-language-info current-language-environment 1428 (let ((func (get-language-info current-language-environment
1427 'exit-function))) 1429 'exit-function)))
1428 (run-hooks 'exit-language-environment-hook) 1430 (run-hooks 'exit-language-environment-hook)
1429 (if (fboundp func) (funcall func)))) 1431 (if (functionp func) (funcall func))))
1430 (let ((default-eol-type (coding-system-eol-type 1432 (let ((default-eol-type (coding-system-eol-type
1431 default-buffer-file-coding-system))) 1433 default-buffer-file-coding-system)))
1432 (reset-language-environment) 1434 (reset-language-environment)
@@ -1486,7 +1488,7 @@ specifies the character set for the major languages of Western Europe."
1486 (require (car required-features)) 1488 (require (car required-features))
1487 (setq required-features (cdr required-features)))) 1489 (setq required-features (cdr required-features))))
1488 (let ((func (get-language-info language-name 'setup-function))) 1490 (let ((func (get-language-info language-name 'setup-function)))
1489 (if (fboundp func) 1491 (if (functionp func)
1490 (funcall func))) 1492 (funcall func)))
1491 (run-hooks 'set-language-environment-hook) 1493 (run-hooks 'set-language-environment-hook)
1492 (force-mode-line-update t)) 1494 (force-mode-line-update t))
@@ -1507,8 +1509,11 @@ specifies the character set for the major languages of Western Europe."
1507 (aset standard-display-table 2208 [32]) ; Latin-1 NBSP 1509 (aset standard-display-table 2208 [32]) ; Latin-1 NBSP
1508 ;; Most Windows programs send out apostrophes as \222. Most X fonts 1510 ;; Most Windows programs send out apostrophes as \222. Most X fonts
1509 ;; don't contain a character at that position. Map it to the ASCII 1511 ;; don't contain a character at that position. Map it to the ASCII
1510 ;; apostrophe. [This is actually RIGHT SINGLE QUOTATION MARK 1512 ;; apostrophe. [This is actually RIGHT SINGLE QUOTATION MARK,
1511 ;; from the cp1252, aka Windows-1252 character set. --fx] 1513 ;; U+2019, normally from the windows-1252 character set. XFree 4
1514 ;; fonts probably have the appropriate glyph at this position,
1515 ;; so they could use standard-display-8bit. It's better to use a
1516 ;; proper windows-1252 coding system. --fx]
1512 (aset standard-display-table 146 [39])))) 1517 (aset standard-display-table 146 [39]))))
1513 1518
1514(defun set-language-environment-coding-systems (language-name 1519(defun set-language-environment-coding-systems (language-name
@@ -1648,25 +1653,31 @@ of buffer-file-coding-system set by this function."
1648(defvar locale-translation-file-name nil 1653(defvar locale-translation-file-name nil
1649 "File name for the system's file of locale-name aliases, or nil if none.") 1654 "File name for the system's file of locale-name aliases, or nil if none.")
1650 1655
1651(defvar locale-language-names 1656;; The following definitions might as well be marked as constants and
1652 '( 1657;; purecopied, since they're normally used on startup, and probably
1653 ;; UTF-8 is not yet implemented. 1658;; should reflect the facilities of the base Emacs.
1654 ;; Put this first, so that e.g. "ko.UTF-8" does not match "ko" below. 1659(defconst locale-language-names
1655 (".*[._]utf" . nil) 1660 (purecopy
1661 '(
1662 ;; UTF-8 is not yet implemented.
1663 ;; Put this first, so that e.g. "ko.UTF-8" does not match "ko" below.
1664 (".*[._]utf" . nil)
1656 1665
1657 ;; Locale names of the form LANGUAGE[_TERRITORY][.CODESET][@MODIFIER] 1666 ;; Locale names of the form LANGUAGE[_TERRITORY][.CODESET][@MODIFIER]
1658 ;; as specified in the Single Unix Spec, Version 2. 1667 ;; as specified in the Single Unix Spec, Version 2.
1659 ;; LANGUAGE is a language code taken from ISO 639:1988 (E/F) 1668 ;; LANGUAGE is a language code taken from ISO 639:1988 (E/F)
1660 ;; with additions from ISO 639/RA Newsletter No.1/1989; 1669 ;; with additions from ISO 639/RA Newsletter No.1/1989;
1661 ;; see Internet RFC 2165 (1997-06). 1670 ;; see Internet RFC 2165 (1997-06) and
1662 ;; TERRITORY is a country code taken from ISO 3166. 1671 ;; http://www.evertype.com/standards/iso639/iso639-en.html
1672 ;; TERRITORY is a country code taken from ISO 3166
1673 ;; http://www.din.de/gremien/nas/nabd/iso3166ma/codlstp1/en_listp1.html.
1663 ;; CODESET and MODIFIER are implementation-dependent. 1674 ;; CODESET and MODIFIER are implementation-dependent.
1664 ;; 1675
1665 ; aa Afar 1676 ; aa Afar
1666 ; ab Abkhazian 1677 ; ab Abkhazian
1667 ("af" . "Latin-1") ; Afrikaans 1678 ("af" . "Latin-1") ; Afrikaans
1668 ("am" . "Ethiopic") ; Amharic 1679 ("am" . "Ethiopic") ; Amharic
1669 ; ar Arabic 1680 ; ar Arabic glibc uses 8859-6
1670 ; as Assamese 1681 ; as Assamese
1671 ; ay Aymara 1682 ; ay Aymara
1672 ; az Azerbaijani 1683 ; az Azerbaijani
@@ -1703,9 +1714,10 @@ of buffer-file-coding-system set by this function."
1703 ("gl" . "Latin-1") ; Galician 1714 ("gl" . "Latin-1") ; Galician
1704 ; gn Guarani 1715 ; gn Guarani
1705 ; gu Gujarati 1716 ; gu Gujarati
1717 ("gv" . "Latin-8") ; Manx Gaelic
1706 ; ha Hausa 1718 ; ha Hausa
1707 ("he" . "Hebrew") 1719 ("he" . "Hebrew")
1708 ("hi" . "Devanagari") ; Hindi 1720 ("hi" . "Devanagari") ; Hindi glibc uses utf-8
1709 ("hr" . "Latin-2") ; Croatian 1721 ("hr" . "Latin-2") ; Croatian
1710 ("hu" . "Latin-2") ; Hungarian 1722 ("hu" . "Latin-2") ; Hungarian
1711 ; hy Armenian 1723 ; hy Armenian
@@ -1726,27 +1738,29 @@ of buffer-file-coding-system set by this function."
1726 ("ko" . "Korean") 1738 ("ko" . "Korean")
1727 ; ks Kashmiri 1739 ; ks Kashmiri
1728 ; ku Kurdish 1740 ; ku Kurdish
1741 ("kw" . "Latin-1") ; Cornish
1729 ; ky Kirghiz 1742 ; ky Kirghiz
1730 ("la" . "Latin-1") ; Latin 1743 ("la" . "Latin-1") ; Latin
1744 ("lb" . "Latin-1") ; Luxemburgish
1731 ; ln Lingala 1745 ; ln Lingala
1732 ("lo" . "Lao") ; Laothian 1746 ("lo" . "Lao") ; Laothian
1733 ("lt" . "Latin-4") ; Lithuanian 1747 ("lt" . "Latin-4") ; Lithuanian
1734 ("lv" . "Latin-4") ; Latvian, Lettish 1748 ("lv" . "Latin-4") ; Latvian, Lettish
1735 ; mg Malagasy 1749 ; mg Malagasy
1736 ; mi Maori 1750 ("mi" . "Latin-7") ; Maori
1737 ("mk" . "Latin-5") ; Macedonian 1751 ("mk" . "Latin-5") ; Macedonian
1738 ; ml Malayalam 1752 ; ml Malayalam
1739 ; mn Mongolian 1753 ; mn Mongolian
1740 ; mo Moldavian 1754 ; mo Moldavian
1741 ("mr" . "Devanagari") ; Marathi 1755 ("mr" . "Devanagari") ; Marathi glibc uses utf-8
1742 ; ms Malay 1756 ("ms" . "Latin-1") ; Malay
1743 ("mt" . "Latin-3") ; Maltese 1757 ("mt" . "Latin-3") ; Maltese
1744 ; my Burmese 1758 ; my Burmese
1745 ; na Nauru 1759 ; na Nauru
1746 ("ne" . "Devanagari") ; Nepali 1760 ("ne" . "Devanagari") ; Nepali
1747 ("nl" . "Dutch") 1761 ("nl" . "Dutch")
1748 ("no" . "Latin-1") ; Norwegian 1762 ("no" . "Latin-1") ; Norwegian
1749 ; oc Occitan 1763 ("oc" . "Latin-1") ; Occitan
1750 ; om (Afan) Oromo 1764 ; om (Afan) Oromo
1751 ; or Oriya 1765 ; or Oriya
1752 ; pa Punjabi 1766 ; pa Punjabi
@@ -1762,6 +1776,7 @@ of buffer-file-coding-system set by this function."
1762 ; rw Kinyarwanda 1776 ; rw Kinyarwanda
1763 ("sa" . "Devanagari") ; Sanskrit 1777 ("sa" . "Devanagari") ; Sanskrit
1764 ; sd Sindhi 1778 ; sd Sindhi
1779 ; se Northern Sami
1765 ; sg Sangho 1780 ; sg Sangho
1766 ("sh" . "Latin-2") ; Serbo-Croatian 1781 ("sh" . "Latin-2") ; Serbo-Croatian
1767 ; si Sinhalese 1782 ; si Sinhalese
@@ -1777,9 +1792,9 @@ of buffer-file-coding-system set by this function."
1777 ; su Sundanese 1792 ; su Sundanese
1778 ("sv" . "Latin-1") ; Swedish 1793 ("sv" . "Latin-1") ; Swedish
1779 ("sw" . "Latin-1") ; Swahili 1794 ("sw" . "Latin-1") ; Swahili
1780 ; ta Tamil 1795 ; ta Tamil glibc uses utf-8
1781 ; te Telugu 1796 ; te Telugu glibc uses utf-8
1782 ; tg Tajik 1797 ; tg Tajik "Cyrillic-KOI8-T"
1783 ("th" . "Thai") 1798 ("th" . "Thai")
1784 ; ti Tigrinya 1799 ; ti Tigrinya
1785 ; tk Turkmen 1800 ; tk Turkmen
@@ -1792,15 +1807,23 @@ of buffer-file-coding-system set by this function."
1792 ; tw Twi 1807 ; tw Twi
1793 ; ug Uighur 1808 ; ug Uighur
1794 ("uk" . "Latin-5") ; Ukrainian 1809 ("uk" . "Latin-5") ; Ukrainian
1795 ; ur Urdu 1810 ; ur Urdu glibc uses utf-8
1796 ; uz Uzbek 1811 ("uz" . "Latin-1") ; Uzbek
1797 ("vi" . "Vietnamese") 1812 ("vi" . "Vietnamese") ; glibc uses utf-8
1798 ; vo Volapuk 1813 ; vo Volapuk
1799 ; wo Wolof 1814 ; wo Wolof
1800 ; xh Xhosa 1815 ; xh Xhosa
1801 ; yi Yiddish 1816 ; yi Yiddish
1802 ; yo Yoruba 1817 ; yo Yoruba
1803 ; za Zhuang 1818 ; za Zhuang
1819
1820 ; glibc:
1821 ; zh_CN.GB18030/GB18030 \
1822 ; zh_CN.GBK/GBK \
1823 ; zh_HK/BIG5-HKSCS \
1824 ; zh_TW/BIG5 \
1825 ; zh_TW.EUC-TW/EUC-TW \
1826
1804 ("zh.*[._]big5" . "Chinese-BIG5") 1827 ("zh.*[._]big5" . "Chinese-BIG5")
1805 ("zh.*[._]gbk" . nil) ; Solaris 2.7; has gbk-0 as well as GB 2312.1980-0 1828 ("zh.*[._]gbk" . nil) ; Solaris 2.7; has gbk-0 as well as GB 2312.1980-0
1806 ("zh_tw" . "Chinese-CNS") 1829 ("zh_tw" . "Chinese-CNS")
@@ -1830,28 +1853,30 @@ The first element whose locale regexp matches the start of a downcased locale
1830specifies the language name corresponding to that locale. 1853specifies the language name corresponding to that locale.
1831If the language name is nil, there is no corresponding language environment.") 1854If the language name is nil, there is no corresponding language environment.")
1832 1855
1833(defvar locale-charset-language-names 1856(defconst locale-charset-language-names
1834 '((".*8859[-_]?1\\>" . "Latin-1") 1857 (purecopy
1835 (".*8859[-_]?2\\>" . "Latin-2") 1858 '((".*8859[-_]?1\\>" . "Latin-1")
1836 (".*8859[-_]?3\\>" . "Latin-3") 1859 (".*8859[-_]?2\\>" . "Latin-2")
1837 (".*8859[-_]?4\\>" . "Latin-4") 1860 (".*8859[-_]?3\\>" . "Latin-3")
1838 (".*8859[-_]?9\\>" . "Latin-5") 1861 (".*8859[-_]?4\\>" . "Latin-4")
1839 (".*8859[-_]?14\\>" . "Latin-8") 1862 (".*8859[-_]?9\\>" . "Latin-5")
1840 (".*8859[-_]?15\\>" . "Latin-9") 1863 (".*8859[-_]?14\\>" . "Latin-8")
1841 (".*@euro\\>" . "Latin-9") 1864 (".*8859[-_]?15\\>" . "Latin-9")
1842 ) 1865 (".*@euro\\>" . "Latin-9")
1866 ))
1843 "List of pairs of locale regexps and charset language names. 1867 "List of pairs of locale regexps and charset language names.
1844The first element whose locale regexp matches the start of a downcased locale 1868The first element whose locale regexp matches the start of a downcased locale
1845specifies the language name whose charsets corresponds to that locale. 1869specifies the language name whose charsets corresponds to that locale.
1846This language name is used if its charsets disagree with the charsets of 1870This language name is used if its charsets disagree with the charsets of
1847the language name that would otherwise be used for this locale.") 1871the language name that would otherwise be used for this locale.")
1848 1872
1849(defvar locale-preferred-coding-systems 1873(defconst locale-preferred-coding-systems
1850 '(("ja.*[._]euc" . japanese-iso-8bit) 1874 (purecopy
1851 ("ja.*[._]jis7" . iso-2022-jp) 1875 '(("ja.*[._]euc" . japanese-iso-8bit)
1852 ("ja.*[._]pck" . japanese-shift-jis) 1876 ("ja.*[._]jis7" . iso-2022-jp)
1853 ("ja.*[._]sjis" . japanese-shift-jis) 1877 ("ja.*[._]pck" . japanese-shift-jis)
1854 ) 1878 ("ja.*[._]sjis" . japanese-shift-jis)
1879 ))
1855 "List of pairs of locale regexps and preferred coding systems. 1880 "List of pairs of locale regexps and preferred coding systems.
1856The first element whose locale regexp matches the start of a downcased locale 1881The first element whose locale regexp matches the start of a downcased locale
1857specifies the coding system to prefer when using that locale.") 1882specifies the coding system to prefer when using that locale.")
@@ -1944,6 +1969,7 @@ See also `locale-charset-language-names', `locale-language-names',
1944 (coding-system 1969 (coding-system
1945 (locale-name-match locale locale-preferred-coding-systems))) 1970 (locale-name-match locale locale-preferred-coding-systems)))
1946 1971
1972 ;; Give preference to charset-language-name over language-name.
1947 (if (and charset-language-name 1973 (if (and charset-language-name
1948 (not 1974 (not
1949 (equal (get-language-info language-name 'charset) 1975 (equal (get-language-info language-name 'charset)