How to set keybindings to work in certain modes in emacs and not others
Sorry if this is a stupid question, but I've searched how this is done for hours. I want some elisp functions to bind to specific key bindings and for those key bindings to call a function depending on the mode the current buffer is in. I'll give you an example.
(defun sml-create-comment ()
"Documentation.."
(interactive)
(code-to-insert-comment))
I want this function to be bound to a key like "Cc c". If I were in sml mode and typed "Cc c" it would comment sml; and similarly, if I were in c mode, it would comment c. Sorry if I phrased it strange or if it should be obvious.
+3
source to share