help-gnu-emacs
[Top][All Lists]
Advanced

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

Confusion regarding invisible text


From: David
Subject: Confusion regarding invisible text
Date: Sun, 28 Sep 2008 13:04:19 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.3 (gnu/linux)

Hi all,

I'm trying to understand how Emacs handles cursor movements and
invisible text, and was hoping someone around here could shed some light
on this issue. I'm using the following test code (with Emacs 22.3):

(save-excursion
  (set-buffer (get-buffer-create "invtest"))
  (erase-buffer)
  (insert "\naaaaa\nbbbbb\n")
  (goto-char (point-min))
  (forward-line 1)
  (set-text-properties (point) (1+ (point-at-eol)) '(invisible t intangible t)))

If you evaluate the above and switch to the buffer "invtest", you will
only see the string "bbbbb", since "aaaaa" is made invisible. Now use
the arrow keys to put the cursor on the first "b" and do "C-u C-x =". It
will say that there is the invisible character "a" at point position
2. If you put the cursor on the next "b", it will correctly say that
it's a "b" at position 9.

It seems that I cannot access the point position of the first "b"
through cursor movements. The Emacs Lisp manual says:

"Thus, if the command moved point back into an invisible range, Emacs
moves point back to the beginning of that range, and then back one more
character.  If the command moved point forward into an invisible range,
Emacs moves point forward up to the first visible character that follows
the invisible text."

This seems to imply that cursor movement would skip over invisible text,
or am I misunderstanding this paragraph? I'd appreciate if someone could
explain this behavior to me, and maybe also how to best avoid a
situation like the above.

-David





reply via email to

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