In an attempt to give bootstrapped solution, t-shirt sized, and that is both a fish, a fishing lesson and a fishing rod, this is what I came with.
- Type
c-h k c-h k
and read. - Type
c-h k c-h f
and read. - With the previous tools, try to understand the following:
(defun foo () (interactive) (save-excursion (beginning-of-line) (insert ";"))) (global-set-key (kbd "C-c ;") 'foo)
- Select the whole snippet and type m-x eval-region.
- Type c-c ; .
- Try to understand what just happened.