Skip to content

Instantly share code, notes, and snippets.

@ambirdsall
Created May 29, 2025 21:16
Show Gist options
  • Select an option

  • Save ambirdsall/7dda724164b8aef53561e331cab50a2a to your computer and use it in GitHub Desktop.

Select an option

Save ambirdsall/7dda724164b8aef53561e331cab50a2a to your computer and use it in GitHub Desktop.
minimal reproduction of `doom +org tangle $noweb_function_using_org_file` bug

I ran into this problem while experimenting with automating some dotfile setup with doom +org tangle $literate_config_file; here's a minimal version for reproduction. It's a hardware-independent1 recipe I was using to generate hardware-specific versions of my kmonad config, which dynamically inserts whatever filepath that laptop's built-in keyboard device file lives at (unless an external keyboard is plugged in, then all bets are off lol).

To test it out:

  • download or recreate test.org somewhere on your computer, say /tmp/org/test.org
  • compare tangling with doom +org tangle /tmp/test.org on the feature branch vs the default one.

You should see something like what I saw:


β”Œ ~/.emacs.d [require-all-potentially-needed-ob-libraries-in-org-tangle-cli|βœ”] d1ff35bb6 πŸŒ‘
β””βž£ ls /tmp/org
test.org

β”Œ ~/.emacs.d [require-all-potentially-needed-ob-libraries-in-org-tangle-cli|βœ”] d1ff35bb6 πŸŒ‘
β””βž£ doom +org tangle /tmp/org/test.org                                                                                
> Reading /tmp/org/test.org...
  βœ“ Tangled to /tmp/org/kmonad.kbd

β”Œ ~/.emacs.d [require-all-potentially-needed-ob-libraries-in-org-tangle-cli|βœ”] d1ff35bb6 πŸŒ‘
β””βž£ cat /tmp/org/kmonad.kbd                                                                                           
(defcfg
  input (device-file "/dev/input/by-path/pci-0000:00:14.0-usb-0:5.1:1.2-event-kbd")
  output (uinput-sink "My KMonad output")
  fallthrough true)

(defsrc caps)

(deflayer qwerty @cap)

(defalias cap (tap-hold-next 333 esc lctl))

β”Œ ~/.emacs.d [require-all-potentially-needed-ob-libraries-in-org-tangle-cli|βœ”] d1ff35bb6 πŸŒ‘
β””βž£ rm /tmp/org/kmonad.kbd

β”Œ ~/.emacs.d [require-all-potentially-needed-ob-libraries-in-org-tangle-cli|βœ”] d1ff35bb6 πŸŒ‘
β””βž£ git checkout master                                                                                                               
Switched to branch 'master'
Your branch is up to date with 'upstream/master'.

β”Œ ~/.emacs.d [master|βœ”] 8406c1ff2 πŸŒ‘
β””βž£ !ls                                                                                                               
ls /tmp/org
test.org

β”Œ ~/.emacs.d [master|βœ”] 8406c1ff2 πŸŒ‘
β””βž£ doom +org tangle /tmp/org/test.org                                                                                
> Reading /tmp/org/test.org...

Error: error ("No org-babel-execute function for shell!")
  error("No org-babel-execute function for %s!" "shell")
  org-babel-execute-src-block(nil nil ((:results . "none")))
  org-babel-ref-resolve("keyboard-device-file()")
  
  [...SKIPPING PASS THE COLOSSAL ELISP STACK TRACE...]
  
  x There was an unexpected runtime error
  Message: No org-babel-execute function for shell!
  Backtrace:
    (error "No org-babel-execute function for %s!" "shell")
    (org-babel-execute-src-block nil nil ((:results . "none")))
    (org-babel-ref-resolve "keyboard-device-file()")
    (#[257 "r\303q\210\306 \307\310\"\216\311\312\"\311\313\"\314\315\316\317$\266\203\211\203H\32...
    (replace-regexp-in-string "\\(.*?\\)\\(<<\\([^ 	\n]\\(?:.*?[^ 	\n]\\)?\\)>>\\)" #[257 "r\303q\21...
    (org-babel-expand-noweb-references ("kbd" "(defcfg\n  input (device-file \"<<keyboard-device-file()>>\")\n  ou...
    (org-babel-tangle-single-block 2)
    (let* ((block (org-babel-tangle-single-block counter)) (src-tfile (cdr (assq :tangle (nth 4 block)))) (file-na...
    (cond ((member "notangle" tags)) ((let* ((tags (seq-group-by #'(lambda (%) (equal (car %) "--or")) tags)) (or-...
    (let* ((tags (org-get-tags-at)) (info (org-babel-get-src-block-info 'no-eval)) (src-lang (nth 0 info)) (src-tf...
    (if (or (org-in-commented-heading-p) (org-in-archived-heading-p)) nil (let* ((tags (org-get-tags-at)) (info (o...
    (let ((full-block (match-string 0)) (beg-block (match-beginning 0)) (end-block (match-end 0)) (lang (match-str...
GNU Emacs     v30.0.93         ce50a1d3c18bcf0e5f51f4ed49f292f7be31010d
Doom core     v3.0.0-pre       HEAD -> master, upstream/master, upstream/HEAD 8406c1ff2 2025-05-24 17:32:27 +0200
Doom modules  v25.06.0-pre     HEAD -> master, upstream/master, upstream/HEAD 8406c1ff2 2025-05-24 17:32:27 +0200
  ! Wrote extended backtrace to ~/.emacs.d/.local/state/logs/cli.doom.250529140816.50920.error

Footnotes

  1. well, the hardware has to run linux ↩

find /dev/input/by-{path,id} -name '*-kbd' | head -n 1 | tr -d "\n"
(defcfg
  input (device-file "<<keyboard-device-file()>>")
  output (uinput-sink "My KMonad output")
  fallthrough true)

(defsrc caps)

(deflayer qwerty @cap)

(defalias cap (tap-hold-next 333 esc lctl))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment