1

I'm tangling my emacs file as usual, but today it broke.

There's like no way to figure out where it has problems;)

BASHY $ emacs --batch --eval "(require 'org)" --eval '(org-babel-tangle-file "/home/b0ef/ds/platform/conf/home.dot.emacs.dot.d.emacsen.org")'

Error: wrong-type-argument (stringp nil)
  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode 0xd93f8818faef148>))
  debug-early-backtrace()
  debug-early(error (wrong-type-argument stringp nil))
  regexp-quote(nil)
  org-src-coderef-regexp(nil)
  org-babel-tangle-single-block(1)
  org-babel-tangle-collect-blocks(nil nil)
  org-babel-tangle(nil nil nil)
  org-babel-tangle-file("/home/b0ef/ds/platform/conf/home.dot.emacs.dot.d.emacsen.org")
  eval((org-babel-tangle-file "/home/b0ef/ds/platform/conf/home.dot.emacs.dot.d.emacsen.org") t)
  command-line-1(("--eval" "(require 'org)" "--eval" "(org-babel-tangle-file \"/home/b0ef/ds/platform/conf/home.dot.emacs.dot.d.emacsen.org\")"))
  command-line()
  normal-top-level()
Wrong type argument: stringp, nil

Is there like a debug switch so that I can figure out at which line it has trouble?;)

EDIT2: Now I have a problem again and it doesn't really help to remove the --batch, because then it just fires up emacs with a broken config, it seems. Here's the terminal output with --batch:

Error: wrong-type-argument (stringp nil)
  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode -0x1955ef469e510ebb>))
  debug-early-backtrace()
  debug-early(error (wrong-type-argument stringp nil))
  regexp-quote(nil)
  org-src-coderef-regexp(nil)
  org-babel-tangle-single-block(1)
  org-babel-tangle-collect-blocks(nil nil)
  org-babel-tangle(nil nil nil)
  org-babel-tangle-file("/home/b0ef/ds/platform/conf/home.dot.emacs.dot.d.emacsen.org")
  eval((org-babel-tangle-file "/home/b0ef/ds/platform/conf/home.dot.emacs.dot.d.emacsen.org") t)
  command-line-1(("--eval" "(require 'org)" "--eval" "(org-babel-tangle-file \"/home/b0ef/ds/platform/conf/home.dot.emacs.dot.d.emacsen.org\")"))
  command-line()
  normal-top-level()
Wrong type argument: stringp, nil

Here's the error in emacs without --batch:

Debugger entered--Lisp error: (error "Could not find package chatgpt-shell. Updating rec...")
  signal(error ("Could not find package chatgpt-shell. Updating rec..."))
  error("Could not find package %S. Updating recipe reposit..." chatgpt-shell (org-elpa melpa gnu-elpa-mirror nongnu-elpa el-get emacsmirror-mirror))
  straight--convert-recipe(chatgpt-shell nil)
  straight-use-package(chatgpt-shell)
  eval-buffer(#<buffer  *load*-109726> nil "/home/b0ef/.emacs.d/emacsen.el" nil t)  ; Reading at buffer position 226531
  load-with-code-conversion("/home/b0ef/.emacs.d/emacsen.el" "/home/b0ef/.emacs.d/emacsen.el" nil nil)
  load("/home/b0ef/.emacs.d/emacsen.el" nil nil t)
  load-file("/home/b0ef/.emacs.d/emacsen.el")
  eval-buffer(#<buffer  *load*> nil "/home/b0ef/.emacs.d/init.el" nil t)  ; Reading at buffer position 45
  load-with-code-conversion("/home/b0ef/.emacs.d/init.el" "/home/b0ef/.emacs.d/init.el" t t)
  load("/home/b0ef/.emacs.d/init" noerror nomessage)
  startup--load-user-init-file(#f(compiled-function () #<bytecode -0xd94a4f67234740c>) #f(compiled-function () #<bytecode -0x1f3c61addc0b4d35>) t)
  command-line()
  normal-top-level()

EDIT3: ok, so basically, I found the culprit with bisect; I was missing a #+end_src , but I should be able to figure out which line this problem occurs, when tangling. I don't understand why it can't give me the line number?

3
  • 1
    Try without the --batch: emacs Q --debug-init --eval ... The problem is regexp-quote(nil) so look at the backtrace from that point down.
    – NickD
    Apr 16, 2023 at 13:11
  • If you have a recent backup, compare it with the current version of the tangled file and see what you changed (it would be even better if you put the file under source control).
    – NickD
    Apr 16, 2023 at 17:26
  • 2
    Yes, I did a bisect and found a non closed src;), but I'll remove --batch next time;). Thanks. It's also in Git;) Apr 16, 2023 at 18:05

1 Answer 1

1

You should run report-emacs-bug to send in a bug report. You can see from the backtrace:

  regexp-quote(nil)
  org-src-coderef-regexp(nil)
  org-babel-tangle-single-block(1)

That regexp-quote has been called with nil as an argument, which isn’t valid (it needs to be called with a string; use C-h f to check the documentation if you need a reminder). Presumably that is related to the missing #+end_src marker in your org file, but org should detect that explicitly rather than accidentally.

So you have all the information you need for the bug report. You can give very good steps to reproduce with a short Org file that breaks the export, and you have the backtrace that shows it accidentally calling regexp-quote instead of failing with an explicit error that tells you about the syntax of your org file.

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.