From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rudi Schlatte Subject: Re: org-beginning-of-line vs visual-line-mode Date: Tue, 7 Jul 2009 15:01:54 +0200 Message-ID: <9749AD05-D300-4EA2-A877-F799898A2461@constantly.at> References: <2E428EB3-00AC-4DFA-BEE4-4DC96434A8C5@gmail.com> Mime-Version: 1.0 (Apple Message framework v935.3) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MOAJR-0003ha-TE for emacs-orgmode@gnu.org; Tue, 07 Jul 2009 09:02:22 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MOAJQ-0003h0-MM for emacs-orgmode@gnu.org; Tue, 07 Jul 2009 09:02:21 -0400 Received: from [199.232.76.173] (port=51764 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MOAJO-0003gk-EB for emacs-orgmode@gnu.org; Tue, 07 Jul 2009 09:02:18 -0400 Received: from mx-out-manc3.simplymailsolutions.com ([85.90.252.32]:39609) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MOAJN-0002TC-KK for emacs-orgmode@gnu.org; Tue, 07 Jul 2009 09:02:17 -0400 In-Reply-To: <2E428EB3-00AC-4DFA-BEE4-4DC96434A8C5@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Carsten Dominik Cc: emacs-orgmode@gnu.org 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