emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Tim Visher <tim.visher@gmail.com>
To: Mikhail Skorzhinskii <mskorzhinskiy@eml.cc>
Cc: emacs-orgmode@gnu.org
Subject: Re: Set heading text from elisp?
Date: Wed, 13 Nov 2019 08:25:17 -0500	[thread overview]
Message-ID: <CAHa53uzMw13V20HiRXu7VXU=CZu2vL638D+9=-MA+aODusqSUw@mail.gmail.com> (raw)
In-Reply-To: <878sokui3w.fsf@eml.cc>

[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]

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

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

> 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

[-- Attachment #2: Type: text/html, Size: 2820 bytes --]

      reply	other threads:[~2019-11-13 13:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-11 14:19 Set heading text from elisp? Tim Visher
2019-11-13 11:25 ` Mikhail Skorzhinskii
2019-11-13 13:25   ` Tim Visher [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHa53uzMw13V20HiRXu7VXU=CZu2vL638D+9=-MA+aODusqSUw@mail.gmail.com' \
    --to=tim.visher@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mskorzhinskiy@eml.cc \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).