I have a macro called f5
, which I globally bind the keyboard key <f5>
to:
(fset 'f5
[?i ?\[ ?* ?* ?P ?1 ? ?\] escape ?h ?a])
(global-set-key (kbd "<f5>") 'f5)
So when I press f5, it inserts [**P1 ]
, and backs up the cursor and leaves me in input mode, which is fine.
But I have reached a stage where, depending on what I am doing, I don't want it to always insert "P1". Sometimes I might like it to insert, say, "P2". What I really want is that it inserts the content of a variable, which variable I can set depending on what I am doing. But I don't know how to reference the contents of a variable in a macro definition. Surely this is possible; how is it done?