* Confusion regarding invisible text
@ 2008-09-28 11:04 David
2008-10-01 19:47 ` Nikolaj Schumacher
0 siblings, 1 reply; 2+ messages in thread
From: David @ 2008-09-28 11:04 UTC (permalink / raw
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Confusion regarding invisible text
2008-09-28 11:04 Confusion regarding invisible text David
@ 2008-10-01 19:47 ` Nikolaj Schumacher
0 siblings, 0 replies; 2+ messages in thread
From: Nikolaj Schumacher @ 2008-10-01 19:47 UTC (permalink / raw
To: help-gnu-emacs
David <de_bb@arcor.de> wrote:
> 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.
I come to the same conclusions as you, David, and think this is a bug.
Please report it using M-x report-emacs-bug.
Surprisingly, it works as expected when using overlays, i.e.:
(save-excursion
(set-buffer (get-buffer-create "invtest"))
(erase-buffer)
(insert "xxxx\naaaaa\nbbbbb\n")
(goto-char (point-min))
(forward-line 1)
(let ((ov (make-overlay (point) (1+ (point-at-eol)))))
(overlay-put ov 'invisible t)))
regards,
Nikolaj Schumacher
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-10-01 19:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-28 11:04 Confusion regarding invisible text David
2008-10-01 19:47 ` Nikolaj Schumacher
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.