unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: lorentey@elte.hu (Lőrentey Károly)
Subject: Re: Something is rotten with end-of-line and move-end-of-line
Date: Mon, 28 Nov 2005 23:24:40 +0100	[thread overview]
Message-ID: <lorentey.g.e.devel.87zmnobec7.elte@walrus.fnord.hu> (raw)
In-Reply-To: <lorentey.g.e.devel.87psokcyrs.elte@walrus.fnord.hu> (Lőrentey	Károly's message of "Mon, 28 Nov 2005 21:17:59 +0100")

[-- Attachment #1: Type: text/plain, Size: 249 bytes --]

Lőrentey Károly <lorentey@elte.hu> writes:
> Indeed, there are some bugs.
[...]
> Obviously this needs to be elaborated.

Here is a patch that updates the doc strings and fixes
move-end-of-line behaviour with respect to field boundaries.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 3681 bytes --]

diff -u -3 -p -r1.774 simple.el
*** simple.el	28 Nov 2005 19:59:34 -0000	1.774
--- simple.el	28 Nov 2005 22:10:28 -0000
***************
*** 3641,3658 ****
  	    (goto-char (previous-char-property-change (point) line-beg))))))))
  
  (defun move-end-of-line (arg)
!   "Move point to end of current line.
  With argument ARG not nil or 1, move forward ARG - 1 lines first.
  If point reaches the beginning or end of buffer, it stops there.
  To ignore intangibility, bind `inhibit-point-motion-hooks' to t.
  
! This command does not move point across a field boundary unless doing so
! would move beyond there to a different line; if ARG is nil or 1, and
! point starts at a field boundary, point does not move.  To ignore field
! boundaries bind `inhibit-field-text-motion' to t."
    (interactive "p")
    (or arg (setq arg 1))
!   (let (done)
      (while (not done)
        (let ((newpos
  	     (save-excursion
--- 3641,3664 ----
  	    (goto-char (previous-char-property-change (point) line-beg))))))))
  
  (defun move-end-of-line (arg)
!   "Move point to end of current display line.
  With argument ARG not nil or 1, move forward ARG - 1 lines first.
  If point reaches the beginning or end of buffer, it stops there.
  To ignore intangibility, bind `inhibit-point-motion-hooks' to t.
  
! Unlike `end-of-line' (which see), this command ignores invisible
! newline characters while it searches for the end of the current
! line.  It moves the point to the end of the displayed screen
! line, which is not necessarily the same as the end of the current
! line in the buffer.
! 
! This command does not move point across the boundary of the
! current field.  To ignore field boundaries bind
! `inhibit-field-text-motion' to t."
    (interactive "p")
    (or arg (setq arg 1))
!   (let ((orig (point))
! 	done)
      (while (not done)
        (let ((newpos
  	     (save-excursion
***************
*** 3664,3670 ****
  			  (goto-char (previous-char-property-change (point))))
  			(backward-char 1)))
  		 (point)))))
! 	(goto-char newpos)
  	(if (and (> (point) newpos)
  		 (eq (preceding-char) ?\n))
  	    (backward-char 1)
--- 3670,3676 ----
  			  (goto-char (previous-char-property-change (point))))
  			(backward-char 1)))
  		 (point)))))
! 	(goto-char (constrain-to-field newpos orig (/= arg 1) t nil))
  	(if (and (> (point) newpos)
  		 (eq (preceding-char) ?\n))
  	    (backward-char 1)
***************
*** 3682,3691 ****
  If point reaches the beginning or end of buffer, it stops there.
  To ignore intangibility, bind `inhibit-point-motion-hooks' to t.
  
! This command does not move point across a field boundary unless doing so
! would move beyond there to a different line; if ARG is nil or 1, and
! point starts at a field boundary, point does not move.  To ignore field
! boundaries bind `inhibit-field-text-motion' to t."
    (interactive "p")
    (or arg (setq arg 1))
    (if (/= arg 1)
--- 3688,3703 ----
  If point reaches the beginning or end of buffer, it stops there.
  To ignore intangibility, bind `inhibit-point-motion-hooks' to t.
  
! Unlike `beginning-of-line' (which see), this command ignores
! invisible newline characters while it searches for the beginning
! of the current line.  It moves the point to the beginning of the
! displayed screen line, which is not necessarily the same as the
! end of the current line in the buffer.
! 
! This command does not move point across the boundary of the
! current field.  If ARG is nil or 1, and point starts at a field
! boundary, point does not move.  To ignore field boundaries bind
! `inhibit-field-text-motion' to t."
    (interactive "p")
    (or arg (setq arg 1))
    (if (/= arg 1)

[-- Attachment #3: Type: text/plain, Size: 892 bytes --]


I have a feeling that C-e should behave like C-a on a field boundary,
and leave the point unchanged when it is at the field end.  This would
make these operations idempotent.

For example, let's say the buffer contents are

	other stuff FIELD other stuff

Suppose that the characters "FIELD" have the same (front-sticky) field
property, while the rest are non-field.  Currently,
move-beginning-of-line (C-a) is a no-op when point is before F:

        other stuff <!>FIELD other stuff

I argue that either C-a should be changed to go the line beginning, or
move-end-of-line should behave symmetrically, i.e. it should have the
following fixed point:

	other stuff FIELD<!> other stuff

This could be achieved by changing `constrain-to-field'.

The various behaviours of C-a/C-e near field-field boundaries are also
somewhat surprising at the moment.

-- 
Károly

[-- Attachment #4: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

  parent reply	other threads:[~2005-11-28 22:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-25  1:09 Something is rotten with end-of-line and move-end-of-line David Kastrup
2005-11-28  4:46 ` Richard M. Stallman
2005-11-28 11:35   ` David Kastrup
2005-11-28 19:52     ` Eli Zaretskii
2005-11-28 21:01     ` Richard M. Stallman
2005-11-28 16:10   ` Lőrentey Károly
2005-11-28 16:13     ` Lőrentey Károly
2005-11-28 16:53       ` David Kastrup
2005-11-28 20:17         ` Lőrentey Károly
2005-11-28 21:46           ` David Kastrup
2005-11-28 22:39             ` Lőrentey Károly
2005-11-28 23:10               ` David Kastrup
2005-11-28 22:24           ` Lőrentey Károly [this message]
2005-11-29  3:11           ` Richard M. Stallman
2005-11-29  9:41             ` Lőrentey Károly
2005-11-29  3:11     ` Richard M. Stallman

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=lorentey.g.e.devel.87zmnobec7.elte@walrus.fnord.hu \
    --to=lorentey@elte.hu \
    /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).