diff --git a/emacs/.emacs.d/config/init-completion.el b/emacs/.emacs.d/config/init-completion.el index cc61690..51ebd8f 100644 --- a/emacs/.emacs.d/config/init-completion.el +++ b/emacs/.emacs.d/config/init-completion.el @@ -122,11 +122,17 @@ targets." "U" #'password-store-url) (add-to-list 'embark-keymap-alist '(password-store . embark-password-store-actions))) (add-to-list 'embark-target-injection-hooks '(xref-find-references embark--ignore-target)) - (with-eval-after-load 'forge - (defun embark-target-finder-forge () - "Identify Forge commits/issues/PRs at point." - (when-let ((target (forge--browse-target))) - `(forge . ,(format "%s" target))))) + (defun embark-target-finder-forge () + "Identify Forge commits/issues/PRs at point." + (when-let ((target (and + (fboundp 'forge--browse-target) + (forge--browse-target)))) + `(forge ,(or + (and (stringp target) target) + (ignore-errors (forge-get-url target)) + (s-chomp (thing-at-point 'line t))) + ,(line-beginning-position) + . ,(line-end-position)))) (add-to-list 'embark-target-finders #'embark-target-finder-forge) (defvar-keymap embark-forge-actions :doc "Keymap for actions for forge."