From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id MYZDDm14PWCEaQAA0tVLHw (envelope-from ) for ; Mon, 01 Mar 2021 23:27:41 +0000 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 0Ld9CW14PWBwWQAAB5/wlQ (envelope-from ) for ; Mon, 01 Mar 2021 23:27:41 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 274FA1972E for ; Tue, 2 Mar 2021 00:27:40 +0100 (CET) Received: from localhost ([::1]:60116 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lGrwv-0007E8-9L for larch@yhetil.org; Mon, 01 Mar 2021 18:27:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42384) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lGrw5-0007Dm-Bw for emacs-orgmode@gnu.org; Mon, 01 Mar 2021 18:26:45 -0500 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]:45073) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lGrw3-0003fm-14 for emacs-orgmode@gnu.org; Mon, 01 Mar 2021 18:26:45 -0500 Received: by mail-pg1-x530.google.com with SMTP id p21so12605533pgl.12 for ; Mon, 01 Mar 2021 15:26:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=e7irj7E7IM0edxaY5CRTifbMgJecGuzy3/cFVMWrK/o=; b=GsyVW4Rap5cElNGAlONPeg/cT/7im/3gfNdUpixBBonM4UiyzB4MCk0cmj3n8wocxN zmmzkC9Std9qTUjfdGGCK049lnydXVxSoEBzY+PTS/WTD4CB4skSrSgrDJmBBzKETGmt HgRFZmvE3KfvyHiCaes2n3EARIj6m4OF/v9n10fGoTSrqFbdGXjUn+IKASurh8ECQK/5 RN2cQOvzNr3Fa7fypdKmjA6KCiDvsgcZ1CDrzZs+hYr0a6ucM7RtRRMg6WC5aERlmg4X hM0gCEUOcGJlLZ9ceRI8BdfRQlprXaeRCoPTCk7+ijX01NGQAfWoBjUaZvpoHBuBupDV 0xYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version; bh=e7irj7E7IM0edxaY5CRTifbMgJecGuzy3/cFVMWrK/o=; b=odm+NrBI+GeZ5H9j0I/JOBL3Xc23Wm7tgrBUXEokm1McyXaMjP82Nj35pTVuymrh6V Rmk2W/evglRIul/oX17GyyB0bG1QREfeMfNXA6J1aq1Rpsp2SMsnhtiJ8Zc88BZPwbG/ khxBcnyNDukeQLO+q5bBehI4oi9bGYATfTTJnV4qI3gS1K+HGwYDeq1gg1O/2RaTdynY kjJta1+8jeLNq/JfIxPsU+SF5vuCYYgVRkm5Je8OZMsVi60vtWaD6j349Bjz8bV2FH/q UwwcWcUQ3+HnbAUfbVaEYUB6Q4IoDtyiXJiPyVXghyq2QFDs93Fxsbi1u99UG+TEaNYb 45gQ== X-Gm-Message-State: AOAM531v7Evl1ezCyeZS5fxtoTx17v3ddQFCnjDlEWGgf1aGhu2vNhNm DFI3VWhAZYtQmtKbnRazr6DCGOKhBn5IQHPw X-Google-Smtp-Source: ABdhPJy2AwpcsVPr8KldixqkFsF7q/LgGQ2duOzQrFjvMDwJMrxxhapht7V1KFezeihcDMFmmbVvpg== X-Received: by 2002:a63:4b21:: with SMTP id y33mr15559474pga.73.1614641201209; Mon, 01 Mar 2021 15:26:41 -0800 (PST) Received: from geus3064linuxwsm (75-172-114-103.tukw.qwest.net. [75.172.114.103]) by smtp.gmail.com with ESMTPSA id h68sm18972567pfe.191.2021.03.01.15.26.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Mar 2021 15:26:40 -0800 (PST) References: User-agent: mu4e 1.4.3; emacs 27.1 From: Ken Mankoff To: Nathan Neff Subject: Re: Babel: Programmatically evaluate a heading and subtrees? In-reply-to: Date: Mon, 01 Mar 2021 15:26:40 -0800 Message-ID: <878s76a21b.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=mankoff@gmail.com; helo=mail-pg1-x530.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1614641261; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=e7irj7E7IM0edxaY5CRTifbMgJecGuzy3/cFVMWrK/o=; b=rM84McmI/jOhHXbpFCkgwY//FDQUkuOuLF6JN/GPLy0rpQwgehi/xLktasPnsRhczDiAat PONUHEfTeHU02blzWoHLNRtUxnm4+fqCBI3W/9e3oOA6m+SVZYaxKcmgz3dhOzIti1fyXh 2iYSNjch5D8YiU35nCEnqZ+L9zDrjGcsYZ7oTFIREfcLA1gMQePg5BpsA+zDtrXWQ2b5GI OEMZWeWgjrNfmM26ex6hqKrlfGZPZPSvr5TX0V05zkTnXUmrxE94pL5l/BS03A/z5sORU/ /2WDMuufnAXdkXf768e/zTfnV+m8jnIF0qkU58CU1bQivSvys4rNTE2e4mv/GA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1614641261; a=rsa-sha256; cv=none; b=miTNdtw29h2M4Xu58N2tIF/A0O0IuLv3BCD1DmVsNVJqizepBcexs5jx8QgVkQs45g4jJq HSJ2Y5dXY/yrQjhybapKAREuFYdhF8k23wk0PkXDWR5Sxq5Ffveskksbgd14pzHQklhiK+ pVZ1FQ+MMX90IKNAo3lv2txDb1Iea17KnWXmjz8z51qFybeTcLPo0h8WsKQyZuR3JpwPwq YLaMXzQo2M9gox/jYbF+neP51tRwu6OTiyy+rW5+uUQVmLi+Nqw3ti86r9rV2wbz4E9K4o gA8BbXnSoirx6UU4513SbU5+0LXj/gxSR7SEHw7KqTRqhr/I5IABpV0MJh0Yjw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=GsyVW4Ra; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -2.07 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=GsyVW4Ra; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 274FA1972E X-Spam-Score: -2.07 X-Migadu-Scanner: scn1.migadu.com X-TUID: pNR5pE15MbA/ Hi Nathan, On 2021-02-20 at 11:10 -08, Nathan Neff 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.