unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* next-error fails to find file on Cygwin with recursive make
@ 2008-04-25 12:52 Gareth Rees
  2008-04-25 13:40 ` Stefan Monnier
  2008-04-25 14:39 ` Eli Zaretskii
  0 siblings, 2 replies; 5+ messages in thread
From: Gareth Rees @ 2008-04-25 12:52 UTC (permalink / raw)
  To: bug-gnu-emacs; +Cc: Gareth Rees

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
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




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-04-25 17:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-25 12:52 next-error fails to find file on Cygwin with recursive make Gareth Rees
2008-04-25 13:40 ` Stefan Monnier
2008-04-25 15:24   ` Drew Adams
2008-04-25 17:40   ` Gareth Rees
2008-04-25 14:39 ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).