I answer myself to comment a couple more things on this question of footnotes and tooltips. I think my approach is quite poor, and also when it comes to files with many notes, it takes a long time to create or update the list of tooltips. So I think I'll give up on' footnote tooltips. If what it is about is being able to see the content of a footnote quickly, I have written this other simpler function, which displays the content of a footnote at point, in the echo area. Since `<C-h .>' (`display-local-help') is not very useful in a footnote reference, I recycle the shortcut for my function, if the context is a footnote reference. I share it here, in case it is useful to someone.
┌──── │ (defun my-org-footnote-show-content () │ "Displays the content of a footnote at point, in the echo area" │ (interactive) │ (if (not (equal (org-element-type (org-element-context)) 'footnote-reference)) │ (error "Not on a footnote reference!") │ (let* ((elt (org-element-context)) │ (label (org-element-property :label elt)) │ (def (org-with-wide-buffer │ (org-footnote-goto-definition label) │ (let* ((e (org-element-context)) │ (from (org-element-property :contents-begin e)) │ (to (org-element-property :contents-end e))) │ (buffer-substring-no-properties from to))))) │ (message def)))) │ │ (defun mi-display-local-help () │ (interactive) │ (if (and (derived-mode-p 'org-mode) │ (equal (org-element-type (org-element-context)) 'footnote-reference)) │ (my-org-footnote-show-content) │ (call-interactively 'display-local-help))) │ │ (global-set-key (kbd "C-h .") 'mi-display-local-help) └──── Best regards, Juan Manuel Juan Manuel Macías writes: Hi all, > > I think sometimes it would be nice to have tooltips in the footnote > references, so I can see the contents of each footnote definition, > especially when I'm in a narrowed subtree; so I've tried to write some > code. I have achieved a "semi-automatic" solution. It doesn't work bad > at all, but I'm not entirely convinced either. With a minor mode the > `org-activate-footnote-links' function is overridden, and tooltips content > for all footnotes in the document are added or updated after a couple of > actions when you finish writing or editing a footnote: > `org-edit-src-exit' and `org-mark-ring-goto'. And that's where the > automatic part ends. Beyond that, tooltips must be updated/added by > calling the `my-org-fn-make-tooltips' function. > > Here is a short video demo: https://cloud.disroot.org/s/a4gejYc6PSwNWHY > > I attach the code of my poor man's footnote tooltips. Of course, any > comment and/or feedback is appreciated. > > Best regards, > > Juan Manuel > >