|
@@ -2467,24 +2467,78 @@ http://article.gmane.org/gmane.emacs.orgmode/21459/"
|
|
|
|
|
|
(ert-deftest test-org/beginning-of-line ()
|
|
|
"Test `org-beginning-of-line' specifications."
|
|
|
- ;; Standard test.
|
|
|
+ ;; Move to beginning of line. If current line in invisible, move to
|
|
|
+ ;; beginning of visible line instead.
|
|
|
(should
|
|
|
(org-test-with-temp-text "Some text\nSome other text<point>"
|
|
|
- (progn (org-beginning-of-line) (bolp))))
|
|
|
- ;; Standard test with `visual-line-mode'.
|
|
|
+ (org-beginning-of-line)
|
|
|
+ (bolp)))
|
|
|
+ (should
|
|
|
+ (org-test-with-temp-text "* H1\n** H2<point>"
|
|
|
+ (org-overview)
|
|
|
+ (org-beginning-of-line)
|
|
|
+ (= (line-beginning-position) 1)))
|
|
|
+ ;; With `visual-line-mode' active, move to beginning of visual line.
|
|
|
(should-not
|
|
|
(org-test-with-temp-text "A <point>long line of text\nSome other text"
|
|
|
- (progn (visual-line-mode)
|
|
|
- (dotimes (i 1000) (insert "very "))
|
|
|
- (org-beginning-of-line)
|
|
|
- (bolp))))
|
|
|
- ;; At an headline with special movement.
|
|
|
+ (visual-line-mode)
|
|
|
+ (dotimes (i 1000) (insert "very "))
|
|
|
+ (org-beginning-of-line)
|
|
|
+ (bolp)))
|
|
|
+ ;; In a wide headline, with `visual-line-mode', prefer going to the
|
|
|
+ ;; beginning of a visual line than to the logical beginning of line,
|
|
|
+ ;; even if special movement is active.
|
|
|
+ (should-not
|
|
|
+ (org-test-with-temp-text "* A <point>long headline"
|
|
|
+ (visual-line-mode)
|
|
|
+ (dotimes (i 1000) (insert "very "))
|
|
|
+ (goto-char (point-max))
|
|
|
+ (org-beginning-of-line)
|
|
|
+ (bobp)))
|
|
|
+ (should-not
|
|
|
+ (org-test-with-temp-text "* A <point>long headline"
|
|
|
+ (visual-line-mode)
|
|
|
+ (dotimes (i 1000) (insert "very "))
|
|
|
+ (goto-char (point-max))
|
|
|
+ (let ((org-special-ctrl-a/e t)) (org-beginning-of-line))
|
|
|
+ (bobp)))
|
|
|
+ ;; At an headline with special movement, first move at beginning of
|
|
|
+ ;; title, then at the beginning of line, rinse, repeat.
|
|
|
(should
|
|
|
(org-test-with-temp-text "* TODO Headline<point>"
|
|
|
(let ((org-special-ctrl-a/e t))
|
|
|
(and (progn (org-beginning-of-line) (looking-at "Headline"))
|
|
|
(progn (org-beginning-of-line) (bolp))
|
|
|
(progn (org-beginning-of-line) (looking-at "Headline"))))))
|
|
|
+ (should
|
|
|
+ (org-test-with-temp-text "* TODO [#A] Headline<point>"
|
|
|
+ (let ((org-special-ctrl-a/e t))
|
|
|
+ (org-beginning-of-line)
|
|
|
+ (looking-at "Headline"))))
|
|
|
+ ;; At an headline with reversed movement, first move to beginning of
|
|
|
+ ;; line, then to the beginning of title.
|
|
|
+ (should
|
|
|
+ (org-test-with-temp-text "* TODO Headline<point>"
|
|
|
+ (let ((org-special-ctrl-a/e 'reversed)
|
|
|
+ (this-command last-command))
|
|
|
+ (and (progn (org-beginning-of-line) (bolp))
|
|
|
+ (progn (org-beginning-of-line) (looking-at "Headline"))))))
|
|
|
+ ;; At an item with special movement, first move after to beginning
|
|
|
+ ;; of title, then to the beginning of line, rinse, repeat.
|
|
|
+ (should
|
|
|
+ (org-test-with-temp-text "- [ ] Item<point>"
|
|
|
+ (let ((org-special-ctrl-a/e t))
|
|
|
+ (and (progn (org-beginning-of-line) (looking-at "Item"))
|
|
|
+ (progn (org-beginning-of-line) (bolp))
|
|
|
+ (progn (org-beginning-of-line) (looking-at "Item"))))))
|
|
|
+ ;; At an item with reversed movement, first move to beginning of
|
|
|
+ ;; line, then to the beginning of title.
|
|
|
+ (should
|
|
|
+ (org-test-with-temp-text "- [X] Item<point>"
|
|
|
+ (let ((org-special-ctrl-a/e 'reversed)
|
|
|
+ (this-command last-command))
|
|
|
+ (and (progn (org-beginning-of-line) (bolp))
|
|
|
+ (progn (org-beginning-of-line) (looking-at "Item"))))))
|
|
|
;; Leave point before invisible characters at column 0.
|
|
|
(should
|
|
|
(org-test-with-temp-text "[[http://orgmode.org]]<point>"
|
|
@@ -2496,6 +2550,11 @@ http://article.gmane.org/gmane.emacs.orgmode/21459/"
|
|
|
(let ((org-special-ctrl-a/e t))
|
|
|
(org-beginning-of-line)
|
|
|
(bolp))))
|
|
|
+ (should
|
|
|
+ (org-test-with-temp-text "[[http<point>://orgmode.org]]"
|
|
|
+ (visual-line-mode)
|
|
|
+ (org-beginning-of-line)
|
|
|
+ (bolp)))
|
|
|
;; Special case: Do not error when the buffer contains only a single
|
|
|
;; asterisk.
|
|
|
(should
|