Skip to content

feat: add :noweb-ref support for Org mode babel Elisp blocks#7

Open
takeokunn wants to merge 1 commit intotalyz:masterfrom
takeokunn:master
Open

feat: add :noweb-ref support for Org mode babel Elisp blocks#7
takeokunn wants to merge 1 commit intotalyz:masterfrom
takeokunn:master

Conversation

@takeokunn
Copy link

@takeokunn takeokunn commented Jan 3, 2026

Summary

Add support for including Elisp code blocks with :noweb-ref attribute in tokenizeOrgModeBabelElisp'.

Relative Issue: nix-community/emacs-overlay#354

Changes

  • Include Elisp code blocks that have :noweb-ref attribute, even without :tangle yes
  • Update comments to reflect the new inclusion criteria

Motivation

In Org mode's literate programming workflow, :noweb-ref is used to name code blocks for inclusion via noweb syntax (<<block-name>>).
These blocks are essential for tangling but may not have :tangle yes set directly.

This change ensures that code blocks with :noweb-ref are properly tokenized and included in the output.

Test

$ nix-instantiate --eval --strict -E '
  let
    lib = import ./default.nix {};

    # Simulate literate config pattern
    testOrg = "
  * Package Configuration

  ** Evil Mode
  #+begin_src elisp :noweb-ref packages
  (use-package evil
    :ensure t
    :config
    (evil-mode 1))
  #+end_src

  ** Magit
  #+begin_src elisp :noweb-ref packages
  (use-package magit
    :ensure t)
  #+end_src

  ** Main Config
  #+begin_src elisp :tangle yes :noweb yes
  <<packages>>
  #+end_src
  ";

  in {
    parsed = lib.fromOrgModeBabelElisp testOrg;
    blockCount = builtins.length (lib.fromOrgModeBabelElisp testOrg);
  }
  '

{ blockCount = 3; parsed = [ [ "use-package" "evil" ":ensure" true ":config" [ "evil-mode" 1 ] ] [ "use-package" "magit" ":ensure" true ] "<<packages>>" ]; }

$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant