Complete emacs rookie here, trying to get this to work:
(defun lock-sclang ()
"Locking sclang and setting the space bar to evaluate the current defun."
(interactive)
(setq-local buffer-read-only t)
(keymap-local-set "<SPC>" #'sclang-eval-defun))
This sets the buffer to read-only mode, but when I hit the space bar I only get the message that the buffer is read-only, and nothing happens.
If I do this manually with C-x C-q
and M-x keymap-local-set <RET> SPC <RET> sclang-eval-defun
it works. What am I doing wrong here?