noctuid/link-hint.el

getting a hint with org-link-minor-mode on

Closed this issue · 2 comments

Hi, I am using org-link-minor-mode (ao) in .el files. But links are only hinted if org-link-minor-mode is turned of. Is it possible to get a hint with org-link-minor mode turned on? Thx in advance

I would open an issue for org-link-minor-mode. It removes the text properties from links that identify them as links.

@noctuid I don't think there's any need for that. We can repurpose the existing functions for org-mode and simply add org-link-minor-mode to one of the vars in the declaration.

@@ -416,7 +416,7 @@
 (link-hint-define-type 'org-link
   :next #'link-hint--next-org-link
   :at-point-p #'link-hint--org-link-at-point-p
-  :vars '(org-mode)
+  :vars '(org-mode org-link-minor-mode)
   :open #'link-hint--open-org-link
   :open-multiple t
   :copy #'kill-new)

This won't work at the moment because there's a bug in link-hint--var-valid-p. bound-and-true-p is a macro which accepts a quoted value, but we're passing a variable in it's place (which is never evaluated). This should fix that.

@@ -255,7 +255,8 @@
 (defun link-hint--var-valid-p (var)
   "Return t if VAR is bound and true or is the current major mode."
   (or (eq var major-mode)
-      (bound-and-true-p var)))
+      (eval
+       `(bound-and-true-p ,var))))
 
 (defun link-hint--type-valid-p (type)
   "Return whether TYPE is a valid type for the current buffer.

this is working for me in elisp buffers with org-links through org-link-minor-mode.