Wilfred / ag.el

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

no filenames when process-connection-type is nil #154

Open YoungFrog opened 5 years ago

YoungFrog commented 5 years ago

Running the following (in a directory where at least one file contains foo): emacs -Q -f package-initialize --eval '(setq process-connection-type nil)' --eval '(ag "foo" default-directory)' returns results without the "filename:" part, e.g.

ag --nocolor --literal --line-number --smart-case --nogroup --column --stats -- foo . 2:27:<!ELEMENT breakfast_menu (food+)> 3:15: <!ELEMENT food (name price description calories)> 4:15: <!ATTLIST food id CDATA #IMPLIED

whereas when setting p-c-t to t, I get:

ag --nocolor --literal --line-number --smart-case --nogroup --column --stats -- foo . code-samples/ajax/xml/ex.dtd:2:27:<!ELEMENT breakfast_menu (food+)> code-samples/ajax/xml/ex.dtd:3:15: <!ELEMENT food (name price description calories)> code-samples/ajax/xml/ex.dtd:4:15: <!ATTLIST food id CDATA #IMPLIED

On my machine, the output of ag --version is:

ag version 0.31.0

Features: +jit +lzma +zlib

My Emacs version is: GNU Emacs 26.1.90

I'm using: Trisquel GNU/Linux 8.0, Flidas

One workaround is to redirect stdin to /dev/null:

           (concat "</dev/null "
                   (mapconcat #'shell-quote-argument
                              (append (list ag-executable) arguments (list string "."))
                              " "))

inside ag/search, but I'm not sure this is the right fix.

The other obvious workaround is to not set p-c-t to nil, but this consequences as well, see https://debbugs.gnu.org/cgi/bugreport.cgi?bug=15695