unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Gareth Rees <gareth.rees@pobox.com>
To: bug-gnu-emacs@gnu.org
Cc: Gareth Rees <gareth.rees@pobox.com>
Subject: next-error fails to find file on Cygwin with recursive make
Date: Fri, 25 Apr 2008 13:52:10 +0100	[thread overview]
Message-ID: <4811D3FA.9000802@pobox.com> (raw)

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




             reply	other threads:[~2008-04-25 12:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-25 12:52 Gareth Rees [this message]
2008-04-25 13:40 ` next-error fails to find file on Cygwin with recursive make Stefan Monnier
2008-04-25 15:24   ` Drew Adams
2008-04-25 17:40   ` Gareth Rees
2008-04-25 14:39 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4811D3FA.9000802@pobox.com \
    --to=gareth.rees@pobox.com \
    --cc=bug-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).