diff options
| author | Dave Love | 2003-10-14 22:29:05 +0000 |
|---|---|---|
| committer | Dave Love | 2003-10-14 22:29:05 +0000 |
| commit | 34703cb150825f4957a26cc31946f6faa2e1667f (patch) | |
| tree | 9101d7e85301754ff8527e9eb13e7ef13772cc93 | |
| parent | ef35b389dcb8d1ecc1a5918feddb4bc1f9b58750 (diff) | |
| download | emacs-34703cb150825f4957a26cc31946f6faa2e1667f.tar.gz emacs-34703cb150825f4957a26cc31946f6faa2e1667f.zip | |
(find-multibyte-characters): Doc fix.
(default-input-method): Add :link, improve :type.
(locale-charset-language-names): Fix utf-8 pattern.
(locale-charset-match-p, locale-charset-alist)
(locale-charset-to-coding-system): New.
(set-locale-environment): Deal with codeset part of locale specs.
| -rw-r--r-- | lisp/ChangeLog | 26 | ||||
| -rw-r--r-- | lisp/international/mule-cmds.el | 76 |
2 files changed, 78 insertions, 24 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 015f54b6968..0018a9d9a09 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2003-10-14 Dave Love <fx@gnu.org> | ||
| 2 | |||
| 3 | * international/mule-cmds.el (find-multibyte-characters): Doc fix. | ||
| 4 | (default-input-method): Add :link, improve :type. | ||
| 5 | (locale-charset-language-names): Fix utf-8 pattern. | ||
| 6 | (locale-charset-match-p, locale-charset-alist) | ||
| 7 | (locale-charset-to-coding-system): New. | ||
| 8 | (set-locale-environment): Deal with codeset part of locale specs. | ||
| 9 | |||
| 1 | 2003-10-14 Lute Kamstra <lute@gnu.org> | 10 | 2003-10-14 Lute Kamstra <lute@gnu.org> |
| 2 | 11 | ||
| 3 | * fringe.el (fringe-mode): Use active voice in docstring. | 12 | * fringe.el (fringe-mode): Use active voice in docstring. |
| @@ -10,18 +19,19 @@ | |||
| 10 | 19 | ||
| 11 | 2003-10-12 Michael Kifer <kifer@cs.stonybrook.edu> | 20 | 2003-10-12 Michael Kifer <kifer@cs.stonybrook.edu> |
| 12 | 21 | ||
| 13 | * ediff-mult.el (ediff-filegroup-action): use | 22 | * ediff-mult.el (ediff-filegroup-action): Use |
| 14 | ediff-default-filtering-regexp. | 23 | ediff-default-filtering-regexp. |
| 15 | 24 | ||
| 16 | * ediff-util.el (ediff-recenter): don't call | 25 | * ediff-util.el (ediff-recenter): Don't call |
| 17 | ediff-restore-highlighting twice. | 26 | ediff-restore-highlighting twice. |
| 18 | (ediff-select-difference): set current difference. | 27 | (ediff-select-difference): Set current difference. |
| 19 | (ediff-unselect-and-select-difference): added comment. | 28 | (ediff-unselect-and-select-difference): Added comment. |
| 20 | 29 | ||
| 21 | * ediff.el (ediff-directories,ediff-directory-revisions, | 30 | * ediff.el (ediff-directories,ediff-directory-revisions) |
| 22 | ediff-directories3,ediff-merge-directories, | 31 | (ediff-directories3,ediff-merge-directories) |
| 23 | ediff-merge-directories-with-ancestor,ediff-merge-directory-revisions, | 32 | (ediff-merge-directories-with-ancestor) |
| 24 | ediff-merge-directory-revisions-with-ancestor): use | 33 | (ediff-merge-directory-revisions) |
| 34 | (ediff-merge-directory-revisions-with-ancestor): Use | ||
| 25 | ediff-default-filtering-regexp. | 35 | ediff-default-filtering-regexp. |
| 26 | 36 | ||
| 27 | 2003-10-12 Andreas Schwab <schwab@suse.de> | 37 | 2003-10-12 Andreas Schwab <schwab@suse.de> |
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index 12b8508ded9..f29e11b8e26 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el | |||
| @@ -288,12 +288,12 @@ wrong, use this command again to toggle back to the right mode." | |||
| 288 | (not (eq cmd 'universal-argument-other-key))) | 288 | (not (eq cmd 'universal-argument-other-key))) |
| 289 | (let ((current-prefix-arg prefix-arg) | 289 | (let ((current-prefix-arg prefix-arg) |
| 290 | ;; Have to bind `last-command-char' here so that | 290 | ;; Have to bind `last-command-char' here so that |
| 291 | ;; `digit-argument', for isntance, can compute the | 291 | ;; `digit-argument', for instance, can compute the |
| 292 | ;; prefix arg. | 292 | ;; prefix arg. |
| 293 | (last-command-char (aref keyseq 0))) | 293 | (last-command-char (aref keyseq 0))) |
| 294 | (call-interactively cmd))) | 294 | (call-interactively cmd))) |
| 295 | 295 | ||
| 296 | ;; This is the final call to `univeral-argument-other-key', which | 296 | ;; This is the final call to `universal-argument-other-key', which |
| 297 | ;; set's the final `prefix-arg. | 297 | ;; set's the final `prefix-arg. |
| 298 | (let ((current-prefix-arg prefix-arg)) | 298 | (let ((current-prefix-arg prefix-arg)) |
| 299 | (call-interactively cmd)) | 299 | (call-interactively cmd)) |
| @@ -541,7 +541,7 @@ The return value is an alist of the following format: | |||
| 541 | where | 541 | where |
| 542 | CHARSET is a character set, | 542 | CHARSET is a character set, |
| 543 | COUNT is a number of characters, | 543 | COUNT is a number of characters, |
| 544 | CHARs are found characters of the character set. | 544 | CHARs are the characters found from the character set. |
| 545 | Optional 3rd arg MAXCOUNT limits how many CHARs are put in the above list. | 545 | Optional 3rd arg MAXCOUNT limits how many CHARs are put in the above list. |
| 546 | Optional 4th arg EXCLUDE is a list of character sets to be ignored. | 546 | Optional 4th arg EXCLUDE is a list of character sets to be ignored. |
| 547 | 547 | ||
| @@ -1191,8 +1191,13 @@ If nil, that means no input method is activated now.") | |||
| 1191 | "*Default input method for multilingual text (a string). | 1191 | "*Default input method for multilingual text (a string). |
| 1192 | This is the input method activated automatically by the command | 1192 | This is the input method activated automatically by the command |
| 1193 | `toggle-input-method' (\\[toggle-input-method])." | 1193 | `toggle-input-method' (\\[toggle-input-method])." |
| 1194 | :link '(custom-manual "(emacs)Input Methods") | ||
| 1194 | :group 'mule | 1195 | :group 'mule |
| 1195 | :type '(choice (const nil) string) | 1196 | :type '(choice (const nil) (string |
| 1197 | :completion-ignore-case t | ||
| 1198 | :complete-function widget-string-complete | ||
| 1199 | :completion-alist input-method-alist | ||
| 1200 | :prompt-history input-method-history)) | ||
| 1196 | :set-after '(current-language-environment)) | 1201 | :set-after '(current-language-environment)) |
| 1197 | 1202 | ||
| 1198 | (put 'input-method-function 'permanent-local t) | 1203 | (put 'input-method-function 'permanent-local t) |
| @@ -1852,7 +1857,7 @@ of `buffer-file-coding-system' set by this function." | |||
| 1852 | 1857 | ||
| 1853 | (put 'describe-specified-language-support 'apropos-inhibit t) | 1858 | (put 'describe-specified-language-support 'apropos-inhibit t) |
| 1854 | 1859 | ||
| 1855 | ;; Print a language specific information such as input methods, | 1860 | ;; Print language-specific information such as input methods, |
| 1856 | ;; charsets, and coding systems. This function is intended to be | 1861 | ;; charsets, and coding systems. This function is intended to be |
| 1857 | ;; called from the menu: | 1862 | ;; called from the menu: |
| 1858 | ;; [menu-bar mule describe-language-environment LANGUAGE] | 1863 | ;; [menu-bar mule describe-language-environment LANGUAGE] |
| @@ -2169,13 +2174,13 @@ If the language name is nil, there is no corresponding language environment.") | |||
| 2169 | (".*8859[-_]?9\\>" . "Latin-5") | 2174 | (".*8859[-_]?9\\>" . "Latin-5") |
| 2170 | (".*8859[-_]?14\\>" . "Latin-8") | 2175 | (".*8859[-_]?14\\>" . "Latin-8") |
| 2171 | (".*8859[-_]?15\\>" . "Latin-9") | 2176 | (".*8859[-_]?15\\>" . "Latin-9") |
| 2172 | (".*utf-?8\\>" . "UTF-8") | 2177 | (".*utf\\(?:-?8\\)?\\>" . "UTF-8") |
| 2173 | ;; utf-8@euro exists, so put this last. (@euro really specifies | 2178 | ;; utf-8@euro exists, so put this last. (@euro really specifies |
| 2174 | ;; the currency, rather than the charset.) | 2179 | ;; the currency, rather than the charset.) |
| 2175 | (".*@euro\\>" . "Latin-9"))) | 2180 | (".*@euro\\>" . "Latin-9"))) |
| 2176 | "List of pairs of locale regexps and charset language names. | 2181 | "List of pairs of locale regexps and charset language names. |
| 2177 | The first element whose locale regexp matches the start of a downcased locale | 2182 | The first element whose locale regexp matches the start of a downcased locale |
| 2178 | specifies the language name whose charsets corresponds to that locale. | 2183 | specifies the language name whose charset corresponds to that locale. |
| 2179 | This language name is used if its charsets disagree with the charsets of | 2184 | This language name is used if its charsets disagree with the charsets of |
| 2180 | the language name that would otherwise be used for this locale.") | 2185 | the language name that would otherwise be used for this locale.") |
| 2181 | 2186 | ||
| @@ -2202,17 +2207,52 @@ start of KEY, or nil if there is no match." | |||
| 2202 | (setq alist (cdr alist))) | 2207 | (setq alist (cdr alist))) |
| 2203 | (cdr element))) | 2208 | (cdr element))) |
| 2204 | 2209 | ||
| 2210 | (defun locale-charset-match-p (charset1 charset2) | ||
| 2211 | "Whether charset names (strings) CHARSET1 and CHARSET2 are equivalent. | ||
| 2212 | Matching is done ignoring case and any hyphens and underscores in the | ||
| 2213 | names. E.g. `ISO_8859-1' and `iso88591' both match `iso-8859-1'." | ||
| 2214 | (setq charset1 (replace-regexp-in-string "[-_]" "" charset1)) | ||
| 2215 | (setq charset2 (replace-regexp-in-string "[-_]" "" charset2)) | ||
| 2216 | (eq t (compare-strings charset1 nil nil charset2 nil nil t))) | ||
| 2217 | |||
| 2218 | (defvar locale-charset-alist nil | ||
| 2219 | "Coding system alist keyed on locale-style charset name. | ||
| 2220 | Used by `locale-charset-to-coding-system'.") | ||
| 2221 | |||
| 2222 | (defun locale-charset-to-coding-system (charset) | ||
| 2223 | "Find coding system corresponding to CHARSET. | ||
| 2224 | CHARSET is any sort of non-Emacs charset name, such as might be used | ||
| 2225 | in a locale codeset, or elsewhere. It is matched to a coding system | ||
| 2226 | first by case-insensitive lookup in `locale-charset-alist'. Then | ||
| 2227 | matches are looked for in the coding system list, treating case and | ||
| 2228 | the characters `-' and `_' as insignificant. The coding system base | ||
| 2229 | is returned. Thus, for instance, if charset \"ISO8859-2\", | ||
| 2230 | `iso-latin-2' is returned." | ||
| 2231 | (or (car (assoc-ignore-case charset locale-charset-alist)) | ||
| 2232 | (let ((cs coding-system-alist) | ||
| 2233 | c) | ||
| 2234 | (while (and (not c) cs) | ||
| 2235 | (if (locale-charset-match-p charset (caar cs)) | ||
| 2236 | (setq c (intern (caar cs))) | ||
| 2237 | (pop cs))) | ||
| 2238 | (coding-system-base c)))) | ||
| 2239 | |||
| 2240 | ;; Fixme: This ought to deal with the territory part of the locale | ||
| 2241 | ;; too, for setting things such as calendar holidays, ps-print paper | ||
| 2242 | ;; size, spelling dictionary. | ||
| 2243 | |||
| 2205 | (defun set-locale-environment (&optional locale-name) | 2244 | (defun set-locale-environment (&optional locale-name) |
| 2206 | "Set up multi-lingual environment for using LOCALE-NAME. | 2245 | "Set up multi-lingual environment for using LOCALE-NAME. |
| 2207 | This sets the language environment, the coding system priority, | 2246 | This sets the language environment, the coding system priority, |
| 2208 | the default input method and sometimes other things. | 2247 | the default input method and sometimes other things. |
| 2209 | 2248 | ||
| 2210 | LOCALE-NAME should be a string | 2249 | LOCALE-NAME should be a string which is the name of a locale supported |
| 2211 | which is the name of a locale supported by the system; | 2250 | by the system. Often it is of the form xx_XX.CODE, where xx is a |
| 2212 | often it is of the form xx_XX.CODE, where xx is a language, | 2251 | language, XX is a country, and CODE specifies a character set and |
| 2213 | XX is a country, and CODE specifies a character set and coding system. | 2252 | coding system. For example, the locale name \"ja_JP.EUC\" might name |
| 2214 | For example, the locale name \"ja_JP.EUC\" might name a locale | 2253 | a locale for Japanese in Japan using the `japanese-iso-8bit' |
| 2215 | for Japanese in Japan using the `japanese-iso-8bit' coding-system. | 2254 | coding-system. The name may also have a modifier suffix, e.g. `@euro' |
| 2255 | or `@cyrillic'. | ||
| 2216 | 2256 | ||
| 2217 | If LOCALE-NAME is nil, its value is taken from the environment | 2257 | If LOCALE-NAME is nil, its value is taken from the environment |
| 2218 | variables LC_ALL, LC_CTYPE and LANG (the first one that is set). | 2258 | variables LC_ALL, LC_CTYPE and LANG (the first one that is set). |
| @@ -2231,7 +2271,7 @@ See also `locale-charset-language-names', `locale-language-names', | |||
| 2231 | (setq locale-translation-file-name | 2271 | (setq locale-translation-file-name |
| 2232 | (let ((files | 2272 | (let ((files |
| 2233 | '("/usr/lib/X11/locale/locale.alias" ; e.g. X11R6.4 | 2273 | '("/usr/lib/X11/locale/locale.alias" ; e.g. X11R6.4 |
| 2234 | "/usr/X11R6/lib/X11/locale/locale.alias" ; e.g. RedHat 4.2 | 2274 | "/usr/X11R6/lib/X11/locale/locale.alias" ; XFree86, e.g. RedHat 4.2 |
| 2235 | "/usr/openwin/lib/locale/locale.alias" ; e.g. Solaris 2.6 | 2275 | "/usr/openwin/lib/locale/locale.alias" ; e.g. Solaris 2.6 |
| 2236 | ;; | 2276 | ;; |
| 2237 | ;; The following name appears after the X-related names above, | 2277 | ;; The following name appears after the X-related names above, |
| @@ -2278,7 +2318,11 @@ See also `locale-charset-language-names', `locale-language-names', | |||
| 2278 | (charset-language-name | 2318 | (charset-language-name |
| 2279 | (locale-name-match locale locale-charset-language-names)) | 2319 | (locale-name-match locale locale-charset-language-names)) |
| 2280 | (coding-system | 2320 | (coding-system |
| 2281 | (locale-name-match locale locale-preferred-coding-systems))) | 2321 | (or (locale-name-match locale locale-preferred-coding-systems) |
| 2322 | (when locale | ||
| 2323 | (if (string-match "\\.\\([^@]+\\)" locale) | ||
| 2324 | (locale-charset-to-coding-system | ||
| 2325 | (match-string 1 locale))))))) | ||
| 2282 | 2326 | ||
| 2283 | ;; Give preference to charset-language-name over language-name. | 2327 | ;; Give preference to charset-language-name over language-name. |
| 2284 | (if (and charset-language-name | 2328 | (if (and charset-language-name |
| @@ -2421,7 +2465,7 @@ If CODING-SYSTEM can't safely encode CHAR, return nil." | |||
| 2421 | (and safe-chars (aref safe-chars char))) | 2465 | (and safe-chars (aref safe-chars char))) |
| 2422 | ;; We must find the encoded string of CHAR. But, just encoding | 2466 | ;; We must find the encoded string of CHAR. But, just encoding |
| 2423 | ;; CHAR will put extra control sequences (usually to designate | 2467 | ;; CHAR will put extra control sequences (usually to designate |
| 2424 | ;; ASCII charaset) at the tail if type of CODING is ISO 2022. | 2468 | ;; ASCII charset) at the tail if type of CODING is ISO 2022. |
| 2425 | ;; To exclude such tailing bytes, we at first encode one-char | 2469 | ;; To exclude such tailing bytes, we at first encode one-char |
| 2426 | ;; string and two-char string, then check how many bytes at the | 2470 | ;; string and two-char string, then check how many bytes at the |
| 2427 | ;; tail of both encoded strings are the same. | 2471 | ;; tail of both encoded strings are the same. |