作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
M-x grep、M-x lgrep、M-x rgrep 对我来说在 EmacsW32 中不起作用。
我执行 M-x lgrep,它说 grep 不是命令:
grep -i -n "hello" * NUL
'grep' is not recognized as an internal or external command,
operable program or batch file.
Grep finished with no matches found at Sun Jan 31 05:59:06
还有那个 NUL 是什么东西? EmacsW32 主页说它附带了 Gnuwin32 实用程序,但似乎配置实际使用 Gnuwin32 grep 的工作留给了用户。
我如何配置它以使用随附的 Gnuwin32 grep 或 cygwin grep?都还好吗?
最佳答案
This article有一些关于如何让它工作的技巧。
我前几天开始使用它,您可以在 emacs 中设置 PATH 环境变量,如果您安装了 cygwin 和/或 gnuw32,只需设置它们的路径即可。这是我的 .emacs 中的一个片段,仅适用于 Windows。我将变量(cygwin-bin、gnu-bin)设置为安装程序的路径。然后建立通往那些的路径。一个缺点是它吹走了我剩下的路。到目前为止这还不是问题,但如果我更聪明地使用 LISP,我可能会想出一些办法。无论如何,希望这对您有所帮助。
;;windows only stuff
(when (string-equal system-type "windows-nt")
(progn
(setq cygwin-bin "c:\\apps\\cygwin\\bin")
(setq gnu-bin "C:\\apps\\GnuWin32\\gnuwin32\\bin")
(setenv "PATH"
(concat cygwin-bin ";" gnu-bin ";"))
(setq exec-path
'(cygwin-bin gnu-bin))))
我应该补充一点,我得出这个解决方案是因为在 Windows 中将 qnuwin32 放在路径前面似乎是一个冒险的提议,你冒着搞乱你机器上其他程序的风险。所以这似乎是一个很好的妥协。
关于windows - 如何让 grep 在 Windows 上的 Emacs 中工作 (EmacsW32),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2169520/
我是一名优秀的程序员,十分优秀!