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:
Nicolas Goaziou 2015-07-22 09:39:07 +02:00
parent 7037eb591e
commit 6e1d7bc8fe
2 changed files with 10 additions and 2 deletions

View File

@ -23816,7 +23816,7 @@ beyond the end of the headline."
(when special
(cond
((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)))
(point-at-eol)))
(goto-char

View File

@ -1815,7 +1815,15 @@ drops support for Emacs 24.1 and 24.2."
(org-end-of-line)
(and (progn (org-beginning-of-line) (looking-at "Headline"))
(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 ()
"Test `org-end-of-line' specifications."