Friday, April 10, 2015

Re: quickfix information

On Friday, April 10, 2015 at 5:03:40 AM UTC-5, herm...@free.fr wrote:
> Hello,
>
> I'm looking for a way to have (buffer-local) variables persist in quickfix buffers -- e.g. project name and compilation mode which are likely (expected in my scenarios) to change between two calls to :make.
>
> :cclose seems to trigger a wipeout of the buffer -- thus all buffer variables are lost. And still when we play with getqflist(), :copen/:cprev/:cnew we are able to recover the list of quickfix messages. The quickfix information is not lost whilst the the buffer information is. Thus, I've tried to inject an item in the quickfix list, but we cannot use fields that are not expected. For instance
>
> let l = getqflist()
> l[0].mydata = {'foobar': [1, 2, 42] }
> call setqflist(l)
>
> echo has_key(getqflist()[0], 'mydata')
>
> prints 0
>
>
> I could inject a fake entry where I'd use 'nr' field as an id to dictionary of quickfix buffers. But is there a better and neater way to proceed ? Or the only persistent qf information is the qflist ?
>

I think the quickfix window title (:help w:quickfix_title) is also saved with the list in recent versions of Vim. You *might* be able to take advantage of this (especially since project name and compilation mode would probably be useful in the quickfix title as well).

But maybe taking advantage of this would actually require the patch from this todo item:

Patch to allow setting w:quickfix_title via setqflist() and setloclist()
functions. (Christian Brabandt, 2013 May 8, update May 21)
Patch to add getlocstack() / setlocstack(). (Christian Brabandt, 2013 May 14)
Second one. Update May 22.
Update by Daniel Hahler, 2014 Jul 4, Aug 14, Oct 14, Oct 15.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment