all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Thierry Volpiatto <thierry.volpiatto@gmail.com>
Cc: 15337@debbugs.gnu.org
Subject: bug#15337: 24.3.50; [PATCH] cd to directory name with french accent fail	from	term/ansi-term
Date: Thu, 12 Sep 2013 18:33:27 +0300	[thread overview]
Message-ID: <83fvtahx6g.fsf@gnu.org> (raw)
In-Reply-To: <87r4cuwrob.fsf@gmail.com>

> From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
> Date: Thu, 12 Sep 2013 07:11:00 +0200
> 
> > If you cannot figure out where does the unibyte string come from,
> > please provide a test case starting from "emacs -Q".  Thanks.
> 
> So from emacs -Q
> 
> (I repeat my initial message)

Sorry, I didn't realize from your original message that M-x ansi-term
is all that is needed after "emacs -Q".

> M-x ansi-term
> cd ~/Téléchargements/
> 
> Debugger entered--Lisp error: (error "No such directory found via CDPATH environment variable")
>   signal(error ("No such directory found via CDPATH environment variable"))
>   error("No such directory found via CDPATH environment variable")
>   cd("/home/thierry/T\303\251l\303\251chargements")

I think I see the problem.  term.el disables decoding of the shell
output, see term-exec-1.  So the text it gets from the shell is
unibyte, un-decoded text.  Therefore, whenever term.el calls other
functions, let alone functions that can be defined by the user, it
must decode the strings it passes to those functions.  And in this
case, it doesn't:

                         ((and (eq char ?\032)
                               (not handled-ansi-message))
                          (let ((end (string-match "\r?$" str i)))
                            (if end
                                (funcall term-command-hook
                                         (prog1 (substring str (1+ i) end)
                                           (setq i (match-end 0))))

Here 'str' is a unibyte string, while term-command-hook expects a
normal, multibyte string as its argument.

So please see if decoding the result of prog1 with
decode-coding-string, like you suggested to do in 'cd', but before
passing it to funcall, fixes the problem.  Something like this:

     (funcall term-command-hook
              (decode-coding-string
                (prog1 (substring str (1+ i) end)
                   (setq i (match-end 0)))
                locale-coding-system))





  reply	other threads:[~2013-09-12 15:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-11 11:57 bug#15337: 24.3.50; [PATCH] cd to directory name with french accent fail from term/ansi-term Thierry Volpiatto
2013-09-11 13:51 ` Eli Zaretskii
2013-09-11 14:12   ` Thierry Volpiatto
2013-09-11 16:21     ` Eli Zaretskii
2013-09-12  5:11       ` Thierry Volpiatto
2013-09-12 15:33         ` Eli Zaretskii [this message]
2013-09-13  5:21           ` Thierry Volpiatto
2013-09-13  7:49             ` Eli Zaretskii
2013-09-13 11:29               ` Thierry Volpiatto
2013-09-13 11:59                 ` Thierry Volpiatto
2013-09-13 13:25                   ` Eli Zaretskii
2013-09-13 13:23                 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83fvtahx6g.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=15337@debbugs.gnu.org \
    --cc=thierry.volpiatto@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.