On Tue, 03 Mar 2009 20:13:50 +0100, Colomban wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi,
Enrico Tröger a écrit :
Perfect, it works well :) But I need to update the tag list manually to generate correct documentation and insert it a the right place, but even if it can be found in the online API doc and in tm_source_file.[ch], tm_source_file_buffer_update() seems not usable from plugins (gets me
tm_source_file_buffer_update() is experimental to update the tags array from the current buffer in Geany, i.e. the displayed text instead of reading the file contents from a file. But this doesn't work at all yet and so is disabled. Additionally, this is not part of the plugin API and so you get an undefined symbol error. Simply ignore it.
Instead use tm_source_file_update() which should work ok but be aware that it reads the contents from the file on disk, so when the document in Geany has changes, you should save it first with document_save_file (). And at this point, tm_source_file_update() is already called after saving the document, so no need to call it manually.
OK. But isn't it possible to at least emulate tm_source_file_buffer_update() by i.e. writing given buffer to a temporary file and updating current document's tags with newly parsed ones? 'Cause I think it is a little ill to force saving of the file only for updating tags. I know my proposal wouldn't have gains of memory parsing (no need to write/read file) but it should work as a temporary workaround, if I miss nothing. What do you think?
Theoretically possible but doesn't make much sense in practise. To do what you want, you would have to create a temporary file, write the current editor's content in it, then create a TMSourceFile for this temporary file, update it, read its tags and delete everything again.
Possible but seems kind of weird to me.
Regards, Enrico