[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: opening correct source file on compile error
From: |
kl . vanw |
Subject: |
Re: opening correct source file on compile error |
Date: |
20 Oct 2006 07:00:34 -0700 |
User-agent: |
G2/1.0 |
Kevin Rodgers wrote:
> kl.vanw@gmail.com wrote:
> > Here's my situation. My header files (C++) are located in a dir named
> > src/lib. These are the files I edit and are CVS managed. When I run
> > 'make', make copies the headers into include/, which my other source
> > files include. Then if there was an error in one of the headers, and I
> > use 'next-error' in the compilation buffer to open the header, emacs
> > opens the file in the include/ directory, but I really need it to open
> > the header in src/lib. Can I some how help emacs find the right file?
> >
> > Unfortunately, I don't have the option of changing the way our makefile
> > works or the #include statements.
>
> Try this:
>
> (add-hook 'find-file-hook
> (lambda ()
> (let* ((file (file-name-nondirectory buffer-file-name))
> (directory (file-name-directory buffer-file-name))
> (alternate-file (expand-file-name file "../src/lib")))
> (when (and (equal (file-name-nondirectory
> (directory-file-name directory))
> "include")
> (file-exists-p alternate-file))
> (find-alternate-file alternate-file)))))
>
> --
> Kevin
I tried that, but it didn't work. I also tried specifing the full paths
in the above, but it didn't work either. Did you verify that it works
for you?
- opening correct source file on compile error, kl . vanw, 2006/10/18
- Re: opening correct source file on compile error, Kevin Rodgers, 2006/10/19
- Message not available
- Re: opening correct source file on compile error,
kl . vanw <=
- Re: opening correct source file on compile error, Kevin Rodgers, 2006/10/23
- Message not available
- Re: opening correct source file on compile error, kl . vanw, 2006/10/24
- Re: opening correct source file on compile error, Burton Samograd, 2006/10/24
- Re: opening correct source file on compile error, kl . vanw, 2006/10/24
- Re: opening correct source file on compile error, Burton Samograd, 2006/10/24
- Re: opening correct source file on compile error, Kevin Rodgers, 2006/10/24
- Message not available
- Re: opening correct source file on compile error, kl . vanw, 2006/10/25
Message not available