diff options
author | Toby S. Cubitt <tsc25@cantab.net> | 2012-11-06 19:06:26 +0100 |
---|---|---|
committer | Nicolas Goaziou <n.goaziou@gmail.com> | 2012-11-09 02:46:21 +0100 |
commit | 2aeb28d2af6050ef9ef5130b28697fdabe8bf04b (patch) | |
tree | 2fed9dde51e6d6c0b5455cd863604e299f47a293 | |
parent | ca5d5e9c9b792f139362968de60b5a3cbf92064b (diff) | |
download | org-mode-2aeb28d2af6050ef9ef5130b28697fdabe8bf04b.tar.gz |
Bug fix in org-beginning-of-line visual line motion
* lisp/org.el (org-beginning-of-line): check `visual-line-mode'
instead of `line-visual-mode' to determine whether to move by visual
lines.
* lisp/org.el (org-kill-line): use of org-bound-and-true-p macro.
* testing/lisp/test-org.el: Add test
-rw-r--r-- | lisp/org.el | 4 | ||||
-rw-r--r-- | testing/lisp/test-org.el | 39 |
2 files changed, 38 insertions, 5 deletions
diff --git a/lisp/org.el b/lisp/org.el index fabfd5c..7b85a11 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -21271,7 +21271,7 @@ beyond the end of the headline." (car org-special-ctrl-a/e) org-special-ctrl-a/e)) refpos) - (if (org-bound-and-true-p line-move-visual) + (if (org-bound-and-true-p visual-line-mode) (beginning-of-visual-line 1) (beginning-of-line 1)) (if (and arg (fboundp 'move-beginning-of-line)) @@ -21398,7 +21398,7 @@ depending on context." (not (y-or-n-p "Kill hidden subtree along with headline? "))) (error "C-k aborted - would kill hidden subtree"))) (call-interactively - (if (and (boundp 'visual-line-mode) visual-line-mode) 'kill-visual-line 'kill-line))) + (if (org-bound-and-true-p visual-line-mode) 'kill-visual-line 'kill-line))) ((looking-at (org-re ".*?\\S-\\([ \t]+\\(:[[:alnum:]_@#%:]+:\\)\\)[ \t]*$")) (kill-region (point) (match-beginning 1)) (org-set-tags nil t)) diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index 1426378..3e38886 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -418,12 +418,44 @@ http://article.gmane.org/gmane.emacs.orgmode/21459/" ;; Navigation +(ert-deftest test-org/beginning-of-line () + "Test `org-beginning-of-line' specifications." + ;; Standard test. + (should + (org-test-with-temp-text "Some text\nSome other text" + (progn (org-beginning-of-line) (bolp)))) + ;; Standard test with `visual-line-mode'. + (should-not + (org-test-with-temp-text "A long line of text\nSome other text" + (progn (visual-line-mode) + (forward-char 2) + (dotimes (i 1000) (insert "very ")) + (org-beginning-of-line) + (bolp)))) + ;; At an headline with special movement. + (should + (org-test-with-temp-text "* TODO Headline" + (let ((org-special-ctrl-a/e t)) + (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"))))))) + (ert-deftest test-org/end-of-line () "Test `org-end-of-line' specifications." ;; Standard test. (should (org-test-with-temp-text "Some text\nSome other text" (progn (org-end-of-line) (eolp)))) + ;; Standard test with `visual-line-mode'. + (should-not + (org-test-with-temp-text "A long line of text\nSome other text" + (progn (visual-line-mode) + (forward-char 2) + (dotimes (i 1000) (insert "very ")) + (goto-char (point-min)) + (org-end-of-line) + (eolp)))) ;; At an headline with special movement. (should (org-test-with-temp-text "* Headline :tag:" @@ -451,9 +483,10 @@ http://article.gmane.org/gmane.emacs.orgmode/21459/" ;; At a block with hidden contents. (should-not (org-test-with-temp-text "#+BEGIN_CENTER\nContents\n#+END_CENTER" - (progn (org-hide-block-toggle) - (org-end-of-line) - (eobp))))) + (let ((org-special-ctrl-a/e t)) + (org-hide-block-toggle) + (org-end-of-line) + (eobp))))) (ert-deftest test-org/forward-element () "Test `org-forward-element' specifications." |