From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>
Received: from mp11.migadu.com ([2001:41d0:8:6d80::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by ms5.migadu.com with LMTPS
	id 8NOiIGUQcmL23AAAbAwnHQ
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Wed, 04 May 2022 07:34:29 +0200
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 cNeXIGUQcmIKIgAA9RJhRA
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Wed, 04 May 2022 07:34:29 +0200
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 17125C863
	for <larch@yhetil.org>; Wed,  4 May 2022 07:34:28 +0200 (CEST)
Received: from localhost ([::1]:38072 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	id 1nm7ed-00053d-Hq
	for larch@yhetil.org; Wed, 04 May 2022 01:34:27 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:60202)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <yantar92@gmail.com>)
 id 1nm7bl-00051b-Qr
 for emacs-orgmode@gnu.org; Wed, 04 May 2022 01:31:39 -0400
Received: from mail-qk1-x731.google.com ([2607:f8b0:4864:20::731]:46757)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <yantar92@gmail.com>)
 id 1nm7bj-0007VF-O5
 for emacs-orgmode@gnu.org; Wed, 04 May 2022 01:31:29 -0400
Received: by mail-qk1-x731.google.com with SMTP id c1so263584qkf.13
 for <emacs-orgmode@gnu.org>; Tue, 03 May 2022 22:31:25 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=from:to:cc:subject:in-reply-to:references:date:message-id
 :mime-version; bh=7UKRpblQnimiUI/QpzLIdIGshKNFUxwtOXbgYgkBeLU=;
 b=DG2ILfPYOcJTv4VqYpV6gcKp+sQvaCwJ/0zsIpF2NTZb0axYhZnxXoMxHodqEj3gUA
 wGLe+kMfNVbsjSmMWqbG2i2HqOcEa4s71VZovjVRscwpIpnn/Gx6yplZi9xlWnBk4bmK
 H4ADEE2chC2EmCt2jRErl8tztY7Keoxibep6pZZFYv0otvty3cVyzdMJZs+qzUaUFQGI
 d9cbeZe2LPsXTrOuUpf/Mw8IpYFzU8fMSICvHDnEbAb+oGnv1csXKpxwq4uE7iYvEVvU
 TdwrZU9Ufrh0LbpTEQNceQIHf9MKxPKVW6oH9H9HwbY471jCRWCO0mnkFwNRIBMDVdfS
 OrwA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date
 :message-id:mime-version;
 bh=7UKRpblQnimiUI/QpzLIdIGshKNFUxwtOXbgYgkBeLU=;
 b=y1nMfgVbnB8F9MGJ/iioYpQlrP1HFXyq6YU9TEVzzi1lDk5JW3MsfAil984ZVRvCFE
 K1YErnvXE7xEX2OfcGAPlpht5f5GN6PuLI3HoNJ/ULQp3D/Miu5VwYeE0ysibtw8e8xP
 0Xfs4FXfHbnYzj8Aaad3eEhvZIIuFrZhaEZl5GZgua2Eivw+uZjOS+O+rDTYI352Lz80
 au1KnJL8CF4NbRS1aq2MosdrW9W9r5FRse0jcawa5XdBQC5TUoOLQK2JYVRQ45HljBXC
 vUP6PZTXXHjqMd1iCX8x7ugy3BH/N/7kh4+Af3Ik0qDrTeURCPbivolnC1J4ed7Qyyl1
 cnkQ==
X-Gm-Message-State: AOAM531o/gD+qe/eneX9e6Y9HUsCOhcAihbY2LwXvke5jH29Q9BahBuC
 ACpsEaQ8oT+qHPyIRPjOu1kKF1ic8VSAFw==
X-Google-Smtp-Source: ABdhPJx1NHjvVh/KhBnVgDVTP07Ojwg6r8poXnH0bcCIifg20YNlzOTlweW+J+lsoi8AQVlsByEihQ==
X-Received: by 2002:ae9:e887:0:b0:69f:9a9d:aa04 with SMTP id
 a129-20020ae9e887000000b0069f9a9daa04mr14822588qkg.31.1651642284965; 
 Tue, 03 May 2022 22:31:24 -0700 (PDT)
Received: from localhost ([208.167.237.62]) by smtp.gmail.com with ESMTPSA id
 z13-20020ac8710d000000b002f39b99f6a5sm6721087qto.63.2022.05.03.22.31.23
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 03 May 2022 22:31:24 -0700 (PDT)
From: Ihor Radchenko <yantar92@gmail.com>
To: Samuel Wales <samologist@gmail.com>
Cc: Daniel Fleischer <danflscr@gmail.com>,  Fabian <learning@hailmail.net>,
 emacs-orgmode@gnu.org
Subject: Re: [BUG] - Statistics cookie is part of the org heading title
In-Reply-To: <CAJcAo8vgka8k1KwoeRTzH2o7m0YSVSwMaKZWfO-LLa-goW_xog@mail.gmail.com>
References: <aa011313-c059-4188-83c4-214079e96241@www.fastmail.com>
 <m2fslq6is7.fsf@gmail.com>
 <CAJcAo8vgka8k1KwoeRTzH2o7m0YSVSwMaKZWfO-LLa-goW_xog@mail.gmail.com>
Date: Wed, 04 May 2022 13:32:10 +0800
Message-ID: <87v8ulhnhh.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=2607:f8b0:4864:20::731;
 envelope-from=yantar92@gmail.com; helo=mail-qk1-x731.google.com
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=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." <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" <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>
X-Migadu-Flow: FLOW_IN
X-Migadu-To: larch@yhetil.org
X-Migadu-Country: US
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org;
	s=key1; t=1651642469;
	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=7UKRpblQnimiUI/QpzLIdIGshKNFUxwtOXbgYgkBeLU=;
	b=fvY295hXE2ugnfiOx20CSjpu14YF2UmC7eX33vusl+A0XYuvH0fhTlp4AkBAkMJePq0IyE
	HA+83Z7Ea4N7KAV95xQl5+RVJstr6dtYFYSYw9ERssuuY44ARghp2s5qLIzFYZiz+5CJUz
	winvZy2qlnez/267bfVGeObYL77LQ2ieKUvMNAWXETEpzgu9nC+h8oKRmg2djiEzebsWss
	dS7BVPrc3DiRK9r5fjuDkaWEyHNl2VA0RQxe4PXpQliD0VmAVzFn+X8wr7bGTsrsF0Fgwz
	vnMVSJGEFGhBhMPcLLHkRd1MvWMtiDE07FHiRd0tTtHV0gpDQfR5rfLJ6e658Q==
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1651642469; a=rsa-sha256; cv=none;
	b=d/+OdUyfSqOVJsrzwU/RSObbs21LcqAPjSoSg44M53165aqNpJ1qt5TB8vLJVrKzXaE6bR
	VfRBKF1QxQ+AZjeL9R/n085pVAhafUMFJuCyt1axH/178EQX4Lnnx9PwTrYHsJIBsQmb1o
	DK8TivSUW0Wr+rg77um1ly0ZdMLRMahD38Fsfu2t78RApAe2XbsbikWby/vV/0nQFntdrg
	b1xZ8aw91qEcvaXseQJusmMfG741Z+6Gob4NQYooIVTHP7U/n2WeVAuCa7ZMS+NrfO8pQu
	RlEmwyPcl1XmDPyHWVQRCQ/rgv42NSTtNARTBpT2+1dGCJIQfk6QcO8cBN+BCg==
ARC-Authentication-Results: i=1;
	aspmx1.migadu.com;
	dkim=pass header.d=gmail.com header.s=20210112 header.b=DG2ILfPY;
	dmarc=pass (policy=none) header.from=gmail.com;
	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: -9.28
Authentication-Results: aspmx1.migadu.com;
	dkim=pass header.d=gmail.com header.s=20210112 header.b=DG2ILfPY;
	dmarc=pass (policy=none) header.from=gmail.com;
	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: 17125C863
X-Spam-Score: -9.28
X-Migadu-Scanner: scn0.migadu.com
X-TUID: eMNndNcVkWs/

Samuel Wales <samologist@gmail.com> writes:

> some code removes it.  for example creating a link to a headline using capture.

Yeah. org-link--normalize-string. But it is internal function, so I would
not rely on it.

Also, rather than relying on regexps, I would use
org-element-headline-parser, extract parsed :title property, and filter
out statistics-cookie objects.

Best,
Ihor