help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problems with some external org-mode shell links which make emacs st


From: Bruno Barbier
Subject: Re: problems with some external org-mode shell links which make emacs stuck
Date: Thu, 01 Feb 2024 13:18:18 +0100

Hi Gregor,

Gregor Zattler <telegraph@gmx.net> writes:

>
> 1. I'm asked every time if I want to execute the
>    command.  This is annoying, is there a possibility
>    to stop this?

See https://orgmode.org/manual/Code-Evaluation-Security.html.
   
>
> 2. Emacs then shows "Executing ssh -N ..." in the echo
>    area and while I still see the active cursor on the
>    link I'm not able to move the point or switch
>    between windows, till I hit C-g.  (In a terminal
>    emulator under bash command returns successfully,
>    it's exit code is 0.)
>
>    The problem does not stem from the "# comment1"
>    part, since the same does not happen with this link:
>    [[shell:/usr/bin/echo hund & # hund][hund]]


Are you sure the problem doesn't come from the comment at the end ?
(isn't "echo" command instantaneous?).

Org passes the command to: `shell-command'. The documentation of 
`shell-command' says:

    If COMMAND ends in ‘&’, execute it asynchronously.
    

I've tested with simpler commands using a recent Org:

┌────
│ [[shell:sleep 5&][Doesn't hang]]
│ 
│ [[shell:sleep 5& # COMMENT][Hang for 5s]]
└────

First link doesn't hang; second link does.


>    Any idea what's happening here?
>
>    If I instead use an external link of type elisp,
>    like so:
>
>    [[elisp:(shell-command "ssh -N -F /etc/ssh/ssh_config -L 
> 30001:xxxxxxxx:8006   -p 2220 xxxx@xxxxxxxxxx & # comment1")][comment2]]


Note that you may explicitly request an asynchronous execution using
`async-shell-command' instead of `shell-command'.

┌────
│ (shell-command "sleep 5")                  ; Hangs.
│ (shell-command "sleep 5&")                 ; Doesn't hang.
│ (shell-command "sleep 5& # whatever")      ; Hangs.
│ (async-shell-command "sleep 5")            ; Doesn't hang.
│ (async-shell-command "sleep 5 # whaever")  ; Doesn't hang.
└────


Bruno



reply via email to

[Prev in Thread] Current Thread [Next in Thread]