Ack does not work when run from "grep-find" in Emacs on Windows

I am trying to use ack-grep as a replacement for grep + find on Emacs on Windows, but ack-grep will exit immediately (successfully) without printing matches. I tried almost any possible combination of command line options for ack-grep, but nothing works.

Mx grep-find 

Type "ack html" to search for files containing "html". Ack immediately exits without typing:

 -*- 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 

Running the same "ack html" command in cmd.exe works fine (displays many different files containing the "html" line.

Any ideas?

+4
source share
3 answers

When running ack under Emacs on Windows, I found that sometimes it got confused about whether it should search for files or read from STDIN. Here is the function that I use to call ack (use Mx ack ). You can put this in .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))) 
+8
source

(setq grep-find-command "ack <nul -i ")

0
source

I had a similar problem using ack-and-a-half module, closing STDIN also helped. There is a github problem: https://github.com/jhelwig/ack-and-a-half/issues/23

0
source

Source: https://habr.com/ru/post/1302177/


All Articles