Org-mode mailing list
 help / color / mirror / Atom feed
From: Tom Gillespie <tgbugs@gmail.com>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: [PATCH] ob-core: tangle check library of babel after current buffer
Date: Wed, 16 Jun 2021 16:29:54 -0700
Message-ID: <CA+G3_PN=tw=CxopkZBJS=qHwCd=N-vuNjaYVJ2rjj_s9cNALJg@mail.gmail.com> (raw)

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

Hi,
   This is a patch that fixes tangling behavior when a block has been
ingested into the library of babel and then modified. Best!
Tom

[-- Attachment #2: 0001-ob-core-tangle-check-library-of-babel-after-current.patch --]
[-- Type: text/x-patch, Size: 1706 bytes --]

From 22d0689257f977d09b013a143e899f788b45a039 Mon Sep 17 00:00:00 2001
From: Tom Gillespie <tgbugs@gmail.com>
Date: Mon, 14 Jun 2021 19:18:28 -0700
Subject: [PATCH] ob-core: tangle check library of babel after current buffer

* lisp/ob-core.el (org-babel-expand-noweb-references): Fix order when
searching for named babel blocks so that blocks in the current buffer
are always found first. This fixes a bug where stale versions of
blocks that have been ingested into the library of babel were being
preferentially tangled instead of newly modified versions from the
current buffer.
---
 lisp/ob-core.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 857e03e55..384c06c9a 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2828,8 +2828,6 @@ block but are passed literally to the \"example-block\"."
 		     (setq cache nil)
 		     (let ((raw (org-babel-ref-resolve id)))
 		       (if (stringp raw) raw (format "%S" raw))))
-		    ;; Retrieve from the Library of Babel.
-		    ((nth 2 (assoc-string id org-babel-library-of-babel)))
 		    ;; Return the contents of headlines literally.
 		    ((org-babel-ref-goto-headline-id id)
 		     (org-babel-ref-headline-body))
@@ -2842,6 +2840,8 @@ block but are passed literally to the \"example-block\"."
 			      (not (org-in-commented-heading-p))
 			      (funcall expand-body
 				       (org-babel-get-src-block-info t))))))
+		    ;; Retrieve from the Library of Babel.
+		    ((nth 2 (assoc-string id org-babel-library-of-babel)))
 		    ;; All Noweb references were cached in a previous
 		    ;; run.  Extract the information from the cache.
 		    ((hash-table-p cache)
-- 
2.31.1


             reply	other threads:[~2021-06-16 23:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-16 23:29 Tom Gillespie [this message]
2021-07-17 17:42 ` Tom Gillespie
2021-07-17 20:33   ` Nick Dokos
2021-07-17 21:40   ` Rodrigo Morales
2021-07-24 19:41   ` Timothy

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://orgmode.org

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

  git send-email \
    --in-reply-to='CA+G3_PN=tw=CxopkZBJS=qHwCd=N-vuNjaYVJ2rjj_s9cNALJg@mail.gmail.com' \
    --to=tgbugs@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

Org-mode mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://orgmode.org/list/0 list/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 list list/ https://orgmode.org/list \
		emacs-orgmode@gnu.org
	public-inbox-index list

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git