From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id QB2fK0Fd12NjJgAAbAwnHQ (envelope-from ) for ; Mon, 30 Jan 2023 07:01:37 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id yPqtKkFd12Nx5wAAG6o9tA (envelope-from ) for ; Mon, 30 Jan 2023 07:01:37 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5BE12AEDE for ; Mon, 30 Jan 2023 07:01:37 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pMNDs-0001s3-Kp; Mon, 30 Jan 2023 01:00:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pMNDq-0001qe-Ps for emacs-orgmode@gnu.org; Mon, 30 Jan 2023 01:00:54 -0500 Received: from sender4-op-o14.zoho.com ([136.143.188.14]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pMNDi-0000O7-PD for emacs-orgmode@gnu.org; Mon, 30 Jan 2023 01:00:54 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1675058440; cv=none; d=zohomail.com; s=zohoarc; b=iBh1lbogPuAlrbwIaRlO6bzUmI2XBq9Kvz8Y8cOnGEBa0on+tfUVDxTfrQ4QIKiIUe8chYpCX6D1KNXj9VgrOxurOZAdAhixEzqmVwYjNqVGOGAD+eDVT8JO/WKL2K/o/ErfVOoPiEW3WBdWXc7pz0J2d9KGVEfvpJYLIz8QjNE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675058440; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=mj1/LvGBqW63dn2UYYxjLFUDEUM07M6vi4SKZEjZUeU=; b=dX18cL5ZP85CjGAG+u3mrtDYSb1HEM/XTf7V1aN00m99iYM9K7CJr5cQUJbbmWGiQxLobnJqFqM/H2kyL+SeZouztkn6beoQ1Qbbaz6/S3MHbCkSQHkcWX1Vr8SdmmIOmG1dh80oUWkf/vpkNhsHYy5S9oXoE/qfHU8NpuMg6d4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=excalamus.com; spf=pass smtp.mailfrom=matt@excalamus.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1675058440; s=zmail; d=excalamus.com; i=matt@excalamus.com; h=Date:Date:From:From:To:To:Cc:Cc:Message-ID:In-Reply-To:References:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=mj1/LvGBqW63dn2UYYxjLFUDEUM07M6vi4SKZEjZUeU=; b=fijb5NEjvdAayZyhSDx9nehErl0DdZ3FBqIU/mp48tyrqg6G7p2qfVj95N0EJF/m uxg7kkK7yNbSFJ47xLsgVbid+bSe8Bo5cPKqufhNycdqU2GJCd+8NPODQHzs2uPDUQB MNpmbMwc4iGtFsW1vnFDIO69GQ5QQE79qalw/yPc= Received: from mail.zoho.com by mx.zohomail.com with SMTP id 1675058437710424.50846196344537; Sun, 29 Jan 2023 22:00:37 -0800 (PST) Date: Mon, 30 Jan 2023 01:00:37 -0500 From: Matt To: "Ihor Radchenko" Cc: "osher jacob" , "emacs-orgmode" Message-ID: <18601435e3d.ff39cc9a634254.5523257640909678550@excalamus.com> In-Reply-To: <87fsbxwrmw.fsf@localhost> References: <185bc86c826.11ae860d1190626.407710511075709301@excalamus.com> <185bd43e452.bb3f5419220019.823265614059778953@excalamus.com> <185c34814a4.bcdd7b94578193.327779579906739164@excalamus.com> <87ilh48b6p.fsf@localhost> <185cd70ae39.f63b9940267772.3953346328326599863@excalamus.com> <87bkmttv2h.fsf@localhost> <185dc9cbce2.e7688b29675726.108231333271155983@excalamus.com> <185ec3f46e2.f96332c0506072.2994965640426706061@excalamus.com> <87fsbxwrmw.fsf@localhost> Subject: Re: [BUG] ob-shell doesn't evaluate last line on Windows (cmd/cmdproxy) [9.6.1 ( @ c:/Users/Osher/AppData/Roaming/.emacs.d/elpa/org-9.6.1/)] MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Importance: Medium User-Agent: Zoho Mail X-Mailer: Zoho Mail Received-SPF: pass client-ip=136.143.188.14; envelope-from=matt@excalamus.com; helo=sender4-op-o14.zoho.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1675058497; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=mj1/LvGBqW63dn2UYYxjLFUDEUM07M6vi4SKZEjZUeU=; b=Fhs7hHMmBGmiahEh7MCBQjqe81k303iRZumcmR28jrDTMXFmTz4jdkxUpZyT6UuCyT4mGb gQOYEDzg6nRb8VO0zCUYrbEJqNAmNPO0fDbWX8gNNDf/sydZVx1G9NTN0QoBaGifOLgX0N eH/xLvnHxHV6JAjnhcbsblVQLcalm6x9j+oDPwbTCmAPgYs7gSOhbPMVdr9TjHcwI48YTz g51sFQD1eXfW2K1uz+9qi74kySIGmBGPab153MoQv6dp11SZLOdkAe8IKbOyT15nP4I39W +myMSPXfRbOY3HQPRS+pW+lI87pi9gYwHz9vOZ9NdMm8H1TJkYxDa4FydSXOhg== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=excalamus.com header.s=zmail header.b=fijb5NEj; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; arc=pass ("zohomail.com:s=zohoarc:i=1") ARC-Seal: i=2; s=key1; d=yhetil.org; t=1675058497; a=rsa-sha256; cv=pass; b=t4YaxYuZjaA4A6N1HiRM/Eh6TfVt5IVDS9Cgy/BpueraPjJ+6MHXRQdwd8A/BinWJnKeMo KmibPO4FYYTQxLTVtMHvxQvIWOcSp9i95ZhSSaFaPN9nPYjALr1KQFGCMCGLFuGxpEnG4R hYT+/fpcKp4jLbP7OGiUsT7pemqtDLnCLSmKCEUaSugNB4StRdyBp4OiNLErGovpk4TAoO kOMDjBnCiakQRDkJQSIDOUETYk882a8umhhv22O33bj+2KLqz0xz0MGJJUf+WrXOKc1t5B eOW7Gud7BVGtJ1/nEN9qjybXffAm7Gpdrh1n9jgpetrJZXn9eVT523X5+QGQWw== Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=excalamus.com header.s=zmail header.b=fijb5NEj; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; arc=pass ("zohomail.com:s=zohoarc:i=1") X-Migadu-Scanner: scn0.migadu.com X-Migadu-Spam-Score: -6.79 X-Spam-Score: -6.79 X-Migadu-Queue-Id: 5BE12AEDE X-TUID: 2h2I8LXvts5w ---- 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