From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 8KDYDkDjWGHUkgAAgWs5BA (envelope-from ) for ; Sun, 03 Oct 2021 00:54:56 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id Nj6DCkDjWGFCDQAAbx9fmQ (envelope-from ) for ; Sat, 02 Oct 2021 22:54:56 +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 C215636927 for ; Sun, 3 Oct 2021 00:54:55 +0200 (CEST) Received: from localhost ([::1]:60226 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWnuA-0007bS-TX for larch@yhetil.org; Sat, 02 Oct 2021 18:54:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWnte-0007bD-9d for emacs-orgmode@gnu.org; Sat, 02 Oct 2021 18:54:23 -0400 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]:39671) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mWntc-0006DF-Nx for emacs-orgmode@gnu.org; Sat, 02 Oct 2021 18:54:22 -0400 Received: by mail-pg1-x534.google.com with SMTP id g184so12913507pgc.6 for ; Sat, 02 Oct 2021 15:54:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=sv4Kbfx+l7KTxfeoa0JvD8F0U7doE6zBb/d+5fTAdzE=; b=LA4KPuFCqsbfuvqGf1kFG19mMAyxjSNMH7bgC/MXxdyV/hLZRG5Di9qx7eJ5Fp3mi+ WQ9lELgdefCsl3CNvLy4Pmjx+a+7jaMQ1VAl1zEXwjksmXiDReCZXj83h/Y9SAibh1A5 8G7J3Yw8uwO0xunavGsczg1mCZFWqYadGpPUmV4oudV37I5xBovD6lDk9blkmza5XeGE qVGFQohFi/Aqm7HgeVrP+OSxBQw9709WAu1n7xgWF0jGohzAL5PdUBh3OIr89yZW1DvB wO+qTsWDlVNTRSuN2HYvqRy/8FvvvoKNot0C6O+I8vmRRKYQ8pL5rpnDYkrq8W/T1CZy 33Vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=sv4Kbfx+l7KTxfeoa0JvD8F0U7doE6zBb/d+5fTAdzE=; b=gFq93vgxYK5Ek2hJSydNeanEQfmY6OeAF6LGWFr0Jkt4rPHHEdSnpTrFg6fwpE1G8K aJfRwG5O6SxrwlH04GYUEk807uklKIlFYdfo+EHqqCtDh+YrRMiHHkoWlMUg+D/rE99r 5KErb9DO9a/+X8eMio9tH9sUJKEk8AHqIRNFZWKrOTZfC5zMiuP247deqIiNa9t1o+m2 waEoW9jT/+YxtF0hyQMoRREAFUSNt4oCgAhOY0t1E9GcWZyMcge73kdyEMGHdmCg5xFJ V0Wqym4RkRsLS0cZuNhY9MjW7SGuflTz/nfVHNMcC7fYCJZVWm2uOmSMHoyfqZy73IxG qIgw== X-Gm-Message-State: AOAM533+V17n0cvZasGupeiVjbvcqhoyXC2U5tOxzXNUlpaRI1NofBWy asgXU0tgfqf52DVDsHXCat8= X-Google-Smtp-Source: ABdhPJzpvgN/CYKpgN0xDCvege5WH+wBKnD1yG2DXQdDygDjUC7SyWM/TKaurXpPIehNG+oNVWKdcw== X-Received: by 2002:a62:407:0:b0:447:c104:2529 with SMTP id 7-20020a620407000000b00447c1042529mr17428231pfe.8.1633215258750; Sat, 02 Oct 2021 15:54:18 -0700 (PDT) Received: from localhost ([198.27.180.62]) by smtp.gmail.com with ESMTPSA id a7sm8998242pfn.150.2021.10.02.15.54.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 15:54:18 -0700 (PDT) From: Jack Kamm To: Jeremie Juste , Org Mode Subject: Re: [PATCH] async process in R In-Reply-To: <87zgrzclb5.fsf@debian-BULLSEYE-live-builder-AMD64> References: <87zgrzclb5.fsf@debian-BULLSEYE-live-builder-AMD64> Date: Sat, 02 Oct 2021 15:54:17 -0700 Message-ID: <87bl47ox5y.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::534; envelope-from=jackkamm@gmail.com; helo=mail-pg1-x534.google.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, 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: "Berry, Charles" Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1633215296; 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=sv4Kbfx+l7KTxfeoa0JvD8F0U7doE6zBb/d+5fTAdzE=; b=SWctFqJyR/VZ96d/B8zL6AUCUgFlbxr2ENxWUCqYrl4HmvpQZzHKznhNK4v1EiMrfkJzYU zxaQM5PmuDm47ES1fkUXfLmOaxfCfst5owkY4MyjD8a5cQyOBblq/CLhGAUdREunMryK63 zCZY2EtqCQLE6+NC7Zmm8+eIO7lgte+q3mSoOUfvt3YA5AN3sAic4wl4dDgQSph/MFi+e8 XM5zb7UvGsfL+6B5a6WCLkVBjnOJe/L3hfo+PX5/5MVE8cPhgm8wHYxZTX72k1kkHThGL8 oLmt3Hzfg3/qdFA2DYTWlob3j9Mqr1H0fhZFvMrWlQqTYhUKy9dPHoT0tYiV9Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1633215296; a=rsa-sha256; cv=none; b=eBWt97c+U7wUK5tXDzxKKE5CNntFQ4Ztj/Vi42fy1T3vjpMqkHeEwWQMYEEbCrrOgH9HfI Rhvv3MkpArOa79uOaSAvmnxuLXZ/fhPu4q4hwYINLQq1nJEE9A8uJe8MYfbwDN86Qc2G3O gFRTk/6BF64omEO3yzcIUa4JaZ/hbKut1QBhrAILOgT1WIHPX/KuEN7Csut/Kw/yn6adHR SmR9cWC65i3xXlmCrGwQ8FREfEdW1fefUfiQSEUzuQALiDF16MTifpNXGaHdf3LFil/Znv 8xrUQsrXln1NBBn88oCXbNxc07yb8piAEvv5U76acz5DiCldXl6fhGka4+eq+A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=LA4KPuFC; dmarc=pass (policy=none) header.from=gmail.com; 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-Migadu-Spam-Score: -4.01 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=LA4KPuFC; dmarc=pass (policy=none) header.from=gmail.com; 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-Migadu-Queue-Id: C215636927 X-Spam-Score: -4.01 X-Migadu-Scanner: scn1.migadu.com X-TUID: 1nG+qjwm8yXf Hi Jeremie, Many thanks for bringing this over the finish line! I'm very glad it made it into Org 9.5. All the tests passed on my end, and and I successfully ran a few async R blocks without any issues. I do have some suggestions for code style below. They apply to both the original patch, as well as followup fixes that have been committed since. > +(defconst ob-session-async-R-indicator "'ob_comint_async_R_%s_%s'") > + > +(defun ob-session-async-org-babel-R-evaluate-session For consistency with the rest of ob-R.el, as well as with the async functions in ob-python, I suggest using a prefix of "org-babel-R-async-". So "ob-session-async-org-babel-R-evaluate-session" would become "org-babel-R-async-evaluate-session", etc. > +(ert-deftest ob-session-async-R-simple-session-async-value () Again, for consistency I suggest renaming the test functions so they are prefixed with "test-ob-R/". For example, "ob-session-async-R-simple-session-async-value" could become "test-ob-R/async-session-simple-value". This would also allow easily running all the R tests using "BTEST_RE='.*ob-R.*' make test". > + (setq user-inject-src-param ess-inject-source) > (setq ess-eval-visibly nil) > + (setq ess-inject-source 'function-and-buffer) > (ess-eval-buffer nil)) > - (setq ess-eval-visibly tmp) > + (setq ess-eval-visibly tmp) > + (setq ess-inject-source user-inject-src-param) Rather than using setq, it would be better to let bind these like so: (let ((ess-eval-visibly nil) (ess-inject-source 'function-and-buffer)) ...code in here... ) This temporarily sets the variables within the let-block, then resets them to their original values afterwards. Then you can also remove the temporary variables "user-inject-src-param" and "ess-eval-visibly-tmp" as well as their defvars at the top of the file. Actually, since the code is already in a let-block, you can simply add these variables to the existing let-statement. > + (list (format org-babel-R-write-object-command > + (if row-names-p "TRUE" "FALSE") > + (if column-names-p > + (if row-names-p "NA" "TRUE") > + "FALSE") > + ".Last.value" > + (org-babel-process-file-name tmp-file 'noquote)) Some parts of ob-session-async-org-babel-R-evaluate-session, such as the above, are duplicated from org-babel-R-evaluate-session; it would be good to reduce duplication by abstracting these out to separate functions. Thanks again for porting this, and for taking care of ob-R.el in general. All the best, Jack