Skip to content

Commit

Permalink
Grep export: Support grep-use-headings (Fix #719)
Browse files Browse the repository at this point in the history
  • Loading branch information
minad committed Jan 16, 2025
1 parent 1540ca3 commit 1b20a28
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions embark-consult.el
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,18 @@ count of the matches (there may be more than one match per line).
The function FOOTER is called to insert a footer."
(let ((buf (generate-new-buffer "*Embark Export Grep*")))
(with-current-buffer buf
(insert (propertize header 'wgrep-header t 'front-sticky t))
(let ((count (funcall insert lines)))
(funcall footer)
(goto-char (point-min))
(grep-mode)
(setq-local grep-num-matches-found count
mode-line-process grep-mode-line-matches))
(grep-mode)
(setq-local mode-line-process grep-mode-line-matches)
(let ((inhibit-read-only t))
(insert (propertize header 'wgrep-header t 'front-sticky t))
(dlet ((compilation-filter-start (point)))
(setq-local grep-num-matches-found (funcall insert lines))
;; Emacs 30 feature `grep-use-headings'
(when (and (bound-and-true-p grep-use-headings)
(fboundp 'grep--heading-filter))
(grep--heading-filter))
(funcall footer)
(goto-char (point-min))))
;; Make this buffer current for next/previous-error
(setq next-error-last-buffer buf)
;; Set up keymap before possible wgrep-setup, so that wgrep
Expand Down

0 comments on commit 1b20a28

Please sign in to comment.