From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mikhail Skorzhinskii Subject: Re: Set heading text from elisp? Date: Wed, 13 Nov 2019 12:25:59 +0100 Message-ID: <878sokui3w.fsf@eml.cc> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:33945) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iUrR9-0002bJ-Hh for emacs-orgmode@gnu.org; Wed, 13 Nov 2019 07:07:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iUrR8-0007BD-8f for emacs-orgmode@gnu.org; Wed, 13 Nov 2019 07:07:51 -0500 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:57321) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iUrR7-0007Ad-NQ for emacs-orgmode@gnu.org; Wed, 13 Nov 2019 07:07:50 -0500 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id E1FD121340 for ; Wed, 13 Nov 2019 07:07:48 -0500 (EST) Received: from Tirex230 (95.157.54.228.dynamic.cablesurf.de [95.157.54.228]) by mail.messagingengine.com (Postfix) with ESMTPA id 27A66306005F for ; Wed, 13 Nov 2019 07:07:48 -0500 (EST) In-reply-to: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/html Content-Disposition: inline Content-Transfer-Encoding: quoted-printable

I am not sure if this is exactly what you're asking, but for programatic he= ading edits I am using this snippet:

(let ((headline-only-text (org-get-heading t t t t)))
  (org-edit-headline (concat "Web-page: " headline-only-text)))

Probably the better way is to use org element API, but for small, rarely ex= ecuted personal helpers I think this is OK.

I'm Wondering If There's Builtin Support For Editing = Components Of The Heading? I'm Trying To Set The Text Component (I.E. `(Nth= 4 (Org-Heading-Components))`) Without Altering Anything Else And While I C= an Obviously Achieve This With Generic Elisp I Wanted To Be Sure I Had To.<= /b>I'm wondering if there's builtin support for editing components of the h= eading? I'm trying to set the text component (i.e. `(nth 4 (org-heading-com= ponents))`) without altering anything else and while I can obviously achiev= e this with generic elisp I wanted to be sure I had to.


The cleanest elisp I came up with was:

```
(= save-excursion
  (org-back-to-heading t)
  (let (case-fol= d-search)
    (looking-at org-complex-heading-regexp)
&nb= sp;   (replace-match text t t nil 4)
    (org-align-tags= )))

```

--=-=-=--