Windows 7. Emacs 24.3.11.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)))当我想要做时,这很好:我可以弹出一个shell并键入"ls“。
然而,M shell命令失败了。当我试图通过shell命令运行"ls“(根据C shell命令,该命令应该在*Shell命令输出*缓冲区中打印其输出)时,我只收到一条错误消息:
搜索程序:拒绝许可,bash
在Google上有一些关于呼叫处理的老建议,还有很多关于让shell在Emacs中工作的问题。请注意,工作得很好,我想要做的是shell命令。
(理由:https://github.com/donkirkby/live-py-plugin#installing-the-emacs-mode)
发布于 2013-05-21 18:43:15
尝试将两个变量设置为指向同一个可执行文件,并确保路径位于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")发布于 2014-06-18 19:24:55
我知道这是一个较老的问题,但我在寻求帮助时发现了同样的问题,所以这里是我为我的特定用例所使用的解决方案,以防它在将来帮助到某人。
我在所有使用emacs的计算机之间同步我的.emacs.d,其中包括Linux和Windows机器。我将它插入到我的init.el文件中,以便在Windows环境中适当地处理这个问题:
;; Set Windows-specific preferences if running in a Windows environment.
(defun udf-windows-setup () (interactive)
;; The variable `git-shell-path' contains the path to the `Git\bin'
;; file on my system. I install this in
;; `%USERPROFILE%\LocalAppInfo\apps\Git\bin'.
(setq git-shell-path
(concat (getenv "USERPROFILE") "\\LocalAppInfo\\apps\\Git\\bin"))
(setq git-shell-executable
(concat git-shell-path "\\bash.exe"))
(add-to-list 'exec-path git-shell-path)
(setenv "PATH"
(concat git-shell-path ";"
(getenv "PATH")))
(message "Windows preferences set."))
(if (eq system-type 'windows-nt)
(udf-windows-setup))请注意,变量git-shell-path需要根据您在系统上安装git的位置来定义。我将它安装在我使用它的一台Windows机器上的%USERPROFILE%\LocalAppInfo\apps\Git中。
发布于 2018-04-19 09:28:41
使用GitBash,您可以使用lein脚本而不是lein.bat脚本。将lein脚本放入windows用户帐户中名为bin的目录中。GitBash应该在它的可执行PATH上有一个bin目录,这样您就可以在任何地方运行lein。
使用这种方法,您不需要在Emacs中进行任何配置。
https://stackoverflow.com/questions/16676750
复制相似问题