From c91b6bee12d27d43e4c2ba90c339c1b86010be67 Mon Sep 17 00:00:00 2001 From: "Toby S. Cubitt" Date: Tue, 6 Nov 2012 19:06:26 +0100 Subject: [PATCH] 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 (test-org/end-of-line): add regression test for `org-end-of-line' in `visual-line-mode' buffers. --- lisp/org.el | 4 ++-- testing/lisp/test-org.el | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index ad2863b..080b527 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -21577,7 +21577,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)) @@ -21704,7 +21704,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 98957ac..a2115bf 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -477,6 +477,13 @@ http://article.gmane.org/gmane.emacs.orgmode/21459/" (should (org-test-with-temp-text "Some text\nSome other text" (progn (org-end-of-line) (eolp)))) + ;; Standard test with `visual-line-mode'. + (should + (org-test-with-temp-text + "A long line of text\nSome other text" + (progn (forward-char 2) (cl-dotimes (i 1000) (insert "very ")) + (visual-line-mode 1) (goto-char (point-min)) (org-end-of-line) + (thing-at-point-looking-at "very")))) ;; At an headline with special movement. (should (org-test-with-temp-text "* Headline :tag:" -- 1.7.8.6