emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] org-beginning-of-line vs visual-line-mode


From: Carsten Dominik
Subject: Re: [Orgmode] org-beginning-of-line vs visual-line-mode
Date: Tue, 7 Jul 2009 15:14:57 +0200

Hi Rudi,

I have applied your patch.
I agree that it is too small to cause copyright problems.

Thanks

- Carsten

On Jul 7, 2009, at 3:01 PM, Rudi Schlatte wrote:

On 06.07.2009, at 17:49, Carsten Dominik wrote:
On Jul 6, 2009, at 12:06 PM, Rudi Schlatte wrote:

Greetings,

I run emacs cvs head and the org-mode that is bundled with it. Visual-line-mode is turned on.

The display part of visual-line-mode (breaking long lines into paragraphs visually) works as expected, but C-a (org-beginning-of- line) jumps to the start of the paragraph (i.e. start of the "physical" line). It would be nice if C-a jumped to the beginning of the screen line.

Cheers, and thanks for an excellent tool for writing!

You can get back the emacs 23 way of doing things with

(add-hook 'org-mode-hook
(lambda ()
  (define-key org-mode-map "\C-a" 'move-beginning-of-line)
  (define-key org-mode-map "\C-a" 'move-end-of-line)))

I personally don't like visual line mode at all, because much
of what I am doing is line-based stuff (source code, for example,
or headlines in Org), and I want these commands to got to
syntactic positions, not visual positions that depend on the
width of my window.

Thanks for the quick reply! Fwiw, I agree about the drawbacks of visual-line-mode, but somewhat to my surprise I found that I like it in text modes, so I turn it on conditionally in text-mode-hook.

On the other hand, I use org-special-ctrl-a/e as well. So I hacked in treatment of line-move-visual at the beginnings of org-{beginning| end}-of-line (sorry no unified diff, just pasted the function beginnings):

(defun org-beginning-of-line (&optional arg)
"Go to the beginning of the current line. If that is invisible, continue to a visible line beginning. This makes the function of C-a more intuitive. If this is a headline, and `org-special-ctrl-a/e' is set, ignore tags on the first attempt, and only move to after the tags when the cursor is already
beyond the end of the headline."
 (interactive "P")
 (let ((pos (point)) refpos)
   (if line-move-visual
       (beginning-of-visual-line 1)
       (beginning-of-line 1))
   (if (and arg (fboundp 'move-beginning-of-line))
[...]

and

(defun org-end-of-line (&optional arg)
 "Go to the end of the line.
If this is a headline, and `org-special-ctrl-a/e' is set, ignore tags on the first attempt, and only move to after the tags when the cursor is already
beyond the end of the headline."
 (interactive "P")
 (if (or (not org-special-ctrl-a/e)
         (not (org-on-heading-p))
         arg)
     (call-interactively (cond (line-move-visual 'end-of-visual-line)
((fboundp 'move-end-of-line) 'move- end-of-line)
                               (t 'end-of-line)))
   (let ((pos (point)))
     (beginning-of-line 1)
[...]

For emacsen <23, the check for line-move-visual should use boundp or bound-and-true-p, of course.

I believe these changes count as trivial w.r.t. copyright assignment, should you decide to merge them (which I'd be happy if you did, of course :) ).

Greetings,

Rudi






reply via email to

[Prev in Thread] Current Thread [Next in Thread]