-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
fix(quickfix): add event QuickFixChanged #16216
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
base: master
Are you sure you want to change the base?
Conversation
524ddc5
to
c996114
Compare
src/quickfix.c
Outdated
@@ -8044,6 +8045,9 @@ set_errorlist( | |||
qf_list_changed(qf_get_curlist(qi)); | |||
} | |||
|
|||
qfbuf = buflist_findnr(qi->qf_bufnr); | |||
apply_autocmds(EVENT_QUICKFIXCMDCHANGED, NULL, NULL, FALSE, qfbuf); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the use case for this autocmd? What happens if the quickfix list or location list is modified from this autocmd?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, you can use the QuickFixCmdPost
event to, e.g., open a quickfix or location list window if a command has filled the list with something to work on. (For example, here.) But if you fill the lists using setqflist
or setloclist
, then the QuickFixCmdPost
event is not triggered. In that case, you have to manually create and fire a dummy autocommand for users to hook into. E.g., here. This additional autocommand event would help users and plugin authors that fill the quickfix or location lists with setqflist
and setloclist
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also what happens if you move to a different quickfix or location list in the stack? What if you :bw
the buffer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after use setqflist or setloclist before copen lopen
in this case qfbuf is NULL do we want also trigger ? i do trigger here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@telemachus moved to trigger on qf_list_changed. But this function runs before qf_update_buffer. Meaning that when the event triggers the qfbuffer may not be updated. Does this have any impact.
Edit: I have updated there. see test case. if useful
Thanks, but I'd like to see few more tests, which modifies the quickfix/locationlist, verify this is also been called by e.g. :vimgrep
command or other quickfix commands or removes the window.
Also I am wondering, shouldn't this autocommand be called QuickFixChanged
? And finally, do we need to know which command/expr modified the quickfix list?
4043a97
to
2e95824
Compare
currently this is used for calling function there is no command to record and if we want to command does this not already known by au_name |
2e95824
to
5043305
Compare
I think, it would be helpful to set |
5043305
to
52a7e52
Compare
11649fb
to
82c5631
Compare
this event is trigger after calling of setqflist and setloclist
82c5631
to
75e2b5a
Compare
this event is trigger after calling of setqflist and setloclist
context neovim/neovim#13099