在emacs中创建多个eshell实例

时间:2010-03-29 20:21:54

标签: emacs xmonad eshell

想一想:用eshells,la xmonad平铺我的emacs窗口。这可能吗?我可以使用M-x eshell打开第一个eshell实例,但未来的调用只关注第一个实例。

7 个答案:

答案 0 :(得分:12)

你可以这样做:

`C-u M-x eshell`

这将创建*eshell**eshell*<2>,依此类推。

答案 1 :(得分:6)

我首选的方法是创建命名shell:

(defun make-shell (name)
  "Create a shell buffer named NAME."
  (interactive "sName: ")
  (setq name (concat "$" name))
  (eshell)
  (rename-buffer name))

是要点。然后M-x make-shell name将创建所需的shell。

答案 2 :(得分:4)

eshell的docstring声明“非数字前缀arg表示创建新会话”。我反复输入 M-- M-x eshell ,每次打开一个新的eshell缓冲区。

答案 3 :(得分:1)

C-u M-x eshell效果很好,但我更喜欢命名shell - make-shell方法,在切换缓冲区时很有用

答案 4 :(得分:0)

对于那些使用ansi-term

的人来说,调用GNU Screen是另一种选择

答案 5 :(得分:0)

Mybe,以下解决方案更好。因为eshell缓冲区由eshell-buffer-name的值决定。您无需重命名缓冲区。

(defun buffer-exists (bufname)   
  (not (eq nil (get-buffer bufname))))

(defun make-shell (name)
  "Create a shell buffer named NAME."
  (interactive "sName: ")
  (if (buffer-exists "*eshell*")
      (setq eshell-buffer-name name)
    (message "eshell doesnot exists, use the default name: *eshell*"))
  (eshell))

答案 6 :(得分:0)

展开make-eshell,这会创建一个eshell附加下一个计数器,所以它就像 eshell1 eshell2 等等:

(lexical-let ((count 1))
  (defun make-eshell-next-number ()
    (interactive)
    (eshell)
    (rename-buffer (concat "*eshell" (number-to-string count) "*"))
    (setq count (1+ count))))