[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Codepages and shell function on w32
From: |
Lennart Borgman (gmail) |
Subject: |
Re: Codepages and shell function on w32 |
Date: |
Sat, 06 Jan 2007 02:55:10 +0100 |
User-agent: |
Thunderbird 1.5.0.9 (Windows/20061207) |
Benjamin Riefenstahl wrote:
Hi Lennart,
Sorry for the late reply.
"Lennart Borgman (gmail)" writes:
I read from there that codepage ansi is the default for Cygwin. But
what black magic do we need to use to specify what Cygwin calls
codepage ansi or oem in Emacs?
Cygwin just uses the MS Windows naming conventions here. "ANSI" is
the codepage that the graphics subsystem uses and "OEM" is the default
codepage for console I/O, like CMD.EXE uses it, e.g.
Emacs should have the coding system for the "ANSI" codepage in the
variable locale-coding-system, I think.
Thanks Benjamin. I tested this with both Cygwin and MSYS and it seems to
work. So now here is how the end of defun shell could look like at the
moment:
(shell-mode)
(when (eq system-type 'windows-nt)
(let* ((shell-file-name prog)
(proc (get-buffer-process (current-buffer)))
(fullprog (executable-find prog))
(cp-out (read (format "cp%s"
(w32-get-console-output-codepage))))
(cp-out-dos (coding-system-change-eol-conversion cp-out
'dos))
(cp-out-unix (coding-system-change-eol-conversion cp-out
'unix))
(cp-in (read (format "cp%s" (w32-get-console-codepage))))
(cp-in-dos (coding-system-change-eol-conversion cp-in 'dos))
(cp-in-unix (coding-system-change-eol-conversion cp-in
'unix))
(cp-locale-dos (coding-system-change-eol-conversion
locale-coding-system 'dos))
(cp-locale-unix (coding-system-change-eol-conversion
locale-coding-system 'unix)))
(cond
((w32-shell-dos-semantics)
(set-process-coding-system proc cp-out-dos cp-in-unix))
((string-match "/msys/" fullprog)
(message "think it is MSYS...")
(set-process-coding-system proc cp-locale-dos cp-locale-unix))
((string-match "/cygwin/" fullprog)
(message "think it is Cygwin...")
(set-process-coding-system proc cp-locale-dos cp-locale-unix))
(t
(message "unrecognized shell program: %s" fullprog))
)))))
buffer)
Maybe we could install something like this and get on with the quesion
about file name completion which as we earlier saw also is broken on w32?
I would however want to add one thing to the above: The possibility to
explicitly set the coding system for the interactive shell.
And maybe the tests for Cygwin and MSYS should be enhanced, but let us
take some steps forward please!
Re: Codepages and shell function on w32, Benjamin Riefenstahl, 2007/01/02