Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

None of the navigation bindings work #97

Closed
evgeniysharapov opened this issue Oct 27, 2015 · 8 comments
Closed

None of the navigation bindings work #97

evgeniysharapov opened this issue Oct 27, 2015 · 8 comments

Comments

@evgeniysharapov
Copy link

None of the navigation bindings compilation-next-error, compilation-previous-error, compilation-previous-file, compilation-next-file work. Always echoes either user-error: Moved back before first error or user-error: Moved past last error

When I press RET (or compile-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

@Wilfred
Copy link
Owner

Wilfred commented Nov 5, 2015

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?

@evgeniysharapov
Copy link
Author

I get the result in the buffer.
Yes. In the video I press n, p, M-n, M-p and RET
image version

@Wilfred
Copy link
Owner

Wilfred commented Nov 9, 2015

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.

@evgeniysharapov
Copy link
Author

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.

@evgeniysharapov
Copy link
Author

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 ?

@smithx
Copy link

smithx commented Nov 17, 2015

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();

@evgeniysharapov
Copy link
Author

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.

evgeniysharapov pushed a commit to evgeniysharapov/ag.el that referenced this issue Nov 19, 2015
Wilfred added a commit that referenced this issue Dec 19, 2015
Wilfred added a commit that referenced this issue Dec 27, 2015
We're only using --vimgrep to workaround an ag problem on windows. The
--vimgrep argument isn't supported on some popular Linux
distros yet (e.g. Ubuntu 14.04 has ag 0.19.2).

See #97.
@wbolster
Copy link

wbolster commented Mar 3, 2016

This issue can be closed since the solution from #101 was merged into master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants