【问题标题】:Create more than one eshell instance in emacs在 emacs 中创建多个 eshell 实例
【发布时间】:2011-02-02 05:11:33
【问题描述】:

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

【问题讨论】:

    标签: emacs xmonad eshell


    【解决方案1】:

    你可以这样做:

    `C-u M-x eshell`
    

    这将创建*eshell**eshell*<2> 等等。

    【讨论】:

      【解决方案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 将创建所需的外壳。

      【讨论】:

        【解决方案3】:

        eshell 的文档字符串指出“非数字前缀 arg 意味着创建一个新会话。”我一遍又一遍地输入 M-- M-x eshell,每次它都会打开一个新的 eshell 缓冲区。

        【讨论】:

        • 该死的。当我开始回答时,您的评论还没有写:)
        【解决方案4】:

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

        【讨论】:

          【解决方案5】:

          对于那些使用 ansi-term 的人来说,调用 GNU Screen 是另一种选择

          【讨论】:

            【解决方案6】:

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

            【讨论】:

              【解决方案7】:

              make-eshell 上展开,这将创建一个附加下一个计数器的 eshell,因此它类似于 eshell1eshell2 等:

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

              【讨论】:

                猜你喜欢
                • 1970-01-01
                • 2011-07-28
                • 1970-01-01
                • 1970-01-01
                • 2020-11-10
                • 2015-08-01
                • 1970-01-01
                • 1970-01-01
                • 1970-01-01
                相关资源
                最近更新 更多