From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id u7jjCknzVV9oLgAA0tVLHw (envelope-from ) for ; Mon, 07 Sep 2020 08:46:01 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id WEEpBknzVV+uHgAAB5/wlQ (envelope-from ) for ; Mon, 07 Sep 2020 08:46:01 +0000 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 A340F94044B for ; Mon, 7 Sep 2020 08:46:00 +0000 (UTC) Received: from localhost ([::1]:54624 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFCmk-0008L2-Ie for larch@yhetil.org; Mon, 07 Sep 2020 04:45:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55392) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFCmI-0008K8-3j for emacs-orgmode@gnu.org; Mon, 07 Sep 2020 04:45:30 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]:38936) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kFCmG-00072l-EE for emacs-orgmode@gnu.org; Mon, 07 Sep 2020 04:45:29 -0400 Received: by mail-pl1-x636.google.com with SMTP id x18so4178889pll.6 for ; Mon, 07 Sep 2020 01:45:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=dgWoe9rs/GJZqdBL+plw4Meo4exu+DJ5ONxR+FWhfDo=; b=mUPZxi73VCQQMC71f3QfdCYRNCvlePTOypwI/DIb8YNh32qh4nH82g/rCJku+xDqcg cdfvS+c7wayIMagVukgt2RUlSflYARCaMvAxQN0qDJxUwJhyVweIuC6p9B/RbwZSbnKi MWZd+3wWQc2beODU8acuNAqx5yUfnUCr0OTSlXIBEUGho+GyRzXEAGnTCVlYGuozVfS1 VEKoMi9V5B5v9LEel8tZv+gT71YyK/I6xjTV1NYWugBavu/XjmUo1vGYGprmKrRp6uoS vqS2G1XaHHOWhaw6q9wQfEb3rz0ViGLdf9SomSMjOcBT5GPMsdEsmvx9Z2bkM8Twy7oh KARQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=dgWoe9rs/GJZqdBL+plw4Meo4exu+DJ5ONxR+FWhfDo=; b=Mj1puCAK9ObVlOshEWBT/AzIlUmSzuugbzTf9n6o/ZJmIcaGkYgprzeg1gPiN0gouV 5sSqX7JIYvgETUr01kZkiDN5Reo6u6n7otcnArIuwPtToOY8roofx7nRMq6d8nuz27np I7fBpCDyUYagbhzBv+h4oduYnBfZvdmxCT2iMTo3GALtK0UKJQsYCr5yE/MiPx+2lRZ3 Qizoyc7Z6kSXIP96j8HdCTyVEL3dZNiDOFYrnS7tLO9etaPqAaLGfhLBj45hG2MM6jgt 05Pa8h0QJ03RZTfBsgVq9u8Pd9wxtKQqYeJke3Nmw52VEt7PwDJL+VwmC+jJDVbvfc/T gLhw== X-Gm-Message-State: AOAM530w3jCpj+3SdEl0T81adkTHF2QJJ94Iorp4QG9zMqEf9hD18pMO PJUTT3Pncjwl2VDET0Jr1KM= X-Google-Smtp-Source: ABdhPJwnqzyTCH1wgg0QOq8ShOJNoHWZjrilKA2H9K1K4gPafa4gxc5u0yTkw/O4ZJFxcqig5IMvlA== X-Received: by 2002:a17:90a:e549:: with SMTP id ei9mr19599985pjb.52.1599468326765; Mon, 07 Sep 2020 01:45:26 -0700 (PDT) Received: from localhost (199-83-220-90.PUBLIC.monkeybrains.net. [199.83.220.90]) by smtp.gmail.com with ESMTPSA id j20sm298493pfh.146.2020.09.07.01.45.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2020 01:45:26 -0700 (PDT) From: Jack Kamm To: "Berry, Charles" Subject: Re: Help debugging R source code block output problem with :session In-Reply-To: <87tuwa9ez4.fsf@gmail.com> References: <87r1rqled0.fsf@havana> <87k0xifa9h.fsf@gmail.com> <87d03art6a.fsf@havana> <87h7slgbi5.fsf@gmail.com> <352C7149-743F-4944-ACA5-7A1242B5A3AA@health.ucsd.edu> <87tuwa9ez4.fsf@gmail.com> Date: Mon, 07 Sep 2020 01:45:25 -0700 Message-ID: <87pn6y9dqy.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=jackkamm@gmail.com; helo=mail-pl1-x636.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "emacs-orgmode@gnu.org" , Dylan Schwilk Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=gmail.com header.s=20161025 header.b=mUPZxi73; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: 0.09 X-TUID: hkfnxBGPJ5ER --=-=-= Content-Type: text/plain I just realized my patch had an issue where it freezes if there is an error in the source block. I'm attaching a second patch, to be applied on top of the first one, that fixes the issue. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=fix-R-prompt-patch.patch diff --git a/lisp/ob-R.el b/lisp/ob-R.el index b37e3965a..5ddf0ebd1 100644 --- a/lisp/ob-R.el +++ b/lisp/ob-R.el @@ -441,7 +441,7 @@ (defun org-babel-R-evaluate-session (output (let* ((tmp-file (org-babel-temp-file "R-"))) (with-temp-file tmp-file - (insert (concat body "\n" org-babel-R-eoe-indicator))) + (insert body)) (with-current-buffer session (let* ((process (get-buffer-process (current-buffer))) (string-buffer "") @@ -450,8 +450,9 @@ (defun org-babel-R-evaluate-session (concat string-buffer text))) comint-output-filter-functions))) (ess-send-string - process (format "source('%s', print.eval=TRUE)" - (org-babel-process-file-name tmp-file 'noquote))) + process (format "tryCatch(source('%s', print.eval=TRUE), finally=print(%s))" + (org-babel-process-file-name tmp-file 'noquote) + org-babel-R-eoe-indicator)) (while (not (string-match (regexp-quote org-babel-R-eoe-output) string-buffer)) (accept-process-output process)) --=-=-=--