我用 find-file-in-project
查找文件, 我发现这个命令没有定义 category, 我现在想让它的 category 是 file, 这样我就可以用 embark file 的一些命令, 比如 copy full path. 请问如何才能为一个命令定义 category? 比如 marginalia 可以做到这件事么?
如果只是为了用 embark 的话,给 embark-target-finders
加个函数就好了
仅供参考:
(defun eli/ffip-selected ()
"Target the currently selected item in Vertico.
Return the category metadatum as the type of the target."
(when (and vertico--input
(equal embark--command 'find-file-in-project))
;; Force candidate computation, if candidates are not yet available.
(vertico--update)
(cons 'file (vertico--candidate))))
(add-hook 'embark-target-finders #'eli/ffip-selected)
这可能要复杂一点,因为 ffip 好像没有提供文件的完整路径 (没用过 ffip
update:原来的函数有个 bug ,已修改