I don't know elisp, but I'm trying to do something like the following:
(add-hook
'scala-mode-hook
(lambda ()
(define-key scala-mode-map (kbd "RET") (lambda ()
(scala-newline)
(scala-indent-line)))))
Goal is to call the two functions each time I hit the ENTER key. How do I actually do this?
I do essentially this in so many modes that I've squashed them all together:
(mapcar (lambda (hooksym)
(add-hook hooksym
(lambda ()
(local-set-key (kbd "C-m") 'newline-and-indent)
)))
'(
clojure-mode-hook
emacs-lisp-mode-hook
erlang-mode-hook
java-mode-hook
js-mode-hook
lisp-interaction-mode-hook
lisp-mode-hook
makefile-mode-hook
nxml-mode-hook
python-mode-hook
ruby-mode-hook
scheme-mode-hook
sh-mode-hook
))
Just stick scala-mode-hook
in there somewhere and it'll work for you too :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With