瀏覽代碼

Do not create new buffer automatically for my-term-shell-command

pull/1/head
10sr 10 年之前
父節點
當前提交
8953881282
共有 1 個文件被更改,包括 8 次插入10 次删除
  1. +8
    -10
      emacs.el

+ 8
- 10
emacs.el 查看文件

@@ -2314,21 +2314,19 @@ ARG is ignored."

(defvar term-shell-command-history nil
"History for term-shell-command.")
(defun my-term-shell-command (command &optional buffer-or-name)
(defun my-term-shell-command (command &optional new-buffer-p)
"Run COMMAND in terminal emulator.
If BUFFER-OR-NAME is given, use this buffer. In this case, old process in the
buffer is destroyed. Otherwise, new buffer is generated automatically from
COMMAND."
If NEW-BUFFER-P is given or called with prefix argument, generate new buffer
and set the buffer the process buffer. Otherwise, existing buffer will be used."
(interactive (list (read-shell-command "Run program: "
nil
'term-shell-command-history)))
'term-shell-command-history)
current-prefix-arg))
(let* ((name (car (split-string command
" ")))
(buf (if buffer-or-name
(get-buffer-create buffer-or-name)
(generate-new-buffer (concat "*"
name
"*"))))
(buf (if new-buffer-p
(generate-new-buffer "*term shell command*")
(get-buffer-create "*term shell command*")))
(proc (get-buffer-process buf))
(dir default-directory))
(and proc


Loading…
取消
儲存