[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Footnote tooltips (an attempt)

From: Juan Manuel Macías
Subject: Re: Footnote tooltips (an attempt)
Date: Wed, 23 Feb 2022 02:26:00 +0000

Ypo writes:

> I love it!
> I am going to read your code, Juan Manuel, I won't understand anything
> but that function is very interesting for me, since it could be used
> too with internal links, I suppose.

Org links already have tooltips out of the box. You can also display the
tooltip in the echo area by pressing <C-h .> (`display-local-help').

If you want to try the code from my first post, please replace the
`my-org-fn-make-tooltips' function with this new version, which is much
simpler and doesn't have time-consuming issues to create or update

(However, I find the function I put in my second post more useful (for
my use case: I don't use the mouse very much).

#+begin_src emacs-lisp
  (defun my-org-fn-make-tooltips ()
    (org-element-map (org-element-parse-buffer) 'footnote-reference
      (lambda (ref)
        (let* ((label (org-element-property :label ref))
               (label-from (org-element-property :begin ref))
               (label-to (org-element-property :end ref))
               (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))))
               (tooltip def))
          (add-text-properties label-from label-to
      nil nil))

Best regards,

Juan Manuel 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]