I have this function
;; Move the point to the first non-whitespace character of the line.
;; If the point is already there, then move it to the beginning of the line.
(defun my/smarter-beginning-of-line ()
(interactive)
(if (= (point) (progn (back-to-indentation) (point)))
(beginning-of-line)))
(keymap-global-set "C-a" 'my/smarter-beginning-of-line)
The function above works great when writing code:
1 var abc = 5; _
2 ^
3 |
4 ^ the first time I press C-a
5 |
6 the second time I press C-a
However in Org mode, I would like to use the default function which is org-beginning-of-line
. If I use my custom function in Org mode then the point jumps to the beginning of a paragraph instead of the beginning of the line like org-beginning-of-line
does.
How can I have my function only activate in non-org buffers? or is there a better way of doing this?