From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id aIjbH+07+mNyFAAAbAwnHQ (envelope-from ) for ; Sat, 25 Feb 2023 17:48:45 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id SF/AH+07+mMVDgEAauVa8A (envelope-from ) for ; Sat, 25 Feb 2023 17:48:45 +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 26A871A4E1 for ; Sat, 25 Feb 2023 17:48:45 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVxiB-0004Op-Rf; Sat, 25 Feb 2023 11:47:51 -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 1pVxiA-0004OZ-JU for emacs-orgmode@gnu.org; Sat, 25 Feb 2023 11:47:50 -0500 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pVxi8-0006Jt-Ub for emacs-orgmode@gnu.org; Sat, 25 Feb 2023 11:47:50 -0500 Received: by mail-pl1-x630.google.com with SMTP id i10so2579417plr.9 for ; Sat, 25 Feb 2023 08:47:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from :user-agent:references:from:to:cc:subject:date:message-id:reply-to; bh=6+ii1Ortro5KMO9maWuYngdSNVPn+X65rss/hRC0SIM=; b=iiuYwoGZYVBCo9ihABmLehW0QOSHBrrS0gL/Ion41aN+xU7/ZqwD/KesFkL6DyPtki wJhKIj8dIh56UtgghJvN4eaPwsOYJgIyZRGYcECdEhvJOwmHSIkQHBRMTcQACsvaciUR lZ0KrHYI08pGx7+vZ1BsQnudyqsmyxSQSJHTvJAN+HJjDqeC7btJEQDaXfLVFksr5yhi 41MXu2fObNCdjAMvNjAhwK/w1VoWtQfEXqJtNNl7skfzQDYCCJojuae2ctr5pWX4Z6GK aCyhJNP6ii3sV+NYxHfjp2nykK5pvFTXyroKkEQEKB2xU/lJrnZfKveMY56Z5X9fSEhI Sn4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from :user-agent:references:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=6+ii1Ortro5KMO9maWuYngdSNVPn+X65rss/hRC0SIM=; b=LCvrc0eD7h9B7yJAYIlWDMFw9hfEhdCjr0iKiXTulyFQ8jCRaKuUKZSjWbTgIlo02y 6khoz919qpsTweFlXClFA8I0+35cgb/eC25L1A+s9Gu86SqufajNIij/3axUFhQIGmg7 l1YKGWtWt2DIQw9YeCKRG6RY79HsXHpv9oXG84VGIrSq/z4E9xtDlYKuuvTBrT6bw67z OZq6CruxAvAHcKMFaBJ2XiYpGzq4oriJi6d3fP+jR2jKLtTTRg5o2hpJ2j6978nV+rKq HwMkyN6vN58PZRcK7LMih869POm8OiEK92KA7+FynFn76IpYHF4AGaNMxHv4BF5K+DBC +nyw== X-Gm-Message-State: AO0yUKVI/vSghoXaOTaIRR1FleqIYjxIiljm1veBs6X7zDfjg7tS8xqp lXWCWVTmm1/R8HOQEH0w9YkQh0s2bUkJNXqrwlo= X-Google-Smtp-Source: AK7set+V9yv96MruiohIiGSiJUuTHjEo55I/s+vEXuT8QkWoajsClAqR5rTYfaivM2Ah8rTQfXLVow== X-Received: by 2002:a17:902:c941:b0:19c:d401:ecb with SMTP id i1-20020a170902c94100b0019cd4010ecbmr8186730pla.63.1677343667474; Sat, 25 Feb 2023 08:47:47 -0800 (PST) Received: from t480 (97-113-138-203.tukw.qwest.net. [97.113.138.203]) by smtp.gmail.com with ESMTPSA id s7-20020a170902988700b0019a70a85e8fsm1474755plp.220.2023.02.25.08.47.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Feb 2023 08:47:46 -0800 (PST) References: <87pm9z8089.fsf@t480.home> <87y1om7w23.fsf@t480.home> <96a91a35-eeb6-55d3-683d-5d51ff6d496e@gmail.com> <877cw5aiab.fsf@t480.home> User-agent: mu4e 1.8.13; emacs 27.1 From: Ken Mankoff To: Max Nikulin Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] lisp/ob-screen.el: Support ~:var~ header args for babel blocks In-reply-to: Date: Sat, 25 Feb 2023 08:47:46 -0800 Message-ID: <87sfet7kul.fsf@t480.home> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=mankoff@gmail.com; helo=mail-pl1-x630.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.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-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1677343725; a=rsa-sha256; cv=none; b=SwQxnN95EWbEWCGWl/l4E6hlu13G2XDErkVdxrrJ4xlprC/heaclt7XiaBFn8QnL84tCHw S4HBeDsTdsNvw4ORJt2GTGIj4mAs0r148KOJ7l6Oaxroe+LCPmJH1dh3SFLaZHTZP9Mtjq PNn4qqSNhcQC+6/Xg5v98c9I1T7I7TfrYDHUeoxcGlvO7oBi0ln6w/CdDKoD+r1lSTaN1K xdvgLI1r0XrN5S0DSx+Ur6SnBqB429Ldkxl0eAiYRj/ClBzOXvrUsuyv4UCArPG8ae9saj uJ5wbHGLAp9zN40KtBDTUw3ZS9awSFSniNAeOI8Bzb6DyGCcJKUEJrYkCs47pQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=iiuYwoGZ; dmarc=pass (policy=none) header.from=gmail.com; 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-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1677343725; 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=6+ii1Ortro5KMO9maWuYngdSNVPn+X65rss/hRC0SIM=; b=EXI2yh+3zHLy8z9vU8YtJN9xREB1M6M5jBmn8K8tNcZj0AlwT/MqnZGCpbOtCgad08WOWO ++lvAgsB2CexHcmEeNMltUmbttqjjYJhbED1dVddHkDXW0KnanQlSSwghN3Um3HzOZTwq6 lqmxUeg9sk/kbAyDq+eTrZEw8lxUm1xUMTGlc1ZbkezU2mrrxGmefDl7eFda+7Nh6J0ezf cnJElHpZRvvLUvDFT7EeFykMChe3bcy4WffBKZVN2lHqDs8F0EFYz7wf4gC58waRg3lmUR 99sPx5L0bY7AY3JrLzoiWAVqS+8S+W2nDTdKy0eaf6ppdfF5CaHmXUWvrOxFFw== X-Migadu-Spam-Score: -4.90 X-Spam-Score: -4.90 X-Migadu-Queue-Id: 26A871A4E1 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=iiuYwoGZ; dmarc=pass (policy=none) header.from=gmail.com; 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" X-Migadu-Scanner: scn1.migadu.com X-TUID: XK9vCA0rHw9I --=-=-= Content-Type: text/plain Hi Max, On 2023-02-25 at 08:05 -08, Max Nikulin wrote: > I believe, it is safer to define > `org-babel-variable-assignments:screen' some way: alias, substitution, > function that calls `org-babel-variable-assignments:shell'. I am > unsure which variant is better. I see a couple of callers for specific > language in ob-core.el. How's this with a defalias? -k. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-lisp-ob-screen.el-Support-var-header-args-for-babel-.patch >From f7ca0258d72b3da5743b1134718b1d1f0d74491d Mon Sep 17 00:00:00 2001 From: "Kenneth D. Mankoff" Date: Mon, 20 Feb 2023 21:40:39 -0800 Subject: [PATCH] lisp/ob-screen.el: Support var header args for babel blocks * ob-screen.el: (org-babel-execute:screen): Parse header params for `:var', then inject into screen session. * etc/ORG-NEWS: Document as New Feature --- etc/ORG-NEWS | 12 ++++++++++++ lisp/ob-screen.el | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 87ecd77cd..0da686354 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -106,6 +106,18 @@ selection. TODO state, priority, tags, statistics cookies, and COMMENT keywords are allowed in the tree structure. +*** ob-screen now supports :var header arguments + +The ~:var~ header arg is now supported. + +#+BEGIN_src org +,#+BEGIN_SRC screen :var x=42 +,echo $x +,#+END_SRC +#+END_src + + + * Version 9.6 ** Important announcements and breaking changes diff --git a/lisp/ob-screen.el b/lisp/ob-screen.el index 269538e79..6e6a31ea6 100644 --- a/lisp/ob-screen.el +++ b/lisp/ob-screen.el @@ -40,6 +40,10 @@ (require 'ob) +;; Reuse the variable assignment code from ob-shell +(defalias 'org-babel-variable-assignments:screen + 'org-babel-variable-assignments:shell) + (defvar org-babel-screen-location "screen" "The command location for screen. In case you want to use a different screen than one selected by your $PATH") @@ -55,8 +59,12 @@ In case you want to use a different screen than one selected by your $PATH") (message "Sending source code block to interactive terminal session...") (save-window-excursion (let* ((session (cdr (assq :session params))) + (var-lines (org-babel-variable-assignments:screen params)) (socket (org-babel-screen-session-socketname session))) (unless socket (org-babel-prep-session:screen session params)) + (mapcar (lambda (var) + (org-babel-screen-session-execute-string session var)) + var-lines) (org-babel-screen-session-execute-string session (org-babel-expand-body:generic body params))))) -- 2.34.1 --=-=-=--