加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

Windows,Emacs,Git Bash和shell命令

发布时间:2020-12-14 01:40:57 所属栏目:Windows 来源:网络整理
导读: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
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中:
(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")

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读