From: lorentey@elte.hu (Lőrentey Károly)
Cc: rms@gnu.org, emacs-devel@gnu.org
Subject: Re: move-beginning-of-line misbehaves on wrapped-line invisible text - recent cvs checkout
Date: Thu, 26 Jan 2006 04:28:49 +0100 [thread overview]
Message-ID: <lorentey.g.e.devel.87fynbekge.elte@walrus.fnord.hu> (raw)
In-Reply-To: <2cd46e7f0601231247p76c5e25fk582a2f90c7876146@mail.gmail.com> (Ken Manheimer's message of "Mon, 23 Jan 2006 15:47:28 -0500")
[-- Attachment #1.1.1: Type: text/plain, Size: 1172 bytes --]
Ken Manheimer <ken.manheimer@gmail.com> 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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1.2: Type: text/x-patch, Size: 4398 bytes --]
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)))))
[-- Attachment #1.1.3: Type: text/plain, Size: 15 bytes --]
--
Károly
[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]
[-- Attachment #2: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
next prev parent reply other threads:[~2006-01-26 3:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-13 0:12 move-beginning-of-line misbehaves on wrapped-line invisible text - recent cvs checkout Ken Manheimer
2006-01-19 17:45 ` Richard M. Stallman
2006-01-22 16:12 ` Ken Manheimer
2006-01-23 18:17 ` Ken Manheimer
2006-01-23 20:47 ` Ken Manheimer
2006-01-26 3:28 ` Lőrentey Károly [this message]
2006-01-27 0:19 ` Ken Manheimer
2006-01-30 18:46 ` Richard M. Stallman
2006-01-31 19:10 ` Ken Manheimer
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.87fynbekge.elte@walrus.fnord.hu \
--to=lorentey@elte.hu \
--cc=emacs-devel@gnu.org \
--cc=rms@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).