emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

moving point and invisible text


From: martin rudalics
Subject: moving point and invisible text
Date: Wed, 08 Feb 2006 10:23:44 +0100
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

The Elisp manual describes the behavior of commands moving point with
respect to invisible text as follows:

"However, if a command ends with point inside or immediately after
invisible text, the main editing loop moves point further forward or
further backward (in the same direction that the command already moved
it) until that condition is no longer true.  ...  If the command moved
point forward into an invisible range, Emacs moves point forward past
the first visible character that follows the invisible text."

This description seems archaic.  With Emacs -q evaluate

(with-current-buffer (get-buffer-create "*test*")
  (insert "foo\n")
  (let ((at (point)))
    (insert "bar\nbar\nbar\n")
    (overlay-put (make-overlay at (point-max)) 'invisible t))
  (insert "baz\n"))

move point to position 18 in *test* (between the "b" and "a" of "baz")
and do C-b.  On my system this moves point to position 17 which is the
position immediately after the invisible text, thus contradicting the
first sentence of the description.  According to that sentence point
should move to position 5 here.

Now move point to position 4 (the end of the first line) and do C-2 C-f.
Another time point moves to position 17.  According to the manual point
should move to position 18 here.  I'm glad it doesn't.

Finally, move point to position 4 and execute C-f.  Once more point
moves to position 17.  This behavior is not mentioned in the manual.
Moreover, the manual fails to say what happens when the invisible text
resides at the end of a buffer.

Also, I was not able to detect a consistent behavior with different
values of `line-move-ignore-invisible' and with respect to whether an
invisibility overlay or an invisibility text-property was used.


Would it be difficult to implement this as:

"However, if a command moved point backward into or to the end of
invisible text, Emacs moves point backward to the beginning of that
text.  If a command moved point forward into or to the beginning of
invisible text, Emacs moves point forward to the end of that text."

Otherwise I'd change the text to something like:

"However, if a command ends with point inside invisible text, the main
editing loop moves point to some position before or after the invisible
text."





reply via email to

[Prev in Thread] Current Thread [Next in Thread]