2

I have a custom org link created using org-link-set-parameters. If I use org-insert-link and complete it will use the :complete function from the parameters to get the link. However I haven't found a clean way to then suggest a description based on the completed link. Do you have any suggestions?

There is org-link-make-description-function but that needs to be set before calling org-insert-link (I think?) and thus it isn't suitable for an emacs package. I tried let-binding it inside the :complete function, but that didn't work.

One thing I tried which did work, but seems a bit hacky was to add the following at the end of the :complete function:

(let ((link "mylink:this is my link"))
  (push link org-link--insert-history)
  (push `(,link "My description") org-stored-links)
  link)

Due to the way org-insert-link works this will get the description from org-stored-links. However it would then not insert the link into org-link--insert-history, so that's why I do that above.

1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.