首页 > 代码库 > emacs run multiple eshell buffers (more then one eshell)

emacs run multiple eshell buffers (more then one eshell)

(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))


Because the eshell buffer is determined by the value of eshell-buffer-name.  You need not to rename the buffer after creating it.