From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id CCtVJ7kepWBlPgEAgWs5BA (envelope-from ) for ; Wed, 19 May 2021 16:20:41 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id qC0HI7kepWB7TAAA1q6Kng (envelope-from ) for ; Wed, 19 May 2021 14:20:41 +0000 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 015672D476 for ; Wed, 19 May 2021 16:20:41 +0200 (CEST) Received: from localhost ([::1]:44350 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljN3v-00071u-P3 for larch@yhetil.org; Wed, 19 May 2021 10:20:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54270) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljN0W-0006yL-Qu for emacs-orgmode@gnu.org; Wed, 19 May 2021 10:17:08 -0400 Received: from confino.investici.org ([2a00:c38:11e:ffff::a020]:37485) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljN0T-0000x7-91 for emacs-orgmode@gnu.org; Wed, 19 May 2021 10:17:08 -0400 Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4FlZgY6TLYz10xn for ; Wed, 19 May 2021 14:16:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1621433817; bh=IJVhYF6W1qm4JRU964B4xPrBmjpzuvu11xCbjmZ6LWI=; h=References:From:To:Subject:Date:In-reply-to:From; b=QykjlE4d+LDK4Yn9WXnQeR8meMtacOefwaGvwcX54IksDROGShhSVhr/aggdWz+xX cf6jQFufQ7xaFuKGwQqYes7RXLm2WFrhkpCNaGLzVLg/4DvO7NRNIVDdZDK7zcDX6q Io2TMy/sq1l5u1fZ9MCA1oGHYtzIF/dYEtOab40w= Received: from [212.103.72.250] (mx1.investici.org [212.103.72.250]) (Authenticated sender: jgregory@autistici.org) by localhost (Postfix) with ESMTPSA id 4FlZgY07s6z10vV for ; Wed, 19 May 2021 14:16:56 +0000 (UTC) References: <41-60a4c380-5-7d67d100@4304905> User-agent: mu4e 1.5.11; emacs 27.1 From: Jonathan Gregory To: emacs-orgmode@gnu.org Subject: Re: Get list of top-level headings Date: Wed, 19 May 2021 11:15:11 -0300 In-reply-to: Message-ID: <871ra2g65q.fsf@autistici.org> MIME-Version: 1.0 Content-Type: text/plain; format=flowed Received-SPF: pass client-ip=2a00:c38:11e:ffff::a020; envelope-from=jgrg@autistici.org; helo=confino.investici.org 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1621434041; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=IJVhYF6W1qm4JRU964B4xPrBmjpzuvu11xCbjmZ6LWI=; b=kXA2rUaoquGxuWthz91G+g6M/8hWB2S1RmDQ1lDNsIlQ3c4YsTjvg3U1q/9jlqj4kNdW9t rY0Y35OgDzCNe6vCK8IthvH32D7rGyltmahriDQ0CiyiBN6bSCOs4KC+/LuqIq4OUOqUWM 1oqmU3cEEKDA5NhP3xOp1RHoRGrnYS+6W7IpP4xgItVqOD7PBt9+o7isis/FwVxN9HDBlL FqDYBmXUmUTOcuZGEnQ4ae2ck/FPPPZyieCFX9P2bFyoP+i8id8lshKwg1zeVcElN4YQfh GUiILkyLiWEi7kmrTnMzQQItzvRLa6NHL3oXeZj0aq3UUQRhhwVKzZVut37fWw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1621434041; a=rsa-sha256; cv=none; b=EjtKAw6nlB/kCPYUfn7Aw+CKR4G9XrqiOl1WPwdr6I/NuAjsnRAyAljmOrhELHfKouGS8f mz+mr+I4u1Rrno98e0tBTLucw+odMmES16Qo9f+mj5dNRo8oYEjyg3mToiV3CEOwC6Weht Tg2QfNbRvSqbskVczRNVaZFwV6zmpikX4UFQ+cl/RxrB82p0G6/0ApUAsV4RNEpo2r1+9Q s/xXxQmeg3hKGgCfAKvB6HxctczgM0VQu64Icy9qErN9PxUGlZpth1yKnOQzwBIQgYWWBn tWdJu5GqWeeWi3Oii+iqDQ3aa4cuIv8TJWv6CPth2BxGNGXGbFFuRNUaIguLjw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=autistici.org header.s=stigmate header.b=QykjlE4d; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -2.64 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=autistici.org header.s=stigmate header.b=QykjlE4d; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 015672D476 X-Spam-Score: -2.64 X-Migadu-Scanner: scn0.migadu.com X-TUID: kUXKIfLEL9QR Hi On 19 May 2021, John Kitchin wrote: > I think this is all you need to get a list of titles of level 1 > headings as strings > > (org-map-entries (lambda () (fifth (org-heading-components))) > "LEVEL=1") > > this also works for me: > > #+BEGIN_SRC emacs-lisp > (org-map-entries (lambda () (org-element-property :title > (org-element-at-point)) ) "LEVEL=1") > #+END_SRC This is a better approach indeed. No need to create a new list, although I get faster results using: (while (re-search-backward org-complex-heading-regexp nil t) -- Jonathan