Wilfred / ag.el

An Emacs frontend to The Silver Searcher
http://agel.readthedocs.org/en/latest/
525 stars 61 forks source link

"No error here no filename" when set ag-highlight-search to t #114

Open saccohuo opened 8 years ago

saccohuo commented 8 years ago

My ag version is 0.29.1, Windows 7 x64 OS, Emacs 24.5.1(i686-pc-mingw32).

If I set ag-highlight-search to t , there will be some problems(if it is set to nil, there is no problem). It prompt that "No error here no filename" when I press RET to see the result file. I have searched in issues of this repo, find some similar issues, but with some different point.

There is no filename display in the ag result buffer, as shown below.

-*- mode: ag; default-directory: "d:/emacs/.emacs.d/" -*-
Ag started at Sat May 28 20:43:11

"ag" "--color" "--color-match" "30;43" "--literal" "--line-number" "--smart-case" "--nogroup" "--column" "--stats" "--" "yasnippet" "."
884:14:(use-package yasnippet
891:31:                           "~/yasnippet-snippets"))
893:18:  ;; OR, keeping YASnippet defaults try out ~/Downloads/interesting-snippets
3 matches
145 files searched
77130951 bytes searched
0.205012 seconds

Ag finished at Sat May 28 20:43:12

image

If I just add --vimgrep to ag-arguments , though I set ag-highlight-search to t , there will be no problem but maybe without highlight(I did not know what is the state of ag's highlight, but it shows the same as I set ag-highlight-search to nil). When I use M-: to set (setq ag-arguments (append '("--vimgrep") ag-arguments)), the result is shown as below.

-*- mode: ag; default-directory: "d:/emacs/.emacs.d/" -*-
Ag started at Sat May 28 20:54:42

"ag" "--color" "--color-match" "30;43" "--literal" "--vimgrep" "--line-number" "--smart-case" "--nogroup" "--column" "--stats" "--" "yasnippet" "."
init.el:884:14:(use-package yasnippet
init.el:891:31:                           "~/yasnippet-snippets"))
init.el:893:18:  ;; OR, keeping YASnippet defaults try out ~/Downloads/interesting-snippets
3 matches
145 files searched
77130951 bytes searched
0.194011 seconds

Ag finished at Sat May 28 20:54:42

image

So how can I highlight the results without the "No error here no filename" problem?

saccohuo commented 8 years ago

26 #52 are problems about --line-number.

101 #97 provide a walkaround of problem with --vimgrep but only solve my problem partly.

evgeniysharapov commented 8 years ago

I added a pull request that handles ag-highlight-search on Windows https://github.com/Wilfred/ag.el/pull/116 You can also use it as I do in https://github.com/evgeniysharapov/DotEmacs/commit/c8dfe4fb1d7fdd4299a8d6deec726b9f119ff544

Davidj361 commented 4 years ago

I am using emacs on Windows currently, I have the same problem about the actual search result not being coloured with

(setq ag-highlight-search t)

However, search result being coloured works fine in helm's grep, but it doesn't utilize the ag package.

(setq helm-grep-default-command "ag --vimgrep -z %p %f"
      helm-grep-default-recurse-command "ag --vimgrep -z %p %f")