diff options
| author | Karoly Lorentey | 2005-05-03 03:01:09 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2005-05-03 03:01:09 +0000 |
| commit | 97c57fb2b8d271b2beba317c6213ab34190bfac7 (patch) | |
| tree | c91313543365d663d8cf3ee6905043380514dcd4 /lisp | |
| parent | 2f420fa825c961636dd4d0cf183b919bc4fe457a (diff) | |
| download | emacs-97c57fb2b8d271b2beba317c6213ab34190bfac7.tar.gz emacs-97c57fb2b8d271b2beba317c6213ab34190bfac7.zip | |
Support for ttys with different character locale settings.
* lisp/server.el (server-process-filter): Set locale environment
variables from client while creating tty frames.
* lisp/faces.el (tty-create-frame-with-faces): Call set-locale-environment.
* lisp/international/mule-cmds.el (set-display-table-and-terminal-coding-system):
Add DISPLAY parameter. Pass it to set-terminal-coding-system.
(set-locale-environment): Add DISPLAY parameter.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-340
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/faces.el | 1 | ||||
| -rw-r--r-- | lisp/international/mule-cmds.el | 85 | ||||
| -rw-r--r-- | lisp/server.el | 10 |
3 files changed, 51 insertions, 45 deletions
diff --git a/lisp/faces.el b/lisp/faces.el index e7940e209b9..03b3a769955 100644 --- a/lisp/faces.el +++ b/lisp/faces.el | |||
| @@ -1782,6 +1782,7 @@ created." | |||
| 1782 | ;; Make sure the kill and yank functions do not touch the X clipboard. | 1782 | ;; Make sure the kill and yank functions do not touch the X clipboard. |
| 1783 | (modify-frame-parameters frame '((interprogram-cut-function . nil))) | 1783 | (modify-frame-parameters frame '((interprogram-cut-function . nil))) |
| 1784 | (modify-frame-parameters frame '((interprogram-paste-function . nil))) | 1784 | (modify-frame-parameters frame '((interprogram-paste-function . nil))) |
| 1785 | (set-locale-environment nil frame) | ||
| 1785 | (setq success t)) | 1786 | (setq success t)) |
| 1786 | (unless success | 1787 | (unless success |
| 1787 | (delete-frame frame))) | 1788 | (delete-frame frame))) |
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index 8af768f91cc..b0340c60794 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el | |||
| @@ -1741,7 +1741,7 @@ The default status is as follows: | |||
| 1741 | 1741 | ||
| 1742 | (reset-language-environment) | 1742 | (reset-language-environment) |
| 1743 | 1743 | ||
| 1744 | (defun set-display-table-and-terminal-coding-system (language-name &optional coding-system) | 1744 | (defun set-display-table-and-terminal-coding-system (language-name &optional coding-system display) |
| 1745 | "Set up the display table and terminal coding system for LANGUAGE-NAME." | 1745 | "Set up the display table and terminal coding system for LANGUAGE-NAME." |
| 1746 | (let ((coding (get-language-info language-name 'unibyte-display))) | 1746 | (let ((coding (get-language-info language-name 'unibyte-display))) |
| 1747 | (if coding | 1747 | (if coding |
| @@ -1755,7 +1755,7 @@ The default status is as follows: | |||
| 1755 | (dotimes (i 128) | 1755 | (dotimes (i 128) |
| 1756 | (aset standard-display-table (+ i 128) nil)))) | 1756 | (aset standard-display-table (+ i 128) nil)))) |
| 1757 | (or (eq window-system 'pc) | 1757 | (or (eq window-system 'pc) |
| 1758 | (set-terminal-coding-system (or coding-system coding))))) | 1758 | (set-terminal-coding-system (or coding-system coding) display)))) |
| 1759 | 1759 | ||
| 1760 | (defun set-language-environment (language-name) | 1760 | (defun set-language-environment (language-name) |
| 1761 | "Set up multi-lingual environment for using LANGUAGE-NAME. | 1761 | "Set up multi-lingual environment for using LANGUAGE-NAME. |
| @@ -2349,7 +2349,7 @@ is returned. Thus, for instance, if charset \"ISO8859-2\", | |||
| 2349 | ;; too, for setting things such as calendar holidays, ps-print paper | 2349 | ;; too, for setting things such as calendar holidays, ps-print paper |
| 2350 | ;; size, spelling dictionary. | 2350 | ;; size, spelling dictionary. |
| 2351 | 2351 | ||
| 2352 | (defun set-locale-environment (&optional locale-name) | 2352 | (defun set-locale-environment (&optional locale-name display) |
| 2353 | "Set up multi-lingual environment for using LOCALE-NAME. | 2353 | "Set up multi-lingual environment for using LOCALE-NAME. |
| 2354 | This sets the language environment, the coding system priority, | 2354 | This sets the language environment, the coding system priority, |
| 2355 | the default input method and sometimes other things. | 2355 | the default input method and sometimes other things. |
| @@ -2370,6 +2370,11 @@ directory named `/usr/share/locale' or `/usr/lib/locale'. LOCALE-NAME | |||
| 2370 | will be translated according to the table specified by | 2370 | will be translated according to the table specified by |
| 2371 | `locale-translation-file-name'. | 2371 | `locale-translation-file-name'. |
| 2372 | 2372 | ||
| 2373 | If DISPLAY is non-nil, only set the keyboard coding system and | ||
| 2374 | the terminal coding system for the given display, and don't touch | ||
| 2375 | session-global parameters like the language environment. DISPLAY | ||
| 2376 | may be a display id or a frame. | ||
| 2377 | |||
| 2373 | See also `locale-charset-language-names', `locale-language-names', | 2378 | See also `locale-charset-language-names', `locale-language-names', |
| 2374 | `locale-preferred-coding-systems' and `locale-coding-system'." | 2379 | `locale-preferred-coding-systems' and `locale-coding-system'." |
| 2375 | (interactive "sSet environment for locale: ") | 2380 | (interactive "sSet environment for locale: ") |
| @@ -2458,14 +2463,15 @@ See also `locale-charset-language-names', `locale-language-names', | |||
| 2458 | 2463 | ||
| 2459 | ;; Set up for this character set. This is now the right way | 2464 | ;; Set up for this character set. This is now the right way |
| 2460 | ;; to do it for both unibyte and multibyte modes. | 2465 | ;; to do it for both unibyte and multibyte modes. |
| 2461 | (set-language-environment language-name) | 2466 | (unless display |
| 2467 | (set-language-environment language-name)) | ||
| 2462 | 2468 | ||
| 2463 | ;; If default-enable-multibyte-characters is nil, | 2469 | ;; If default-enable-multibyte-characters is nil, |
| 2464 | ;; we are using single-byte characters, | 2470 | ;; we are using single-byte characters, |
| 2465 | ;; so the display table and terminal coding system are irrelevant. | 2471 | ;; so the display table and terminal coding system are irrelevant. |
| 2466 | (when default-enable-multibyte-characters | 2472 | (when default-enable-multibyte-characters |
| 2467 | (set-display-table-and-terminal-coding-system | 2473 | (set-display-table-and-terminal-coding-system |
| 2468 | language-name coding-system)) | 2474 | language-name coding-system display)) |
| 2469 | 2475 | ||
| 2470 | ;; Set the `keyboard-coding-system' if appropriate (tty | 2476 | ;; Set the `keyboard-coding-system' if appropriate (tty |
| 2471 | ;; only). At least X and MS Windows can generate | 2477 | ;; only). At least X and MS Windows can generate |
| @@ -2477,12 +2483,14 @@ See also `locale-charset-language-names', `locale-language-names', | |||
| 2477 | (let ((kcs (or coding-system | 2483 | (let ((kcs (or coding-system |
| 2478 | (car (get-language-info language-name | 2484 | (car (get-language-info language-name |
| 2479 | 'coding-system))))) | 2485 | 'coding-system))))) |
| 2480 | (if kcs (set-keyboard-coding-system kcs))) | 2486 | (if kcs (set-keyboard-coding-system kcs display))) |
| 2481 | 2487 | ||
| 2482 | (setq locale-coding-system | 2488 | (unless display |
| 2483 | (car (get-language-info language-name 'coding-priority)))) | 2489 | (setq locale-coding-system |
| 2490 | (car (get-language-info language-name 'coding-priority))))) | ||
| 2484 | 2491 | ||
| 2485 | (when (and coding-system | 2492 | (when (and (not display) |
| 2493 | coding-system | ||
| 2486 | (not (coding-system-equal coding-system | 2494 | (not (coding-system-equal coding-system |
| 2487 | locale-coding-system))) | 2495 | locale-coding-system))) |
| 2488 | (prefer-coding-system coding-system) | 2496 | (prefer-coding-system coding-system) |
| @@ -2494,9 +2502,9 @@ See also `locale-charset-language-names', `locale-language-names', | |||
| 2494 | (when (boundp 'w32-ansi-code-page) | 2502 | (when (boundp 'w32-ansi-code-page) |
| 2495 | (let ((code-page-coding (intern (format "cp%d" w32-ansi-code-page)))) | 2503 | (let ((code-page-coding (intern (format "cp%d" w32-ansi-code-page)))) |
| 2496 | (when (coding-system-p code-page-coding) | 2504 | (when (coding-system-p code-page-coding) |
| 2497 | (setq locale-coding-system code-page-coding) | 2505 | (unless display (setq locale-coding-system code-page-coding)) |
| 2498 | (set-keyboard-coding-system code-page-coding) | 2506 | (set-keyboard-coding-system code-page-coding display) |
| 2499 | (set-terminal-coding-system code-page-coding)))) | 2507 | (set-terminal-coding-system code-page-coding display)))) |
| 2500 | 2508 | ||
| 2501 | (when (eq system-type 'darwin) | 2509 | (when (eq system-type 'darwin) |
| 2502 | ;; On Darwin, file names are always encoded in utf-8, no matter | 2510 | ;; On Darwin, file names are always encoded in utf-8, no matter |
| @@ -2511,32 +2519,33 @@ See also `locale-charset-language-names', `locale-language-names', | |||
| 2511 | 2519 | ||
| 2512 | ;; Default to A4 paper if we're not in a C, POSIX or US locale. | 2520 | ;; Default to A4 paper if we're not in a C, POSIX or US locale. |
| 2513 | ;; (See comments in Flocale_info.) | 2521 | ;; (See comments in Flocale_info.) |
| 2514 | (let ((locale locale) | 2522 | (unless display |
| 2515 | (paper (locale-info 'paper))) | 2523 | (let ((locale locale) |
| 2516 | (if paper | 2524 | (paper (locale-info 'paper))) |
| 2517 | ;; This will always be null at the time of writing. | 2525 | (if paper |
| 2518 | (cond | 2526 | ;; This will always be null at the time of writing. |
| 2519 | ((equal paper '(216 279)) | 2527 | (cond |
| 2520 | (setq ps-paper-type 'letter)) | 2528 | ((equal paper '(216 279)) |
| 2521 | ((equal paper '(210 297)) | 2529 | (setq ps-paper-type 'letter)) |
| 2522 | (setq ps-paper-type 'a4))) | 2530 | ((equal paper '(210 297)) |
| 2523 | (let ((vars '("LC_ALL" "LC_PAPER" "LANG"))) | 2531 | (setq ps-paper-type 'a4))) |
| 2524 | (while (and vars (= 0 (length locale))) | 2532 | (let ((vars '("LC_ALL" "LC_PAPER" "LANG"))) |
| 2525 | (setq locale (getenv (pop vars))))) | 2533 | (while (and vars (= 0 (length locale))) |
| 2526 | (when locale | 2534 | (setq locale (getenv (pop vars))))) |
| 2527 | ;; As of glibc 2.2.5, these are the only US Letter locales, | 2535 | (when locale |
| 2528 | ;; and the rest are A4. | 2536 | ;; As of glibc 2.2.5, these are the only US Letter locales, |
| 2529 | (setq ps-paper-type | 2537 | ;; and the rest are A4. |
| 2530 | (or (locale-name-match locale '(("c$" . letter) | 2538 | (setq ps-paper-type |
| 2531 | ("posix$" . letter) | 2539 | (or (locale-name-match locale '(("c$" . letter) |
| 2532 | (".._us" . letter) | 2540 | ("posix$" . letter) |
| 2533 | (".._pr" . letter) | 2541 | (".._us" . letter) |
| 2534 | (".._ca" . letter) | 2542 | (".._pr" . letter) |
| 2535 | ("enu$" . letter) ; Windows | 2543 | (".._ca" . letter) |
| 2536 | ("esu$" . letter) | 2544 | ("enu$" . letter) ; Windows |
| 2537 | ("enc$" . letter) | 2545 | ("esu$" . letter) |
| 2538 | ("frc$" . letter))) | 2546 | ("enc$" . letter) |
| 2539 | 'a4)))))) | 2547 | ("frc$" . letter))) |
| 2548 | 'a4))))))) | ||
| 2540 | nil) | 2549 | nil) |
| 2541 | 2550 | ||
| 2542 | ;;; Charset property | 2551 | ;;; Charset property |
diff --git a/lisp/server.el b/lisp/server.el index b822eff0ae6..ef58306a9a5 100644 --- a/lisp/server.el +++ b/lisp/server.el | |||
| @@ -651,10 +651,10 @@ The following commands are accepted by the client: | |||
| 651 | (setq request (substring request (match-end 0))) | 651 | (setq request (substring request (match-end 0))) |
| 652 | (unless (server-client-get client 'version) | 652 | (unless (server-client-get client 'version) |
| 653 | (error "Protocol error; make sure you use the correct version of emacsclient")) | 653 | (error "Protocol error; make sure you use the correct version of emacsclient")) |
| 654 | ;; Set up client's environment for tgetent(3) | ||
| 655 | ;; according to ncurses(3). | ||
| 656 | (server-with-client-environment proc | 654 | (server-with-client-environment proc |
| 657 | ("BAUDRATE" "COLUMNS" "ESCDELAY" "HOME" "LINES" | 655 | ("LANG" "LC_CTYPE" "LC_ALL" |
| 656 | ;; For tgetent(3); list according to ncurses(3). | ||
| 657 | "BAUDRATE" "COLUMNS" "ESCDELAY" "HOME" "LINES" | ||
| 658 | "NCURSES_ASSUMED_COLORS" "NCURSES_NO_PADDING" | 658 | "NCURSES_ASSUMED_COLORS" "NCURSES_NO_PADDING" |
| 659 | "NCURSES_NO_SETBUF" "TERM" "TERMCAP" "TERMINFO" | 659 | "NCURSES_NO_SETBUF" "TERM" "TERMCAP" "TERMINFO" |
| 660 | "TERMINFO_DIRS" "TERMPATH") | 660 | "TERMINFO_DIRS" "TERMPATH") |
| @@ -665,10 +665,6 @@ The following commands are accepted by the client: | |||
| 665 | (server-client-set client 'tty (display-name frame)) | 665 | (server-client-set client 'tty (display-name frame)) |
| 666 | (server-client-set client 'display (frame-display frame)) | 666 | (server-client-set client 'display (frame-display frame)) |
| 667 | 667 | ||
| 668 | ;; Set up display for the remote locale. | ||
| 669 | ;; XXX This function has been removed from mule-cmds.el, we need to find another way. | ||
| 670 | ;; (configure-display-for-locale) | ||
| 671 | |||
| 672 | ;; Reply with our pid. | 668 | ;; Reply with our pid. |
| 673 | (server-send-string proc (concat "-emacs-pid " (number-to-string (emacs-pid)) "\n")) | 669 | (server-send-string proc (concat "-emacs-pid " (number-to-string (emacs-pid)) "\n")) |
| 674 | (setq dontkill t))) | 670 | (setq dontkill t))) |