Windows,Emacs,Git Bash和shell命令

Ahm*_*sih 6 windows emacs shell

Windows 7. Emacs 24.3.1.Git 1.8.1.msysgit.1.我在等效的.emacs文件中有以下内容:

(if (equal system-type 'windows-nt)
    (progn (setq explicit-shell-file-name
                 "C:/Program Files (x86)/Git/bin/sh.exe")
           (setq shell-file-name "bash")
           (setq explicit-sh.exe-args '("--login" "-i"))
           (setenv "SHELL" shell-file-name)
           (add-hook 'comint-output-filter-functions 'comint-strip-ctrl-m)))
Run Code Online (Sandbox Code Playgroud)

当我想做Mx shell时,这很有用:我可以弹出一个shell并输入"ls".

但是,Mx shell命令失败.当我尝试通过shell-command运行"ls"时(根据Ch f shell-command,它应该在*Shell命令输出*缓冲区中打印其输出),我收到一条错误消息:

"搜索程序:权限被拒绝,bash"

关于调用过程,Google上有一些非常古老的建议,以及关于让shell在Emacs中运行的许多关于StackOverflow的问题.请注意,Mx shell运行良好,我想要的是shell命令.

(原因:https://github.com/donkirkby/live-py-plugin#installing-the-emacs-mode)

Ale*_*iev 12

尝试将两个变量设置为指向相同的可执行文件,并确保路径位于exec-path:

(setq explicit-shell-file-name
      "C:/Program Files (x86)/Git/bin/bash.exe")
(setq shell-file-name explicit-shell-file-name)
(add-to-list 'exec-path "C:/Program Files (x86)/Git/bin")
Run Code Online (Sandbox Code Playgroud)