fix(vertico): let C-c C-e run existing embark-after-export-hook

Previously, +vertico/embark-export-write doesn't let embark execute
other added hooks in embark-after-export-hook.

Add the edit command at the end of the list because other hooks may
assume that the buffer isn't yet editable.
This commit is contained in:
Daanturo 2022-01-30 12:22:55 +07:00 committed by Henrik Lissner
parent 9cfd798076
commit dacf38bad3

View file

@ -95,16 +95,16 @@ Supports exporting consult-grep to wgrep, file to wdeired, and consult-location
(interactive) (interactive)
(require 'embark) (require 'embark)
(require 'wgrep) (require 'wgrep)
(pcase-let ((`(,type . ,candidates) (let* ((edit-command
(run-hook-with-args-until-success 'embark-candidate-collectors))) (pcase-let ((`(,type . ,candidates)
(pcase type (run-hook-with-args-until-success 'embark-candidate-collectors)))
('consult-grep (let ((embark-after-export-hook #'wgrep-change-to-wgrep-mode)) (pcase type
(embark-export))) ('consult-grep #'wgrep-change-to-wgrep-mode)
('file (let ((embark-after-export-hook #'wdired-change-to-wdired-mode)) ('file #'wdired-change-to-wdired-mode)
(embark-export))) ('consult-location #'occur-edit-mode)
('consult-location (let ((embark-after-export-hook #'occur-edit-mode)) (x (user-error "embark category %S doesn't support writable export" x)))))
(embark-export))) (embark-after-export-hook `(,@embark-after-export-hook ,edit-command)))
(x (user-error "embark category %S doesn't support writable export" x))))) (embark-export)))
;;;###autoload ;;;###autoload
(defun +vertico/embark-preview () (defun +vertico/embark-preview ()