ob-typescript icon indicating copy to clipboard operation
ob-typescript copied to clipboard

Error: (wrong-type-argument listp :rowname-names))

Open RyanMcCarl opened this issue 7 years ago • 7 comments

Debugger entered--entering a function:
* org-babel-tangle(nil)
  funcall-interactively(org-babel-tangle nil)
  call-interactively(org-babel-tangle nil nil)
  command-execute(org-babel-tangle)
  recursive-edit()
  debug(error (wrong-type-argument listp :rowname-names))
  #[(pair) "\301\302@\303A!#\207" [pair format "%s=%S" org-babel-typescript-var-to-typescript] 5](:rowname-names)
  mapconcat(#[(pair) "\301\302@\303A!#\207" [pair format "%s=%S" org-babel-typescript-var-to-typescript] 5] (:rowname-names) "\n")
  org-babel-expand-body:typescript("import {Component} from '@angular/core';\nimport { NgModule } from '@angular/core';\nimport { BrowserModule } from '@angular/platform-browser';\nimport { platformBrowserDynamic } from '@angular/platform-browser-dynamic';\n\n" ((:colname-names) (:rowname-names) (:result-params "replace") (:result-type . value) (:results . "replace") (:exports . "code") (:tangle . "yes") (:cmdline . "--noImplicitAny") (:hlines . "no") (:noweb . "no") (:cache . "no") (:session . "none")))
  funcall(org-babel-expand-body:typescript "import {Component} from '@angular/core';\nimport { NgModule } from '@angular/core';\nimport { BrowserModule } from '@angular/platform-browser';\nimport { platformBrowserDynamic } from '@angular/platform-browser-dynamic';\n\n" ((:colname-names) (:rowname-names) (:result-params "replace") (:result-type . value) (:results . "replace") (:exports . "code") (:tangle . "yes") (:cmdline . "--noImplicitAny") (:hlines . "no") (:noweb . "no") (:cache . "no") (:session . "none")))
  (cond ((assq :no-expand params) body) ((fboundp expand-cmd) (funcall expand-cmd body params)) (t (org-babel-expand-body:generic body params (and (fboundp assignments-cmd) (funcall assignments-cmd params)))))
  (insert (cond ((assq :no-expand params) body) ((fboundp expand-cmd) (funcall expand-cmd body params)) (t (org-babel-expand-body:generic body params (and (fboundp assignments-cmd) (funcall assignments-cmd params))))))
  (progn (insert (cond ((assq :no-expand params) body) ((fboundp expand-cmd) (funcall expand-cmd body params)) (t (org-babel-expand-body:generic body params (and (fboundp assignments-cmd) (funcall assignments-cmd params)))))) (if (string-match "-r" extra) (progn (goto-char (point-min)) (while (re-search-forward (replace-regexp-in-string "%s" ".+" cref-fmt) nil t) (replace-match "")))) (run-hooks (quote org-babel-tangle-body-hook)) (buffer-string))
  (unwind-protect (progn (insert (cond ((assq :no-expand params) body) ((fboundp expand-cmd) (funcall expand-cmd body params)) (t (org-babel-expand-body:generic body params (and (fboundp assignments-cmd) (funcall assignments-cmd params)))))) (if (string-match "-r" extra) (progn (goto-char (point-min)) (while (re-search-forward (replace-regexp-in-string "%s" ".+" cref-fmt) nil t) (replace-match "")))) (run-hooks (quote org-babel-tangle-body-hook)) (buffer-string)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))
  (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert (cond ((assq :no-expand params) body) ((fboundp expand-cmd) (funcall expand-cmd body params)) (t (org-babel-expand-body:generic body params (and ... ...))))) (if (string-match "-r" extra) (progn (goto-char (point-min)) (while (re-search-forward (replace-regexp-in-string "%s" ".+" cref-fmt) nil t) (replace-match "")))) (run-hooks (quote org-babel-tangle-body-hook)) (buffer-string)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))
  (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert (cond ((assq :no-expand params) body) ((fboundp expand-cmd) (funcall expand-cmd body params)) (t (org-babel-expand-body:generic body params ...)))) (if (string-match "-r" extra) (progn (goto-char (point-min)) (while (re-search-forward ... nil t) (replace-match "")))) (run-hooks (quote org-babel-tangle-body-hook)) (buffer-string)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))
  (let ((body (if (org-babel-noweb-p params :tangle) (org-babel-expand-noweb-references info) (nth 1 info)))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert (cond (... body) (... ...) (t ...))) (if (string-match "-r" extra) (progn (goto-char ...) (while ... ...))) (run-hooks (quote org-babel-tangle-body-hook)) (buffer-string)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))))
  (let* ((info (org-babel-get-src-block-info)) (start-line (save-restriction (widen) (+ 1 (line-number-at-pos (point))))) (file (buffer-file-name (buffer-base-buffer))) (src-lang (nth 0 info)) (params (nth 2 info)) (extra (nth 3 info)) (cref-fmt (or (and (string-match "-l \"\\(.+\\)\"" extra) (match-string 1 extra)) org-coderef-label-format)) (link (let ((l (org-no-properties (org-store-link nil)))) (and (string-match org-bracket-link-regexp l) (match-string 1 l)))) (source-name (or (nth 4 info) (format "%s:%d" (or (condition-case nil (progn ...) (error nil)) "No heading") block-counter))) (expand-cmd (intern (concat "org-babel-expand-body:" src-lang))) (assignments-cmd (intern (concat "org-babel-variable-assignments:" src-lang))) (body (let ((body (if (org-babel-noweb-p params :tangle) (org-babel-expand-noweb-references info) (nth 1 info)))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn ... ... ... ...) (and ... ...)))))) (comment (if (or (string= "both" (cdr (assq :comments params))) (string= "org" (cdr (assq :comments params)))) (progn (funcall org-babel-process-comment-text (buffer-substring (max ... ...) (point)))))) (result (list start-line (if org-babel-tangle-use-relative-file-links (file-relative-name file) file) (if (and org-babel-tangle-use-relative-file-links (string-match org-link-types-re link) (string= (match-string 0 link) "file")) (concat "file:" (file-relative-name (match-string 1 link) (file-name-directory ...))) link) source-name params (org-unescape-code-in-string (if org-src-preserve-indentation (org-trim body t) (org-trim (org-remove-indentation body)))) comment))) (if only-this-block (list (cons src-lang (list result))) result))
  org-babel-tangle-single-block(1)
  (let ((by-lang (assoc src-lang blocks)) (block (org-babel-tangle-single-block counter))) (if by-lang (setcdr by-lang (cons block (cdr by-lang))) (setq blocks (cons (cons src-lang (list block)) blocks))))
  (if (or (string= src-tfile "no") (and tangle-file (not (equal tangle-file src-tfile))) (and language (not (string= language src-lang)))) nil (let ((by-lang (assoc src-lang blocks)) (block (org-babel-tangle-single-block counter))) (if by-lang (setcdr by-lang (cons block (cdr by-lang))) (setq blocks (cons (cons src-lang (list block)) blocks)))))
  (let* ((info (org-babel-get-src-block-info (quote light))) (src-lang (nth 0 info)) (src-tfile (cdr (assq :tangle (nth 2 info))))) (if (or (string= src-tfile "no") (and tangle-file (not (equal tangle-file src-tfile))) (and language (not (string= language src-lang)))) nil (let ((by-lang (assoc src-lang blocks)) (block (org-babel-tangle-single-block counter))) (if by-lang (setcdr by-lang (cons block (cdr by-lang))) (setq blocks (cons (cons src-lang (list block)) blocks))))))
  (if (org-in-commented-heading-p) nil (let* ((info (org-babel-get-src-block-info (quote light))) (src-lang (nth 0 info)) (src-tfile (cdr (assq :tangle (nth 2 info))))) (if (or (string= src-tfile "no") (and tangle-file (not (equal tangle-file src-tfile))) (and language (not (string= language src-lang)))) nil (let ((by-lang (assoc src-lang blocks)) (block (org-babel-tangle-single-block counter))) (if by-lang (setcdr by-lang (cons block (cdr by-lang))) (setq blocks (cons (cons src-lang ...) blocks)))))))
  (let ((full-block (match-string 0)) (beg-block (match-beginning 0)) (end-block (match-end 0)) (lang (match-string 2)) (beg-lang (match-beginning 2)) (end-lang (match-end 2)) (switches (match-string 3)) (beg-switches (match-beginning 3)) (end-switches (match-end 3)) (header-args (match-string 4)) (beg-header-args (match-beginning 4)) (end-header-args (match-end 4)) (body (match-string 5)) (beg-body (match-beginning 5)) (end-body (match-end 5))) (ignore full-block beg-block end-block lang beg-lang end-lang switches beg-switches end-switches header-args beg-header-args end-header-args body beg-body end-body) (let ((current-heading-pos (save-excursion (save-restriction (widen) (progn (defvar org-called-with-limited-levels) (defvar org-outline-regexp) (defvar outline-regexp) (defvar org-outline-regexp-bol) (let* ... ...)))))) (if (eq last-heading-pos current-heading-pos) (setq counter (1+ counter)) (setq counter 1) (setq last-heading-pos current-heading-pos))) (if (org-in-commented-heading-p) nil (let* ((info (org-babel-get-src-block-info (quote light))) (src-lang (nth 0 info)) (src-tfile (cdr (assq :tangle (nth 2 info))))) (if (or (string= src-tfile "no") (and tangle-file (not (equal tangle-file src-tfile))) (and language (not (string= language src-lang)))) nil (let ((by-lang (assoc src-lang blocks)) (block (org-babel-tangle-single-block counter))) (if by-lang (setcdr by-lang (cons block ...)) (setq blocks (cons ... blocks))))))) (goto-char end-block))
  (progn (goto-char (match-beginning 0)) (let ((full-block (match-string 0)) (beg-block (match-beginning 0)) (end-block (match-end 0)) (lang (match-string 2)) (beg-lang (match-beginning 2)) (end-lang (match-end 2)) (switches (match-string 3)) (beg-switches (match-beginning 3)) (end-switches (match-end 3)) (header-args (match-string 4)) (beg-header-args (match-beginning 4)) (end-header-args (match-end 4)) (body (match-string 5)) (beg-body (match-beginning 5)) (end-body (match-end 5))) (ignore full-block beg-block end-block lang beg-lang end-lang switches beg-switches end-switches header-args beg-header-args end-header-args body beg-body end-body) (let ((current-heading-pos (save-excursion (save-restriction (widen) (progn ... ... ... ... ...))))) (if (eq last-heading-pos current-heading-pos) (setq counter (1+ counter)) (setq counter 1) (setq last-heading-pos current-heading-pos))) (if (org-in-commented-heading-p) nil (let* ((info (org-babel-get-src-block-info (quote light))) (src-lang (nth 0 info)) (src-tfile (cdr (assq :tangle ...)))) (if (or (string= src-tfile "no") (and tangle-file (not ...)) (and language (not ...))) nil (let ((by-lang ...) (block ...)) (if by-lang (setcdr by-lang ...) (setq blocks ...)))))) (goto-char end-block)))
  (if (org-babel-active-location-p) (progn (goto-char (match-beginning 0)) (let ((full-block (match-string 0)) (beg-block (match-beginning 0)) (end-block (match-end 0)) (lang (match-string 2)) (beg-lang (match-beginning 2)) (end-lang (match-end 2)) (switches (match-string 3)) (beg-switches (match-beginning 3)) (end-switches (match-end 3)) (header-args (match-string 4)) (beg-header-args (match-beginning 4)) (end-header-args (match-end 4)) (body (match-string 5)) (beg-body (match-beginning 5)) (end-body (match-end 5))) (ignore full-block beg-block end-block lang beg-lang end-lang switches beg-switches end-switches header-args beg-header-args end-header-args body beg-body end-body) (let ((current-heading-pos (save-excursion (save-restriction ... ...)))) (if (eq last-heading-pos current-heading-pos) (setq counter (1+ counter)) (setq counter 1) (setq last-heading-pos current-heading-pos))) (if (org-in-commented-heading-p) nil (let* ((info (org-babel-get-src-block-info ...)) (src-lang (nth 0 info)) (src-tfile (cdr ...))) (if (or (string= src-tfile "no") (and tangle-file ...) (and language ...)) nil (let (... ...) (if by-lang ... ...))))) (goto-char end-block))))
  (while (re-search-forward org-babel-src-block-regexp nil t) (if (org-babel-active-location-p) (progn (goto-char (match-beginning 0)) (let ((full-block (match-string 0)) (beg-block (match-beginning 0)) (end-block (match-end 0)) (lang (match-string 2)) (beg-lang (match-beginning 2)) (end-lang (match-end 2)) (switches (match-string 3)) (beg-switches (match-beginning 3)) (end-switches (match-end 3)) (header-args (match-string 4)) (beg-header-args (match-beginning 4)) (end-header-args (match-end 4)) (body (match-string 5)) (beg-body (match-beginning 5)) (end-body (match-end 5))) (ignore full-block beg-block end-block lang beg-lang end-lang switches beg-switches end-switches header-args beg-header-args end-header-args body beg-body end-body) (let ((current-heading-pos (save-excursion ...))) (if (eq last-heading-pos current-heading-pos) (setq counter (1+ counter)) (setq counter 1) (setq last-heading-pos current-heading-pos))) (if (org-in-commented-heading-p) nil (let* ((info ...) (src-lang ...) (src-tfile ...)) (if (or ... ... ...) nil (let ... ...)))) (goto-char end-block)))))
  (progn (if file (progn (find-file file))) (setq to-be-removed (current-buffer)) (goto-char (point-min)) (while (re-search-forward org-babel-src-block-regexp nil t) (if (org-babel-active-location-p) (progn (goto-char (match-beginning 0)) (let ((full-block (match-string 0)) (beg-block (match-beginning 0)) (end-block (match-end 0)) (lang (match-string 2)) (beg-lang (match-beginning 2)) (end-lang (match-end 2)) (switches (match-string 3)) (beg-switches (match-beginning 3)) (end-switches (match-end 3)) (header-args (match-string 4)) (beg-header-args (match-beginning 4)) (end-header-args (match-end 4)) (body (match-string 5)) (beg-body (match-beginning 5)) (end-body (match-end 5))) (ignore full-block beg-block end-block lang beg-lang end-lang switches beg-switches end-switches header-args beg-header-args end-header-args body beg-body end-body) (let ((current-heading-pos ...)) (if (eq last-heading-pos current-heading-pos) (setq counter ...) (setq counter 1) (setq last-heading-pos current-heading-pos))) (if (org-in-commented-heading-p) nil (let* (... ... ...) (if ... nil ...))) (goto-char end-block))))))
  (unwind-protect (progn (if file (progn (find-file file))) (setq to-be-removed (current-buffer)) (goto-char (point-min)) (while (re-search-forward org-babel-src-block-regexp nil t) (if (org-babel-active-location-p) (progn (goto-char (match-beginning 0)) (let ((full-block ...) (beg-block ...) (end-block ...) (lang ...) (beg-lang ...) (end-lang ...) (switches ...) (beg-switches ...) (end-switches ...) (header-args ...) (beg-header-args ...) (end-header-args ...) (body ...) (beg-body ...) (end-body ...)) (ignore full-block beg-block end-block lang beg-lang end-lang switches beg-switches end-switches header-args beg-header-args end-header-args body beg-body end-body) (let (...) (if ... ... ... ...)) (if (org-in-commented-heading-p) nil (let* ... ...)) (goto-char end-block)))))) (set-window-configuration wconfig))
  (let ((wconfig (current-window-configuration))) (unwind-protect (progn (if file (progn (find-file file))) (setq to-be-removed (current-buffer)) (goto-char (point-min)) (while (re-search-forward org-babel-src-block-regexp nil t) (if (org-babel-active-location-p) (progn (goto-char (match-beginning 0)) (let (... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) (ignore full-block beg-block end-block lang beg-lang end-lang switches beg-switches end-switches header-args beg-header-args end-header-args body beg-body end-body) (let ... ...) (if ... nil ...) (goto-char end-block)))))) (set-window-configuration wconfig)))
  (let* ((case-fold-search t) (file (buffer-file-name)) (visited-p (or (null file) (get-file-buffer (expand-file-name file)))) (point (point)) to-be-removed) (let ((wconfig (current-window-configuration))) (unwind-protect (progn (if file (progn (find-file file))) (setq to-be-removed (current-buffer)) (goto-char (point-min)) (while (re-search-forward org-babel-src-block-regexp nil t) (if (org-babel-active-location-p) (progn (goto-char ...) (let ... ... ... ... ...))))) (set-window-configuration wconfig))) (if visited-p nil (kill-buffer to-be-removed)) (goto-char point))
  (let ((counter 0) last-heading-pos blocks) (let* ((case-fold-search t) (file (buffer-file-name)) (visited-p (or (null file) (get-file-buffer (expand-file-name file)))) (point (point)) to-be-removed) (let ((wconfig (current-window-configuration))) (unwind-protect (progn (if file (progn (find-file file))) (setq to-be-removed (current-buffer)) (goto-char (point-min)) (while (re-search-forward org-babel-src-block-regexp nil t) (if (org-babel-active-location-p) (progn ... ...)))) (set-window-configuration wconfig))) (if visited-p nil (kill-buffer to-be-removed)) (goto-char point)) (mapcar (function (lambda (b) (cons (car b) (nreverse (cdr b))))) blocks))
  org-babel-tangle-collect-blocks(nil nil)
  (if (equal arg (quote (4))) (org-babel-tangle-single-block 1 t) (org-babel-tangle-collect-blocks lang tangle-file))
  (mapc (function (lambda (by-lang) (let* ((lang (car by-lang)) (specs (cdr by-lang)) (ext (or (cdr ...) lang)) (lang-f (intern (concat ... "-mode"))) she-banged) (mapc (function (lambda (spec) (let ... ...))) specs)))) (if (equal arg (quote (4))) (org-babel-tangle-single-block 1 t) (org-babel-tangle-collect-blocks lang tangle-file)))
  (let ((block-counter 0) (org-babel-default-header-args (if target-file (org-babel-merge-params org-babel-default-header-args (list (cons :tangle target-file))) org-babel-default-header-args)) (tangle-file (if (equal arg (quote (16))) (progn (or (cdr (assq :tangle ...)) (user-error "Point is not in a source code block"))))) path-collector) (mapc (function (lambda (by-lang) (let* ((lang (car by-lang)) (specs (cdr by-lang)) (ext (or ... lang)) (lang-f (intern ...)) she-banged) (mapc (function (lambda ... ...)) specs)))) (if (equal arg (quote (4))) (org-babel-tangle-single-block 1 t) (org-babel-tangle-collect-blocks lang tangle-file))) (message "Tangled %d code block%s from %s" block-counter (if (= block-counter 1) "" "s") (file-name-nondirectory (buffer-file-name (or (buffer-base-buffer) (current-buffer))))) (if org-babel-post-tangle-hook (progn (mapc (function (lambda (file) (let* (... ... temp-result temp-file) (org-babel-find-file-noselect-refresh temp-path) (setq temp-file ...) (save-current-buffer ... ...) (if visited-p nil ...) temp-result))) (mapcar (function car) path-collector)))) (mapc (function (lambda (pair) (if (cdr pair) (progn (set-file-modes (car pair) (cdr pair)))))) path-collector) (mapcar (function car) path-collector))
  (save-excursion (if (equal arg (quote (4))) (progn (let ((head (org-babel-where-is-src-block-head))) (if head (goto-char head) (user-error "Point is not in a source code block"))))) (let ((block-counter 0) (org-babel-default-header-args (if target-file (org-babel-merge-params org-babel-default-header-args (list (cons :tangle target-file))) org-babel-default-header-args)) (tangle-file (if (equal arg (quote (16))) (progn (or (cdr ...) (user-error "Point is not in a source code block"))))) path-collector) (mapc (function (lambda (by-lang) (let* ((lang ...) (specs ...) (ext ...) (lang-f ...) she-banged) (mapc (function ...) specs)))) (if (equal arg (quote (4))) (org-babel-tangle-single-block 1 t) (org-babel-tangle-collect-blocks lang tangle-file))) (message "Tangled %d code block%s from %s" block-counter (if (= block-counter 1) "" "s") (file-name-nondirectory (buffer-file-name (or (buffer-base-buffer) (current-buffer))))) (if org-babel-post-tangle-hook (progn (mapc (function (lambda (file) (let* ... ... ... ... ... temp-result))) (mapcar (function car) path-collector)))) (mapc (function (lambda (pair) (if (cdr pair) (progn (set-file-modes ... ...))))) path-collector) (mapcar (function car) path-collector)))
  (save-restriction (save-excursion (if (equal arg (quote (4))) (progn (let ((head (org-babel-where-is-src-block-head))) (if head (goto-char head) (user-error "Point is not in a source code block"))))) (let ((block-counter 0) (org-babel-default-header-args (if target-file (org-babel-merge-params org-babel-default-header-args (list ...)) org-babel-default-header-args)) (tangle-file (if (equal arg (quote ...)) (progn (or ... ...)))) path-collector) (mapc (function (lambda (by-lang) (let* (... ... ... ... she-banged) (mapc ... specs)))) (if (equal arg (quote (4))) (org-babel-tangle-single-block 1 t) (org-babel-tangle-collect-blocks lang tangle-file))) (message "Tangled %d code block%s from %s" block-counter (if (= block-counter 1) "" "s") (file-name-nondirectory (buffer-file-name (or (buffer-base-buffer) (current-buffer))))) (if org-babel-post-tangle-hook (progn (mapc (function (lambda ... ...)) (mapcar (function car) path-collector)))) (mapc (function (lambda (pair) (if (cdr pair) (progn ...)))) path-collector) (mapcar (function car) path-collector))))
  org-babel-tangle(nil)
  funcall-interactively(org-babel-tangle nil)
  call-interactively(org-babel-tangle nil nil)
  command-execute(org-babel-tangle)

RyanMcCarl avatar Feb 14 '17 06:02 RyanMcCarl

sorry, I missed the issue opend.

Could you show me your .org file? (to reproduce your error) It's better with minimal config of your environment.

lurdan avatar Apr 04 '17 09:04 lurdan

I got the same error. I'm using the latest version Org Mode which is loaded from master branch source code. the latest commit is 96cc762ff master upstream/master Remove duplicate selection letters from tag filter prompt.

stardiviner avatar Aug 23 '19 10:08 stardiviner

hmm...I can't reproduce it. It runs successfully with its sample conversions (README.org).

  • emacs26 (26.2~1.gitfd1b34b-kk1+18.04)
  • org-mode (master 73c0989037e6bf9ed39e57867a662b861e9d0af8)
  • node (v11.12.0)

lurdan avatar Aug 25 '19 07:08 lurdan

I'm using Emacs version GNU Emacs 26.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.8) of 2019-04-13. And with minimal config, still have this error.

stardiviner avatar Aug 26 '19 07:08 stardiviner

Would you put these somewhere?

  • your minimal config which reproduces the problem
  • your target code block which raises error

lurdan avatar Aug 27 '19 06:08 lurdan

Here is my minimal config

(package-initialize)

;;; [ Debug ]
(setq debug-on-error t
      debug-on-signal nil
      debug-on-quit nil)

;;; add my init files directory

(add-to-list 'load-path "/usr/share/emacs/site-lisp/")

(add-to-list 'load-path (expand-file-name "init" user-emacs-directory))

;; recursively load init files.
(let ((default-directory "~/.emacs.d/init/"))
  (setq load-path
        (append
         (let ((load-path (copy-sequence load-path))) ; shadow
           (append
            (copy-sequence (normal-top-level-add-to-load-path '(".")))
            (normal-top-level-add-subdirs-to-load-path)))
         load-path)))

(setq load-prefer-newer t)

;;; [ package.el ]
(load "~/.emacs.d/init/init-package.el")
(require 'init-package)

;; (require 'init-org-mode)

;;; Org-mode Babel
(setq org-confirm-babel-evaluate nil)
(setq org-babel-no-eval-on-ctrl-c-ctrl-c nil)
(setq org-confirm-shell-link-function 'yes-or-no-p)
(setq org-confirm-elisp-link-function 'yes-or-no-p)

;; babel src block editing
(setq org-src-fontify-natively t
      ;; nil: preserve org indent, t: preserve export indent.
      org-src-preserve-indentation nil
      ;; 0: fix `diff' babel syntax highlighting invalid issue.
      org-edit-src-content-indentation 0
      org-src-tab-acts-natively nil ; make [Tab] work native as in major mode.
      org-src-window-setup 'current-window ; 'reorganize-frame, 'current-window
      org-src-ask-before-returning-to-edit-buffer nil
      org-edit-src-auto-save-idle-delay 0 ; 0: don't auto save.
      )

(org-babel-do-load-languages
 'org-babel-load-languages
 '((emacs-lisp . t) (org . t)
   (shell . t)
   (lisp . t) (clojure . t)
   (js . t)))

;; [ ob-typescript ]
(use-package ob-typescript
  :defer t
  :commands (org-babel-execute:typescript)
  :config
  (add-to-list 'org-babel-load-languages '(typescript . t))
  (org-babel-do-load-languages 'org-babel-load-languages org-babel-load-languages)
  (add-to-list 'org-babel-tangle-lang-exts '("typescript" . "ts"))
  (add-to-list 'org-babel-default-header-args:typescript '(:results . "output")))

And here is my typescript code block:

#+begin_src typescript :tangle "data/code/wechaty-demo.ts"
import { Wechaty } from 'wechaty'

Wechaty.instance()
.on('scan',        qrcode  => console.log('扫码登录:' + qrcode))
.on('login',       user    => console.log('登录成功:' + user))
.on('message',     message => console.log('收到消息:' + message))
.on('friendship',  friendship => console.log('收到好友请求:' + friendship))
.on('room-invite', invitation => console.log('收到入群邀请:' + invitation))
.start()
#+end_src

Weird, when I test again, this error gone.

stardiviner avatar Aug 28 '19 00:08 stardiviner

hi, thanks for your snippet.

I've found that ":results output" setting seems to cause the error, because I didn't care about org-babel parameters. I will take care of it later, or @dop's commit 7782749dc54a6b76cc4e3988247685e1a02bfe42 will fix the problem.

lurdan avatar Aug 28 '19 08:08 lurdan