Hey all, 

When exporting an org file with an R sourceblock that results in a table I get the following error: ~(wrong-type-argument number-or-marker-p nil)~.

This happens when using ~emacs -Q~ and putting the below code blocks in a test.org file; then using C-e h o to export to html.

#+begin_src emacs-lisp :results none
  (require 'ob-R) ;; C-x C-e here as it's needed to run R blocks
#+end_src

#+begin_src R :exports both :colnames yes
mtcars
#+end_src

This does not seem to happen in Emacs 28.1, or in 29.0.50 with Org 9.4.6.

Debug on error shows the following:

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  jit-lock--run-functions(142 2726)
  jit-lock-fontify-now(142 #<marker at 2726 in test.org<2>>)
  org-font-lock-ensure(142 #<marker at 2726 in test.org<2>>)
  org-table-align()
  org-babel-insert-result((("mpg" "cyl" "disp" "hp" "drat" "wt" "qsec" "vs" "am" "gear" "carb") hline (21 6 160 110 3.9 2.62 16.46 0 1 4 4) (21 6 160 110 3.9 2.875 17.02 0 1 4 4) (22.8 4 108 93 3.85 2.32 18.61 1 1 4 1) (21.4 6 258 110 3.08 3.215 19.44 1 0 3 1) (18.7 8 360 175 3.15 3.44 17.02 0 0 3 2) (18.1 6 225 105 2.76 3.46 20.22 1 0 3 1) (14.3 8 360 245 3.21 3.57 15.84 0 0 3 4) (24.4 4 146.7 62 3.69 3.19 20 1 0 4 2) (22.8 4 140.8 95 3.92 3.15 22.9 1 0 4 2) (19.2 6 167.6 123 3.92 3.44 18.3 1 0 4 4) (17.8 6 167.6 123 3.92 3.44 18.9 1 0 4 4) (16.4 8 275.8 180 3.07 4.07 17.4 0 0 3 3) (17.3 8 275.8 180 3.07 3.73 17.6 0 0 3 3) (15.2 8 275.8 180 3.07 3.78 18 0 0 3 3) (10.4 8 472 205 2.93 5.25 17.98 0 0 3 4) (10.4 8 460 215 3 5.424 17.82 0 0 3 4) (14.7 8 440 230 3.23 5.345 17.42 0 0 3 4) (32.4 4 78.7 66 4.08 2.2 19.47 1 1 4 1) (30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2) (33.9 4 71.1 65 4.22 1.835 19.9 1 1 4 1) (21.5 4 120.1 97 3.7 2.465 20.01 1 0 3 1) (15.5 8 318 150 2.76 3.52 16.87 0 0 3 2) (15.2 8 304 150 3.15 3.435 17.3 0 0 3 2) (13.3 8 350 245 3.73 3.84 15.41 0 0 3 4) (19.2 8 400 175 3.08 3.845 17.05 0 0 3 2) (27.3 4 79 66 4.08 1.935 18.9 1 1 4 1) (26 4 120.3 91 4.43 2.14 16.7 0 1 5 2) (30.4 4 95.1 113 3.77 1.513 16.9 1 1 5 2) (15.8 8 351 264 4.22 3.17 14.5 0 1 5 4) (19.7 6 145 175 3.62 2.77 15.5 0 1 5 6) (15 8 301 335 3.54 3.57 14.6 0 1 5 8) (21.4 4 121 109 4.11 2.78 18.6 1 1 4 2)) ("replace") ("R" "mtcars" ((:colname-names) (:rowname-names) (:result-params "replace") (:result-type . value) (:results . "replace") (:exports . "both") (:cache . "no") (:colnames . "yes") (:hlines . "no") (:noweb . "no") (:session . "none") (:tangle . "no")) "" nil 71 "(ref:%s)") nil "R")
  org-babel-execute-src-block(nil ("R" "mtcars" ((:colname-names) (:rowname-names) (:result-params "replace") (:result-type . value) (:results . "replace") (:exports . "both") (:tangle . "no") (:session . "none") (:noweb . "no") (:hlines . "no") (:colnames . "yes") (:cache . "no")) "" nil 71 "(ref:%s)"))
  org-babel-exp-results(("R" "mtcars" ((:cache . "no") (:colname-names) (:colnames . "yes") (:exports . "both") (:hlines . "no") (:noweb . "no") (:result-params "replace") (:result-type . value) (:results . "replace") (:rowname-names) (:session . "none") (:tangle . "no")) "" nil 71 "(ref:%s)") block nil "8ebec0065e2f8c60506a73f500125bdbdce014a1")
  org-babel-exp-do-export(("R" "mtcars" ((:cache . "no") (:colname-names) (:colnames . "yes") (:exports . "both") (:hlines . "no") (:noweb . "no") (:result-params "replace") (:result-type . value) (:results . "replace") (:rowname-names) (:session . "none") (:tangle . "no")) "" nil 71 "(ref:%s)") block "8ebec0065e2f8c60506a73f500125bdbdce014a1")
  org-babel-exp-src-block()
  org-babel-exp-process-buffer()
  org-export-as(html nil nil nil (:output-file "test.html"))
  org-export-to-file(html "test.html" nil nil nil nil nil)
  org-html-export-to-html(nil nil nil nil)
  (org-open-file (org-html-export-to-html nil s v b))
  (if a (org-html-export-to-html t s v b) (org-open-file (org-html-export-to-html nil s v b)))
  (lambda (a s v b) (if a (org-html-export-to-html t s v b) (org-open-file (org-html-export-to-html nil s v b))))(nil nil nil nil)
  org-export-dispatch(nil)
  funcall-interactively(org-export-dispatch nil)
  command-execute(org-export-dispatch)
  completing-read-default("Describe variable: " help--symbol-completion-table #f(compiled-function (vv) #<bytecode -0x19d6628d31b2d408>) t nil nil nil nil)
  completing-read("Describe variable: " help--symbol-completion-table #f(compiled-function (vv) #<bytecode -0x19d6628d31b2d408>) t nil nil nil)
  byte-code("\301 \302p\303\2\30\304\305\306\6\69\205\22\0\6\6\"\307\310\311\6\6\"\302\303\211\6\n9\205&\0\312\6\13!&\7\262\1\211\313\232\2034\0\3\202..." [enable-recursive-minibuffers variable-at-point t nil completing-read format-prompt "Describe variable" help--symbol-completion-table make-closure #f(compiled-function (vv) #<bytecode 0x1c9b2e261ea2bfa>) symbol-name "" intern] 13)
  command-execute(describe-variable)


Emacs  : GNU Emacs 29.0.50 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.34, cairo version 1.17.6)
 of 2022-09-19
Package: Org mode version 9.5.5 (release_9.5.5 @ /usr/share/emacs/29.0.50/lisp/org/)

current state:
==============
(setq
 org-link-elisp-confirm-function 'yes-or-no-p
 org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn ENTRY)"]
 org-export-before-parsing-hook '(org-attach-expand-links)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-odt-format-inlinetask-function 'org-odt-format-inlinetask-default-function
 org-ascii-format-drawer-function #[771 "\207" [] 4 "\n\n(fn NAME CONTENTS WIDTH)"]
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers org-cycle-show-empty-lines org-optimize-window-after-visibility-change)
 org-export-coding-system 'utf-8
 org-mode-hook '(#[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-show-all append local] 5]
#[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-babel-show-result-all append local] 5] org-babel-result-hide-spec
org-babel-hide-all-hashes)
 org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"]
 org-latex-format-headline-function 'org-latex-format-headline-default-function
 org-confirm-shell-link-function 'yes-or-no-p
 org-reveal-start-hook '(org-decrypt-entry)
 org-html-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 outline-isearch-open-invisible-function 'outline-isearch-open-invisible
 org-odt-format-headline-function 'org-odt-format-headline-default-function
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-tangle-lang-exts '(("D" . "d") ("C++" . "cpp") ("awk" . "awk") ("clojurescript" . "cljs") ("clojure" . "clj") ("fortran" . "F90")
     ("groovy" . "groovy") ("haskell" . "hs") ("java" . "java") ("julia" . "jl") ("latex" . "tex") ("LilyPond" . "ly")
     ("lisp" . "lisp") ("lua" . "lua") ("maxima" . "max") ("ocaml" . "ml") ("perl" . "pl") ("processing" . "pde")
     ("python" . "py") ("ruby" . "rb") ("sed" . "sed") ("emacs-lisp" . "el") ("elisp" . "el"))
 org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-speed-command-hook '(org-speed-command-activate org-babel-speed-command-activate)
 org-html-format-inlinetask-function 'org-html-format-inlinetask-default-function
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 org-latex-format-inlinetask-function 'org-latex-format-inlinetask-default-function
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand)
 org-link-shell-confirm-function 'yes-or-no-p
 org-babel-pre-tangle-hook '(save-buffer)
 org-agenda-loop-over-headlines-in-active-region nil
 org-occur-hook '(org-first-headline-recenter)
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-link-parameters '(("attachment" :follow org-attach-follow :complete org-attach-complete-link) ("id" :follow org-id-open)
      ("eww" :follow org-eww-open :store org-eww-store-link) ("rmail" :follow org-rmail-open :store org-rmail-store-link)
      ("mhe" :follow org-mhe-open :store org-mhe-store-link)
      ("irc" :follow org-irc-visit :store org-irc-store-link :export org-irc-export)
      ("info" :follow org-info-open :export org-info-export :store org-info-store-link)
      ("gnus" :follow org-gnus-open :store org-gnus-store-link)
      ("docview" :follow org-docview-open :export org-docview-export :store org-docview-store-link)
      ("bibtex" :follow org-bibtex-open :store org-bibtex-store-link)
      ("bbdb" :follow org-bbdb-open :export org-bbdb-export :complete org-bbdb-complete-link :store org-bbdb-store-link)
      ("w3m" :store org-w3m-store-link) ("doi" :follow org-link-doi-open :export org-link-doi-export) ("file+sys") ("file+emacs")
      ("shell" :follow org-link--open-shell)
      ("news" :follow #[514 "\301\300\302Q\"\207" ["news" browse-url ":"] 6 "\n\n(fn URL ARG)"])
      ("mailto" :follow #[514 "\301\300\302Q\"\207" ["mailto" browse-url ":"] 6 "\n\n(fn URL ARG)"])
      ("https" :follow #[514 "\301\300\302Q\"\207" ["https" browse-url ":"] 6 "\n\n(fn URL ARG)"])
      ("http" :follow #[514 "\301\300\302Q\"\207" ["http" browse-url ":"] 6 "\n\n(fn URL ARG)"])
      ("ftp" :follow #[514 "\301\300\302Q\"\207" ["ftp" browse-url ":"] 6 "\n\n(fn URL ARG)"])
      ("help" :follow org-link--open-help :store org-link--store-help) ("file" :complete org-link-complete-file)
      ("elisp" :follow org-link--open-elisp))
 org-html-format-headline-function 'org-html-format-headline-default-function
 org-metaup-hook '(org-babel-load-in-session-maybe)
 )

Best,
Mattias