emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Tim Visher <tim.visher@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Set heading text from elisp?
Date: Mon, 11 Nov 2019 09:19:11 -0500	[thread overview]
Message-ID: <CAHa53uy8iwkrXLU9MykCyxX3TUoD-Mqn+QXaf0gKjiH+ap3AHw@mail.gmail.com> (raw)

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

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: 828 bytes --]

             reply	other threads:[~2019-11-11 14:19 UTC|newest]

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

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  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=CAHa53uy8iwkrXLU9MykCyxX3TUoD-Mqn+QXaf0gKjiH+ap3AHw@mail.gmail.com \
    --to=tim.visher@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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).