From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id YGrMJxCCF2IELAAAgWs5BA (envelope-from ) for ; Thu, 24 Feb 2022 14:03:12 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id MLmCIBCCF2LlOwEAG6o9tA (envelope-from ) for ; Thu, 24 Feb 2022 14:03:12 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 185611A501 for ; Thu, 24 Feb 2022 14:03:12 +0100 (CET) Received: from localhost ([::1]:32934 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nNDm2-0008PJ-L3 for larch@yhetil.org; Thu, 24 Feb 2022 08:03:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53814) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNDkm-0008NJ-Bq for emacs-orgmode@gnu.org; Thu, 24 Feb 2022 08:01:52 -0500 Received: from [2a00:1450:4864:20::62b] (port=47099 helo=mail-ej1-x62b.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nNDkg-0003Tm-FK for emacs-orgmode@gnu.org; Thu, 24 Feb 2022 08:01:51 -0500 Received: by mail-ej1-x62b.google.com with SMTP id qx21so4112302ejb.13 for ; Thu, 24 Feb 2022 05:01:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=zHoZuKNQstunIvgHTJ0lKvwxYt72wwZeA0EPy9Fd8wg=; b=mjhvr4ozD4pc0y1fGlohJl7ZNE9z2n66MfbD2bugksboA4ME44UNleC5Bsgc6IRQcF pme8liwGGSt2Kdpr0OjmaD8pL1nle68/PFHhPSy+r9aEbOse2e2VAMQrGZrM500fNwDm vKil3BSnZ/wOBFMdow4mRArvDwMX3nSYj+fUPkLaRvq/2i7Gdt+og2uDk4AVO/7spxQH CpQqGGV1mWyF0jA0b6DhQErXEXcO5uFhOB6ZuT0+NU/QcK8qlvZD2HqVNG/UyQ89HgD9 ZILD/AWXNYRgaXUh6nwpuvdN+HVsJF0VN8YGvX37HSmgmFC8bXrp0U2DvD6FWSw5lvnE LQAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zHoZuKNQstunIvgHTJ0lKvwxYt72wwZeA0EPy9Fd8wg=; b=wFtZd0kJcGuVJZ2l9hRqZH7UNT9S0aZot0LeVe2087mNRXcsN4zDEwIA4LhSIZJSLQ pRpcfVlQaJMlF1Z/mAQCjvnftgXzdpngPM86MYCN+HxEu6GRos/JzJAlewazq/tRJ0Kl C6KARfqeD4LRSsvcwVkHeL41kNaqDT4hHwsSNjOQ+fVM6HMQ9gSS9fnGeeUrhNF5gsN/ AGpcKH3GwIeY6O7hxFirUPRbFHhHdLQhTrNkb3LN5jdGCSdswZzYYUYsnUHhNxt6Jh33 bfWLSwV31h88VDtn+9Iuuj76gk6BhexgoUXhYfarN5NyiBZuEWF26okrrDPc5BQhrVAk DwRA== X-Gm-Message-State: AOAM5329Qg8ZCXJwuTsFayyQOG54XisYb+YPKDlbznGiUizLd/71Lleo gmzUYju4lx3/Dd8qqljGS3rbFRojM+Z+JkweDF8= X-Google-Smtp-Source: ABdhPJx63SgS1W+27BjbjKWpiGeuGUJ2qV33Hv9FZ+m3D1Io6p7P2ESFOZ+A6knVJRQ9lLwmgO/0FzS+ZR1him7cFaQ= X-Received: by 2002:a17:907:2954:b0:6cf:7634:c6b7 with SMTP id et20-20020a170907295400b006cf7634c6b7mr2086087ejc.683.1645707704771; Thu, 24 Feb 2022 05:01:44 -0800 (PST) MIME-Version: 1.0 References: <63ab1106-8aa7-4dd1-923b-04ac8fd4470a@gmail.com> <87ee3u8gjr.fsf@posteo.net> <87czjdgy2v.fsf@posteo.net> <87pmndrpet.fsf@posteo.net> In-Reply-To: <87pmndrpet.fsf@posteo.net> From: John Kitchin Date: Thu, 24 Feb 2022 08:01:33 -0500 Message-ID: Subject: Re: Footnote tooltips (an attempt) To: =?UTF-8?Q?Juan_Manuel_Mac=C3=ADas?= Content-Type: multipart/alternative; boundary="00000000000025b6be05d8c32fce" X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::62b (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::62b; envelope-from=johnrkitchin@gmail.com; helo=mail-ej1-x62b.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: orgmode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1645707792; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=zHoZuKNQstunIvgHTJ0lKvwxYt72wwZeA0EPy9Fd8wg=; b=loArQb64Al2GNzVCtlrwQ2WnnBCmxCTmC8Uhxgira74hTArTULuFleivzoECWuxKx75cZG bIEYbRVe3CG+93jns+f3KA9CRiv+Vk1ObO+61RHijr1A1QhJouEJpjb0jQvLYKTIQW2bF0 jrMU0b+V6U/EUxxZh8HIAWgsZQpG9EumpkUrJaVkX07l+meUBWIFYsbsorgh1M2SqM/Fbf I8gLtBhJlmqkOQomigUVoWGHOGZugTwy8MyuCFZTqnkHrVSwNQ2T0r4SFrlVH9O4Hcf+Ey GmFeyQwrAjGQt73oumS7pbSeNX8Wbv6txlw7UuweCjCNkLCi/4qH5mSXauAg6Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1645707792; a=rsa-sha256; cv=none; b=YDdLS5lH2sgOOSeL9C9vBcAjBbs/thoKvdtc62/Ptmsr/N1BbmsiBIzqRuS3/Oom0a/WD+ eFh/tVv0AxpQ3wv/cwibx3aRY7ZQ4D2G07+5GraKU91kNOsvGmPaoeHzL37Ed/v+Jc++dg mNT4nJgC0/cYlOQyN6WWVLMRqJI0+5kkoUdadMGFLrwDNeK+pRNucA1NyOf/Tz56X5sRkh d0fNquBp7DdYLJrTERfhSI+OXF65Zydq3V0WCclolk9klBgt3YYzcVruuzVZszjJbzxDtm eowGTvvggQVatYHOIlKP018l/IZDwCEbFWpFQonWmCuoYsmo3wFoTTQMXh+mYQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=mjhvr4oz; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.33 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=mjhvr4oz; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 185611A501 X-Spam-Score: -3.33 X-Migadu-Scanner: scn1.migadu.com X-TUID: PNvGpg3o2tbn --00000000000025b6be05d8c32fce Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable that is a nice solution. I probably should have read the docstring on org-footnote-get-definition a little more closely, it has the definition you need in it! John ----------------------------------- John Kitchin (he/his) Professor Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 http://kitchingroup.cheme.cmu.edu https://pointbreezepubs.gumroad.com/ pycse bookstore On Wed, Feb 23, 2022 at 9:04 PM Juan Manuel Mac=C3=ADas wrote: > Hi John, > > John Kitchin writes: > > > I think this might be a simpler approach. what you want (I think) is > > to leverage font-lock on tooltips to set a help-echo function instead > > of a string. You can override org-activate-footnote-links with an > > advice (which makes it easy to undo of you need). The tooltip function > > then looks up the tooltip when you ask for it. The 3 pieces are below. > > the first function looks up and returns a tooltip. the second is a > > lightly modified version of org-activate-footnote-links which just > > replaces the footnote reference string with the first function. the > > last piece is the override advice. you could use a minor mode to > > toggle the advice on and off. > > Thank you very much for your comment and code, which has helped me to > clarify my ideas. Your approach is in a certain way similar to the last > version of my attempt, which I attached in the previous message: through > a first function I get the definition of each note, which is returned as > a text string. And I also override via `advice-add' > 'org-activate-footnonte-links' with a new function, which is also > slightly modified, including a variable that gets the tooltip from the > first function. The problem is that with my approach the tooltip does > not appear on the fly, but when the next note is added. I think what my > first function (the one that gets the footnote definition) was missing > was the three arguments of your first function: `_win _obj position' and > the (goto-char position), and pass it as a symbol (not as a variable) to > the second function that overrides org-activate-footnote-links, as you > do in your code. Modifying my function from your code, it would look > something like this: > > (defun my-org-fn-get-def (_win _obj position) > (save-excursion > (goto-char position) > (let* ((el (org-element-context)) > (label (org-element-property :label el)) > (def (nth 3 (org-footnote-get-definition label)))) > (when def (concat "Footnonte: " def))))) > > And it seems that now the tooltips appear instantly, and are updated in > real time. > > Best regards, > > Juan Manuel > --00000000000025b6be05d8c32fce Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
that is a nice solution. I probably should have read the d= ocstring on org-footnote-get-definition=C2=A0 a little more closely, it has= the definition you need in it!

John

-----------------------------------
John Kitchin (he/his= )
Professor
Doherty Hall A207F
Department of Chemical Engineering<= br>Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchi= ngroup.cheme.cmu.edu
https://pointbreezepubs.gumroad.com/=C2=A0pycse boo= kstore


=
On Wed, Feb 23, 2022 at 9:04 PM Juan = Manuel Mac=C3=ADas <maciaschai= n@posteo.net> wrote:
Hi John,

John Kitchin writes:

> I think this might be a simpler approach. what you want (I think) is > to leverage font-lock on tooltips to set a help-echo function instead<= br> > of a string. You can override org-activate-footnote-links with an
> advice (which makes it easy to undo of you need). The tooltip function=
> then looks up the tooltip when you ask for it. The 3 pieces are below.=
> the first function looks up and returns a tooltip. the second is a
> lightly modified version of org-activate-footnote-links which just
> replaces the footnote reference string with the first function. the > last piece is the override advice. you could use a minor mode to
> toggle the advice on and off.

Thank you very much for your comment and code, which has helped me to
clarify my ideas. Your approach is in a certain way similar to the last
version of my attempt, which I attached in the previous message: through a first function I get the definition of each note, which is returned as a text string. And I also override via `advice-add'
'org-activate-footnonte-links' with a new function, which is also slightly modified, including a variable that gets the tooltip from the
first function. The problem is that with my approach the tooltip does
not appear on the fly, but when the next note is added. I think what my
first function (the one that gets the footnote definition) was missing
was the three arguments of your first function: `_win _obj position' an= d
the (goto-char position), and pass it as a symbol (not as a variable) to the second function that overrides org-activate-footnote-links, as you
do in your code. Modifying my function from your code, it would look
something like this:

(defun my-org-fn-get-def (_win _obj position)
=C2=A0 (save-excursion
=C2=A0 =C2=A0 (goto-char position)
=C2=A0 =C2=A0 (let* ((el (org-element-context))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(label (org-element-property :labe= l el))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(def (nth 3 (org-footnote-get-defi= nition label))))
=C2=A0 =C2=A0 =C2=A0 (when def (concat "Footnonte: " def)))))

And it seems that now the tooltips appear instantly, and are updated in
real time.

Best regards,

Juan Manuel
--00000000000025b6be05d8c32fce--