From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: org-beginning-of-line vs visual-line-mode Date: Tue, 7 Jul 2009 15:14:57 +0200 Message-ID: <9DF73E57-8B78-4D8C-BF67-ECEF11C57C73@gmail.com> References: <2E428EB3-00AC-4DFA-BEE4-4DC96434A8C5@gmail.com> <9749AD05-D300-4EA2-A877-F799898A2461@constantly.at> 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 1MOAVn-00049l-Dt for emacs-orgmode@gnu.org; Tue, 07 Jul 2009 09:15:07 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MOAVh-00047T-SL for emacs-orgmode@gnu.org; Tue, 07 Jul 2009 09:15:06 -0400 Received: from [199.232.76.173] (port=36499 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MOAVh-00047O-NZ for emacs-orgmode@gnu.org; Tue, 07 Jul 2009 09:15:01 -0400 Received: from mail-ew0-f208.google.com ([209.85.219.208]:52328) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MOAVh-0004ar-9w for emacs-orgmode@gnu.org; Tue, 07 Jul 2009 09:15:01 -0400 Received: by ewy4 with SMTP id 4so5629222ewy.42 for ; Tue, 07 Jul 2009 06:15:00 -0700 (PDT) In-Reply-To: <9749AD05-D300-4EA2-A877-F799898A2461@constantly.at> 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: Rudi Schlatte Cc: emacs-orgmode@gnu.org 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 >