I'd like to change the default behaviour of pressing C-e so that, If I have an inline comment, pressing C-e should first go to the end of line and pressing it again should go to the beginning of the first non-space character in the inline comment like so :-
(insert code here) ;; |inline comment.
How can I achieve this (I know very little elisp to be able to code this :( )? This was inspired by
smarter-move-beginning-of-line which toggles between the first non-space character in a line and the beginning of line.