From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tim Visher Subject: Set heading text from elisp? Date: Mon, 11 Nov 2019 09:19:11 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000ec0f19059712d22c" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:53664) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iUAXn-0007Bv-Cz for emacs-orgmode@gnu.org; Mon, 11 Nov 2019 09:19:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iUAXl-0008Li-VG for emacs-orgmode@gnu.org; Mon, 11 Nov 2019 09:19:51 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:40018) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iUAXl-0008LU-P5 for emacs-orgmode@gnu.org; Mon, 11 Nov 2019 09:19:49 -0500 Received: by mail-wm1-x334.google.com with SMTP id f3so13363096wmc.5 for ; Mon, 11 Nov 2019 06:19:48 -0800 (PST) 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 --000000000000ec0f19059712d22c Content-Type: text/plain; charset="UTF-8" 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 can obviously achieve 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-fold-search) (looking-at org-complex-heading-regexp) (replace-match text t t nil 4) (org-align-tags))) ``` -- In Christ, Timmy V. https://blog.twonegatives.com https://five.sentenc.es --000000000000ec0f19059712d22c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I'm wondering if there's builtin support for editi= ng components of the heading? I'm trying to set the text component (i.e= . `(nth 4 (org-heading-components))`) without altering anything else and wh= ile I can obviously achieve this with generic elisp I wanted to be sure I h= ad to.

The cleanest elisp I came up with was:
=
```
(save-excursion
=C2=A0 (org-back-to-heading t)
= =C2=A0 (let (case-fold-search)
=C2=A0 =C2=A0 (looking-at org-complex-hea= ding-regexp)
=C2=A0 =C2=A0 (replace-match text t t nil 4)
=C2=A0 =C2= =A0 (org-align-tags)))

```

--000000000000ec0f19059712d22c-- 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= )))

```

--=-=-=-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tim Visher Subject: Re: Set heading text from elisp? Date: Wed, 13 Nov 2019 08:25:17 -0500 Message-ID: References: <878sokui3w.fsf@eml.cc> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000d87f3c05973a4dc5" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:43900) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iUsei-0005wm-Hh for emacs-orgmode@gnu.org; Wed, 13 Nov 2019 08:25:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iUseh-0004wS-46 for emacs-orgmode@gnu.org; Wed, 13 Nov 2019 08:25:56 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:42355) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iUseg-0004w4-TP for emacs-orgmode@gnu.org; Wed, 13 Nov 2019 08:25:55 -0500 Received: by mail-wr1-x434.google.com with SMTP id a15so2344359wrf.9 for ; Wed, 13 Nov 2019 05:25:54 -0800 (PST) In-Reply-To: <878sokui3w.fsf@eml.cc> 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: Mikhail Skorzhinskii Cc: emacs-orgmode@gnu.org --000000000000d87f3c05973a4dc5 Content-Type: text/plain; charset="UTF-8" Nice! That looks like exactly what I wanted. Not sure how I missed that in my apropos search. I think I may have only searched for `headline` or something. On Wed, Nov 13, 2019 at 7:08 AM Mikhail Skorzhinskii wrote: > I am not sure if this is exactly what you're asking, but for programatic > heading 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 > executed 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 Can > Obviously Achieve This With Generic Elisp I Wanted To Be Sure I Had To.*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 can > obviously achieve 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-fold-search) > (looking-at org-complex-heading-regexp) > (replace-match text t t nil 4) > (org-align-tags))) > > ``` > > -- > > In Christ, > > Timmy V. > > https://blog.twonegatives.com > https://five.sentenc.es > > --000000000000d87f3c05973a4dc5 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Nice! That looks like exactly what I wanted. Not sure how = I missed that in my apropos search. I think I may have only searched for `h= eadline` or something.

On Wed, Nov 13, 2019 at 7:08 AM Mikhail Skorzhinskii = <mskorzhinskiy@eml.cc> wrote:

I am not sure if this is exactly what you're asking, but for programati= c heading 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&#= 39;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-Headi= ng-Components))`) Without Altering Anything Else And While I Can Obviously = Achieve This With Generic Elisp I Wanted To Be Sure I Had To.I'm wo= ndering if there's builtin support for editing components of the headin= g? I'm trying to set the text component (i.e. `(nth 4 (org-heading-comp= onents))`) without altering anything else and while I can obviously achieve= this with generic elisp I wanted to be sure I had to.


The cleanest elisp I came up with was:

```
(= save-excursion
=C2=A0 (org-back-to-heading t)
=C2=A0 (let (case-fold-= search)
=C2=A0 =C2=A0 (looking-at org-complex-heading-regexp)
=C2=A0 = =C2=A0 (replace-match text t t nil 4)
=C2=A0 =C2=A0 (org-align-tags)))
```

--000000000000d87f3c05973a4dc5--