From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id uE2JEarUT2TvggEASxT56A (envelope-from ) for ; Mon, 01 May 2023 17:03:06 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id oBFwEKrUT2RwHwAAG6o9tA (envelope-from ) for ; Mon, 01 May 2023 17:03:06 +0200 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 157C6154BA for ; Mon, 1 May 2023 17:03:06 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ptTqE-0007ah-Pk; Mon, 01 May 2023 09:45:23 -0400 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 1ptTqB-0007aT-Ux for emacs-orgmode@gnu.org; Mon, 01 May 2023 09:45:19 -0400 Received: from [39.171.215.100] (helo=Mac-mini.local) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ptTq5-0001Zm-Ff for emacs-orgmode@gnu.org; Mon, 01 May 2023 09:45:19 -0400 Received: by Mac-mini.local (Postfix, from userid 501) id 928E78AA12F0; Mon, 1 May 2023 21:45:05 +0800 (CST) References: <87354hs9pz.fsf@localhost> <87mt2oqyup.fsf@localhost> <877cts8emr.fsf@localhost> <87y1m86vnj.fsf@localhost> User-agent: mu4e 1.10.3; emacs 30.0.50 From: "Christopher M. Miles" To: Ihor Radchenko Cc: "Christopher M. Miles" , Org-mode , Matt Subject: Re: ob-shell sessions will send final echo '...' as input key sequence when previous command reads input interactively Date: Mon, 01 May 2023 21:41:49 +0800 In-reply-to: <87y1m86vnj.fsf@localhost> Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Host-Lookup-Failed: Reverse DNS lookup failed for 39.171.215.100 (deferred) Received-SPF: softfail client-ip=39.171.215.100; envelope-from=numbchild@gmail.com; helo=Mac-mini.local X-Spam_score_int: 58 X-Spam_score: 5.8 X-Spam_bar: +++++ X-Spam_report: (5.8 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FREEMAIL_FROM=0.001, MSGID_MULTIPLE_AT=1, NML_ADSP_CUSTOM_MED=0.9, RCVD_IN_PBL=3.335, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665, SPOOFED_FREEMAIL_NO_RDNS=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: reject 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: , Reply-To: numbchild@gmail.com 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=1682953386; a=rsa-sha256; cv=none; b=GklGinlBEDGZIp6IHwkFxkLYLRHfCAyFvOgcPrvaAq2bTJc42gbMRd/Ch/bBj3ExGvTVag ETV7TSXIbpKdy9UYbrBFdTp1PZsHet7sZpo7HRYbyltguK1ZSL8VpEBHX9o2FtNNl6Onpf 0CjNAyDRel+XZZvuUoUa9yoAFZ+Pnnosi4NL8MJEu6MjWGZqAYS8Bv4fytrZ3g8RPQAHLi SCoFOYxNqxGp0rPWUluYdYuTTHjytgp8+/Agzni+zKbbRHbRkOy+Hq+t8Fp4EwrHD4OPwa Si+5vnyuuby+a46TK5D5iAN//+M5adqd4DLeJKSyzQD47yr+Phpv6OvEOWkgnQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); 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=1682953386; h=from:from:sender:sender:reply-to: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; bh=GG24kEq5DsSvz1HVU8XOM8OEmX5NYCygTwWAITPwCdk=; b=TQk7YfxmasWJeHz8pLtn5FCvWN+KfCzD0w4rA5KuxyKWdolMVDg84jPIfARrlNdKG24MfT JnK9YgPFL1VvDFy9QYjVvpdJydAintgo4NmMXTA1rlj2otCv7Hsf5flPkDTdW2cnlhPIN9 uGzmMm0aQoKh6Hh2HT/jdYpXOuyoDijfUmjVqmpqeqSYKUlGFsMRG2GrlE/BO7Djf8QbRm uG0fEgKGjsHeHtFS6wRl9ZvTTFFx92mCkzlJqDp2qGFinjzFrtW4oBkGZ4mEbGu3fPzPrR vST7/jmZvo+WOvn+cWXY8BqyqKJMzBCNHSLWDr8f43c3n2Lu0vIRwtBWkPcY+w== X-Migadu-Spam-Score: -2.41 X-Spam-Score: -2.41 X-Migadu-Queue-Id: 157C6154BA X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); 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-TUID: 62yxJ3P3OQzs --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Ihor Radchenko writes: > "Christopher M. Miles" writes: > >> I might consider to use another language like python instead of sh to >> execute command to play video to get around this issue. I will update >> here if I success. > > All you need to do is getting rid of :async and :session. > Just use :results none + "&" at the end of mpv command. > Non-session blocks will not suffer from this problem. My first version property "EVAL" inline src block indeed don't using :async and :session. It can play video file. But I found it will block [Tab] org-cycle expand headline. I don't want Emacs to be suspended. So I added :async change. Now I use python `os.system()` to invoke shell command works fine. Here is my current version: (defcustom org-property-eval-keyword "EVAL" "A property keyword for evaluate code." :type 'string :safe #'stringp :group 'org) (add-to-list 'org-default-properties org-property-eval-keyword) (defun org-property-eval-on-cycle-expand (&optional state) "Evaluate Org inline source block in property value on headline cycle exp= and." (when (memq state '(children subtree)) (if-let ((inline-src-block (org-entry-get nil org-property-eval-keyword= nil))) (with-temp-buffer (insert inline-src-block) (goto-char (point-min)) (let* ((context (org-element-context)) (lang (org-element-property :language context)) (type (org-element-type context)) (src-block-info (org-babel-get-src-block-info nil context)= )) (when (eq type 'inline-src-block) (org-babel-execute-src-block nil src-block-info (pcase lang ("sh" `((:session . ,(make-temp-name " *ob-sh-inline-async= (sh) ")) (:async . "yes") (:results . "silent"))) ("shell" `((:session . ,(make-temp-name " *ob-sh-inline-as= ync (shell) ")) (:async . "yes") (:results . "silent"))) ("bash" `((:session . ,(make-temp-name " *ob-sh-inline-asy= nc (bash) ")) (:async . "yes") (:results . "silent"))) ("zsh" `((:session . ,(make-temp-name " *ob-sh-inline-asyn= c (zsh) ")) (:async . "yes") (:results . "silent"))) ("python" `((:session . ,(make-temp-name "ob-python-inline= -async ")) (:async . "yes") (:results . "silent"))) (_ '((:results . "none"))))))))))) (add-hook 'org-cycle-hook #'org-property-eval-on-cycle-expand) (defvar org-property-eval-templates '("src_sh{mpg123 \"path/to/music.mp3\"}" "src_python{import os; os.system(\"mpv 'path/to/video.mp4' \")}")) (org-completing-read-property-construct-function "EVAL" org-property-eval-t= emplates) (add-to-list 'org-property-set-functions-alist '("EVAL" . org-completing-re= ad-property_eval)) =2D-=20 [ stardiviner ] I try to make every word tell the meaning that I want to express without mi= sunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAmRPwmEACgkQG13xyVro msOeewgAiM49ndHwkNJLO95i72fcmBY6lWzCLwPA3PnSvxUdIevwDL4NNVXkCshl U8eTY7weBq0biBCcEmnwvc0kIyA9LC6Y3Ays7fTOscA1tmqPMJ+lB+63+RLu7pbE kc6EtxZUx8zfAFoEh9umn2ZICguMW5bA8nXhfqvCD6AnEOsU2tmpXfQ2zfhdPFzT /KfW9qG/OvnPjXXv8GEkaAX8UorYTjO8U+Bynf4YCakVrS4wrhHEs4WcBDR99DeD 1xUjM06gNlAOjyXJMNFDxaTYAqDb45lwKT7zlZvABrsxfIYt+tK0W2NYkfv0GmwI vEpJiIROa0QTCt2iJzWcumw53KGBqw== =EZ0V -----END PGP SIGNATURE----- --=-=-=--