[vim/vim] quickfix list get the incorrect directory when 'make -C' (#4122)

91 views
Skip to first unread message

Astone

unread,
Mar 17, 2019, 12:12:50 AM3/17/19
to vim/vim, Subscribed

project directory:

./

├── Makefile

└── main

    ├── Makefile

    └── main.go

Makefile

build:

	make -C main

main/Makefile

build:

         go build

main/main.go

package main



func main() {

	i := 0

}

when i call :make in ./main/ I get the right quick fix.

  1 main.go|4 col 7| i declared and not used                                                                            

but when i call :make in ./ I get the incorrect quick fix.

  1 || make -C main

  2 || go build

  3 || # _/Users/marco/Astone/git/test/main

  4 main.go|10 col 7| i declared and not used                                                                           

  5 || make[1]: *** [build] Error 2 

  6 || make: *** [build] Error 2

when I press enter in line 4. It will create a new file _/Users/marco/Astone/git/test/main.go not open the right file _/Users/marco/Astone/git/test/main/main.go

It's also happend in linux. and if u call cd .. in Makefile will cause the same problem.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub

general0000

unread,
Mar 24, 2019, 4:21:47 AM3/24/19
to vim/vim, Subscribed

I've had this problem, too. I found the builtin errorformat can't work properly,I modified errorformat and now it's ok:
set errorformat+=
%D%\a[%\d]:\ Entering\ directory\ %f', \%D%*\\a[%*\\d]:\ Entering\ directory\ '%f', \%D%*\\a:\ Entering\ directory\ %f',
%D%*\a:\ Entering\ directory\ '%f'

Bram Moolenaar

unread,
Mar 24, 2019, 7:59:35 AM3/24/19
to vim/vim, Subscribed


> I've had this problem, too. I found the builtin errorformat can't work properly,I modified errorformat and now it's ok:
> set errorformat+=
> \%D%*\\a[%*\\d]:\ Entering\ directory\ `%f',
> \%D%*\\a[%*\\d]:\ Entering\ directory\ '%f',
> \%D%*\\a:\ Entering\ directory\ `%f',
> \%D%*\\a:\ Entering\ directory\ '%f'

What exactly is the change? The default should do the same:

%D%*\a[%*\d]: Entering directory %%*[`']%f'
%X%*\a[%*\d]: Leaving directory %*[`']%f'
%D%*\a: Entering %directory %*[`']%f'
%X%*\a: Leaving directory %*[`']%f'

--
hundred-and-one symptoms of being an internet addict:
108. While reading a magazine, you look for the Zoom icon for a better
look at a photograph.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Yegappan Lakshmanan

unread,
Mar 24, 2019, 12:15:57 PM3/24/19
to vim_dev, reply+00b1d198934ae79f8483778e1ddea1aa904ac5c...@reply.github.com, vim/vim, Subscribed
Hi,
Vim relies on the 'errorformat' option setting to parse the make
output. To correctly
parse entering and leaving directories, the 'errorformat' option setting must be
set to look for lines that print the directory names. You can refer to the
":help quickfix-directory-stack" help text for more information about this.

The default 'errorformat' option setting expects the text "Entering directory"
and "Leaving directory" in the make output to parse the change in directories.
In the above output, I don't see these lines. It looks like the directory
name is printed using the below format:

# _/Users/marco/Astone/git/test/main

Which 'make' are you using? What is 'makeprg' set to?
You may need to modify the 'errorformat' setting to parse the above line
using %D and %X.

- Yegappan

vim-dev ML

unread,
Mar 24, 2019, 12:16:14 PM3/24/19
to vim/vim, vim-dev ML, Your activity
Hi,

On Sat, Mar 16, 2019 at 9:12 PM Astone <vim-dev...@256bit.org> wrote:
>
Vim relies on the 'errorformat' option setting to parse the make
output. To correctly
parse entering and leaving directories, the 'errorformat' option setting must be
set to look for lines that print the directory names. You can refer to the
":help quickfix-directory-stack" help text for more information about this.

The default 'errorformat' option setting expects the text "Entering directory"
and "Leaving directory" in the make output to parse the change in directories.
In the above output, I don't see these lines. It looks like the directory
name is printed using the below format:

# _/Users/marco/Astone/git/test/main

Which 'make' are you using? What is 'makeprg' set to?
You may need to modify the 'errorformat' setting to parse the above line
using %D and %X.

- Yegappan

Astone

unread,
Mar 25, 2019, 2:36:42 AM3/25/19
to vim/vim, vim-dev ML, Comment

Closed #4122.


You are receiving this because you commented.

Astone

unread,
Mar 25, 2019, 2:36:44 AM3/25/19
to vim/vim, vim-dev ML, Comment

Thanks very much. I thinks I got the key.


You are receiving this because you commented.

Reply all
Reply to author
Forward
0 new messages