Function: wgrep-prepare-context-while
wgrep-prepare-context-while is a natively compiled function defined in
wgrep.el.
Signature
(wgrep-prepare-context-while FILENAME LINE DIRECTION FPROP FLEN)
Source Code
;; Defined in /nix/store/pbj4kr4ar755h56yscbqpnmv3swf8i1k-emacs-packages-deps/share/emacs/site-lisp/elpa/wgrep-20230203.1214/wgrep.el
;; -A -B -C output may be misunderstood and set read-only.
;; Context match break font-lock if context have at least two `:'.
;; e.g.
;; filename-1-2010-01-01 23:59:99
;; filename:2:hoge
;; filename-3-20:10:25
(defun wgrep-prepare-context-while (filename line direction fprop flen)
(let* ((next (+ direction line))
(fregexp (regexp-quote filename)))
(forward-line direction)
(while (looking-at (format "^%s[-\0]%d-" fregexp next))
(let ((start (match-beginning 0))
(end (match-end 0))
(bol (line-beginning-position))
(eol (line-end-position)))
(put-text-property start end 'wgrep-line-filename filename)
(put-text-property start end 'wgrep-line-number next)
(put-text-property start (+ start flen) fprop filename)
(remove-text-properties bol eol '(wgrep-ignore))
(forward-line direction)
(setq next (+ direction next))))))