tags:

views:

118

answers:

3
+2  Q: 

emacs on windows

I'm having some issues with rgrep/find on emacs. Any search returns 0 results, with this message:

The filename, directory name, or volumn label syntax is incorrect.

Grep finished with no matches found.

I am using the find bundled with cygwin, so I'm curious if me entering d:/workspace is breaking because find is using cygwin for disk access (so the correct path would be /cygdrive/d/workspace). However, emacs will balk at /cygdrive/d/workspace as it doesn't read it this way.

I am curious why I am the only one with this problem, when it is common to use cygwin find with emacs.

Different problems now.

When I execute rgrep, I always get the same thing "find: missing argument to -name". Google found nothing on this problem, if I execute grep on it's own. I don't get the line number links, so I get a report of where the text is found, but I can't click any of them to open that file.

A: 

(I assume you are talking about using grep-find, but maybe I am mistaken.)

I agree that part of the problem is passing cygwin's find d:/workspace. I've never had good luck at mixing cygwin and non-cygwin things together. Have you considered using the emacs (or XEmacs) builds for cygwin?

When I was mixing things, I ended up setting things up so that a non-cygwin version of emacs knew about cygwin drive names. I had two different solutions in my .emacs (really .xemacs/init.el) file, one for emacs and one for XEmacs.

    ;;
;; Life with Cygwin
;;
(if am-i-running-xemacs-p
    ; true - I am running XEmacs
    (progn
;;--      (setq directory-abbrev-alist
;;--        (append directory-abbrev-alist
;;--                '(("^/cygdrive/a/" . "a:/")
;;--                  ("^/cygdrive/b/" . "b:/")
;;--                  ("^/cygdrive/c/" . "c:/")
;;--                  ("^/cygdrive/d/" . "d:/")
;;--                  ("^/cygdrive/e/" . "e:/")
;;--                  ("^/cygdrive/f/" . "f:/")
;;--                  ("^/cygdrive/g/" . "g:/")
;;--                  ("^/cygdrive/h/" . "h:/")
;;--                  ("^/cygdrive/i/" . "i:/")
;;--                  ("^/usr/" .        "d:/cygwin/usr/")
;;--                  ("^/homes/" .      "d:/cygwin/homes/")
;;--                  ("^/etc/" .        "d:/cygwin/etc/")
;;--                  ("^/lib/" .        "d:/cygwin/lib/")
;;--                  ("^/var/" .        "d:/cygwin/var/")
;;--                  ("^/include/" .    "d:/cygwin/include/")
;;--                  ("^/info/" .       "d:/cygwin/info/")
;;-                   ("^/" . "c:\\"))
;;--                ))
            )
      )
    ; false (else) - I am Not running XEmacs
    (progn
       (require 'cygwin32-mount)

       ;; make cygwin symlinks accessible
       (defun follow-cygwin-symlink ()
         (save-excursion
           (goto-char 0)
           (if (looking-at "!<symlink>")
               (progn
                 (re-search-forward "!<symlink>\\(.*\\)\0")
                 (find-alternate-file (match-string 1)))
             )))
       (add-hook 'find-file-hooks 'follow-cygwin-symlink)
))

I no longer use these as once I get into cygwin, I stay in cygwin (i.e. cygwin emacs, cygwin find).

  • John
jwernerny
I figured sticking to the windows port was safer than relying on the cygwin team to port emacs, but this is a pretty big oversight by emacs. Thank you very much for providing this script. Have you tried using a port of find maybe from gnuwin32?
Drew
I pretty much stick to using the cygwin packages at this point, so I can't comment on the gnuwin32 find.
jwernerny
+1  A: 

For ease of setup, as well as performance, I'd recommend using the native windows version of emacs and the gnu win32 versions of find and grep etc. The important thing is to make sure that the binaries for these tools are first in your path, before the cygwin ones.

justinhj
Notes: It also needs to be before the windows find, not just cygwin. When I execute rgrep within emacs, it still throws an error. find: missing argument to `-name`. The find in gnuwin32 doesn't seem to be compatible with windows port of emacs.
Drew
That's not right, I'm using it!
justinhj
Maybe I'm using the wrong version of grep, do you have to set 'grep-program' just like you do with 'find-program' in the emacs init file?
Drew
Ok I figured it out ... http://justinsboringpage.blogspot.com/2010/10/rgrep-on-windows-7-for-emacs.html
justinhj
A: 

Sorry, I'll have to answer my own here. I had to use a specially bundled version of emacs for windows (not just the port), to get everything working with grep and find.

Drew