[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Text copied from *grep* buffer has NUL (0x00) characters
From: |
Stefan Monnier |
Subject: |
Re: Text copied from *grep* buffer has NUL (0x00) characters |
Date: |
Sun, 09 May 2021 09:57:22 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
> 2) Copying text from a *grep* buffer that looks like ":" should not suddenly
> deliver a NUL character instead. That's just unexpected and prone to
> problems down the line.
This "what you see in NOT what you get" is indeed undesirable. I'm not
sure it's easy to fix in a reliable way in Emacs (beside not using
`--null` as Eli points out), but I suggest you `M-x report-emacs-bug`.
Maybe grep-mode can add a `filter-buffer-substring-function` that
converts those NUL into `:`.
For the detection of NULs in UTF-8 files, you could also ask for such
a feature via `M-x report-emacs-bug` but it should be pretty easy to get
something comparable with something like:
(defun my-utf-8-nul-check ()
(save-excursion
(goto-char (point-min))
(when (search-forward "\000" nil t)
(error "NUL!!"))))
(add-hook 'before-save-hook #'my-utf-8-nul-check)
-- Stefan
Re: Text copied from *grep* buffer has NUL (0x00) characters,
Stefan Monnier <=