New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`{}` no longer expands to just the part `*` matched #116

Closed
shym opened this Issue Oct 8, 2018 · 8 comments

Comments

Projects
None yet
3 participants
@shym

shym commented Oct 8, 2018

I had not updated projectionist in quite some time. I notice that the {} no longer expands as it used to.

I set a projections like:

"doc/*.tex": {
    "type": "doc",
    "dispatch": "-dir=doc make {}.pdf"
}

Before commit d675f23, my dispatch for doc/bob.tex defaulted to :Dispatch -dir=/tmp/project -dir=doc make bob.pdf (which worked nice).
Now it defaults to :Dispatch -dir=/tmp/project -dir=doc make /tmp/project/bob.pdf (which is broken, obviously).

Did I miss something about how I could use {}, for instance with transformations, to get just the matched part, or at least rebuild a proper path? I tried "dispatch": "-dir=doc make doc/{}.pdf" but this yields :Dispatch -dir=/tmp/project -dir=doc make doc//tmp/project/bob.pdf.

[Oh, and by the way, I love the fact that projections even work in fugitive revisions now!]

@Axnyff

This comment has been minimized.

Axnyff commented Oct 14, 2018

Could you replace "dispatch": "-dir=doc make {}.pdf" with "dispatch": "-dir=doc make {basename}.pdf" ? It should only replace the last part of the path

@tpope

This comment has been minimized.

Owner

tpope commented Oct 14, 2018

I can confirm this is a bug, I just haven't gotten around to fixing it.

@tpope

This comment has been minimized.

Owner

tpope commented Oct 21, 2018

BTW I'd recommend make -C doc over the hack that is -dir=.

@shym

This comment has been minimized.

shym commented Oct 28, 2018

Thank you very much for the fix!

To follow your suggestion I finally added my localized "entering directory" messages to my efm. But in some cases, it seems to be ignored.
I managed to reproduce this by adding a configuration for make:

"doc/*.tex": {
    "type": "doc",
    "dispatch": "make -C doc {}.pdf",
    "make": "make -C doc"
}

Without the "make"-line, running :Dispatch uses my extended efm. With the "make"-line, it doesn’t (it uses the vim default?).
Maybe I should have opened a new issue?

@tpope

This comment has been minimized.

Owner

tpope commented Oct 28, 2018

Setting the compiler to make forces it to reset to the global value of 'efm', which should be what you want, assuming you are overriding it globally. How are you overriding it?

elseif compiler ==# 'make'
setlocal errorformat<

@shym

This comment has been minimized.

shym commented Oct 29, 2018

I set efm+=... in my ~/.vimrc. With the projection in my last comment, running :Make bob.pdf uses that global 'efm' (if I understand correctly, that’s what’s doing L559, isn’t it?) but :Dispatch make -C doc bob.pdf uses the default value. (I checked the value of 'efm' with an :echo &efm in the quickfix window beside checking whether doc is correctly prepended to error messages).
Could the following lines be the reason?

https://github.com/tpope/vim-dispatch/blob/ab7470d4b03bae9880bf2b5cef60fc0fb51b1101/autoload/dispatch.vim#L574-L576

or should I set my 'efm' another way?

@tpope

This comment has been minimized.

Owner

tpope commented Oct 31, 2018

That's a correct diagnosis. Just changed it to errorformat<, which I think makes more sense.

@shym

This comment has been minimized.

shym commented Nov 4, 2018

I think so too. Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment