This question already has an answer here:
I need to change a space to a
| here and there and i guessed that the best possibility were to bind a mouse click and the insertion of the pipe
(global-set-key [s-mouse-1] '(insert "|"))
But when I tested my idea I was told
Wrong type argument: commandp, (insert "|")
I have read 49.3.10 Rebinding Mouse Buttons but it did not mention which types of commands are bindable to mouse clicks.