I just had to migrate to a new work computer and it took a bit of remembering to get ack working from emacs. For next time, here are the instructions for getting it to work.
- Install Perl
- Add the perl bin and site bin to the Windows Path
- Download the single file version of ack to the site bin (note the .pl extension):
1
curl http://beyondgrep.com/ack-2.12-single-file > c:\Strawberry\perl\site\bin\ack.pl
- Associate the .pl Extension with perl by running the following lines as an administrator:
This assumes that you’ve installed Strawberry Perl to the default installation directory.
1
2assoc .pl=PerlScript
ftype PerlScript=C:\Strawberry\bin\perl.exe "%1" %* - Define an ack function for use in emacs (see Stack Overflow on ack in Emacs on Windows):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18(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)))