setqflist and QuickFixCmdPre|QuickFixCmdPost

46 views
Skip to first unread message

Paul Jolly

unread,
Jun 4, 2019, 8:46:17 AM6/4/19
to vim...@googlegroups.com
Hi all,

Despite the documentation being quite clear, I was a little surprised
that setqflist did not trigger QuickFixCmdPre|QuickFixCmdPost.

This is hardly surprising: setqflist is a function, not a command.

Not only that, if we ignore the fact it's not a command, the very
example given in QuickFixCmdPost-example would become infinitely
recursive if this were possible.

Has there been any discussion on this in the past?

Reason being, I'd like the user to be able to decide what to do when I
populate the quickfix list.

It might be that this scenario just doesn't "fit" with
QuickFixCmdPre|QuickFixCmdPost, and hence I need to investigate
options described in
https://groups.google.com/d/msg/vim_dev/uiw6gHft-0g/i8qdfT8YBQAJ in
more detail.

Any pointers would be appreciated.

Thanks,


Paul

Yegappan Lakshmanan

unread,
Jun 15, 2019, 12:11:41 PM6/15/19
to vim_dev
Hi,

On Tue, Jun 4, 2019 at 5:46 AM Paul Jolly <pa...@myitcv.io> wrote:
>
> Hi all,
>
> Despite the documentation being quite clear, I was a little surprised
> that setqflist did not trigger QuickFixCmdPre|QuickFixCmdPost.
>
> This is hardly surprising: setqflist is a function, not a command.
>
> Not only that, if we ignore the fact it's not a command, the very
> example given in QuickFixCmdPost-example would become infinitely
> recursive if this were possible.
>

Yes. As you described above, these autocmds are triggered only
for the quickfix commands and not for the quickfix functions.

>
> Has there been any discussion on this in the past?
>

No. I am not aware of any discussions about this in the past.

>
> Reason being, I'd like the user to be able to decide what to do when I
> populate the quickfix list.
>

Different plugins and user triggered commands can populate the
quickfix/location lists. To handle plugin specific behavior, it is simpler
to have the plugin call a user supplied function(s) or autocmd:

doautocmd User MyPluginEvent

Regards,
Yegappan

Paul Jolly

unread,
Jun 18, 2019, 5:09:26 AM6/18/19
to vim...@googlegroups.com
> Different plugins and user triggered commands can populate the
> quickfix/location lists. To handle plugin specific behavior, it is simpler
> to have the plugin call a user supplied function(s) or autocmd:

Thanks very much for the reply. This is the conclusion I had also reached.


Paul
Reply all
Reply to author
Forward
0 new messages