Fix `org-beginning-of-line'
* lisp/org.el (org-beginning-of-line): Prevent an error when buffer contains only a single star. * testing/lisp/test-org.el (test-org/beginning-of-line): Add tests.
This commit is contained in:
parent
7037eb591e
commit
6e1d7bc8fe
|
@ -23816,7 +23816,7 @@ beyond the end of the headline."
|
||||||
(when special
|
(when special
|
||||||
(cond
|
(cond
|
||||||
((and (looking-at org-complex-heading-regexp)
|
((and (looking-at org-complex-heading-regexp)
|
||||||
(= (char-after (match-end 1)) ?\ ))
|
(eq (char-after (match-end 1)) ?\s))
|
||||||
(setq refpos (min (1+ (or (match-end 3) (match-end 2) (match-end 1)))
|
(setq refpos (min (1+ (or (match-end 3) (match-end 2) (match-end 1)))
|
||||||
(point-at-eol)))
|
(point-at-eol)))
|
||||||
(goto-char
|
(goto-char
|
||||||
|
|
|
@ -1815,7 +1815,15 @@ drops support for Emacs 24.1 and 24.2."
|
||||||
(org-end-of-line)
|
(org-end-of-line)
|
||||||
(and (progn (org-beginning-of-line) (looking-at "Headline"))
|
(and (progn (org-beginning-of-line) (looking-at "Headline"))
|
||||||
(progn (org-beginning-of-line) (bolp))
|
(progn (org-beginning-of-line) (bolp))
|
||||||
(progn (org-beginning-of-line) (looking-at "Headline")))))))
|
(progn (org-beginning-of-line) (looking-at "Headline"))))))
|
||||||
|
;; Special case: Do not error when the buffer contains only a single
|
||||||
|
;; asterisk.
|
||||||
|
(should
|
||||||
|
(org-test-with-temp-text "*<point>"
|
||||||
|
(let ((org-special-ctrl-a/e t)) (org-beginning-of-line))))
|
||||||
|
(should
|
||||||
|
(org-test-with-temp-text "*<point>"
|
||||||
|
(let ((org-special-ctrl-a/e nil)) (org-beginning-of-line)))))
|
||||||
|
|
||||||
(ert-deftest test-org/end-of-line ()
|
(ert-deftest test-org/end-of-line ()
|
||||||
"Test `org-end-of-line' specifications."
|
"Test `org-end-of-line' specifications."
|
||||||
|
|
Loading…
Reference in New Issue