3

I recently updated to emacs 26.1. Since then, grep results are not highlighted and does not contain links to files. 'n' or 'p' gives "Moved past last grep hit" or "Moved back before first grep hit".

Steps followed:
1. Ran emacs 26.1 with -Q option
2. Set the following variables:
(setq explicit-shell-file-name "C:/cygwin/bin/bash.exe")
(setq shell-file-name explicit-shell-file-name)
(add-to-list 'exec-path "C:/cygwin/bin")
(setq null-device "/dev/null")
3. grep -nHri --include=*.m -e "hello" c:/path/to/dir

Couldn't visit the files in the search results.

The same steps work in 25.2 version. In both versions, grep returns search results in windows path format (c:/path/to/dir/...)

Aravind
  • 31
  • 3
  • 1
    Welcome to emacs.stackexchange.com. Can you give us a minimal setup recipe to reproduce this issue ourselves using Emacs 26.1 without any user configuration? This is called starting from Emacs -Q. – lawlist Oct 08 '18 at 21:58
  • ...which is to say, run emacs -Q at the command line. – phils Oct 08 '18 at 23:54
  • Thank you, @lawlist. I am using emacs for windows. Downloaded from here. I open by double clicking on the exe file. – Aravind Oct 09 '18 at 04:26
  • @phils, I don't use command line to run emacs. How do I run emacs with -Q from windows? – Aravind Oct 09 '18 at 04:48
  • Add -Q to whatever it is that runs the emacs executable. If memory serves, Windows lets you create "shortcuts" to an executable, which you can edit to specify arguments to pass. It's probably easier to just use the command line, though? – phils Oct 09 '18 at 05:27
  • Added the steps to reproduce the issue. – Aravind Oct 09 '18 at 08:44
  • 1
    Can you add output from that grep command to your question? I'm assuming this is related to using cygwin and using a mingw build of Emacs, which use different formats for paths. –  Oct 09 '18 at 10:01
  • It is working in emacs-25.2 version. The output in both versions (25.2 and 26.1) is in c:/path/to/dir/... format. – Aravind Oct 10 '18 at 15:41

2 Answers2

2

This is an emacs bug in emacs 26.1, resolved in 26.2. It has to do with —null being added to the default grep arguments, so the drive letter in Windows paths, with its colon, was not matched by the grep regexp. You can either upgrade to the unreleased version, or customize the grep arguments to remove —null.

InHarmsWay
  • 1,319
  • 7
  • 8
  • My grep command looks like this: grep -nHir --include=*.m --exclude=*.svn-base "hello" c:/path/to/dir/. I have the following setup: (grep-use-null-device nil) and (grep-use-null-filename-separator nil). The results don't have links to files. Am I missing something? – Aravind Oct 11 '18 at 20:41
0

Adding -Z option (-Z, --null: print 0 byte after FILE name) to grep command fixes the issue.

grep -nHirZ --include=*.m --exclude=*.svn-base "hello" c:/path/to/dir

Aravind
  • 31
  • 3