Closed evgeniysharapov closed 8 years ago
Strange, that's pretty basic functionality that usually works. ag.el does generally work on Windows.
What's the contents of *ag search
buffer? To ask the obvious question, you do have some search results?
Also, does the error occur with emacs -q
?
I get the result in the buffer.
Yes. In the video I press n
, p
, M-n
, M-p
and RET
Wow, a video! Thanks, that's very helpful.
Your results buffer doesn't have any file names, so ag.el doesn't know which file each result came from.
Normally, a search results buffer would look something like this:
ag --nocolor --literal --line-number --smart-case --nogroup --column --stats -- defun .
docs/configuration.rst:31:6: (defun set-exec-path-from-shell-PATH ()
ag.el:35:34:(require 'cl-lib) ;; cl-letf, cl-defun
ag.el:113:2:(defun ag/run-finished-hook (buffer how-finished)
ag.el:126:2:(defun ag/next-error-function (n &optional reset)
ag.el:163:2:(defun ag/buffer-name (search-string directory regexp)
ag.el:170:2:(defun ag/format-ignore (ignores)
Could you try with the latest version of the ag command? The latest is 0.31.0.
you are right when I run ag
then I get buffer
-*- mode: ag; default-directory: "~/.emacs.d/" -*-
Ag started at Mon Nov 9 22:30:40
"ag" "--color" "--color-match" "30;43" "--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")
570:7: (keymap-on-key ctl-z-w-map "C-z w")
3 matches
454 files searched
9176148 bytes searched
0.827066 seconds
but if I run that long ag
command in shell-command
I get
You can run the command `shell-command' with M-!
configuration.org:[1;33m194[0m[K:15: (defmacro keymap-on-key (name keys)
configuration.org:[1;33m233[0m[K:9: (keymap-on-key ctl-x-f-map "C-x f")
configuration.org:[1;33m570[0m[K:7: (keymap-on-key ctl-z-w-map "C-z w")
3 matches
454 files searched
9176148 bytes searched
0.140787 seconds
I thought that perhaps color match is the problem but no, setting ag-higlight-search
to nil
brings the same ag
buffer without filenames, whilst adding --nocolor
to the shell-command
brings normal output without ANSI sequences.
So, I am kind of at the bottom of the problem - I don't see how to dig any deeper because I am now running start-process
from the process.C
file.
Here's the my example. If I run
(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\" \".\"")))
I get
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
If I run it in the command prompt as
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 ."
I get
#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
Does it mean that the problem is in the start-process
function ?
For Emacs 25:
(let ((default-directory "C:/src/"))
(make-process :name "ag" :buffer (get-buffer-create "test")
:command (list
"C:\\Users\\smith\\AppData\\Local\\emacs\\libexec\\emacs\\25.0.50\\x86_64-w64-mingw32\\cmdproxy.exe"
"/c ag.exe --nocolor --literal --line-number --smart-case --nogroup --column --stats -- data .")))
return to test buffer:
26:15: void open_database();
27:17: void backup_database();
when I run (at C:/src/) from command prompt:
C:\Users\smith\AppData\Local\emacs\libexec\emacs\25.0.50\x86_64-w64-mingw32\cmdproxy.exe "/c ag.exe --nocolor --literal --line-number --smart-case --nogroup --column --stats -- data ."
output is:
Store.h:26:15: void open_database();
Store.h:27:17: void backup_database();
Ok. After meditating on source code for ag
and asking questions on SO, I came up with the least intrusive option - add --vimgrep
to ag-arguments
. Solves the problem. I am not sure if it should be done via a pull request or just put on the FAQ of some sort.
This issue can be closed since the solution from #101 was merged into master
.
None of the navigation bindings
compilation-next-error
,compilation-previous-error
,compilation-previous-file
,compilation-next-file
work. Always echoes eitheruser-error: Moved back before first error
oruser-error: Moved past last error
When I press
RET
(orcompile-goto-error
) it echoes `No error here'Version: GNU Emacs 24.5.1 (i686-pc-mingw32) of 2015-04-11 on LEG570 Ag Package-Version: 0.46 ag command line is 0.29