> Yes, that was what I was asking, describing a feature as "I want it to work 
> like Vscode" is unhelpful if the reader doesn't use Vscode or that feature of 
> Vscode, whereas "I want it to do xyz when I click blah because I have found 
> it useful in Vscode" is of course fine.

Sounds like we're in agreement in that case. ;)
> 
> > [end getting in ahead]
> 
> I was simply saying that I was making the above point as guidance ahead of 
> you doing anything, not that it was a criticism of anything you had done in 
> the past.
> 
> > I searched for document_valid
> 
> Sorry I meant 
> [`DOC_VALID`](https://www.geany.org/manual/reference/document_8h.html#a064c8f47ec543aa26cb8fd2a895a4ce6)
>  which does exactly your suggested code but allows for Geany to add 
> conditions without your code needing to be changed. Thats not to say all 
> plugins use it properly (or even Geany itself).

I'll use that macro, thanks for pointing it out, but as I mentioned  in 
https://github.com/geany/geany/pull/3770 , if doc->is_valid is true, 
doc->file_name may not necessarily be valid, it may be NULL. This happens when 
the 'document' in front of the user is an 'untitled' document. Although there's 
no point in trying to "pin" an untitled document, it's better to prevent a 
segfault if a user accidentally tries to pin it (like I did).

> 
> The important thing was to beware that state can change between callbacks to 
> your plugin, I saw a note that you made a list (of documents I think) global, 
> thats fine, but if you are saving information between callbacks you have to 
> check that the information in that list is valid every time your plugin is 
> entered because any arbitrary changes could be made (documents 
> opening/closing) between callbacks.

Ok. I know I antipated that if a user closes a doc on the pin list and clicks 
the filename from the pin list later, the doc will be re-opened. Which isn't so 
terrible but it sounds like at some point I should implement checking the list 
as you said.

> 
> > Maybe our miscommunication stems from my lack of experience developing 
> > Geany or GTK development, but feel free to elaborate.
> 
> Or the problem of the description of the plugin. I had in mind "pin" as being 
> locking the document tab to the left side of the notebook tabs, a feature 
> available in several other applications. Your `README.md` definition of "pin" 
> as adding to a sidebar list clears that up (and is probably simpler to 
> implement).

If you haven't already looked at the video, or had time to glance at my code, 
it is implemented. ;)



-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/pull/1308#issuecomment-1955159823
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany-plugins/pull/1308/c1955159...@github.com>

Reply via email to