emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: BUG: org-sbe not working anymore: Format specifier doesn’t match arg


From: zhaoyiyu
Subject: Re: BUG: org-sbe not working anymore: Format specifier doesn’t match argument type
Date: Wed, 22 Feb 2023 11:49:59 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1

Maybe change the org-sbe macro? Below is a workaround.

(defmacro org-sbe (source-block &rest variables)

  (declare (debug (form form)))
  (let* ((header-args (if (stringp (car variables)) (car variables) ""))
     (variables (if (stringp (car variables)) (cdr variables) variables)))
    (let* (quote
       (variables
        (mapcar
         (lambda (var)
           ;; ensure that all cells prefixed with $'s are strings
           (cons (car var)
             (delq nil (mapcar
                (lambda (el)
                  (if (eq '$ el)
                      (prog1 nil (setq quote t))
                    (prog1
                    (cond
                                         ;; FIXME: replace "\"%s\"" for quotation marks inside value
-->                     (quote (format "%S" el))
                     ((stringp el) (org-no-properties el))
                     (t el))
                      (setq quote nil))))
                (cdr var)))))
         variables)))
      (unless (stringp source-block)
    (setq source-block (symbol-name source-block)))
      (let ((result
             (if (and source-block (> (length source-block) 0))
                 (let ((params
                        ;; FIXME: Why `eval'?!?!?
                        (eval `(org-babel-parse-header-arguments
                                (concat
                                 ":var results="
                                 ,source-block
                                 "[" ,header-args "]"
                                 "("
                                 (mapconcat
                                  (lambda (var-spec)
                                    (if (> (length (cdr var-spec)) 1)
                                        (format "%S='%S"
                                                (car var-spec)
                                                (mapcar #'read (cdr var-spec)))
                                      (format "%S=%s"
                                              (car var-spec) (cadr var-spec))))
                                  ',variables ", ")
                                 ")")))))
                   (org-babel-execute-src-block
                    ;; FIXME: manual add names in list
-->                    nil (list "emacs-lisp" "results" params "" "results")
                    '((:results . "silent"))))
               "")))
        (org-trim (if (stringp result) result (format "%S" result)))))))

On 2022/11/4 15:23, Ihor Radchenko wrote:
Michael Dauer <mick.dauer@gmail.com> writes:

It's this fixed? How can I track myself?
I think it is, as a side effect of
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=9987451252fa64af65d0a0a014f41812f4402c02

I was mainly waiting for Timothy to chime in, but there was a second bug 
report...





reply via email to

[Prev in Thread] Current Thread [Next in Thread]