grep-find: first ':" char is a zero

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

grep-find: first ':" char is a zero

jonetsu
The first character ':' after the filename in grep-find turns out to be
a zero.  The second is a legitimate ':'.  Both are shown as ':'.  This
means that the line numbers for each find are in between a zero and a
':' even though they look like being between two ':'.

I found this when searching (C-s) for a ':' from the beginning of a
line.  It would not stop at the first ':'

Is there a way to configure the grep-find results so that an actual
character is used instead of zero ?


Reply | Threaded
Open this post in threaded view
|

Re: grep-find: first ':" char is a zero

Noam Postavsky
On Mon, 25 Nov 2019 at 09:49, jonetsu <[hidden email]> wrote:

> Is there a way to configure the grep-find results so that an actual
> character is used instead of zero ?

Yes, customize grep-use-null-filename-separator to nil.

Reply | Threaded
Open this post in threaded view
|

Re: grep-find: first ':" char is a zero

jonetsu
On Mon, 25 Nov 2019 10:09:29 -0500
Noam Postavsky <[hidden email]> wrote:

> On Mon, 25 Nov 2019 at 09:49, jonetsu <[hidden email]> wrote:
>
>  [...]  
>
> Yes, customize grep-use-null-filename-separator to nil.

Thanks, this will be quite helpful.  

In the meanwhile I found that by using hexl-mode on a saved version of
the grep-find results and subsequently exiting hexl-mode, the 0
character will be shown as caret + @.  It then becomes easy to do a
regular search-replace.

Having grep-find not using a 0 character is the most direct solution.



Reply | Threaded
Open this post in threaded view
|

Re: grep-find: first ':" char is a zero

Nick Dokos-3
jonetsu <[hidden email]> writes:

> On Mon, 25 Nov 2019 10:09:29 -0500
> Noam Postavsky <[hidden email]> wrote:
>
>> On Mon, 25 Nov 2019 at 09:49, jonetsu <[hidden email]> wrote:
>>
>>  [...]  
>>
>> Yes, customize grep-use-null-filename-separator to nil.
>
> Thanks, this will be quite helpful.  
>
> In the meanwhile I found that by using hexl-mode on a saved version of
> the grep-find results and subsequently exiting hexl-mode, the 0
> character will be shown as caret + @.  It then becomes easy to do a
> regular search-replace.
>
> Having grep-find not using a 0 character is the most direct solution.
>

... but it might lead to problems with filenames containing white
space or other strange chars. Now that you know it is a NUL, you can
use `C-s C-q C-<space>' to search for it if you want to keep the --null
option on grep.

--
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler