unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* C-n and fields
@ 2006-09-08 11:56 Richard Stallman
  2006-09-16 14:59 ` Chong Yidong
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Stallman @ 2006-09-08 11:56 UTC (permalink / raw)


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?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: C-n and fields
  2006-09-08 11:56 C-n and fields Richard Stallman
@ 2006-09-16 14:59 ` Chong Yidong
  2006-09-17 15:12   ` Richard Stallman
  0 siblings, 1 reply; 4+ messages in thread
From: Chong Yidong @ 2006-09-16 14:59 UTC (permalink / raw)
  Cc: emacs-devel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: C-n and fields
  2006-09-16 14:59 ` Chong Yidong
@ 2006-09-17 15:12   ` Richard Stallman
  2006-09-18 15:50     ` Chong Yidong
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Stallman @ 2006-09-17 15:12 UTC (permalink / raw)
  Cc: emacs-devel

How does line-end-position have an effect on C-n?
I can't find any calls to it from the line-move code.
If it does indeed get called, can you tell me how?

I need to see how it gets called, and from where,
in order to think about what is right to do there.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: C-n and fields
  2006-09-17 15:12   ` Richard Stallman
@ 2006-09-18 15:50     ` Chong Yidong
  0 siblings, 0 replies; 4+ messages in thread
From: Chong Yidong @ 2006-09-18 15:50 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman <rms@gnu.org> writes:

> How does line-end-position have an effect on C-n?
> I can't find any calls to it from the line-move code.
> If it does indeed get called, can you tell me how?
>
> I need to see how it gets called, and from where,
> in order to think about what is right to do there.

It's the call to end-of-line in simple.el:3597:

    (let (done)
      (while (and (> arg 0) (not done))
	;; If the following character is currently invisible,
	;; skip all characters with that same `invisible' property value.
	(while (and (not (eobp)) (line-move-invisible-p (point)))
	  (goto-char (next-char-property-change (point))))
	;; Now move a line.
	(end-of-line)
        ...

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-09-18 15:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-08 11:56 C-n and fields Richard Stallman
2006-09-16 14:59 ` Chong Yidong
2006-09-17 15:12   ` Richard Stallman
2006-09-18 15:50     ` Chong Yidong

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).