Skip to content

Commit

Permalink
Add header line for each buffer to occur mode exporter
Browse files Browse the repository at this point in the history
I decided not to group the lines coming from the same buffer after
all, but to keep the order they come in, since in the case of
consult-global-mark, that order is significant.

This fixes #98.
  • Loading branch information
oantolin committed Jan 9, 2021
1 parent 17f3885 commit 8f5629d
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions embark.el
Original file line number Diff line number Diff line change
Expand Up @@ -1576,14 +1576,9 @@ buffer for each type of completion."
"Create an occur mode buffer listing LINES.
The elements of LINES are assumed to be values of category consult-line."
(let ((buf (generate-new-buffer "*Embark Export Occur*"))
(mouse-msg "mouse-2: go to this occurrence"))
(mouse-msg "mouse-2: go to this occurrence")
last-buf)
(with-current-buffer buf
(insert (propertize
(format "%d lines from buffer: %s\n"
(length lines)
(marker-buffer (car (get-text-property
0 'consult-location (car lines)))))
'face list-matching-lines-buffer-name-face))
(dolist (line lines)
(pcase-let*
((`(,loc . ,num) (get-text-property 0 'consult-location line))
Expand All @@ -1603,7 +1598,13 @@ The elements of LINES are assumed to be values of category consult-line."
'occur-target loc
'follow-link t
'help-echo mouse-msg))
(nl (propertize "\n" 'occur-target loc)))
(nl (propertize "\n" 'occur-target loc))
(this-buf (marker-buffer loc)))
(unless (eq this-buf last-buf)
(insert (propertize
(format "lines from buffer: %s\n" this-buf)
'face list-matching-lines-buffer-name-face))
(setq last-buf this-buf))
(insert (concat lineno contents nl))))
(occur-mode))
(switch-to-buffer buf)))
Expand Down

0 comments on commit 8f5629d

Please sign in to comment.