I use emacs for development and very often need to move to the start of a line (C-a). However if the line is indented, I\'d like to move to the point at which code st
A favorite way for me to handle this is to have C-a toggle between the beginning of the line and the beginning of the code. You can do so with this function:
(defun beginning-of-line-or-indentation ()
"move to beginning of line, or indentation"
(interactive)
(if (bolp)
(back-to-indentation)
(beginning-of-line)))
And add the appropriate binding to your favorite mode map:
(eval-after-load "cc-mode"
'(define-key c-mode-base-map (kbd "C-a") 'beginning-of-line-or-indentation))