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
I think the problem is konsole.
(shell-command "xterm &")
does what you expect, opening an xterm in a new window and returning control to Emacs. However,
(shell-command "konsole &")
opens and closes konsole immediately. Something about the way konsole is started seems to be causing the problem. I think KDE apps have their own system for launching apps, but I'm not sure. In any case, I don't think the problem is on the Emacs side here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With