0

As the title says, I get this error whenever I, or the function I'll show below, call org-babel-tangle. I'm using a org file to configure emacs, which tangles every time it is saved to my init.el.

The config regarding org-babel:

(with-eval-after-load 'org
  (org-babel-do-load-languages
   'org-babel-load-languages
   '((emacs-lisp . t)
     (python . t))
  (setq org-confirm-babel-evaluate nil)))

;; Templates
(with-eval-after-load 'org
  (require 'org-tempo)
  (add-to-list 'org-structure-template-alist '("sh" . "src shell"))
  (add-to-list 'org-structure-template-alist '("py" . "src python"))
  (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")))

;; Automatically tangle when saved
(defun tzne/org-babel-tangle-config ()
  (when (string-equal (buffer-file-name)
                      (expand-file-name "~/dotfiles/home/.config/emacs/README.org"))
    (let ((org-confirm-babel-evaluate nil))
      (org-babel-tangle))))
  (add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'tzne/org-babel-tangle-config)))

I'm getting the error:

    Debugger entered--Lisp error: (wrong-number-of-arguments (2 . 2) 3)
  org-babel-do-load-languages(org-babel-load-languages ((emacs-lisp . t) (python . t)) nil)
  (lambda nil (org-babel-do-load-languages 'org-babel-load-languages '((emacs-lisp . t) (python . t)) (setq org-confirm-babel-evaluate nil)))()
  eval-after-load(org (lambda nil (org-babel-do-load-languages 'org-babel-load-languages '((emacs-lisp . t) (python . t)) (setq org-confirm-babel-evaluate nil))))
  eval-buffer(#<buffer  *load*-615341> nil "/home/felipe/.config/emacs/babel.el" nil t)  ; Reading at buffer position 170
  load-with-code-conversion("/home/felipe/.config/emacs/babel.el" "/home/felipe/.config/emacs/babel.el" nil nil)
  load("/home/felipe/.config/emacs/babel.el" nil nil t)
  load-file("~/.config/emacs/babel.el")
  eval-buffer(#<buffer  *load*> nil "/home/felipe/.config/emacs/init.el" nil t)  ; Reading at buffer position 24665
  load-with-code-conversion("/home/felipe/.config/emacs/init.el" "/home/felipe/.config/emacs/init.el" t t)
  load("/home/felipe/.config/emacs/init" noerror nomessage)
  startup--load-user-init-file(#f(compiled-function () #<bytecode 0x766eaa9efc2819c>) #f(compiled-function () #<bytecode 0x4d12c0e0e44348b>) t)
  command-line()
  normal-top-level()

Note: The error comes from a babel.el file because I changed so many times the babel config I thought it would be safer to put it in a separate file to avoid messing other things up.

Plus, I know almost nothing of elisp, my config is built taking snippets of SystemCrafters and DistroTube.

1 Answer 1

0

The error is telling you that org-babel-do-load-languages takes two arguments, and you have passed in three. Yes, it is hard to decode this from the stack trace, since you just have to know what the numbers mean. I have pondered ways to improve the error messages, and concluded that the best way to do it is to implement translations into other languages, but even translating them into English is a huge project and I never got started on it.

A quick glance at your code shows a misplaced ).

1
  • I found the misplaced ), put it on the right spot and the error persists. I even copy and pasted the snippet I got the code from, still no luck. Important to note it was working for years, and yesterday, when messing around with my config, I started getting the error. Commented Jul 10, 2023 at 1:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.