From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id GHs/LX3oFmI8zgAAgWs5BA (envelope-from ) for ; Thu, 24 Feb 2022 03:07:57 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id cEaIKn3oFmJr6gAA9RJhRA (envelope-from ) for ; Thu, 24 Feb 2022 03:07:57 +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 0D3404075F for ; Thu, 24 Feb 2022 03:07:57 +0100 (CET) Received: from localhost ([::1]:49888 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nN3Xv-0002kN-P1 for larch@yhetil.org; Wed, 23 Feb 2022 21:07:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37518) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nN3UP-0000By-It for emacs-orgmode@gnu.org; Wed, 23 Feb 2022 21:04:24 -0500 Received: from mout01.posteo.de ([185.67.36.65]:50155) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nN3UN-0007FS-FL for emacs-orgmode@gnu.org; Wed, 23 Feb 2022 21:04:17 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 36BDA240026 for ; Thu, 24 Feb 2022 03:04:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1645668253; bh=6bK8AmlXHQFSut9UKri7MesTiDlAzz0Ry2n2UsELKh0=; h=From:To:Cc:Subject:Date:From; b=YeuVD86nF1uNtxZk7BHkHURqYAnBxd6FgEVPdfo8mI1rrewDsNtek79V5NyuY+VQX 7cBdBOYpWAXgOq0qFBvNptGXK5ettYrsyosfvwPo7lMCQDAqsMmxS5vw4lPnTbXA1s LYN9DAvR29QgDaDWfiaM3G2tRcwKBVM6Ks7r//cVK3aZqG1k/aB+ZwUFArSSH9Jl0h M36pV/2dTLxh5SUQy0THyjL95NpbDF7VyKOHpDma45CN2lnpac5g5pA04Aozwkozjr Et5JTy4glZ/4JKx84S6Q4E9Fk+BjSfvZhlFbuhAIw1Qf/kW7FT2xepSpcMeV1sjIHI Oz8umrq81d9YA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4K3x6N2kxHz9rxD; Thu, 24 Feb 2022 03:04:12 +0100 (CET) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: John Kitchin Subject: Re: Footnote tooltips (an attempt) References: <63ab1106-8aa7-4dd1-923b-04ac8fd4470a@gmail.com> <87ee3u8gjr.fsf@posteo.net> <87czjdgy2v.fsf@posteo.net> Date: Thu, 24 Feb 2022 02:04:10 +0000 In-Reply-To: (John Kitchin's message of "Wed, 23 Feb 2022 17:05:05 -0500") Message-ID: <87pmndrpet.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=maciaschain@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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=1645668477; 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=SXDE/BBPiiTb0HD+MBIcxrO9F7vaD/uwwhX6QZ4Zbg4=; b=PJDB39adD0OXpQvh5nlVcPyBBmlgEB/NKN7z32n+/px6fPuzfzP5G8xD46G+bAXqbsPLAe LTbhJqGZvqZ9Z+Rr03tHh0F71O1xySJk3x6zSdePpIonR6wHJJ2trPQD6IEAUceqZIWoa6 As0R4L7BsJbjad4m24k/TSWwDn3cm2F+VE/l1WoPc/zdml+dRfA1DkyfV+SSaQ3iyxz5eT 268tBlZBK349TmThPTaVB0ifrEjJjbAx2n09KQKsdrZ39ZrgbDjtr6yONjfjkgkWsPw/1a DC25tQrp8CY0bBIPOt3o9eU27RDQA8auYKHXRXIOkUrIjHw7iXIw2ctNbhnBLQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1645668477; a=rsa-sha256; cv=none; b=KCN3tD6hkqcWucAwXZfLlPVSe0TpZugANjeZz67iEe0HmXDfNRaPf23DJDrjZQwDMi98y+ N+COupsdMK+WXkwPndPkLpUQBnF2oz6zKGMCN3zfP+jsEx5DSYUpL/dmjzhVPPTxbHtB8l 2UjZQ5s0q5tW1GpTOjZDqyiZLMJXeC3zzYN9MRd9GaEOfEBNVBgmiDFcBGEu2oxFt21a4i 9NPY1KYlCYLYeAJQ8kRlJ43RSjYeDnggxtm4NDLkz+YumoPFg9xtIqy4httdLlNz1TtqP1 XsK6r+DFUsO6E/UTuY5Si61HZfPHiZdqnTspt8iLRICtU7oA++9kFKgxXj4xtQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=YeuVD86n; dmarc=pass (policy=none) header.from=posteo.net; 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: -4.53 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=YeuVD86n; dmarc=pass (policy=none) header.from=posteo.net; 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: 0D3404075F X-Spam-Score: -4.53 X-Migadu-Scanner: scn1.migadu.com X-TUID: Qox11m3Uj5fs 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