EDIT: I don't know why I was having a problem, but my code works just fine as it is. There's no problem here, but I'll leave this post up as an example!
____
I want `M-RET`(aka `org-meta-return`) to call `org-insert-heading-after-current` instead of `org-insert-heading`. To do this, I copied the the `(defun org-meta-return...)` from org.el to my init.el, and made some small changes. But it doesn't show up as an `M-x` command and it doesn't show up in the help system.
;; Override for org-meta-return to use org-insert-heading-after-current instead
;; of org-insert-heading
;; I just copied org-meta-return and made some changes to the help text and the function call.
(defun dls-org-meta-return (&optional arg)
"MY SPECIAL OVERRIDE. Insert a new heading or wrap a region in a table.
Calls `org-insert-heading-after-current' [INSTEAD OF ORG-INSERT-HEADING], `org-insert-item' or
`org-table-wrap-region', depending on context. When called with
an argument, unconditionally call `org-insert-heading'."
(interactive "P")
(org-check-before-invisible-edit 'insert)
(or (run-hook-with-args-until-success 'org-metareturn-hook)
(call-interactively (cond (arg #'org-insert-heading-after-current)
((org-at-table-p) #'org-table-wrap-region)
((org-in-item-p) #'org-insert-item)
(t #'org-insert-heading)))))
I would like help getting this to work, or at least understanding why "it doesn't work that way".
(I know I can just call `C-u C-RET` to accomplish the same thing, but I'm learning elisp and I did the above work first, so I'd like to know why it doesn't work.)