Function: wgrep-string-replace-bom
wgrep-string-replace-bom is a natively compiled function defined in
wgrep.el.
Signature
(wgrep-string-replace-bom STRING CS)
Source Code
;; Defined in /nix/store/pbj4kr4ar755h56yscbqpnmv3swf8i1k-emacs-packages-deps/share/emacs/site-lisp/elpa/wgrep-20230203.1214/wgrep.el
;;;
;;; Basic utilities
;;;
;;;;
;;;; misc
;;;;
;;Hack function
(defun wgrep-string-replace-bom (string cs)
(let ((regexp (car (rassq (coding-system-base cs) auto-coding-regexp-alist)))
;;TODO check ack-grep
;; FIXME: `find-operation-coding-system' is not exactly correct.
;; However almost case is ok like this bom function.
;; e.g. (let ((default-process-coding-system 'some-coding))
;; (call-interactively 'grep))
(grep-cs (or (find-operation-coding-system 'call-process grep-program)
(terminal-coding-system)))
str)
(if (and regexp
(setq str (encode-coding-string string grep-cs))
(string-match regexp str))
(decode-coding-string (substring str (match-end 0)) cs)
string)))