Here's a simple defun to run a shell script:
(defun bk-konsoles ()
"Calls: bk-konsoles.bash"
(interactive)
(shell-command (concat (expand-file-name "~/its/plts/goodies/bk-konsoles.bash ")
(if (buffer-file-name)
(file-name-directory (buffer-file-name)))
" &")
nil nil))
If I start a program with no ampersand - it start the script, but blocks emacs until I close the program, if I don't put ampersand it gives error:
/home/boris/its/plts/goodies/bk-konsoles.bash /home/boris/scl/geekgeek/: exited abnormally with code 1.
Edit:
So now I'm using:
(defun bk-konsoles ()
"Calls: bk-konsoles.bash"
(interactive)
(shell-command (concat (expand-file-name "~/its/plts/goodies/bk-konsoles.bash ")
(if (buffer-file-name)
(file-name-directory (buffer-file-name)))
" & disown")
nil nil)
(kill-buffer "*Shell Command Output*"))
Edit 2:
Nope - doesn't work:
(defun bk-konsoles ()
"Calls: bk-konsoles.bash"
(interactive)
(let ((curDir default-directory))
;; (shell-command (concat "nohup " (expand-file-name "~/its/plts/goodies/bk-konsoles.bash ") curDir) nil nil)
(shell-command (concat (expand-file-name "~/its/plts/goodies/bk-konsoles.bash ")
curDir "& disown") nil nil)
(kill-buffer "*Shell Command Output*")))
keeps emacs busy - either with disown, or nohup.
Here's a script I'm running if it might be of help: bk-konsoles.bash
async-shell-commandjust adds the ampersand behind the scenes if one isn't present. If that worked, then what he has posted would also work.disownlike this:your-command & diswon.your-command & diswonsolves it! Please make it an answer - so I can accept it.(shell-command "x-term &")does what you expect, but(shell-command "konsole &")opens and closes konsole immediately. Something about the way konsole is started seems to be causing the problem.