"Christopher M. Miles" <[email protected]> writes:

> Don't know why, I checked my previous sent email headers raw info, have
> not found any mailing list reply address info. I guess that's why.

Re-added. Please make sure to CC the list to keep the conversation
public. I am not sure why, but I consistently see the list stripped from
CC in your emails.

>>> I noticed that the 'remove-echo is not working as I expected. Is it
>>> supposed output result like this? If no, how to fix it?
>>
>> You are inserting a body that is different from what you pass to
>> `org-babel-comit-with-output', so indeed it cannot remote it.
>>
>> (dolist (code (append (split-string body "\n")
>>                                                  (list (format "print(%S)" 
>> org-babel-lua-eoe))))
>>                              (goto-char (point-max))
>>                              (insert (org-babel-chomp code))
>>                              (comint-send-input nil t))
>>
>> is unnecessary and makes body stripping fail.
>> Moreover, it risks mixing body lines with output.
>> Just insert body (maybe full-body?) as a single string. No need to split it.
>>
>
> I tried your mention (insert full-body) in bellowing diff the first "+"
> added (commented out) part. But it suspend Emacs after
> (comint-send-input nil t) evaluation. Don't know why. I tried edebug on
> `org-babel-comint-with-output`, it does not enter this macro in edebug.
> Maybe because the `full-body'? Because when I switch back to old patch
> implementation, lua source block [C-c C-c] execution output correctly.
>
> I checked other ob-*.el's `org-babel-comint-with-output' example code,
> but have not found similar with Lua situation. Can you help me on this
> part code?
>
> #+begin_src diff
>  (defun org-babel-execute:lua (body params)
>    "Execute Lua BODY according to PARAMS.
> @@ -99,26 +97,37 @@ (defun org-babel-execute:lua (body params)
>                     (org-babel-lua-evaluate
>                   full-body cmd result-type result-params preamble))
>                    ;; session evaluation
> +
> +                  ;; (t
> +                  ;;  (let* ((session (org-babel-lua-initiate-session (cdr 
> (assq :session params)))))
> +                  ;;    (org-babel-comint-with-output
> +                  ;;        ;; (BUFFER EOE-INDICATOR REMOVE-ECHO FULL-BODY 
> PROMPT-HANDLING)
> +                  ;;        (session (format "%S" org-babel-lua-eoe) 
> 'remove-echo full-body 'filter-prompts)
> +                  ;;      (goto-char (point-max))
> +                  ;;      (insert full-body)
> +                  ;;      (comint-send-input nil nil))))
> +
>                    (t
>                     (let* ((session (org-babel-lua-initiate-session (cdr 
> (assq :session params)))))
>                       (mapconcat
>                        #'org-babel-lua-strip-prompt
> - -                      (split-string
> - -                       (car
> - -                        (mapcar
> - -                         #'substring-no-properties
> - -                         (org-babel-comint-with-output
> - -                             (session (format "%S" org-babel-lua-eoe) 
> 'remove-echo body 'filter-prompts)
> - -                           (dolist (code (append (split-string body "\n")
> - -                                                 (list (format "print(%S)" 
> org-babel-lua-eoe))))
> - -                             (goto-char (point-max))
> - -                             (insert (org-babel-chomp code))
> - -                             (comint-send-input nil t)))))
> - -                       "\n")
> - -                      ;; (butlast
> - -                      ;;  ;; Remove `org-babel-lua-eoe-indicator' output 
> line.
> - -                      ;;  1)
> - -                      ))))))
> +                      ;; remove `org-babel-lua-eoe-indicator' output line.
> +                      (butlast
> +                       (split-string
> +                        (car
> +                         (mapcar
> +                          #'substring-no-properties
> +                          (org-babel-comint-with-output
> +                              (session (format "%S" org-babel-lua-eoe) 
> 'remove-echo body 'filter-prompts)
> +                            (dolist (code (append (split-string body "\n")
> +                                                  (list (format "print(%S)" 
> org-babel-lua-eoe))))
> +                              (goto-char (point-max))
> +                              (insert (org-babel-chomp code))
> +                              (comint-send-input nil t)))))
> +                        "\n")
> +                       2)
> +                      )))
> +                  )))
>      (org-babel-result-cond (cdr (assq :result-params params))
>        result (org-babel-lua-read result))))
> #+end_src

Can you send a patch and a reproducer? Then, I can debug on my side.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
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>

Reply via email to