Update move-to-beginnings to work with org headers
This commit is contained in:
@@ -1,17 +1,19 @@
|
||||
(provide 'thoom-editing)
|
||||
|
||||
;; TODO Support org headings and comments
|
||||
(defun thoom/move-to-beginnings ()
|
||||
"Move between the two beginnings of a line: The very beginning,
|
||||
and the first non-whitespace character."
|
||||
;; TODO Support comments
|
||||
(defun move-to-beginnings ()
|
||||
"Move between possible beginnings of a line:
|
||||
The very beginning, the start of an org headline, and the first non-whitespace character."
|
||||
(interactive "^")
|
||||
(if (bolp)
|
||||
(back-to-indentation)
|
||||
(move-beginning-of-line 1)))
|
||||
|
||||
(cond
|
||||
((not (bolp))
|
||||
(move-beginning-of-line 1))
|
||||
((org-at-heading-p)
|
||||
(search-forward-regexp "*+ *" nil t))
|
||||
(t (back-to-indentation))))
|
||||
|
||||
(use-package emacs
|
||||
:bind (("C-a" . thoom/move-to-beginnings)))
|
||||
:bind (("C-a" . move-to-beginnings)))
|
||||
|
||||
;; Allow movement during isearch
|
||||
;; C/M-v move to next/previous match not currently visible
|
||||
|
||||
Reference in New Issue
Block a user