Only literal replacement is intended in helm-ag--abbreviate-file-name call to replace-match, so prevent backspace parsing by by passing LITERAL as true.
E.g. if rg is used as helm-ag-base-command, it can output backslashes in its search results for binary files, so an error or unintended replacing behavior could occur.
I opened git-gutter.el and git-gutter.elc, then used helm-do-ag-buffers to search for "git-gutter:linum-get-overlay" (mostly by accident), and the following error popped up (sorry for overlong backtrace):
Debugger entered--Lisp error: (error "Invalid use of ‘\’ in replacement text")
replace-match("Binary file /home/standard/.emacs.d/elpa/27.1/develop/git-gutter-20211002.2345/git-gutter.elc matches (found \"\u{0}\" byte around offset 5)\n/mnt/c/Dev/github/git-gutter/git-gutter.el")
helm-ag--abbreviate-file-name()
helm-ag--do-ag-propertize("git-gutter:linum-get-overlay")
Only literal replacement is intended in
helm-ag--abbreviate-file-name
call toreplace-match
, so prevent backspace parsing by by passing LITERAL as true.E.g. if rg is used as helm-ag-base-command, it can output backslashes in its search results for binary files, so an error or unintended replacing behavior could occur.
Reproduction:
(setq helm-ag-base-command "rg --smart-case --no-heading --color=never --line-number --max-columns=150")
I opened git-gutter.el and git-gutter.elc, then used
helm-do-ag-buffers
to search for "git-gutter:linum-get-overlay" (mostly by accident), and the following error popped up (sorry for overlong backtrace):