comparison lisp/process.el @ 4610:38e8af61f38d

Check if env vars are encodable by native coding system, #'setenv 2009-02-11 Aidan Kehoe <kehoea@parhasard.net> * process.el (setenv): Check whether the environment variable and value can be encoded by the native coding system, error if not, as does GNU Emacs (but our implementation is different).
author Aidan Kehoe <kehoea@parhasard.net>
date Wed, 11 Feb 2009 12:14:28 +0000
parents 466ad8ad5f13
children 9c97a5a8c241
comparison
equal deleted inserted replaced
4609:33b8c874b2c8 4610:38e8af61f38d
597 (if unset 597 (if unset
598 (setq value nil) 598 (setq value nil)
599 (if substitute-env-vars 599 (if substitute-env-vars
600 (setq value (substitute-env-vars value)))) 600 (setq value (substitute-env-vars value))))
601 601
602 ;; GNU fuck around with coding systems here. We do it at a much lower 602 ;; XEmacs change: check whether the environment understands this variable,
603 ;; level; an equivalent of the following code of Handa's would be 603 ;; using our function for exactly that, don't use
604 ;; worthwhile here, though: 604 ;; #'find-coding-systems-string or trust `undecided' to encode it.
605 605 (query-coding-string (concat variable "=" value) 'native nil t)
606 ; (let ((codings (find-coding-systems-string (concat variable value))))
607 ; (unless (or (eq 'undecided (car codings))
608 ; (memq (coding-system-base locale-coding-system) codings))
609 ; (error "Can't encode `%s=%s' with `locale-coding-system'"
610 ; variable (or value "")))))
611
612 ;; But then right now our find-coding-systems analogue is in packages.
613 606
614 (if (string-match "=" variable) 607 (if (string-match "=" variable)
615 (error "Environment variable name `%s' contains `='" variable) 608 (error "Environment variable name `%s' contains `='" variable)
616 (let ((pattern (concat "\\`" (regexp-quote (concat variable "=")))) 609 (let ((pattern (concat "\\`" (regexp-quote (concat variable "="))))
617 (case-fold-search nil) 610 (case-fold-search nil)