[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

next-error fails to find file on Cygwin with recursive make

From: Gareth Rees
Subject: next-error fails to find file on Cygwin with recursive make
Date: Fri, 25 Apr 2008 13:52:10 +0100
User-agent: Thunderbird (Windows/20080213)

I am using

GNU Emacs 22.1.1 (i386-mingw-nt5.1.2600) of 2007-06-02 on RELEASE
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --cflags -Ic:/gnuwin32/include'

I have `shell-file-name' set to "bash" and I type M-x compile RET make RET.

Cygwin's "make" produces the following output in the *compilation* buffer:

-*- mode: compilation; default-directory: "c:/tmp/test/" -*-
Compilation started at Fri Apr 25 13:13:20

make -f src/Makefile
make[1]: Entering directory `/cygdrive/c/tmp/test'
gcc -Wall -g -o build/test.o -c src/test.c
src/test.c:1:2: #error Error
make[1]: *** [build/test.o] Error 1
make[1]: Leaving directory `/cygdrive/c/tmp/test'
make: *** [all] Error 2

Compilation exited abnormally with code 2 at Fri Apr 25 13:13:21

Now I type M-x next-error RET. I expect Emacs to go to the location of the first error, but instead it asks me thiis question:

   Find this error in (default src/test.c): c:/cygdrive/c/tmp/test

The reason it can't find the file is that `compilation-directory-matcher' has matched the recursive make's "Entering directory" line, which contains an absolute path name in Cygwin syntax; and then `compilation-find-file' has called `expand-file-name', which has converted `/cygdrive/c/tmp/test' into the incorrect `c:/cygdrive/c/tmp/test' instead of the correct `c:/tmp/test'.

I am aware that I can work around this problem by advising `expand-file-name' to recognize Cygwin path names and convert them to path names that Emacs recognizes, for example like this:

(defadvice expand-file-name (before cygpath-convert-to-emacs-path activate)
 (let ((name (ad-get-arg 0)))
   (when (string-match "^/cygdrive/\\([a-z]\\)\\(/.*\\)" name)
(ad-set-arg 0 (concat (match-string 1 name) ":" (match-string 2 name))))))

However, it would be nice if recursive make in Cygwin worked in Emacs out of the box.

Gareth Rees

reply via email to

[Prev in Thread] Current Thread [Next in Thread]