unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
Cc: emacs-devel@gnu.org
Subject: Re: C-n and fields
Date: Sat, 16 Sep 2006 10:59:09 -0400	[thread overview]
Message-ID: <87odtf6eo2.fsf@furball.mit.edu> (raw)
In-Reply-To: <E1GLey6-0007PB-Kn@fencepost.gnu.org> (Richard Stallman's message of "Fri\, 08 Sep 2006 07\:56\:22 -0400")

Richard Stallman <rms@gnu.org> writes:

> It's now clear what the behavior of C-n with fields needs to be.
> It should keep the column number as close as possible to the desired one
> but without moving across field boundaries.
>
> Can someone please implement that, then ack?

The behavior was broken by my 2006-08-03 change to
line-move-to-column, which in retrospect is completely misguided.
I've now reverted it.

The change was originally aimed at a line-motion bug reported on
emacs-pretest-bug on 18 July ("C-n doesn't work in Customize Option
buffer in -nw with long value displayed").  The way to trigger this
bug was supplied by Johan BockgÃrd:

    (insert (propertize "x" 'field t)
            (make-string 89 ?y)
            "\n")

    Put point on the x (or the first y) and press C-n. Point doesn't
    move.

I now think the problem lies, not in line-move-to-column, but in
line-end-position.  After computing the line end position,
line-end-position calls constrain-to-field with a nil ESCAPE-FROM-EDGE
argument.  Thus, if point lies right at the edge of the field,

            X|YYYYY
 non-nil     ^        null   
 `field'    point     `field'
 property             property

Then line-end-position reports the field end position, and similarly
end-of-line won't move point.  This is counter-intuitive.

How bout making line-end-position pass a non-nil ESCAPE-FROM-EDGE
argument?  (This indeed fixes the bug in the test case.)

*** emacs/src/editfns.c.~1.428.~	2006-09-12 23:04:03.000000000 -0400
--- emacs/src/editfns.c	2006-09-16 10:42:43.000000000 -0400
***************
*** 874,880 ****
  
    /* Return END_POS constrained to the current input field.  */
    return Fconstrain_to_field (make_number (end_pos), make_number (orig),
! 			      Qnil, Qt, Qnil);
  }
  
  \f
--- 874,880 ----
  
    /* Return END_POS constrained to the current input field.  */
    return Fconstrain_to_field (make_number (end_pos), make_number (orig),
! 			      Qt, Qt, Qnil);
  }
  
  \f

  reply	other threads:[~2006-09-16 14:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-08 11:56 C-n and fields Richard Stallman
2006-09-16 14:59 ` Chong Yidong [this message]
2006-09-17 15:12   ` Richard Stallman
2006-09-18 15:50     ` Chong Yidong

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.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87odtf6eo2.fsf@furball.mit.edu \
    --to=cyd@stupidchicken.com \
    --cc=emacs-devel@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.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).