unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Windows Emacs shell/shell fail to execute ack perl script(locale error)
@ 2013-01-11 17:59 Vin Che
  2013-01-13 10:21 ` Oleksandr Gavenko
  0 siblings, 1 reply; 2+ messages in thread
From: Vin Che @ 2013-01-11 17:59 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 711 bytes --]

Typing this command on regular cmd.exe or cygwin termal gives me results as
expected:

    $ ack hello

(I have ack.bat that execute ack.pl in my PATH)

However, when I run the same command from either shell or eshell in Emacs,
it gives me this error:


    c:\Users\Martin>"C:\cygwin\bin\perl" /cygdrive/c/Users/Martin/Desktop/
ack.pl hello
    perl: warning: Setting locale failed.
    perl: warning: Please check that your locale settings:
    LC_ALL = (unset),
    LANG = "ENU"
        are supported and installed on your system.
    perl: warning: Falling back to the standard locale ("C").

I tried to fix it by SETENV both variable to en_US.UTF-8 but when I run it
again, it gave me no result but froze.

[-- Attachment #2: Type: text/html, Size: 1134 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Windows Emacs shell/shell fail to execute ack perl script(locale error)
  2013-01-11 17:59 Windows Emacs shell/shell fail to execute ack perl script(locale error) Vin Che
@ 2013-01-13 10:21 ` Oleksandr Gavenko
  0 siblings, 0 replies; 2+ messages in thread
From: Oleksandr Gavenko @ 2013-01-13 10:21 UTC (permalink / raw)
  To: help-gnu-emacs

On 2013-01-11, Vin Che wrote:

> Typing this command on regular cmd.exe or cygwin termal gives me results as
> expected:
>
>     $ ack hello
>
> (I have ack.bat that execute ack.pl in my PATH)
>
> However, when I run the same command from either shell or eshell in Emacs,
> it gives me this error:
>
>
>     c:\Users\Martin>"C:\cygwin\bin\perl" /cygdrive/c/Users/Martin/Desktop/
> ack.pl hello
>     perl: warning: Setting locale failed.
>     perl: warning: Please check that your locale settings:
>     LC_ALL = (unset),
>     LANG = "ENU"
>         are supported and installed on your system.
>     perl: warning: Falling back to the standard locale ("C").
>
> I tried to fix it by SETENV both variable to en_US.UTF-8 but when I run it
> again, it gave me no result but froze.

Try:

  (setenv "LC_ALL" "C")
  (setenv "LANG" "C")

What is "ENU" locale ??

From:

  http://perldoc.perl.org/perllocale.html

  You may encounter the following warning message at Perl startup:

      perl: warning: Setting locale failed.
      perl: warning: Please check that your locale settings:
      LC_ALL = "En_US",
      LANG = (unset)
      are supported and installed on your system.
      perl: warning: Falling back to the standard locale ("C").

  This means that your locale settings had LC_ALL set to "En_US" and LANG exists
  but has no value. Perl tried to believe you but could not. Instead, Perl gave
  up and fell back to the "C" locale, the default locale that is supposed to
  work no matter what. This usually means your locale settings were wrong, they
  mention locales your system has never heard of, or the locale installation in
  your system has problems (for example, some system files are broken or
  missing). There are quick and temporary fixes to these problems, as well as
  more thorough and lasting fixes.

Another valuable answer:

  http://stackoverflow.com/questions/2499794/how-can-i-fix-a-locale-warning-from-perl

For example I use such code:

  (when (eq system-type 'windows-nt)
    (ignore-errors
      (require 'cygwin-mount)
      (cygwin-mount-activate)
      )
    (add-hook 'find-file-hook 'follow-cygwin-symlink)
    ;; Workaround for Cygwin shell, when set 'CYGWIN=noglob'. By default 'shell-quote-argument'
    ;; quoted by double '\' chars this cause failure.
    (defun shell-quote-argument (argument)
      (concat "'" argument "'")
      )
    ;; Workaround for Cygwin when 'shell-file-name' is 'bash'.
    (setq null-device "/dev/null")
    ;; Use shell from Cygwin/MinGW.
    (setq shell-file-name "bash")
    (setenv "SHELL" "/bin/bash")
    (modify-coding-system-alist 'process "bash" '(cp1251-unix . cp1251-unix))
    )

  ;; I prefer EN man pages.
  (when (memq system-type '(windows-nt cygwin))
    (setq manual-program "LANG=C man")
    )

in which I turn man into LANG=C... The trick work as I use "bash" command line
interpreter under Windows.

-- 
Best regards!




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-13 10:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-11 17:59 Windows Emacs shell/shell fail to execute ack perl script(locale error) Vin Che
2013-01-13 10:21 ` Oleksandr Gavenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).