emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rudi Schlatte <rudi@constantly.at>
To: Carsten Dominik <carsten.dominik@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: org-beginning-of-line vs visual-line-mode
Date: Tue, 7 Jul 2009 15:01:54 +0200	[thread overview]
Message-ID: <9749AD05-D300-4EA2-A877-F799898A2461@constantly.at> (raw)
In-Reply-To: <2E428EB3-00AC-4DFA-BEE4-4DC96434A8C5@gmail.com>

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	other threads:[~2009-07-07 13:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-06 10:06 org-beginning-of-line vs visual-line-mode Rudi Schlatte
2009-07-06 15:49 ` Carsten Dominik
2009-07-07 13:01   ` Rudi Schlatte [this message]
2009-07-07 13:14     ` Carsten Dominik

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=9749AD05-D300-4EA2-A877-F799898A2461@constantly.at \
    --to=rudi@constantly.at \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.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).