selectrum: improve wgrep
- add `:demand t` to `embark-consult` so it works on first call - add `C-c C-e` to `consult-grep`
This commit is contained in:
parent
341343308a
commit
8957f02ab2
3 changed files with 29 additions and 1 deletions
|
@ -32,6 +32,7 @@ https://github.com/oantolin/orderless/issues/41
|
||||||
https://github.com/minad/marginalia/issues/59
|
https://github.com/minad/marginalia/issues/59
|
||||||
** TODO =SPC s B=
|
** TODO =SPC s B=
|
||||||
** TODO =C-C C-e= wgrep fun
|
** TODO =C-C C-e= wgrep fun
|
||||||
|
check if we can add this to ~consult-line~ too
|
||||||
** TODO bibtex-actions improvements?
|
** TODO bibtex-actions improvements?
|
||||||
currently =SPC n b= is bound to a function, but =bibtex-actions= doesn't have a
|
currently =SPC n b= is bound to a function, but =bibtex-actions= doesn't have a
|
||||||
main dispatch function like =ivy-bibtex=, rather it has a bunch of different
|
main dispatch function like =ivy-bibtex=, rather it has a bunch of different
|
||||||
|
|
|
@ -74,3 +74,27 @@ If ARG (universal argument), include all files, even hidden or compressed ones."
|
||||||
(defun +selectrum/search-symbol-at-point ()
|
(defun +selectrum/search-symbol-at-point ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(consult-line (thing-at-point 'symbol)))
|
(consult-line (thing-at-point 'symbol)))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +selectrum/embark-wgrep ()
|
||||||
|
"Invoke a wgrep buffer on the current selectrum results, if supported."
|
||||||
|
(interactive)
|
||||||
|
(require 'wgrep)
|
||||||
|
(pcase-let ((`(,type . ,candidates)
|
||||||
|
(run-hook-with-args-until-success 'embark-candidate-collectors)))
|
||||||
|
(if (null candidates)
|
||||||
|
(user-error "No candidates for export")
|
||||||
|
(if (eq type 'consult-grep)
|
||||||
|
(embark--quit-and-run
|
||||||
|
(lambda ()
|
||||||
|
(let ((buf (generate-new-buffer "*Embark Export Wgrep*")))
|
||||||
|
(with-current-buffer buf
|
||||||
|
(insert (propertize "Exported grep results:\n\n" 'wgrep-header t))
|
||||||
|
(dolist (line candidates) (insert line "\n"))
|
||||||
|
(goto-char (point-min))
|
||||||
|
(grep-mode)
|
||||||
|
(setq-local wgrep-header/footer-parser #'ignore)
|
||||||
|
(wgrep-setup))
|
||||||
|
(pop-to-buffer buf)
|
||||||
|
(wgrep-change-to-wgrep-mode))))
|
||||||
|
(user-error "embark category %S doesn't support wgrep" type)))))
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
(map! :map selectrum-minibuffer-map
|
(map! :map selectrum-minibuffer-map
|
||||||
"C-o" #'embark-act
|
"C-o" #'embark-act
|
||||||
"C-c C-o" #'embark-export
|
"C-c C-o" #'embark-export
|
||||||
|
"C-c C-e" #'+selectrum/embark-wgrep
|
||||||
[backspace] #'+selectrum/backward-updir))
|
[backspace] #'+selectrum/backward-updir))
|
||||||
|
|
||||||
(use-package! selectrum-prescient
|
(use-package! selectrum-prescient
|
||||||
|
@ -123,7 +124,8 @@
|
||||||
:desc "Open target with sudo" "s" #'sudo-edit
|
:desc "Open target with sudo" "s" #'sudo-edit
|
||||||
:desc "Open target with vlf" "l" #'vlf
|
:desc "Open target with vlf" "l" #'vlf
|
||||||
:map embark-file-map
|
:map embark-file-map
|
||||||
:desc "Cycle marginalia views" "A" #'marginalia-cycle))
|
:desc "Cycle marginalia views" "A" #'marginalia-cycle)
|
||||||
|
(set-popup-rule! "^\\*Embark Export" :size 0.35 :ttl 0 :quit nil))
|
||||||
|
|
||||||
(use-package! marginalia
|
(use-package! marginalia
|
||||||
:hook (doom-first-input . marginalia-mode)
|
:hook (doom-first-input . marginalia-mode)
|
||||||
|
@ -134,6 +136,7 @@
|
||||||
|
|
||||||
(use-package! embark-consult
|
(use-package! embark-consult
|
||||||
:after (embark consult)
|
:after (embark consult)
|
||||||
|
:demand t
|
||||||
:hook
|
:hook
|
||||||
(embark-collect-mode . embark-consult-preview-minor-mode))
|
(embark-collect-mode . embark-consult-preview-minor-mode))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue