From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.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 IJw4M73N12OQkQAAbAwnHQ (envelope-from ) for ; Mon, 30 Jan 2023 15:01:33 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id GLwlM73N12M28wAA9RJhRA (envelope-from ) for ; Mon, 30 Jan 2023 15:01:33 +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 8BB7F28FB7 for ; Mon, 30 Jan 2023 15:01:33 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pMUhs-0001Jm-Rq; Mon, 30 Jan 2023 09:00:24 -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 1pMUhq-0001In-Lu for emacs-orgmode@gnu.org; Mon, 30 Jan 2023 09:00:22 -0500 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pMUho-0006Eg-H6 for emacs-orgmode@gnu.org; Mon, 30 Jan 2023 09:00:22 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 128BE2401D9 for ; Mon, 30 Jan 2023 15:00:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1675087218; bh=jyAkW733uiK2QGAcLBAdRzWCb9zQrbCnWKDCRaasxrg=; h=From:To:Cc:Subject:Date:From; b=LXyB0Y9zzNOhuftN1qCJGFEeVJe70z5yXrd/Q9Fol1nlgnEWLTWWToDb1Y4eWEFGR e0K9xWfIt3lkc9mQJGOEL2AF3Y9DkhifBpF1YNOQz/7PKHDP4WZRWz0Uw2UDwE+6uM 2ixOzxNlnLo/wP6H1pMQL60KrL//0RkdvqWMoSpRROVatuHmYJj3MDjikyg9xVDI4n FFlqed2WaSVskfgSMO3zVFKBcpFnHC5Xvnc41XcAZ41cEeSvUxQdiaqjn/ISIrSph0 6+uMBSSJZoBqO2mQLZeAnIQ/tYWP8Rd7V4zSOBKq19BBheotXRkhQ42RGFizsn/+GC 8Nqf+K9FhMj1w== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4P58vh6Wxdz9rxG; Mon, 30 Jan 2023 15:00:16 +0100 (CET) From: Ihor Radchenko To: Matt Cc: osher jacob , emacs-orgmode 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/)] In-Reply-To: <18601435e3d.ff39cc9a634254.5523257640909678550@excalamus.com> 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> <18601435e3d.ff39cc9a634254.5523257640909678550@excalamus.com> Date: Mon, 30 Jan 2023 14:00:48 +0000 Message-ID: <87mt603ywf.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, 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=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1675087293; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=TRNj4ECB0Lysje6Bk5GMpTgujfW1towvpYuK447Uv7g=; b=sppMccLtRUNt37yO1blfa/P5Am0+YkctBwndyIBaYrnu9AT2FtErwwN15cqBR0jGQjEzUT 9RMcY9WUyME4g6tBfucw9JOY9bvqojyk+Bfl45zDG4UPDJFeO9IBQGXbI+CQnmJDGo+dup xbri3tUMirsAAG8jq0LExMVgqzr7qOXlZzQivh5EDBS4HpLRbS1UyZ/pp0Zt3VhvqrevvL KO+EMIIsRUKELT9bROL/6lOTVdC4lb9rQ1Nez6q705ONWpgw+v28q5nNwwI+a+Pn78woGh Ppe1tObDf0Etr+xXuN40lLbl/JJ4YxfL+EPBK2YV98AtZFBhPOmnDqm6Zg8T+Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=LXyB0Y9z; 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"; dmarc=pass (policy=none) header.from=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1675087293; a=rsa-sha256; cv=none; b=ByWsk8MJnqei8fvc4I0XjitfQM9wigtrygv5YDMQTPrnkjir5VMJ1X7MK7xWtcafPYSX7h HJmdH5J0537LVxo+HuNs9+svlCRhhXPfzEUJX/WyKtyGXVo6uft9Kgb1ZVIqO/vwbbcHLV UPGrekTrfDm9390ZwumpODsVMcj3LcX/cquFtR6hunPgktVrb6jHNDSSgZp/RF+GaZ0EFF 3m+vskv/Z2fZIvWokzslf/Ujv/HZiKrfoTkFRy6oRe2XQIdwEx4HSV5GywZ4nXPlmURZ5H QyB+hBIOG82zOhJw2lVgm83uYk5YIjqcl+2UpGou83nlTdB/WsLSrrljT7lZaA== Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=LXyB0Y9z; 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"; dmarc=pass (policy=none) header.from=posteo.net X-Migadu-Scanner: scn0.migadu.com X-Spam-Score: -6.34 X-Migadu-Queue-Id: 8BB7F28FB7 X-Migadu-Spam-Score: -6.34 X-TUID: 0aMAWKyJuJn7 Matt writes: > ---- 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 just thought that it is the most logical place to add trailing newline. `org-babel--write-temp-buffer-input-file' deletes the buffer contents anyway, so modification will not cause any undesired side effects. > ;; 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))) I meant inserting newline in current buffer at the beginning. > 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")) The original is just (insert query). (insert query "\n") is also ok. I don't have strong preference here. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at