comparison lisp/international/mule-cmds.el @ 83421:bb2edc915032

Implement automatic terminal-local environment variables via `local-environment-variables'. * lisp/env.el (setenv, getenv): Add optional terminal parameter. Update docs. (setenv): Handle `local-environment-variables'. (read-envvar-name): Also allow (and complete) local environment variables on the current terminal. * src/callproc.c: Include frame.h and termhooks.h, for terminal parameters. (Qenvironment): New constant. (Vlocal_environment_variables): New variable. (syms_of_callproc): Register and initialize them. (child_setup): Handle Vlocal_environment_variables. (getenv_internal): Add terminal parameter. Handle Vlocal_environment_variables. (Fgetenv_internal): Add terminal parameter. * src/termhooks.h (get_terminal_param): Declare. * src/Makefile.in (callproc.o): Update dependencies. * mac/makefile.MPW (callproc.c.x): Update dependencies. * lisp/termdev.el (terminal-id): Make parameter optional. (terminal-getenv, terminal-setenv, with-terminal-environment): Disable functions. * lisp/mule-cmds.el (set-locale-environment): Convert `terminal-getenv' calls to `getenv'. * lisp/rxvt.el (rxvt-set-background-mode): Ditto. * lisp/x-win.el (x-initialize-window-system): Ditto. * lisp/xterm.el (terminal-init-xterm): Ditto. * lisp/server.el (server-process-filter): Fix reference to the 'display frame parameter. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-461
author Karoly Lorentey <lorentey@elte.hu>
date Mon, 26 Dec 2005 02:14:10 +0000
parents 37d0562504bf
children 9bec09743395
comparison
equal deleted inserted replaced
83420:521d3f18b3d1 83421:bb2edc915032
2458 ;; Use the first of these three environment variables 2458 ;; Use the first of these three environment variables
2459 ;; that has a nonempty value. 2459 ;; that has a nonempty value.
2460 (let ((vars '("LC_ALL" "LC_CTYPE" "LANG"))) 2460 (let ((vars '("LC_ALL" "LC_CTYPE" "LANG")))
2461 (while (and vars 2461 (while (and vars
2462 (= 0 (length locale))) ; nil or empty string 2462 (= 0 (length locale))) ; nil or empty string
2463 (setq locale (terminal-getenv (pop vars)))))) 2463 (setq locale (getenv (pop vars) display)))))
2464 2464
2465 (unless locale 2465 (unless locale
2466 ;; The two tests are kept separate so the byte-compiler sees 2466 ;; The two tests are kept separate so the byte-compiler sees
2467 ;; that mac-get-preference is only called after checking its existence. 2467 ;; that mac-get-preference is only called after checking its existence.
2468 (when (fboundp 'mac-get-preference) 2468 (when (fboundp 'mac-get-preference)
2571 ;; the locale. 2571 ;; the locale.
2572 (setq default-file-name-coding-system 'utf-8) 2572 (setq default-file-name-coding-system 'utf-8)
2573 ;; Mac OS X's Terminal.app by default uses utf-8 regardless of 2573 ;; Mac OS X's Terminal.app by default uses utf-8 regardless of
2574 ;; the locale. 2574 ;; the locale.
2575 (when (and (null window-system) 2575 (when (and (null window-system)
2576 (equal (terminal-getenv "TERM_PROGRAM") "Apple_Terminal")) 2576 (equal (getenv "TERM_PROGRAM" display) "Apple_Terminal"))
2577 (set-terminal-coding-system 'utf-8) 2577 (set-terminal-coding-system 'utf-8)
2578 (set-keyboard-coding-system 'utf-8))) 2578 (set-keyboard-coding-system 'utf-8)))
2579 2579
2580 ;; Default to A4 paper if we're not in a C, POSIX or US locale. 2580 ;; Default to A4 paper if we're not in a C, POSIX or US locale.
2581 ;; (See comments in Flocale_info.) 2581 ;; (See comments in Flocale_info.)
2589 (setq ps-paper-type 'letter)) 2589 (setq ps-paper-type 'letter))
2590 ((equal paper '(210 297)) 2590 ((equal paper '(210 297))
2591 (setq ps-paper-type 'a4))) 2591 (setq ps-paper-type 'a4)))
2592 (let ((vars '("LC_ALL" "LC_PAPER" "LANG"))) 2592 (let ((vars '("LC_ALL" "LC_PAPER" "LANG")))
2593 (while (and vars (= 0 (length locale))) 2593 (while (and vars (= 0 (length locale)))
2594 (setq locale (terminal-getenv (pop vars))))) 2594 (setq locale (getenv (pop vars) display))))
2595 (when locale 2595 (when locale
2596 ;; As of glibc 2.2.5, these are the only US Letter locales, 2596 ;; As of glibc 2.2.5, these are the only US Letter locales,
2597 ;; and the rest are A4. 2597 ;; and the rest are A4.
2598 (setq ps-paper-type 2598 (setq ps-paper-type
2599 (or (locale-name-match locale '(("c$" . letter) 2599 (or (locale-name-match locale '(("c$" . letter)