summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2015-07-22 09:39:07 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2015-07-22 09:39:07 +0200
commit6e1d7bc8feb6901349e0fa5e025fd10f4580651e (patch)
tree07bcf8f52be9683405663b862719facfd427b9f7
parent7037eb591ead970b678cdfd966df74c2924b4b97 (diff)
downloadorg-mode-6e1d7bc8feb6901349e0fa5e025fd10f4580651e.tar.gz
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.
-rwxr-xr-xlisp/org.el2
-rw-r--r--testing/lisp/test-org.el10
2 files changed, 10 insertions, 2 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 1824121..9807e93 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -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
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index af9dbff..9243be4 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -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."