Hello,

I am having an odd behavior with org-return. I use hard indents, and I have set 'org-adapt-indentation' to t in my .emacs file. However, I have noticed that sometimes when I press RET under a heading, instead of getting an indent to match the indentation of the heading after the *'s, point is set right at 0. For example, the expected behavior of pressing RET at the end of the line '* Heading' would be that point is placed on the next line below the heading, at column 2.

I am having an issue pinpointing what is causing the error, however, as I haven't found any consistency. Sometimes RET works as expected in my files, othertimes it does not. The bug does seem to only 'fix' in between instances of Emacs. I run Emacs as a daemon, and I noticed that sometimes the files will work and other times not work, but only between instances of the daemon/between system boots.

I have tried restarting org mode through the menu-bar option "restart org-mode (new version)", as well as disabling and renabling org-mode, as well as simply calling org-mode. No avail.

When I tried to debug the function, I really didn't have a clue what I was doing, but I think I narrowed the issue down to org-mode not getting the right context on where point is. I think this because org-return functions as expected when called with 't' as an argument, such as (org-return t), but I get the issue when calling just (org-return), which is bound to RET.

My work-around, for the time being, has just been to disable electric-indent-mode, and use C-J to get the desired behavior, as that calls (org-return-and-maybe-indent), and gives t if org-adapt-indentation is t and electric-indent-mode is disabled.

I apologize if my bug report is not up to scratch, but I have tried my best to give as much detail as I can, and this is my first time trying a bug report, as I am unsure how to proceed with this on my own.

Thank you,
Kevan B.