emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Make org-[beginning|end]-of-line respect visual-line-mode
@ 2012-11-06 12:30 Toby Cubitt
  2012-11-06 12:31 ` Nicolas Goaziou
  0 siblings, 1 reply; 10+ messages in thread
From: Toby Cubitt @ 2012-11-06 12:30 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 225 bytes --]

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: tsc25@cantab.net
web:   www.dr-qubit.org

[-- Attachment #2: 0001-Make-org-end-of-line-respect-visual-line-mode.patch --]
[-- Type: text/x-patch, Size: 2334 bytes --]

From bca045ffd27d41630c52a67390767cd622544bb9 Mon Sep 17 00:00:00 2001
From: "Toby S. Cubitt" <tsc25@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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-11-06 19:45 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-06 12:30 [PATCH] Make org-[beginning|end]-of-line respect visual-line-mode Toby Cubitt
2012-11-06 12:31 ` Nicolas Goaziou
2012-11-06 12:47   ` Toby Cubitt
2012-11-06 17:02     ` Nicolas Goaziou
2012-11-06 17:27       ` Toby Cubitt
2012-11-06 17:30         ` Nicolas Goaziou
2012-11-06 17:43           ` Toby Cubitt
2012-11-06 17:46             ` Nicolas Goaziou
2012-11-06 18:46               ` Toby Cubitt
2012-11-06 19:41                 ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).