emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Toby Cubitt <tsc25@cantab.net>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: [PATCH] Make org-[beginning|end]-of-line respect visual-line-mode
Date: Tue, 6 Nov 2012 13:30:50 +0100	[thread overview]
Message-ID: <20121106123050.GA27247@c3po> (raw)

[-- 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


             reply	other threads:[~2012-11-06 12:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-06 12:30 Toby Cubitt [this message]
2012-11-06 12:31 ` [PATCH] Make org-[beginning|end]-of-line respect visual-line-mode 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121106123050.GA27247@c3po \
    --to=tsc25@cantab.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=toby-dated-1353414632.1cd3a1@dr-qubit.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).