emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: setenv -> locale-coding-system cannot handle ASCII?!


From: Kenichi Handa
Subject: Re: setenv -> locale-coding-system cannot handle ASCII?!
Date: Tue, 25 Feb 2003 15:34:07 +0900 (JST)
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.2.92 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI)

In article <address@hidden>, Sam Steingold <address@hidden> writes:
> GNU Emacs 21.3.50.7 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
>  of 2003-02-24 on loiso.podval.org

> Debugger entered--Lisp error: (error "Can't encode
>   `SSH_AUTH_SOCK=/tmp/ssh-XXgfCthd/agent.1191' with
>   `locale-coding-system'") 
>   signal(error ("Can't encode `SSH_AUTH_SOCK=/tmp/ssh-XXgfCthd/agent.1191' 
>                  with `locale-coding-system'")) 

Miles Bader <address@hidden> writes:
> I try to do this using today's CVS:

>   M-x setenv RET lk25 RET /proj/soft2/uclinux/uclinux/linux-2.5.63-uc0 RET

> and got this error:

>   setenv: Can't encode `lk25=/proj/soft2/uclinux/uclinux/linux-2.5.63-uc0' 
> with `locale-coding-system'

I've just installed this change.  I think it should fix the
above problems.  Please try the new code.

2003-02-25  Kenichi Handa  <address@hidden>

        * env.el (setenv): Fix previous change.

*** env.el.~1.28.~      Tue Feb 25 09:43:17 2003
--- env.el      Tue Feb 25 15:09:45 2003
***************
*** 121,133 ****
             nil
             t))))
    (if (and (multibyte-string-p variable) locale-coding-system)
!       (unless (memq (coding-system-base locale-coding-system)
!                   (find-coding-systems-string (concat variable value)))
!       (error "Can't encode `%s=%s' with `locale-coding-system'"
!              variable (or value "")))
!     (unless (memq 'undecided (find-coding-systems-string variable))
!       (error "Can't encode `%s=%s' with unspecified `locale-coding-system'"
!            variable (or value ""))))
    (if unset 
        (setq value nil)
      (if substitute-env-vars
--- 121,131 ----
             nil
             t))))
    (if (and (multibyte-string-p variable) locale-coding-system)
!       (let ((codings (find-coding-systems-string (concat variable value))))
!       (unless (or (eq 'undecided (car codings))
!                   (memq (coding-system-base locale-coding-system) codings))
!         (error "Can't encode `%s=%s' with `locale-coding-system'"
!                variable (or value "")))))
    (if unset 
        (setq value nil)
      (if substitute-env-vars

> What's wierd is that I _don't_ get an error if I invoke the same command
> via C-x ESC ESC (repeat-complex-command).

> Looking at the code for `setenv,' I'm not sure what's going on; in this
> snippet (which is the only place the above error occurs):

>   (if (and (multibyte-string-p variable) locale-coding-system)
>       (unless (memq (coding-system-base locale-coding-system)
>                   (find-coding-systems-string (concat variable value)))
>       (error "Can't encode `%s=%s' with `locale-coding-system'"
>              variable (or value "")))
>      ...

> the call to multibyte-string-p seems to be odd -- if I just evaluate
> (multibyte-string-p "lk25") it returns nil, but if I get an error
> backtrace so that `variable' is bound to "lk25", and evaluate
> (multibyte-string-p variable), then it returns t!

> Since (find-coding-systems-string (concat variable value)) always seems
> to return just '(undecided), something seems dreadfully wrong.

> [I'm confused about what `multibyte-string-p' actually _means_, by the
> way -- shouldn't it only ever return t if the string contains non-ascii
> characters?]

Looong ago I proposed the same thing to Richard.  His answer
was that the multibyteness of a string should follow the
source of the string.  If it is a substring of a multibyte
buffer/string, it should be multibyte.  Only when we can't
determine the multibyteness of a source (e.g. lisp reader),
we should determine the multibyteness of a string from it's
contents.

And, as read-from-minibuffer, etc usually inherit the
multibyteness of the current buffer, what you type after M-x
setenv are also multibyte even if it contains only ASCII
characters.

But, as C-x ESC ESC reads s-exp by lisp reader, the ASCII
strings in the s-exp will be unibyte.  Thus, you didn't get
an error.

---
Ken'ichi HANDA
address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]