Say, the C-M-j is bound to c-indent-new-comment-line for c-mode (and c++-mode) and indent-new-comment-line for other modes, but I want to define a function that will execute C-M-j to c-indent-new-comment-line in c-mode (and c++-mode) and indent-new-comment-line in other modes.
Is there any simple way that I can just embed the shortcut but not check the current major mode and then execute the different functions in defun...?
Example:
(defun example-fn ()
(interactive)
(beginning-of-line)
(execute-C-M-j)
(next-line))
The (execute-C-M-j) is what I want, execute the key not the command it is bound to, but I don't know how to implement this?