emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* BUG: org-sbe not working anymore: Format specifier doesn’t match argument type
@ 2022-10-17 10:40 Michael Dauer
  2022-10-17 13:11 ` Ihor Radchenko
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Dauer @ 2022-10-17 10:40 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 283 bytes --]

Org mode version 9.5.5 (9.5.5-geeae6e

#+CALL: test1()

#+RESULTS:
: 1

#+CALL: test2()

Fails with: Format specifier doesn’t match argument type

* Test
#+name: test1
#+begin_src elisp
1
#+end_src
#+NAME: test2
#+begin_src elisp
(org-sbe "test1")
#+end_src

[-- Attachment #2: Type: text/html, Size: 378 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: BUG: org-sbe not working anymore: Format specifier doesn’t match argument type
  2022-10-17 10:40 BUG: org-sbe not working anymore: Format specifier doesn’t match argument type Michael Dauer
@ 2022-10-17 13:11 ` Ihor Radchenko
  2022-11-04  7:07   ` BUG: org-sbe not working anymore: Format " Michael Dauer
  0 siblings, 1 reply; 10+ messages in thread
From: Ihor Radchenko @ 2022-10-17 13:11 UTC (permalink / raw)
  To: Michael Dauer, Timothy; +Cc: emacs-orgmode

Michael Dauer <mick.dauer@gmail.com> writes:

> Org mode version 9.5.5 (9.5.5-geeae6e
>
> #+CALL: test1()
>
> #+RESULTS:
> : 1
>
> #+CALL: test2()
>
> Fails with: Format specifier doesn’t match argument type
>
> * Test
> #+name: test1
> #+begin_src elisp
> 1
> #+end_src
> #+NAME: test2
> #+begin_src elisp
> (org-sbe "test1")
> #+end_src

Thanks for reporting.
Confirmed.

Timothy, it is caused by your

392ccbbf5d450ad47cd5952ed2f4ef35e454648e
Author:     TEC <git@tecosaur.net>
ob-core: Display position of executed babel blocks

(nth 5 info) is nil in the above scenario. 

Could you please take a look?

I can "fix" this by using "%S" formatter, but maybe we can do better?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: BUG: org-sbe not working anymore: Format specifier doesn’t match argument type
  2022-10-17 13:11 ` Ihor Radchenko
@ 2022-11-04  7:07   ` Michael Dauer
  2022-11-04  7:23     ` Ihor Radchenko
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Dauer @ 2022-11-04  7:07 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Timothy, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1155 bytes --]

It's this fixed? How can I track myself?

Ihor Radchenko <yantar92@posteo.net> schrieb am Mo., 17. Okt. 2022, 15:11:

> Michael Dauer <mick.dauer@gmail.com> writes:
>
> > Org mode version 9.5.5 (9.5.5-geeae6e
> >
> > #+CALL: test1()
> >
> > #+RESULTS:
> > : 1
> >
> > #+CALL: test2()
> >
> > Fails with: Format specifier doesn’t match argument type
> >
> > * Test
> > #+name: test1
> > #+begin_src elisp
> > 1
> > #+end_src
> > #+NAME: test2
> > #+begin_src elisp
> > (org-sbe "test1")
> > #+end_src
>
> Thanks for reporting.
> Confirmed.
>
> Timothy, it is caused by your
>
> 392ccbbf5d450ad47cd5952ed2f4ef35e454648e
> Author:     TEC <git@tecosaur.net>
> ob-core: Display position of executed babel blocks
>
> (nth 5 info) is nil in the above scenario.
>
> Could you please take a look?
>
> I can "fix" this by using "%S" formatter, but maybe we can do better?
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
>

[-- Attachment #2: Type: text/html, Size: 2037 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: BUG: org-sbe not working anymore: Format specifier doesn’t match argument type
  2022-11-04  7:07   ` BUG: org-sbe not working anymore: Format " Michael Dauer
@ 2022-11-04  7:23     ` Ihor Radchenko
  2023-02-22  3:49       ` zhaoyiyu
  0 siblings, 1 reply; 10+ messages in thread
From: Ihor Radchenko @ 2022-11-04  7:23 UTC (permalink / raw)
  To: Michael Dauer; +Cc: Timothy, emacs-orgmode

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...

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: BUG: org-sbe not working anymore: Format specifier doesn’t match argument type
  2022-11-04  7:23     ` Ihor Radchenko
@ 2023-02-22  3:49       ` zhaoyiyu
  2023-02-22 11:18         ` Ihor Radchenko
  0 siblings, 1 reply; 10+ messages in thread
From: zhaoyiyu @ 2023-02-22  3:49 UTC (permalink / raw)
  To: Ihor Radchenko, Michael Dauer; +Cc: Timothy, emacs-orgmode

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...
>



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: BUG: org-sbe not working anymore: Format specifier doesn’t match argument type
  2023-02-22  3:49       ` zhaoyiyu
@ 2023-02-22 11:18         ` Ihor Radchenko
  2023-02-22 13:47           ` 赵一宇
  0 siblings, 1 reply; 10+ messages in thread
From: Ihor Radchenko @ 2023-02-22 11:18 UTC (permalink / raw)
  To: zhaoyiyu; +Cc: Michael Dauer, Timothy, emacs-orgmode


zhaoyiyu <zhyznd@163.com> writes:
> Maybe change the org-sbe macro? Below is a workaround.

Sorry, I was not clear.
This bug has been fixed.
I can no longer reproduce it.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re:  BUG: org-sbe not working anymore: Format specifier doesn’t match argument type
  2023-02-22 11:18         ` Ihor Radchenko
@ 2023-02-22 13:47           ` 赵一宇
  2023-02-22 13:57             ` Ihor Radchenko
  0 siblings, 1 reply; 10+ messages in thread
From: 赵一宇 @ 2023-02-22 13:47 UTC (permalink / raw)
  To: yantar92@posteo.net
  Cc: mick.dauer@gmail.com, orgmode@tec.tecosaur.net,
	emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1124 bytes --]

Oh thanks, that was clear.
However, I wanna figure out if another change would somehow fix another problem, when in the (var value) pair, the value contains quotation marks, for example 123°34'23.34", the assignment would fail.


In macro she-org,
change
(quote (format "\"%s\"" el))
to
(quote (format "%S" el))


Now I can use the $ prefix to assign the string value.


|
zhyznd@163.com
|
---- Replied Message ----
| From | Ihor Radchenko<yantar92@posteo.net> |
| Date | 2/22/2023 19:18 |
| To | zhaoyiyu<zhyznd@163.com> |
| Cc | Michael Dauer<mick.dauer@gmail.com> ,
Timothy<orgmode@tec.tecosaur.net> ,
<emacs-orgmode@gnu.org> |
| Subject | Re: BUG: org-sbe not working anymore: Format specifier doesn’t match argument type |

zhaoyiyu <zhyznd@163.com> writes:
Maybe change the org-sbe macro? Below is a workaround.

Sorry, I was not clear.
This bug has been fixed.
I can no longer reproduce it.

--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

[-- Attachment #2: Type: text/html, Size: 6862 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re:  BUG: org-sbe not working anymore: Format specifier doesn’t match argument type
  2023-02-22 13:47           ` 赵一宇
@ 2023-02-22 13:57             ` Ihor Radchenko
  2023-02-22 14:05               ` 赵一宇
  0 siblings, 1 reply; 10+ messages in thread
From: Ihor Radchenko @ 2023-02-22 13:57 UTC (permalink / raw)
  To: 赵一宇
  Cc: mick.dauer@gmail.com, orgmode@tec.tecosaur.net,
	emacs-orgmode@gnu.org

赵一宇 <zhyznd@163.com> writes:

> However, I wanna figure out if another change would somehow fix another problem, when in the (var value) pair, the value contains quotation marks, for example 123°34'23.34", the assignment would fail.

Could you please provide a reproducer?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re:  BUG: org-sbe not working anymore: Format specifier doesn’t match argument type
  2023-02-22 13:57             ` Ihor Radchenko
@ 2023-02-22 14:05               ` 赵一宇
  2023-02-23  9:33                 ` Ihor Radchenko
  0 siblings, 1 reply; 10+ messages in thread
From: 赵一宇 @ 2023-02-22 14:05 UTC (permalink / raw)
  To: yantar92@posteo.net
  Cc: mick.dauer@gmail.com, orgmode@tec.tecosaur.net,
	emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1229 bytes --]

Here is an example, in org file


#+name: test
#+begin_src emacs-lisp :var a :results silent
a
#+end_src


Now, if I execute 
(org-sbe "test" (a "123°34'23.34\"otherthing"))
it would say: Reference 123°34'23.34"otherthing not found
and
(org-sbe "test" (a $"123°34'23.34\"otherthing"))
would result 123°34'23.34
|
|


|
|
zhyznd@163.com
|
---- Replied Message ----
| From | Ihor Radchenko<yantar92@posteo.net> |
| Date | 2/22/2023 21:57 |
| To | 赵一宇<zhyznd@163.com> |
| Cc | mick.dauer@gmail.com<mick.dauer@gmail.com> ,
orgmode@tec.tecosaur.net<orgmode@tec.tecosaur.net> ,
emacs-orgmode@gnu.org<emacs-orgmode@gnu.org> |
| Subject | Re: BUG: org-sbe not working anymore: Format specifier doesn’t match argument type |
赵一宇 <zhyznd@163.com> writes:

However, I wanna figure out if another change would somehow fix another problem, when in the (var value) pair, the value contains quotation marks, for example 123°34'23.34", the assignment would fail.

Could you please provide a reproducer?

--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

[-- Attachment #2: Type: text/html, Size: 10626 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re:  BUG: org-sbe not working anymore: Format specifier doesn’t match argument type
  2023-02-22 14:05               ` 赵一宇
@ 2023-02-23  9:33                 ` Ihor Radchenko
  0 siblings, 0 replies; 10+ messages in thread
From: Ihor Radchenko @ 2023-02-23  9:33 UTC (permalink / raw)
  To: 赵一宇
  Cc: mick.dauer@gmail.com, orgmode@tec.tecosaur.net,
	emacs-orgmode@gnu.org

赵一宇 <zhyznd@163.com> writes:

> Here is an example, in org file
>
>
> #+name: test
> #+begin_src emacs-lisp :var a :results silent
> a
> #+end_src
>
>
> Now, if I execute 
> (org-sbe "test" (a "123°34'23.34\"otherthing"))
> it would say: Reference 123°34'23.34"otherthing not found

Fixed, on main.
I made org-sbe accept quoting string values with "$".
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=2e883b21a

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-02-23  9:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-17 10:40 BUG: org-sbe not working anymore: Format specifier doesn’t match argument type Michael Dauer
2022-10-17 13:11 ` Ihor Radchenko
2022-11-04  7:07   ` BUG: org-sbe not working anymore: Format " Michael Dauer
2022-11-04  7:23     ` Ihor Radchenko
2023-02-22  3:49       ` zhaoyiyu
2023-02-22 11:18         ` Ihor Radchenko
2023-02-22 13:47           ` 赵一宇
2023-02-22 13:57             ` Ihor Radchenko
2023-02-22 14:05               ` 赵一宇
2023-02-23  9:33                 ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).