I ran into a little problem when testing my pinner plugin. When using document_get_current(), the 'file_name' member was NULL even if the value returned by document_get_current() was not NULL and 'is_valid' was 1. You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/3770
-- Commit Summary --
* Return NULL from document_get_current() if document is 'untitled'
-- File Changes --
M src/document.c (11)
-- Patch Links --
https://github.com/geany/geany/pull/3770.patch https://github.com/geany/geany/pull/3770.diff
Closed #3770.
This break `document_get_current()` when the document has no filename. That means any functionality that uses `document_get_current()` won't work on a document that the user has not given a filename.
I will add further comments on the plugin.
There was a little more conversation about this in https://github.com/andy5995/pinner/commit/8151d8b0b16e4ff3e674d2ad7aaaf97c3b...
I wanted to mention that if you think is_valid should be 0 when file_name == NULL, I'd redo this PR so that happens on https://github.com/geany/geany/blob/06acd17cbeab6c0154e752b584aaf5001d9af1e8... and I'd get rid of the changes currently in this PR.
@elextr explained this to me in detail at https://github.com/andy5995/pinner/commit/8151d8b0b16e4ff3e674d2ad7aaaf97c3b...
I consider the matter resolved. :) Thank you @elextr
github-comments@lists.geany.org