我处于问题的最底层 - 我不知道如何深入挖掘,因为我现在正在从start-process
文件中运行process.C
。这是在Emacs内部,下一步似乎是在看C代码。
这是我的问题。我跑的时候
(let ((default-directory "C:/Users/esharapov/.emacs.d/"))
(apply 'start-process "ag" (get-buffer-create "test")
"c:\\App\\emacs\\libexec\\emacs\\24.5\\i686-pc-mingw32\\cmdproxy.exe"
(list "-c" "\"ag\" \"--nocolor\" \"--literal\" \"--line-number\" \"--smart-case\" \"--nogroup\" \"--column\" \"--stats\" \"--\" \"keymap-on\" \".\"")))
我在输出
之后进入缓冲区194:15: (defmacro keymap-on-key (name keys)
233:9: (keymap-on-key ctl-x-f-map "C-x f")
572:7: (keymap-on-key ctl-z-w-map "C-z w")
194:15: (defmacro keymap-on-key (name keys)
233:9: (keymap-on-key ctl-x-f-map "C-x f")
572:7: (keymap-on-key ctl-z-w-map "C-z w")
6 matches
382 files searched
8993756 bytes searched
0.446822 seconds
Process ag finished
如果我在Windows命令提示符下以
运行它c:\\App\\emacs\\libexec\\emacs\\24.5\\i686-pc-mingw32\\cmdproxy.exe /c "C:\\App\\bin\\ag.exe --nocolor --literal --line-number --smart-case --nogroup --column --stats -- keymap-on ."
我得到以下输出
#configuration.org#:194:15: (defmacro keymap-on-key (name keys)
#configuration.org#:233:9: (keymap-on-key ctl-x-f-map "C-x f")
#configuration.org#:572:7: (keymap-on-key ctl-z-w-map "C-z w")
configuration.org:194:15: (defmacro keymap-on-key (name keys)
configuration.org:233:9: (keymap-on-key ctl-x-f-map "C-x f")
configuration.org:572:7: (keymap-on-key ctl-z-w-map "C-z w")
6 matches
382 files searched
8993756 bytes searched
0.483917 seconds
注意到区别?当我使用start-process
时,文件名将从流程输出中删除。有谁知道这里的问题是什么?
更新
我进行了几项实验,比较了CMD
shell和Emacs shell
中各种命令的输出。一个明显的竞争者是grep
命令
(let ((default-directory "C:/Users/esharapov/Dev/Test/"))
(apply 'start-process "grep" (get-buffer-create "test") "c:\\App\\emacs\\libexec\\emacs\\24.5\\i686-pc-mingw32\\cmdproxy.exe" (list "-c" "\"grep\" \"-nH\" \"-e\" \"Metlife\" \"*.txt\"")))
打印
Evgeniy_Review.txt:192: 1. Finishing Harmony Docker container and presenting it to the Metlife SWAT
Evgeniys_20141031.txt:16: 1. Finishing Harmony Docker container and presenting it to the Metlife SWAT
Process grep finished
控制台的输出相同
C:\Users\esharapov\Dev\Test>grep -nH -e Metlife *.txt
Evgeniy_Review.txt:192: 1. Finishing Harmony Docker container and presenting it to the Metlife SWAT
Evgeniys_20141031.txt:16: 1. Finishing Harmony Docker container and presenting it to the Metlife SWAT
现在是ag
命令
(let ((default-directory "C:/Users/esharapov/Dev/Test/"))
(apply 'start-process "ag" (get-buffer-create "test") "c:\\App\\emacs\\libexec\\emacs\\24.5\\i686-pc-mingw32\\cmdproxy.exe" (list "-c" "\"ag\" --nocolor --nogroup \"Metlife\" .")))
打印出以下内容:
1. Finishing Harmony Docker container and presenting it to the Metlife SWAT
1. Finishing Harmony Docker container and presenting it to the Metlife SWAT
Process ag finished
在控制台(CMD shell)中
C:\Users\esharapov\Dev\Test>ag --nocolor --nogroup Metlife .
Evgeniys_20141031.txt:16: 1. Finishing Harmony Docker container and presenting it to the Metlife SWAT
Evgeniy_Review.txt:192: 1. Finishing Harmony Docker container and presenting it to the Metlife SWAT
似乎用来自Git for Windows的cmdproxy
替换bash
或cmd
没有任何区别,结果是相同的。
因此,ag
控制台命令中的某些内容会产生影响。另一方面,start-process
输出的结果与cmd输出有什么不同?
版本:
答案 0 :(得分:0)
我猜你需要在ag中包含--filename
参数来修复它。
由于输出分歧的原因,我的猜测是它与环境变量有关。 emacs和prompt之间可能有所不同(ag二进制文件的路径,ag查找其默认值的HOME等)。