Let’s say I want to change a command slightly while still utilizing a code irrespective of updates. For example, _display. I want to automatically copy the code of _display, and use my own _display instead while still using the _display code.
Why not just use your own _display within your custom *.gmic while also comparing the code after each update to see if any changes were made. I believe the previous stdlibs are still there on your computer.
As for your issue, it is about the command order. It could be that $$_display is not retrieving anything because either the syntax is wrong or the stdlib _display has not yet been accessed.
Ok this one is a bit tricky
Command command (aka m) interprets backslashes in the specified string argument as a way to insert specific codes (e.g. \n is replaced by 10).
The command _display is quite complex and has backslashes in it, and you don’t want to make command m interprets those. The solution is to use the (rarely useful) syntax {/string}, to make sure the backslashes inside the string will be actually backslashed (so a backslash in the original string will be kept when passed to the m command).
The solution is then:
foo :
m "my_display : "$$display
m "_my_display : "{/$$_display}
Maybe to make things more clear, this example shows how a backlashed character (\n) is substituted in the m command.
foo :
m "bar : x=3\ny=4"
defines a command bar that is valid:
gmic foo v + bar
[gmic]./ Start G'MIC interpreter (v.3.3.6).
[gmic]./ Increment verbosity level (set to 2).
[gmic]./bar/ Set local variable 'x=3'.
[gmic]./bar/ Set local variable 'y=4'.
[gmic]./ End G'MIC interpreter.
Hmm, my idea does work, but it seems you need a image to load _display and thus the cli_end trick would work in that case. Hmmm, not sure what to do at this point besides suggesting a change into how importing .gmic file work for those cases where you don’t want images before importing gmic. But, I guess I can do this trick with input too, but can’t see how it’s possible.
It would be nice if input_gmic was a command that calls input_gmic.
EDIT: Never mind about modifying input via cli_start which means I’d like a input_gmic command which has a built-in input_gmic.