【发布时间】:2011-02-02 05:11:33
【问题描述】:
想想:用 eshell 平铺我的 emacs 窗口,就像 xmonad。这可能吗?我可以 M-x eshell 打开第一个 eshell 实例,但以后的调用只关注第一个实例。
【问题讨论】:
想想:用 eshell 平铺我的 emacs 窗口,就像 xmonad。这可能吗?我可以 M-x eshell 打开第一个 eshell 实例,但以后的调用只关注第一个实例。
【问题讨论】:
你可以这样做:
`C-u M-x eshell`
这将创建*eshell*、*eshell*<2> 等等。
【讨论】:
我的首选方法是创建命名 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 将创建所需的外壳。
【讨论】:
eshell 的文档字符串指出“非数字前缀 arg 意味着创建一个新会话。”我一遍又一遍地输入 M-- M-x eshell,每次它都会打开一个新的 eshell 缓冲区。
【讨论】:
C-u M-x eshell 效果很好,但我更喜欢命名 shell - make-shell 方法,在切换缓冲区时很有用
【讨论】:
对于那些使用 ansi-term 的人来说,调用 GNU Screen 是另一种选择
【讨论】:
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))
【讨论】:
在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))))
【讨论】: