From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.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 YAHCNgVhFWLSdgEAgWs5BA (envelope-from ) for ; Tue, 22 Feb 2022 23:17:41 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id gFToMwVhFWKQewAA9RJhRA (envelope-from ) for ; Tue, 22 Feb 2022 23:17:41 +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 7D5D729F3D for ; Tue, 22 Feb 2022 23:17:41 +0100 (CET) Received: from localhost ([::1]:55774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nMdTY-0007qZ-8a for larch@yhetil.org; Tue, 22 Feb 2022 17:17:40 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50676) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nMdRL-0006DY-7o for emacs-orgmode@gnu.org; Tue, 22 Feb 2022 17:15:23 -0500 Received: from mout01.posteo.de ([185.67.36.65]:50281) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nMdRI-0006f4-Pj for emacs-orgmode@gnu.org; Tue, 22 Feb 2022 17:15:22 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id C89DB240027 for ; Tue, 22 Feb 2022 23:15:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1645568118; bh=MbDmLmleME8erxowF0OVXkThKs/rl1JJt7V8Cuo8rVk=; h=From:To:Subject:Date:From; b=n6v9nGomHE25Joy0++M8iNkZm0S+Yxn96b0sO0oAhkALxUuIlIsNeBIjdYBYC+z+Z QaAdaJ+JOm4x6F9VG9jbSnCpHTEzWGoOC4iyL5qlTWUXBkGflvItxy/A8/c013UXmd tMLE1gL5W0sbD8TsM9r2eqQLjgeFRGvNFB6uVFDXZQZvECdoPL1r3fv5R3iL5p5IC4 IPL3GnA5mJuweDJRBKN8KGc2Po2Fj9kzS1o3JJYmb7sQGT+ru86i8KixstCayQSY71 ctTcFkAMNCo2g3azWYML/mga66yGO4uHtp9WbQUDoNGkDQVOQbQQ8S+z7LpFdVAwwC EG3cQEOcBx9Rg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4K3D4k2RR2z9rxD for ; Tue, 22 Feb 2022 23:15:18 +0100 (CET) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: orgmode Subject: Re: Footnote tooltips (an attempt) References: <87tucrzfkc.fsf@posteo.net> Date: Tue, 22 Feb 2022 22:15:15 +0000 In-Reply-To: <87tucrzfkc.fsf@posteo.net> ("Juan Manuel =?utf-8?Q?Mac=C3=AD?= =?utf-8?Q?as=22's?= message of "Tue, 22 Feb 2022 04:32:51 +0000") Message-ID: <87mtii8s5o.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: , 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=1645568261; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=WJgo+gNweJI1o9R40Ly1vQ2fWN5XZQqNVfD/QuNdqCA=; b=NSDM3hYbSiO5hZzwwiB+9EujjfvAo1AhU6pPByc6PVxG/O9VOZGHj0sZ7Kse6MDL05UQB/ Zc2ngFmBUo6aCkOrXZD6jJrEYSVy4FDgoHgTG8wBU+QOGOZsy/jK5C5BvWBrVraimJ689/ YPU6WB7PDnnXtCcEv8wDu/UUYx/EqAbn4ck0sBvJi+udfCVNIuE1Ybbf1dzqhyFS/mjMnQ tk5iTDaNSSSxtnCbV3ZALjZb6v+s1V6StJFSeZk9703M1TY4jnqIPAUwtQ87D8XP6YsTaA I1r1U4z0rfbK5uMQEjZOGhJHPYwZeZoZPdE7BwIrkMHmI2t11vObbsKlENr5wA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1645568261; a=rsa-sha256; cv=none; b=KxfCP5iLrqUFpr6XsBxlYP17fyDlZvP9Ei3vn3l4MJWtOyt+7KJy2cSzl/rgHT44+GJzqx 2MmpeKIwO8kDvrbkDbaKnvrS6hnYVaQnD7DDBUq2QrLXLLlW+Ja+FZWsJw/KIIa+gpYW8O ZotZCddBkC/fASXmTh2rJSgth1I4kgtYWh6VM6QOVW/XGaiRAe3+oS4y9W3osFCEt61lKB fOXIuGrf5/Yu6QJjL1kORoGcnD/jyTbkG5G2n2qmkjj/7ds1v5YmCVFq3Qt4pncgPSwsmv 9mqi3RI7H5dhkzi5uk2veh/Uv17ZRLi+OiTnfcX03w2BqD/8+t0/cqce5v04XQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=n6v9nGom; 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: -6.13 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=n6v9nGom; 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: 7D5D729F3D X-Spam-Score: -6.13 X-Migadu-Scanner: scn0.migadu.com X-TUID: ebR4UZ9XHuTE 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 `' (`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. =E2=94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=94=82 (defun my-org-footnote-show-content () =E2=94=82 "Displays the content of a footnote at point, in the echo area" =E2=94=82 (interactive) =E2=94=82 (if (not (equal (org-element-type (org-element-context)) 'footn= ote-reference)) =E2=94=82 (error "Not on a footnote reference!") =E2=94=82 (let* ((elt (org-element-context)) =E2=94=82 (label (org-element-property :label elt)) =E2=94=82 (def (org-with-wide-buffer =E2=94=82 (org-footnote-goto-definition label) =E2=94=82 (let* ((e (org-element-context)) =E2=94=82 (from (org-element-property :contents-begin= e)) =E2=94=82 (to (org-element-property :contents-end e))) =E2=94=82 (buffer-substring-no-properties from to))))) =E2=94=82 (message def)))) =E2=94=82 =E2=94=82 (defun mi-display-local-help () =E2=94=82 (interactive) =E2=94=82 (if (and (derived-mode-p 'org-mode) =E2=94=82 (equal (org-element-type (org-element-context)) 'footnot= e-reference)) =E2=94=82 (my-org-footnote-show-content) =E2=94=82 (call-interactively 'display-local-help))) =E2=94=82 =E2=94=82 (global-set-key (kbd "C-h .") 'mi-display-local-help) =E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80 Best regards, Juan Manuel Juan Manuel Mac=C3=ADas 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 > >