The excellent answer to the question How do I define an Emacs List function to spawn a shell buffer with a particular command executed in the shell weirdly does not work in a Gnu "screen" session. In the context of a screen command, instead of the command I tell it to execute,
echo 'test1'\n
, Emacs is called recursively! The would-be shell buffer contains the familiar "emacs: Terminal type "dumb" is not powerful enough to run Emacs" message.
How can I make this work? Here's what I did:
On the command line:
~ srn@basil{1}% screen -s run-emacs2
Here is the shell script run-emacs2:
#!/bin/bash
EMACS=/usr/bin/emacs23-x
export NO_AT_BRIDGE=1 ## suppress annoying gtk>2 warning
exec "$EMACS" -nw --load init.el.test -f spawn-shell
NOTE: If on the command line I say:
~ srn@basil{1}% run-emacs2
...everything works fine. The problem appears to be some interaction with Gnu screen.
Here is init.el.test (almost verbatim from the answer linked above):
(defun spawn-shell ()
"Invoke shell test"
(pop-to-buffer (get-buffer-create (generate-new-buffer-name "gzo")))
(shell (current-buffer))
(process-send-string nil "echo 'test1'\n"))