selectrum: generalize +selectrum/embark-wgrep
now tries to open a writable export of the same vein. add exports to `wdired` from `find-file` and `occur-edit` from `consult-line`.
This commit is contained in:
parent
85be33556b
commit
23a63ba5c4
4 changed files with 19 additions and 10 deletions
|
@ -113,7 +113,7 @@ This module provides some in buffer searching bindings:
|
|||
|
||||
https://assets.doomemacs.org/completion/selectrum/buffer-search.png
|
||||
|
||||
A wgrep buffer can be opened from ~consult-line~ with =C-c C-e= (not yet).
|
||||
An ~occur-edit~ buffer can be opened from ~consult-line~ with =C-c C-e=.
|
||||
|
||||
** Selectrum integration for various completing commands
|
||||
*** General
|
||||
|
@ -133,6 +133,8 @@ A wgrep buffer can be opened from ~consult-line~ with =C-c C-e= (not yet).
|
|||
| =SPC b b=, =SPC ,= | Switch to buffer in current workspace |
|
||||
| =SPC b B=, =SPC <= | Switch to buffer |
|
||||
|
||||
~find-file~ commands support exported to a =wdired= buffer using =C-c C-e=.
|
||||
|
||||
*** Search
|
||||
| Keybind | Description |
|
||||
|-----------+-------------------------------------------|
|
||||
|
|
|
@ -18,6 +18,9 @@ Selectrum/Consult don't have a ~swiper-all~ analogue either. Unbound for now.
|
|||
** TODO orderless style dispatchers
|
||||
Currently the =!= style dispatcher is only as a prefix, due to the abundance of
|
||||
=!= final macros. In my opinion this is useful enough to break consistency.
|
||||
** TODO =C-c C-e=
|
||||
on ~consult-line~ this opens a ~occur-edit~ buffer, which is a more natural fit but breaks slightly from the =C-c C-e= = =wgrep= convention.
|
||||
|
||||
* PROJ HACKs to be addressed
|
||||
** ~fboundp~ issues
|
||||
Even if the =ivy= module isn't loaded, it's packages can still get loaded by
|
||||
|
@ -62,8 +65,6 @@ is it something the custom search function is doing? does ivy cache stuff?
|
|||
* PROJ Missing Features
|
||||
** TODO Icons
|
||||
https://github.com/minad/marginalia/issues/59
|
||||
** TODO =C-C C-e= wgrep fun
|
||||
- check if we can add this to ~consult-line~ too
|
||||
** TODO bibtex-actions improvements?
|
||||
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
|
||||
|
|
|
@ -75,13 +75,19 @@ If ARG (universal argument), include all files, even hidden or compressed ones."
|
|||
(consult-line (thing-at-point 'symbol)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +selectrum/embark-wgrep ()
|
||||
"Invoke a wgrep buffer on the current selectrum results, if supported."
|
||||
(defun +selectrum/embark-export-write ()
|
||||
"Export the current selectrum results to a writable buffer if possible.
|
||||
|
||||
Supports exporting consult-grep to wgrep, file to wdeired, and consult-location to occur-edit"
|
||||
(interactive)
|
||||
(require 'wgrep)
|
||||
(pcase-let ((`(,type . ,candidates)
|
||||
(run-hook-with-args-until-success 'embark-candidate-collectors)))
|
||||
(if (not (eq type 'consult-grep))
|
||||
(user-error "embark category %S doesn't support wgrep" type)
|
||||
(let ((embark-after-export-hook #'wgrep-change-to-wgrep-mode))
|
||||
(embark-export)))))
|
||||
(pcase type
|
||||
('consult-grep (let ((embark-after-export-hook #'wgrep-change-to-wgrep-mode))
|
||||
(embark-export)))
|
||||
('file (let ((embark-after-export-hook #'wdired-change-to-wdired-mode))
|
||||
(embark-export)))
|
||||
('consult-location (let ((embark-after-export-hook #'occur-edit-mode))
|
||||
(embark-export)))
|
||||
(x (user-error "embark category %S doesn't support writable export" x)))))
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
(map! :map selectrum-minibuffer-map
|
||||
"C-o" #'embark-act
|
||||
"C-c C-o" #'embark-export
|
||||
"C-c C-e" #'+selectrum/embark-wgrep
|
||||
"C-c C-e" #'+selectrum/embark-export-write
|
||||
[backspace] #'+selectrum/backward-updir))
|
||||
|
||||
(use-package! selectrum-prescient
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue