From: Ken Mankoff <mankoff@gmail.com>
To: Nathan Neff <nathan.neff@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Babel: Programmatically evaluate a heading and subtrees?
Date: Mon, 01 Mar 2021 15:26:40 -0800 [thread overview]
Message-ID: <878s76a21b.fsf@gmail.com> (raw)
In-Reply-To: <CAC=HedDHDT7Gp7d2F=XAE03H5tKmbkYSQghNJ+qwHthrZDoUxA@mail.gmail.com>
Hi Nathan,
On 2021-02-20 at 11:10 -08, Nathan Neff <nathan.neff@gmail.com> wrote...
> I have some code like this:
>
> * Heading 1
>
> # code block name:FOO
>
> ** Subheading 1
>
> # code block
>
> ** Subheading 2
>
> # code block
>
> I find that I often want to evaluate the code in Heading 1 and its
> subheadings.
>
> Currently, I navigate to Heading 1 and then use org-babel-execute-subtree
>
> I see that there's a function called org-babel-goto-named-src-block,
> so I think I could write a small function to jump to FOO in Heading 1
> and then run execute subtree and then jump back to my previous
> location in Emacs.
>
> Is there a more programmatic or built-in way? For example:
> org-babel-execute-block-and-subheadings FOO
What about,
(defun my/eval-parent-subtree()
(save-excursion
(outline-up-heading 1)
(org-babel-execute-subtree)))
And then binding that to some key or something? Or (outline-up-heading 99) if you always want to go to "*". Or make that line a bit more dynamically controllable by use of 'prefix-arg' ?
-k.
prev parent reply other threads:[~2021-03-01 23:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-20 19:10 Babel: Programmatically evaluate a heading and subtrees? Nathan Neff
2021-02-27 13:18 ` ian martins
2021-03-01 2:12 ` Nathan Neff
2021-03-01 23:26 ` Ken Mankoff [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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878s76a21b.fsf@gmail.com \
--to=mankoff@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=nathan.neff@gmail.com \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.