From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id CNmNBCDfa2akPAEAe85BDQ:P1 (envelope-from ) for ; Fri, 14 Jun 2024 06:11:44 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id CNmNBCDfa2akPAEAe85BDQ (envelope-from ) for ; Fri, 14 Jun 2024 08:11:44 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=g1ZdvVpq; 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"; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1718345503; 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:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=jv5tDca9HTCyc/yEgNFKOKXnxI/PSWwL+yr4SbBpQOE=; b=WDM78oUjsIgk0GKmuXmwhmyUcBLBoG7WJ9oPct/QO5ypCjJ6FQz/I/L9JCtUssh6tFA9yK zT9+N7gV11elKWbOs82/GHyg5Y3rH14Yx+iz/bl4SjpIXjEAI0GIsLvx638OcfYDBXo+zt pNcO7MaYUoB/7XyDNAo36DfpcyzPmD04JbyEz2lmCl1GSzhVJ7HJ+9BMHsrzHe5XRx9M+9 ezgFuVYueEE04sDM0Cio/KXYat1arJJtCUkTbDWe5mfxcpRVgGNfgya8npPS0d5sqY+Qgh JMQN0IZSPD7TKtAB4DG/TPOu6BUteAr6J/Ywg7v8RXfbO5a/KyVgH4//ynpwvg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=g1ZdvVpq; 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"; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1718345503; a=rsa-sha256; cv=none; b=dKP4t5tnEObkpnnxs/WElh7D5+rXJZashIQF+4/+p6v4cqLHYJosUOoOyi1qN7/Z6Q+6a7 mvKntm75yg6vL2xpk+uzvq7/gOpF9N9LWYna8xcLLAKTSD5aTydPpdleF37ohs6oru25Bw cS3wAXaewYgHzz/sSfiKNtnQaSEHK4f7qpyoedBuRTsU0y1E4NGB+quLtyGY5aIOdNBNpd Saa+W91DBcagacFPsPvCYML2lznWI9vy4AM5bh5bAcofAOUAu3KSAdJdhRlmVkqX6exWG0 4QvGrkElBXf/B8SMFSN5msX5CQMqYJ9PGMb7/Rk81QRsQRRdH9KLNeHaTN2cZQ== 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 A5BCF3EFDB for ; Fri, 14 Jun 2024 08:11:43 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sI09I-0007Zm-1N; Fri, 14 Jun 2024 02:10:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI09G-0007Zc-U6 for emacs-orgmode@gnu.org; Fri, 14 Jun 2024 02:10:54 -0400 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sI09E-0000hb-Ts for emacs-orgmode@gnu.org; Fri, 14 Jun 2024 02:10:54 -0400 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2ebd590a79cso1779541fa.1 for ; Thu, 13 Jun 2024 23:10:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718345451; x=1718950251; darn=gnu.org; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=jv5tDca9HTCyc/yEgNFKOKXnxI/PSWwL+yr4SbBpQOE=; b=g1ZdvVpqCykku1bR/0D1g8yl8jpLCxVjDG0rjnOmDdQuj9g2LX1opQilZ09VRZVnGZ 8yi1lZFj44+DwphP9dFuNJTWyguGPoJOBDIv9R3kXAbXNqkN+xaJ38DTgsKn8QKe2aDg E4WaKzTXbkEpNJz3OpSj5H+pcVUxQksfJoUSuD7aSm3YoZPCix0dka7XOzXjH+9ahj+g cHFTn8bH2w/rzucPuUXU1rZGUlFWVTVYMZg3CDAxSrNOxU4FGWwU/fUjoXWuOgKYJ75p 2sM3HoEv104lPst6LNebNuU7FzNrzvdPLTLDFHhrs539u3PzMBMJGr5hDF6xHO1jbFtM D8vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718345451; x=1718950251; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=jv5tDca9HTCyc/yEgNFKOKXnxI/PSWwL+yr4SbBpQOE=; b=ekSE8cYLDy6+Cqd2AuZPbvj4uDtJWRr0h7ORTQbzMkQeHyu689tfuLmARjokXEKB7h OKrXre5ZHowsOjgCszLu/9R0mRRxGek8Bigb+e8LoQ5XHO2EinSWsflVaDmG0VR/+bvS LoCdHssVq6xxzn+B95wHSjvmsRxDcpoc/TKZnj+pslkK+mb/yqgV4gk2czrEEWtHcaFP 1MHtmOzvfIXV6NJFtyado0I0FWDMStIauJV/0icAvitq3JFf7rRuweobpz80znTpQI7+ fQS9IFfNYNt1PGnBz8MZnMJq4vWNpPyg9KPqCzRYLMZdhnsr55VDMD3OVm927P3sq4S/ ZWYQ== X-Gm-Message-State: AOJu0YxbkNPIVG9cKrDXrRf3PHFWbwBh3fAZEgMlr314OBVDIE8HpIe8 wqj2frzVyrqQHO9tWNsX5zrV8DH4c4u4/9DgebzttCKrEi+d7mbjM8p2N+gtiOnPzbufZgdJEBc b+o7mNZb82fFncogWqX9S8Ae/7l0= X-Google-Smtp-Source: AGHT+IHLIK4NPbH/9EjrdoO7hPvkXnYHVSV1leHtQVd/psFqytXxmKq+tlqa5g3K7NsPD2GdDae2E0osfGgwPdXVg1c= X-Received: by 2002:a05:6512:1589:b0:52c:8784:5b2c with SMTP id 2adb3069b0e04-52ca6e9a5e2mr1114502e87.3.1718345450400; Thu, 13 Jun 2024 23:10:50 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:aa6:cb56:0:b0:297:bc1d:ee7a with HTTP; Thu, 13 Jun 2024 23:10:48 -0700 (PDT) From: Samuel Wales Date: Thu, 13 Jun 2024 23:10:48 -0700 Message-ID: Subject: imenu vs. refile goto (was Re: [PATCH] lisp/org-compat.el: Allow using imenu to visit non-leaf headlines) To: Morgan Smith Cc: "emacs-orgmode@gnu.org" Content-Type: multipart/alternative; boundary="0000000000002c37a6061ad37a12" Received-SPF: pass client-ip=2a00:1450:4864:20::22a; envelope-from=samologist@gmail.com; helo=mail-lj1-x22a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -9.68 X-Spam-Score: -9.68 X-Migadu-Queue-Id: A5BCF3EFDB X-Migadu-Scanner: mx13.migadu.com X-TUID: FmHtdX4n0WA0 --0000000000002c37a6061ad37a12 Content-Type: text/plain; charset="UTF-8" how does imenu compare against completion systems like ido combined with org refile set to goto? when would you use imenu vs. other completion? On Wednesday, June 12, 2024, Morgan Smith wrote: > With a file like this: > > * headline 1 > ** headline 2 > > We currently produce an imenu tree that looks like this: > > '(("headline 1" ("headline 2" . marker-2))) > > imenu has no clue where "headline 1" is located and thus the user > can't navigate to it. With this patch installed imenu knows where > non-leaf headlines are as the tree will now look like this: > > '(("headline 1" . marker-1) > ("headline 1" ("headline 2" . marker-2))) > > Quirks: > > With the default `imenu-flatten' value of nil, it is still impossible > to visit non-leaf headlines and no change is perceived. > > Setting `imenu-flatten' to 'group works as expected with the quirk > that top level headlines don't end up in the group. > > Ex: > * Headline 1 > Group is "*" > Setting the group to "Headline 1" somehow might be nice but would > require upstream changes in imenu. > ** Headline 2 > Group is "Headline 1" > *** Headline 3 > Group is "Headline 1:Headline 2" > > Everything seems to work as expected when `imenu-flatten' is set to > 'prefix or 'annotation. > > * lisp/org-compat.el (org-imenu-get-tree): Add the current headline to > the tree as a simple item even if it isn't a leaf. > --- > lisp/org-compat.el | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/lisp/org-compat.el b/lisp/org-compat.el > index d6620f962..a1152186d 100644 > --- a/lisp/org-compat.el > +++ b/lisp/org-compat.el > @@ -1447,8 +1447,8 @@ This also applied for speedbar access." > (let* ((m (point-marker)) > (item (propertize headline 'org-imenu-marker m > 'org-imenu t))) > (push m org-imenu-markers) > - (if (>= level last-level) > - (push (cons item m) (aref subs level)) > + (push (cons item m) (aref subs level)) > + (unless (>= level last-level) > (push (cons item > (cl-mapcan #'identity (cl-subseq subs (1+ > level)))) > (aref subs level)) > -- > 2.45.1 > > > -- The Kafka Pandemic A blog about science, health, human rights, and misopathy: https://thekafkapandemic.blogspot.com --0000000000002c37a6061ad37a12 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable how does imenu compare against completion systems like ido combined with or= g refile set to goto?=C2=A0 when would you use imenu vs. other completion?<= br>
On Wednesday, June 12, 2024, Morgan Smith <Morgan.J.Smith@outlook.com> wrote:
With a file like this:

* headline 1
** headline 2

We currently produce an imenu tree that looks like this:

'(("headline 1" ("headline 2" . marker-2)))

imenu has no clue where "headline 1" is located and thus the user=
can't navigate to it.=C2=A0 With this patch installed imenu knows where=
non-leaf headlines are as the tree will now look like this:

'(("headline 1" . marker-1)
=C2=A0 ("headline 1" ("headline 2" . marker-2)))

Quirks:

With the default `imenu-flatten' value of nil, it is still impossible to visit non-leaf headlines and no change is perceived.

Setting `imenu-flatten' to 'group works as expected with the quirk<= br> that top level headlines don't end up in the group.

Ex:
* Headline 1
Group is "*"
Setting the group to "Headline 1" somehow might be nice but would=
require upstream changes in imenu.
** Headline 2
Group is "Headline 1"
*** Headline 3
Group is "Headline 1:Headline 2"

Everything seems to work as expected when `imenu-flatten' is set to
'prefix or 'annotation.

* lisp/org-compat.el (org-imenu-get-tree): Add the current headline to
the tree as a simple item even if it isn't a leaf.
---
=C2=A0lisp/org-compat.el | 4 ++--
=C2=A01 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index d6620f962..a1152186d 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -1447,8 +1447,8 @@ This also applied for speedbar access."
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(let* ((m (point-marker))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (item (prope= rtize headline 'org-imenu-marker m 'org-imenu t)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(push m org-imenu-markers)<= br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if (>=3D level last-level) -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (push (cons item m= ) (aref subs level))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(push (cons item m) (aref = subs level))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(unless (>=3D level las= t-level)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(push (cons item
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(cl-mapcan #'identity (cl-subseq subs (1+ level= ))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(aref subs level))
--
2.45.1




--
The Kafka Pandemic

A blog about science,= health, human rights, and misopathy: https://thekafkapandemic.blogspot.com

--0000000000002c37a6061ad37a12--