---- On Thu, 26 Jan 2023 04:51:19 -0500 Ihor Radchenko wrote ---
> This will add a newline to "cmdproxy.exe" command -> "cmdproxy.exe\n". > You should instead look into `org-babel--write-temp-buffer-input-file'. I made the change in `org-babel--shell-command-on-region' based on your recommendation in https://list.orgmode.org/orgmode/87bkmttv2h.fsf@localhost/ I'd be happy to put it in `org-babel--write-temp-buffer-input-file'. Unfortunately, I don't understand why you suggest the change be made there. Wouldn't it make more sense to insert the newline into the temp buffer that `org-babel--write-temp-buffer-input-file' writes from? I'm confused because I don't see a good way write a newline from `org-babel--write-temp-buffer-input-file'. All the file writing functions[fn:1], with the exception of `with-temp-file', require a region's start and end and `with-temp-file' appears to overwrite the file. ;; 99.999% sure this isn't what you meant (defun org-babel--write-temp-buffer-input-file (input-file) "Write the contents of the current temp buffer into INPUT-FILE." (let ((start (point-min)) (end (point-max))) (goto-char start) (push-mark (point) 'nomsg) (write-region start end input-file) + (with-temp-buffer + (insert "\n") + (write-region (point-min) (point-max) input-file)) (delete-region start end) (exchange-point-and-mark))) AFAICT, `org-babel--write-temp-buffer-input-file' is only called by `org-babel--shell-command-on-region' and that's only ever called by `org-babel-eval'. That's where the query (the block source) is inserted into a temp buffer. Maybe something like this? modified lisp/ob-eval.el @@ -64,7 +64,7 @@ Writes QUERY into a temp-buffer that is processed with (let ((error-buffer (get-buffer-create " *Org-Babel Error*")) exit-code) (with-current-buffer error-buffer (erase-buffer)) (with-temp-buffer - (insert query "\n") + (insert (concat query "\n")) (setq exit-code (org-babel--shell-command-on-region command error-buffer)) [fn:1] https://www.gnu.org/software/emacs/manual/html_node/elisp/Writing-to-Files.html#Writing-to-Files