这是一个简单的defun来运行shell脚本:
(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))
Run Code Online (Sandbox Code Playgroud)
如果我启动一个没有&符号的程序 - 它启动脚本,但阻止emacs直到我关闭程序,如果我没有输入&符号它会给出错误:
/home/boris/its/plts/goodies/bk-konsoles.bash /home/boris/scl/geekgeek/: exited abnormally with code 1.
Run Code Online (Sandbox Code Playgroud)
编辑:
所以现在我正在使用:
(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*"))
Run Code Online (Sandbox Code Playgroud)
编辑2:
不 - 不起作用:
(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*")))
Run Code Online (Sandbox Code Playgroud)
让emacs忙碌 - 或者用disown,或者nohup.
这是我正在运行的脚本,如果有帮助的话:bk-konsoles.bash
我认为问题出在konsole上。
(shell-command "xterm &")
Run Code Online (Sandbox Code Playgroud)
执行您所期望的操作,在新窗口中打开 xterm 并将控制权返回给 Emacs。然而,
(shell-command "konsole &")
Run Code Online (Sandbox Code Playgroud)
立即打开和关闭 konsole。konsole 的启动方式似乎是导致问题的原因。我认为 KDE 应用程序有自己的启动应用程序的系统,但我不确定。无论如何,我认为问题不在于 Emacs 这边。
| 归档时间: |
|
| 查看次数: |
3063 次 |
| 最近记录: |