[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Want to grep for text in selected coding...
From: |
Oleksandr Gavenko |
Subject: |
Re: Want to grep for text in selected coding... |
Date: |
Wed, 29 Feb 2012 18:58:04 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) |
On 2012-02-28, Oleksandr Gavenko wrote:
> On 2012-02-28, Eli Zaretskii wrote:
>> And, btw, you should be able to use "C-x RET c" before "M-x rgrep" to
>> search for any encoding with Grep as well.
>>
> I often use "C-x RET c" and try your suggestion previously.
>
> My first attempt work under Linux but I forget condition when it fail.
>
> Next morning I try all cases that I can use in practice...
I checked with negative result...
Both Emacs 23.3 and 24.0.91 are affected. Both are from ftp.gnu.org for
Windows with Cygwin grep command.
My setup is system wide 'LANG=ru_RU.cp1251' to make Cygwin Russian friendly.
Then I start "emacs -q" I start experimenting with M-x lgrep and such file:
cp866 ЏаЁўҐв!
cp1251 Привет!
koi8-r рТЙЧЕФ!
utf-8 Привет!
All work fine ("C-x RET c cp1251 RET M-x lgrep RET Привет! RET *.txt RET"):
text.txt:2:cp1251 Привет!
But if I load my .emacs file test was failed.
I debug issue to most simple call:
(call-process shell-file-name nil t nil "-c" "grep -nH -e 'Привет!' *.txt")
which fail with or without loading my .emacs
So I start "emacs -q" and try evaluate above expression. All fine!
Next I eval (if you remember my LANG=ru_RU.cp1251)
(setenv "LANG" "C")
because 'lgrep' call 'compilation-start' with temporary change LANG env var
before 'call-process'.
Evaluation of 'call-process' return "1" without output!
Next I eval
(setq shell-file-name "bash")
to get more close environment to my .emacs and get from 'call-process':
/usr/bin/bash: $'grep -nH -e
\'\320\237\321\200\320\270\320\262\320\265\321\202\' *.txt': command not found
If you remember I say that under Debian and Windows with -q "M-x lgrep" work
fine with Russian search string.
If I change LANG from Cygwin shell (mintty) - grep work fine:
$ LANG=C grep -nH -e 'Привет!' *.txt
text.txt:2:cp1251 Привет!
$ LANG=C grep -nH -e 'ЏаЁўҐв!' *.txt
text.txt:1:cp866 ЏаЁўҐв!
Is this a bug in Emacs or in Cygwin?
Currently I don't need to work in Widows as leave my job but next job can
change this statement...
That is why I am so harsh in my previous post...
--
Best regards!