Drew
Drew

Reputation: 4691

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.

Upvotes: 2

Views: 1687

Answers (3)

Drew
Drew

Reputation: 4691

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.

Upvotes: 0

justinhj
justinhj

Reputation: 11306

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.

Upvotes: 1

jwernerny
jwernerny

Reputation: 7048

(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

Upvotes: 0

Related Questions