Post by Jean-Marc Lasgouttes Post by Pavel Sanda Post by Jean-Marc Lasgouttes
There has been quite a bit of discussion on lyx-fr on the
reading the statistics of a document for further processing. As a result,
Stéphane Mourey implemented a new LFUN, server-get-statistics. If there is
no objection, I am going to push this to master (and eventually branch)
What usecase lead to this lfun? If the point is to store this info in document
more proper way would be insetinfo.
The problem with insetinfo is that havbing to update this information
at every keystroke can be expensive, unless of course the value is not
shown in the edit window (but then you know that this is the next
thing people would ask for...).
OTOH, it would make sense to have an InsetInfo instance that shows the
result of an lfun (probably maked as Embedable in LyXAction.cpp to
I guess one problem is that Stéphane did not really know what
InsetInfo was (they are not really discoverable) and thus started in
this direction. And I did not want to hamper his creativity :)
Stéphane, would you care to elaborate why a LFUN is better than an
inset that contains this same information?
Well, it's hard for me to explain why lfun is better than insetinfo in
this case because I do not really know what infosets are, except the few
words Jean-Marc told me.
The fact is that, wondering what infosets are and reading the
documentation in the hope to find out, I discovered lfun and lyxserver.
So I figured out a way to get the statistics in my doc using a strategy,
mimic of the one I used previously with wordcount based on write18. And
it is fine for me. And more than that, as my documents often contain
informations that are not really part of the main text like licence or
contact informations, I was able to set modifiers to the statistics
fixing the difference in the document, but maybe could this be achieved
with insetinfo too?
I do not really know if using insetinfo better or proper, and I don't
care. I like LyX very much, not for itself, but for the way I use it.
When I read the code, I find it beautiful, with high quality standards,
and I respect that more than I can tell. So I did the trick I need this
way. It was only a few lines but they were not easy for me, as it is
only the second time in my whole life that I write some C++. Now I share
it as I'm proud of my work and I think someone else could find it useful.
I could consider to re-do it another way if I'm convicted that it is
useful to someone, but certainly not for conceptual beauty only, even if
Conclusion : in this case, in my opinion, LFUN is better because the
trick is done, and insetinfo is to do. But you may consider this to be a
Blog: Impossible Exil <http://impossible-exil.info>