Subject line and commit message says it all.

Toby
-- 
Dr T. S. Cubitt
Mathematics and Quantum Information group
Department of Mathematics
Complutense University
Madrid, Spain

email: ts...@cantab.net
web:   www.dr-qubit.org
>From bca045ffd27d41630c52a67390767cd622544bb9 Mon Sep 17 00:00:00 2001
From: "Toby S. Cubitt" <ts...@cantab.net>
Date: Tue, 6 Nov 2012 13:25:15 +0100
Subject: [PATCH] Make org-end-of-line respect visual-line-mode

* lisp/org.el (org-beginning-of-line, org-end-of-line): Use
beginning-of-visual-line and end-of-visual-line to move to
beginning/end of line in visual-line-mode.
---
 lisp/org.el |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 2aa70bd..4ce4ed3 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -21567,7 +21567,8 @@ 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 (or (org-bound-and-true-p visual-line-mode)
+	    (org-bound-and-true-p line-move-visual))
 	(beginning-of-visual-line 1)
       (beginning-of-line 1))
     (if (and arg (fboundp 'move-beginning-of-line))
@@ -21578,7 +21579,9 @@ beyond the end of the headline."
 	(if (org-truely-invisible-p)
 	    (while (and (not (bobp)) (org-truely-invisible-p))
 	      (backward-char 1)
-	      (beginning-of-line 1))
+	      (if (org-bound-and-true-p visual-line-mode)
+		  (beginning-of-visual-line 1)
+		  (beginning-of-line 1)))
 	  (forward-char 1))))
     (when special
       (cond
@@ -21633,7 +21636,8 @@ the cursor is already beyond the end of the headline."
     (cond
      ((or (not special) arg)
       (call-interactively
-       (if (fboundp 'move-end-of-line) 'move-end-of-line 'end-of-line)))
+       (if (org-bound-and-true-p visual-line-mode) 'end-of-visual-line
+	 (if (fboundp 'move-end-of-line) 'move-end-of-line 'end-of-line))))
      ((memq type '(headline inlinetask))
       (let ((pos (point)))
         (beginning-of-line 1)
@@ -21657,7 +21661,8 @@ the cursor is already beyond the end of the headline."
       (when (org-invisible-p2) (backward-char)))
      (t
       (call-interactively
-       (if (fboundp 'move-end-of-line) 'move-end-of-line 'end-of-line))))
+       (if (org-bound-and-true-p visual-line-mode) 'end-of-visual-line
+	 (if (fboundp 'move-end-of-line) 'move-end-of-line 'end-of-line)))))
     (org-no-warnings (and (featurep 'xemacs) (setq zmacs-region-stays t)))))
 
 (define-key org-mode-map "\C-a" 'org-beginning-of-line)
-- 
1.7.8.6

Reply via email to