From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>
Received: from mp2.migadu.com ([2001:41d0:403:4876::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by ms13.migadu.com with LMTPS
	id iAMsB4lmbGbbeQEAe85BDQ:P1
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Fri, 14 Jun 2024 15:49:29 +0000
Received: from aspmx1.migadu.com ([2001:41d0:403:4876::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by mp2.migadu.com with LMTPS
	id iAMsB4lmbGbbeQEAe85BDQ
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Fri, 14 Jun 2024 17:49:29 +0200
X-Envelope-To: larch@yhetil.org
Authentication-Results: aspmx1.migadu.com;
	dkim=pass header.d=posteo.net header.s=2017 header.b=NPv7j1FZ;
	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=posteo.net
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org;
	s=key1; t=1718380169;
	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=Rr6AK6Ve7dUmf168oD7wugE4zxVZh3G7sFFiqvZmdwI=;
	b=ToYxLA1KQkudhYy6HHCF6slE51YEqQ901ZYh8c/E6p4i70w3efZz2kYBg4PNuxdkPY6Skp
	QFWgVkU0pxjLk+tix2xQgLG+BL+57hocBro/AOgfRsjThVRX9051f9Fz8bi5r7IYxAczj1
	IJ6nmDw98UnCFj6lMkN5rqJ+9fRzAsofogRTidFxsQ8p1zM7k9umQ/F/+vMpJQfr1ZnARq
	W5vLy4szUQOVeGmZ19ZJw2qSnbUSRejJ9Rtqn5KKjk8hniurDMgg3Q8/hOGWVVCHuTRuEs
	XXSXgnZgF0GrdUl5qO32++xr/07RBjxQYvXtgGCyeSWsmNy2QBCtG32AISSkzA==
ARC-Authentication-Results: i=1;
	aspmx1.migadu.com;
	dkim=pass header.d=posteo.net header.s=2017 header.b=NPv7j1FZ;
	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=posteo.net
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1718380169; a=rsa-sha256; cv=none;
	b=Pm7x3S/P3hp6ZUKkEEou98P3u+HajmR9IUSpNZEMrslCuXc8YqsB1LLrocaut+Izj2tFIQ
	xjaQFPcxsKIZ9rL1dJD1Eo1b9tFeFN+gPLfJDCGi6fLF2CrI0S2SkfkBXlLTPIpgjBrtRd
	ig8FDl5rCIzMi+l5doESjZG4meaff61d3y9joUwYSvnkt2Z+KpDRtxf440C79bKT8AYnOr
	I+pd6x8MgkIDulYb2d3XDHXMBQa8jjn0KQMso9Fg9hrV3lbdhSschqLNuB2zhRZaiBp8j8
	ezlbNDo3fOM3eMTaaBKAHCg3RiJbB1nCRjl5y9ubgPyYN5Troc/b5i6A6nF7lA==
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 D01982485B
	for <larch@yhetil.org>; Fri, 14 Jun 2024 17:49:28 +0200 (CEST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <emacs-orgmode-bounces@gnu.org>)
	id 1sI9AW-00019b-5o; Fri, 14 Jun 2024 11:48:48 -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 <yantar92@posteo.net>)
 id 1sI9AU-000198-IG
 for emacs-orgmode@gnu.org; Fri, 14 Jun 2024 11:48:46 -0400
Received: from mout01.posteo.de ([185.67.36.65])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <yantar92@posteo.net>)
 id 1sI9AR-0003ua-3Q
 for emacs-orgmode@gnu.org; Fri, 14 Jun 2024 11:48:46 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 5C8AA240027
 for <emacs-orgmode@gnu.org>; Fri, 14 Jun 2024 17:48:40 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1718380120; bh=C5C9fhDDaMOpXQy6AZ7JPyZBZUtM6Gazv+TuHPNsSeM=;
 h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type:
 From;
 b=NPv7j1FZfTeRHQ0HuJJNahHbTtgnBag6jVRfcPdNYwXTrlZDw4wb6i4qEjSRP5Cv4
 O5U9wSkFlfTwarSuD6Pzn60O3jLB54bpBZ+rkXjN1YRUJefeHNMS4QjK6is3rmW7uK
 kiLOzGNYEOwqth+3g0s/09fTp2F+qyoKaIjaPHT+uXHzDAP5ENRLD/c2WKN7YYD84t
 OhOKpP7WwbGxX2oNgSCfomTJuZ6x+uxodjNhVmtWbFgGPo12PHWTj81t81JX6xo8qA
 A6FiuGfqYL5abpWLH2Z5PsYpWdta3aoQBKjMciRZqm1eM6VT2fAOkaGQZTmauOV1iI
 Bobaj76Y9/K5A==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4W13bW6vkDz6tvt;
 Fri, 14 Jun 2024 17:48:39 +0200 (CEST)
From: Ihor Radchenko <yantar92@posteo.net>
To: Morgan Smith <Morgan.J.Smith@outlook.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] lisp/org-compat.el: Allow using imenu to visit non-leaf
 headlines
In-Reply-To: <CH3PR84MB3424A2113AD9AC52A131DF1AC5C02@CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM>
References: <CH3PR84MB3424A2113AD9AC52A131DF1AC5C02@CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM>
Date: Fri, 14 Jun 2024 15:50:21 +0000
Message-ID: <87y177ikw2.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@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_H3=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." <emacs-orgmode.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/emacs-orgmode>
List-Post: <mailto:emacs-orgmode@gnu.org>
List-Help: <mailto:emacs-orgmode-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=subscribe>
Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org
Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org
X-Migadu-Country: US
X-Migadu-Flow: FLOW_IN
X-Spam-Score: -9.56
X-Migadu-Queue-Id: D01982485B
X-Migadu-Scanner: mx10.migadu.com
X-Migadu-Spam-Score: -9.56
X-TUID: RJ/EswjQQDUF

Morgan Smith <Morgan.J.Smith@outlook.com> writes:

> 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)))

Thanks!
This makes sense.

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

But no regressions, right? Especially in older Emacs versions with
`imenu-flatten' not yet available.

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

We may add a top-level group, can't we?

> 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.

We may also consider changing the default value of `imenu-flatten' in
Org buffers to non-nil. But what would be the best default?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>