Adding a menu via a plugin

I am editing the plugin csvTable (, adding a menu item, and I get the menu item only sometimes when I load the plugin. I have perhaps guessed correctly what happens and written then code so that the menu item appears every time; could someone tell me if what I did makes sense?

Here is the description of what I did and guessed.

What I did

The menu definition is

(tm-menu (insert-table-menu)
	 (when (csv-table-condition)
	   ("Insert table from cvs file" (choose-file insert-csv-table "choose table file" ""))))

Whether the menu appears or not, there is no error message on the terminal.

How I tried to fix the code

I suspect that insert-table-menu gets loaded lazily, therefore sometimes I load the plugin when it is not yet defined, then when the lazy definition is loaded it overwrites my definition. In fact, in init-texmacs.scm I read

(lazy-menu (table table-menu) insert-table-menu)

By this guess, I have added

(lazy-define-force insert-table-menu)

before the plugin’s menu definition and in a few tests the menu appeared every time.


Does this make sense?