[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dired-do-find-regexp failure with latin-1 encoding
From: |
Juri Linkov |
Subject: |
Re: dired-do-find-regexp failure with latin-1 encoding |
Date: |
Mon, 30 Nov 2020 22:54:32 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) |
>> For grep output a bigger problem is that grep on binary data
>> might output too long lines before the terminating newline.
>
> (*) We already have this kind of problem with "normal" files which contain
> minified assets (JS or CSS). The file contents are usually normal ASCII,
> but it's just one line which can reach several MBs in length.
>
> The usual way to deal with that is with project-ignores and
> grep-find-ignored-files. That works for both cases.
This is a bug problem - often grep output lines are so long
that Emacs freezes, so need to kill the process. Updating
manually ignored-files every time a new file causes freeze
is very unreliable and time-consuming workaround.
I tried to fix this problem, and fortunately the fix is simple
with the 1-liner patch.
It does exactly the same thing that we recently did to hide
overly long grep command lines with 'grep-find-abbreviate'.
The patch even uses the same 'grep-find-abbreviate-properties'
to allow clicking the hidden part to expand it.
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index dafba22f77..e0df2402ee 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -492,6 +492,9 @@ grep-mode-font-lock-keywords
(0 grep-context-face)
(1 (if (eq (char-after (match-beginning 1)) ?\0)
`(face nil display ,(match-string 2)))))
+ ;; Hide excessive parts of grep output lines
+ ("^.+?:.\\{,64\\}\\(.*\\).\\{10\\}$"
+ 1 grep-find-abbreviate-properties)
;; Hide excessive part of rgrep command
("^find \\(\\. -type d .*\\\\)\\)"
(1 (if grep-find-abbreviate grep-find-abbreviate-properties
More customizability could be added later to define the
length of the hidden part, etc.
- Re: dired-do-find-regexp failure with latin-1 encoding, (continued)
- Re: dired-do-find-regexp failure with latin-1 encoding, Eli Zaretskii, 2020/11/29
- Re: dired-do-find-regexp failure with latin-1 encoding, Dmitry Gutov, 2020/11/29
- Re: dired-do-find-regexp failure with latin-1 encoding, Eli Zaretskii, 2020/11/29
- Re: dired-do-find-regexp failure with latin-1 encoding, Dmitry Gutov, 2020/11/29
- Re: dired-do-find-regexp failure with latin-1 encoding, Eli Zaretskii, 2020/11/29
- Re: dired-do-find-regexp failure with latin-1 encoding, Eli Zaretskii, 2020/11/29
- Re: dired-do-find-regexp failure with latin-1 encoding, Stephen Berman, 2020/11/29
- Re: dired-do-find-regexp failure with latin-1 encoding, Gregory Heytings, 2020/11/29
- Re: dired-do-find-regexp failure with latin-1 encoding, Juri Linkov, 2020/11/29
- Re: dired-do-find-regexp failure with latin-1 encoding, Dmitry Gutov, 2020/11/29
- Re: dired-do-find-regexp failure with latin-1 encoding,
Juri Linkov <=
- Re: dired-do-find-regexp failure with latin-1 encoding, Dmitry Gutov, 2020/11/30