[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: move-beginning-of-line misbehaves on wrapped-line invisible text - r
From: |
Lőrentey Károly |
Subject: |
Re: move-beginning-of-line misbehaves on wrapped-line invisible text - recent cvs checkout |
Date: |
Thu, 26 Jan 2006 04:28:49 +0100 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.52 (gnu/linux) |
Ken Manheimer <address@hidden> writes:
> i now have a fix i'm more confident about, because (1) it takes care
> of another problem i noticed, even with my previous fix, and (2) it
> departs less from the checked-in version of the function, leaving less
> room for betrayal of unfamiliar concerns.
I propose the following change instead, which, in addition to
incorporating your fix, restores the useful special handling of field
boundaries. As noted in another thread, C-a and C-e behaviour is
currently broken in the minibuffer, in *shell* buffers, in entry
fields in customization buffers, and all other places where fields are
used. This makes `move-{beginning,end}-of-line' inconsistent with the
original `{beginning,end}-of-line' commands (which are still
available) and the underlying `line-{beginning,end}-position'
functions.
Meanwhile, I committed two (hopefully non-controversial) related fixes
in CVS; the first is for an annoying cursor display problem when point
is just before an ellipsis coming from an invisible overlay. The
second fixed `constrain-to-field' to always return the right result
when new-pos or old-pos is on a field boundary.
Index: simple.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/simple.el,v
retrieving revision 1.786
diff -c -p -r1.786 simple.el
*** simple.el 23 Jan 2006 04:05:59 -0000 1.786
--- simple.el 26 Jan 2006 02:52:52 -0000
*************** and `current-column' to be able to ignor
*** 3691,3705 ****
(defun move-end-of-line (arg)
"Move point to end of current line as displayed.
! \(If there's an image in the line, this disregards newlines
! which are part of the text that the image rests on.)
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."
(interactive "p")
(or arg (setq arg 1))
! (let (done)
(while (not done)
(let ((newpos
(save-excursion
--- 3691,3712 ----
(defun move-end-of-line (arg)
"Move point to end of current line as displayed.
! \(This disregards invisible newlines such as those
! which are part of the text that an image rests on.)
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 function does not move point across a field boundary unless that
! would move point to a different line than the original, unconstrained
! result. If N is nil or 1, and a rear-sticky field ends at point,
! the point does not move. 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
*************** To ignore intangibility, bind `inhibit-p
*** 3721,3749 ****
;; and now we're not really at eol,
;; keep going.
(setq arg 1)
! (setq done t)))))))
(defun move-beginning-of-line (arg)
"Move point to beginning of current line as displayed.
! \(If there's an image in the line, this disregards newlines
! which are part of the text that the image rests on.)
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."
(interactive "p")
(or arg (setq arg 1))
(if (/= arg 1)
(line-move (1- arg) t))
-
- ;; Move to beginning-of-line, ignoring fields and invisibles.
- (skip-chars-backward "^\n")
- (while (and (not (bobp)) (line-move-invisible-p (1- (point))))
- (goto-char (previous-char-property-change (1- (point))))
- (skip-chars-backward "^\n"))
(let ((orig (point)))
(vertical-motion 0)
(if (/= orig (point))
(goto-char (constrain-to-field (point) orig (/= arg 1) t nil)))))
--- 3728,3764 ----
;; and now we're not really at eol,
;; keep going.
(setq arg 1)
! (setq done t)))))
! (if (/= orig (point))
! (goto-char (constrain-to-field (point) orig (/= arg 1) t nil)))))
(defun move-beginning-of-line (arg)
"Move point to beginning of current line as displayed.
! \(This disregards invisible newlines such as those
! which are part of the text that an image rests on.)
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 function does not move point across a field boundary unless that
! would move point to a different line than the original, unconstrained
! result. If N is nil or 1, and a front-sticky field starts at point,
! the 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)
(line-move (1- arg) t))
(let ((orig (point)))
+ ;; Move to beginning-of-line, ignoring fields and invisibles.
+ (skip-chars-backward "^\n")
+ (while (and (not (bobp)) (line-move-invisible-p (1- (point))))
+ (goto-char (previous-char-property-change (point)))
+ (skip-chars-backward "^\n"))
(vertical-motion 0)
(if (/= orig (point))
(goto-char (constrain-to-field (point) orig (/= arg 1) t nil)))))
--
Károly
pgpK_tvOtO1bx.pgp
Description: PGP signature