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