在 Windows 版 Emacs 中使用 msysgit shell

在 Windows 版 Emacs 中使用 msysgit shell

我對 Emacs 相對陌生,正在嘗試設定 emacs,以允許以下命令開啟 msysgit shell。

M-x bash-shell

我已將以下程式碼片段新增至我的 init.el 中。

(defun bash-shell ()
  "Run git bash in shell mode."
  (interactive)
  (let ((explicit-shell-file-name "C:/Dev/Apps/Git/bin/sh.exe")
    (shell-file-name explicit-shell-file-name)
    (explicit-sh.exe-args '("--login" "-i")))
    (call-interactively 'shell)))

它似乎有效,但不是我期望的那樣。它以以下輸出開始。

Welcome to Git (version 1.8.4-preview20130916)


Run 'git help git' to display the help index.
Run 'git help <command>' to display help for specific commands.

但隨後就陷入困境。然而,我可以輸入標準命令(例如 ls、pwd...),但我的 .bashrc 似乎沒有被執行。然而,當我exit,它似乎要么正確啟動它,要么至少執行 .bashrc,這對我來說非常困惑。

Welcome to Git (version 1.8.4-preview20130916)


Run 'git help git' to display the help index.
Run 'git help <command>' to display help for specific commands.
pwd
/c/Dev/Apps/Emacs/emacs-23.3/bin
uname
MINGW32_NT-5.1
ll
bash: line 3: ll: command not found
exit
laiwib@WZUR5250815 /c/D.A.E.e/emacs-23.3/bin  $ 

無論如何,它的行為與我在 Windows 上啟動 Git Bash 不同

C:\WINDOWS\system32\cmd.exe /c ""C:\Dev\Apps\Git\bin\sh.exe" --login -i"

這給了我以下內容

Welcome to Git (version 1.8.4-preview20130916)


Run 'git help git' to display the help index.
Run 'git help <command>' to display help for specific commands.
Agent pid 4384
laiwib@WZUR5250815 ~ (git::master) $ ll
total 16
drwxr-xr-x    1 laiwib   Administ        0 Oct 21  2012 WINDOWS
drwxr-xr-x    1 laiwib   Administ        0 Oct 23  2012 .eclipse
-rw-r--r--    1 laiwib   Administ       38 Oct 23  2012 .dbshell
...

如何讓它像 Git Bash 一樣運行而不需要手動調用exit

相關內容