I am writing my first major mode and in many ways it is going well. As one of the last steps, I want to write my own newline-and-indent function. I am having trouble getting my function called when I press return. I have the following in my local keymap for the mode:
(define-key pypoutline-mode-map "\C-j" 'pypoutline-newline-and-indent)
(define-key pypoutline-mode-map [<return>] 'pypoutline-newline-and-indent)
(define-key py-mode-map "\C-m" 'pypoutline-newline-and-indent)
but none of them seem to be working. If I type C-h k and then hit return (in a buffer running my mode), I get:
RET (translated from <return>) runs the command newline
which is an interactive compiled Lisp function in `simple.el'.
It is bound to RET.
(newline &optional arg)
Insert a newline, and move to left margin of the new line if it's blank.
If `use-hard-newlines' is non-nil, the newline is marked with the
text-property `hard'.
With arg, insert that many newlines.
Call `auto-fill-function' if the current column number is greater
than the value of `fill-column' and arg is nil.
What am I doing wrong? Is there something I need to add to the syntax table of my mode or somewhere else?
Thanks,
Ryan