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)))
当我想做M-x shell时,这很有效:我可以弹出一个shell并输入“ls”.
但是,M-x shell-command失败了.当我尝试通过shell-command运行“ls”时(根据C-h f shell-command,它应该在* Shell命令输出*缓冲区中打印输出),我收到一条错误消息:
“搜索程序:权限被拒绝,bash”
关于调用过程,Google上有一些非常古老的建议,以及关于让shell在Emacs中运行的许多关于StackOverflow的问题.请注意,M-x shell运行良好,我想要的是shell命令.
(原因:https://github.com/donkirkby/live-py-plugin#installing-the-emacs-mode)
尝试将两个变量设置为指向相同的可执行文件,并确保路径位于exec-path中:
原文链接:https://www.f2er.com/windows/363901.html(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")