从Windows上的Emacs中的"grep-find"运行时,ack不起作用

Jes*_*erE 4 windows emacs perl ack

我正在尝试使用ack-grep作为Windows上Emacs中grep + find的替代品,但ack-grep立即(成功)退出而不打印任何匹配项.我已经尝试了几乎所有可能的命令行参数组合到ack-grep,但似乎没有任何效果.

M-x grep-find
Run Code Online (Sandbox Code Playgroud)

输入"ack html"以搜索包含"html"的文件.Ack立刻退出,什么都不打印:

-*- mode: grep; default-directory: "c:/" -*-
Grep started at Tue Feb 23 23:50:52

ack html

Grep finished (matches found) at Tue Feb 23 23:50:52
Run Code Online (Sandbox Code Playgroud)

执行相同的命令"ack html" cmd.exe工作正常(显示许多包含字符串"html"的各种文件.

有任何想法吗?

cjm*_*cjm 8

当在Windows下的Emacs下运行ack时,我发现它有时会混淆它是应该搜索文件还是从STDIN读取.这是我用来调用ack(使用M-x ack)的函数.你可以把它放进去.emacs.

(defvar ack-command "ack --nogroup --nocolor ")
(defvar ack-history nil)
(defvar ack-host-defaults-alist nil)
(defun ack ()
  "Like grep, but using ack-command as the default"
  (interactive)
  ; Make sure grep has been initialized
  (if (>= emacs-major-version 22)
      (require 'grep)
    (require 'compile))
  ; Close STDIN to keep ack from going into filter mode
  (let ((null-device (format "< %s" null-device))
        (grep-command ack-command)
        (grep-history ack-history)
        (grep-host-defaults-alist ack-host-defaults-alist))
    (call-interactively 'grep)
    (setq ack-history             grep-history
          ack-host-defaults-alist grep-host-defaults-alist)))
Run Code Online (Sandbox Code Playgroud)