From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id Ch4qFDkdDl+tZwAA0tVLHw (envelope-from ) for ; Tue, 14 Jul 2020 21:01:45 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id CCOTDzkdDl8XFQAAbx9fmQ (envelope-from ) for ; Tue, 14 Jul 2020 21:01:45 +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 908689404D7 for ; Tue, 14 Jul 2020 21:01:44 +0000 (UTC) Received: from localhost ([::1]:47810 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jvS3Z-0005jx-Tm for larch@yhetil.org; Tue, 14 Jul 2020 17:01:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jvS2O-0005jW-4n for emacs-orgmode@gnu.org; Tue, 14 Jul 2020 17:00:29 -0400 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]:50959) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jvS2J-0004eR-LZ for emacs-orgmode@gnu.org; Tue, 14 Jul 2020 17:00:27 -0400 Received: by mail-pj1-x1041.google.com with SMTP id k71so2399556pje.0 for ; Tue, 14 Jul 2020 14:00:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:subject:in-reply-to:date:message-id :mime-version; bh=MPvcS1hcB2Jz2cxP7JqqL1pQNifu4uY4aQLN51nRwd4=; b=aQOW7eWA8TnEV+WsDJrnGNS/zGEr09LY3BsJ5+vHYKyjza7Le/R+gYCZ0HMEwj0fyn e77iz0lmDZ1wAlpGywgMrcO7iyDSVYVGFE/mfnFa9+nUca8yhrw/J6LITS+0bGqSKCbe MqpmfTzyKKJYOM2Jnuq6F9+jDDqz0oBgigoayaYPN8HcZD1ZbPgz3oZUG6nOHMutkne0 nkVSfd2awLNdm+RoTl5ylTj/uWCbDgOeXZ2JQCWGIm6Q7XT1WKDzLv/uxIcMN6GfkSZG gghmRdYiSKNionfnY5CEAehjyeKaX8yh4KgE6XDY9pGMUTyHdar4aZv4zUduMsykxSfe g7Xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:subject :in-reply-to:date:message-id:mime-version; bh=MPvcS1hcB2Jz2cxP7JqqL1pQNifu4uY4aQLN51nRwd4=; b=cVvMKvtWMZD4M5T+hru3q72Fi2hgPrppASTwDB1Aoj377qpWnDrr7CdGxplRMl7aGY xO8k1QZ3Jn3az4QPze4wOZHXYrlsYILpKJAV/Tzc/ccl0kgbiUjF55L3iCiJz0K3iDLS BJQeWnRooEi3NwhhIttCZLJECOzZ/2yd3YMAGayLuV6SNw74quvX6sON5SIH4y+R2zhH zwzu4+tgIv93nAxbHkyFGuh8h+eAkWZ6exsxtOTJIoes/z+0XOQAR8d+ubt+oUKi7xfr sGbKqgagirkbbOj7dQK/izo43Zhdwo3y1arpV1Fbtof9MlbG4x2EfvtvdtrXaslUqyJQ SFqg== X-Gm-Message-State: AOAM533BcGckxDJ4q0MUpC20ui98oYdtQ/QQFynXPlZ6+ic49zFfW5T/ CK8azB296CeeKtOQYp7cVigwJamzG9w= X-Google-Smtp-Source: ABdhPJz5ZZsP/+EmFHR0hvzNa9TKhCvad9Ds98Rb86dnpdTXyleDBMoSS3kA8adizE/wOa9oOK//mA== X-Received: by 2002:a17:902:8546:: with SMTP id d6mr5440685plo.220.1594760421638; Tue, 14 Jul 2020 14:00:21 -0700 (PDT) Received: from geus3064linuxwsm (97-126-92-2.tukw.qwest.net. [97.126.92.2]) by smtp.gmail.com with ESMTPSA id d12sm73547pfh.196.2020.07.14.14.00.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2020 14:00:21 -0700 (PDT) References: <877dvcsmgu.fsf@gmail.com> <874kqa66hb.fsf@kyleam.com> User-agent: mu4e 1.4.3; emacs 26.3 From: Ken Mankoff To: Kyle Meyer , emacs-orgmode@gnu.org Subject: [PATCH] 3 improvements to ob-screen In-reply-to: <874kqa66hb.fsf@kyleam.com> Date: Tue, 14 Jul 2020 14:00:20 -0700 Message-ID: <87h7u93j8b.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::1041; envelope-from=mankoff@gmail.com; helo=mail-pj1-x1041.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, URIBL_BLOCKED=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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=aQOW7eWA; 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-Spam-Score: -0.21 X-TUID: YTD4MqgrSrjq --=-=-= Content-Type: text/plain Hello, The attached three patches implement a bug fix, a simplification, and a new feature to ob-screen. bug fix: 001 Execute last line in block (send newline) simplify: 002 Don't add extra characters to session name feature: 003 Accept :screenrc header argument I've signed the FSF docs but do not see my name here: https://orgmode.org/worg/org-contribute.html under "Current contributors". -k. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-ob-screen-Execute-last-line-in-block-send-newline.patch >From cb014cd2da79b30967dd24fba37d7f75569ed92d Mon Sep 17 00:00:00 2001 From: "Kenneth D. Mankoff" Date: Tue, 14 Jul 2020 13:29:36 -0700 Subject: [PATCH 1/3] ob-screen: Execute last line in block (send newline) --- lisp/ob-screen.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/ob-screen.el b/lisp/ob-screen.el index 75a2dc691..3edc2c265 100644 --- a/lisp/ob-screen.el +++ b/lisp/ob-screen.el @@ -108,6 +108,7 @@ In case you want to use a different screen than one selected by your $PATH") (let ((tmpfile (org-babel-temp-file "screen-"))) (with-temp-file tmpfile (insert body) + (insert "\n") ;; org-babel has superfluous spaces (goto-char (point-min)) -- 2.25.1 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0002-ob-screen-Respect-session-name.-Don-t-prepend-org-ba.patch >From e6ee8bff913da35a0183f8e2c1db7021342492d9 Mon Sep 17 00:00:00 2001 From: "Kenneth D. Mankoff" Date: Tue, 14 Jul 2020 13:41:35 -0700 Subject: [PATCH 2/3] ob-screen: Respect :session name. Don't prepend 'org-babel-session-' --- etc/ORG-NEWS | 7 +++++++ lisp/ob-screen.el | 6 ++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index c366f61e0..623fa9dc3 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -380,6 +380,13 @@ From ~org-enable-priority-commands~ to ~org-priority-enable-commands~. From ~org-show-priority~ to ~org-priority-show~. ** Miscellaneous +*** =ob-screen.el=: Respect screen =:session= name + +Screen babel session are now named based on the =:session= header +argument (defaults to ~default~). + +Previously all session names had ~org-babel-session-~ prepended. + *** Forward/backward paragraph functions in line with the rest of Emacs ~org-forward-paragraph~ and ~org-backward-paragraph~, bound to ~~ and ~~ functions mimic more closely behaviour of diff --git a/lisp/ob-screen.el b/lisp/ob-screen.el index 3edc2c265..fe4698203 100644 --- a/lisp/ob-screen.el +++ b/lisp/ob-screen.el @@ -62,8 +62,7 @@ In case you want to use a different screen than one selected by your $PATH") (process-name (concat "org-babel: terminal (" session ")"))) (apply 'start-process process-name "*Messages*" terminal `("-T" ,(concat "org-babel: " session) "-e" ,org-babel-screen-location - "-c" "/dev/null" "-mS" ,(concat "org-babel-session-" session) - ,cmd)) + "-c" "/dev/null" "-mS" ,session ,cmd)) ;; XXX: Is there a better way than the following? (while (not (org-babel-screen-session-socketname session)) ;; wait until screen session is available before returning @@ -97,8 +96,7 @@ In case you want to use a different screen than one selected by your $PATH") nil (mapcar (lambda (x) - (when (string-match - (concat "org-babel-session-" session) x) + (when (string-match x) x)) sockets))))) (when match-socket (car (split-string match-socket))))) -- 2.25.1 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0003-ob-screen-accept-screenrc-header-argument.patch >From 866f3c4788e58bf26dcf9c90cb7638f48a6a4ecc Mon Sep 17 00:00:00 2001 From: "Kenneth D. Mankoff" Date: Tue, 14 Jul 2020 13:48:52 -0700 Subject: [PATCH 3/3] ob-screen: accept :screenrc header argument --- etc/ORG-NEWS | 6 ++++++ lisp/ob-screen.el | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 623fa9dc3..5fb2af22e 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -229,6 +229,12 @@ directory configured for ClojureScript will /not/ work. Babel Java blocks recognize header argument =:cmdargs= and pass its value in call to =java=. +*** =ob-screen.el=: Screen now accepts =:screenrc= header argument + +Screen blocks now recognize the =:screenrc= header argument and pass +its value to the screen command via the "-c" option. The default +remains =/dev/null= (i.e. a clean screen session) + *** =RET= and =C-j= now obey ~electric-indent-mode~ Since Emacs 24.4, ~electric-indent-mode~ is enabled by default. In diff --git a/lisp/ob-screen.el b/lisp/ob-screen.el index fe4698203..7115080f8 100644 --- a/lisp/ob-screen.el +++ b/lisp/ob-screen.el @@ -40,7 +40,7 @@ In case you want to use a different screen than one selected by your $PATH") (defvar org-babel-default-header-args:screen - '((:results . "silent") (:session . "default") (:cmd . "sh") (:terminal . "xterm")) + '((:results . "silent") (:session . "default") (:cmd . "sh") (:terminal . "xterm") (:screenrc . "/dev/null")) "Default arguments to use when running screen source blocks.") (defun org-babel-execute:screen (body params) @@ -59,10 +59,11 @@ In case you want to use a different screen than one selected by your $PATH") (let* ((session (cdr (assq :session params))) (cmd (cdr (assq :cmd params))) (terminal (cdr (assq :terminal params))) + (screenrc (cdr (assq :screenrc params))) (process-name (concat "org-babel: terminal (" session ")"))) (apply 'start-process process-name "*Messages*" terminal `("-T" ,(concat "org-babel: " session) "-e" ,org-babel-screen-location - "-c" "/dev/null" "-mS" ,session ,cmd)) + "-c" ,screenrc "-mS" ,session ,cmd)) ;; XXX: Is there a better way than the following? (while (not (org-babel-screen-session-socketname session)) ;; wait until screen session is available before returning -- 2.25.1 --=-=-=--