From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
To: emacs-devel@gnu.org
Subject: `vertical-motion', `goto-line' set point to invisible text
Date: Sun, 03 Jul 2011 06:59:49 +0400 [thread overview]
Message-ID: <87ei28f4re.fsf@gmail.com> (raw)
Hi all.
While working on notmuch [1] emacs client, I stumbled upon an unexpected
behavior: `beginning-of-visual-line' places point to invisible text in
the beginning to the line. I.e. you have:
line1
line2 <--- this line is not visible
line3 <--- point is on this line
in this case, `beginning-of-visual-line' will set the position to start
of line2 (which is invisible), not line3. It differs from what
`move-beginning-of-line' and even does not match
`line-beginning-position'. `beginning-of-visual-line' uses
`vertical-motion' to do the job. `goto-line' has a similar behavior. I
believe there are more functions like this.
This does not look right to me. I expect these functions never set
point inside invisible text and there should be some general way to
protect from this. But perhaps I am wrong and we have to manually skip
all invisible text forward after any point move?
Here is a small test to demonstrate the issue:
(progn (message "test begin")
(switch-to-buffer "test")
(insert "line1\nline2\nline3\n")
(goto-line 2)
(put-text-property (line-beginning-position)
(line-beginning-position 2)
'invisible 'invis1)
(goto-line 3)
(message "point #1: %s" (point))
(add-to-invisibility-spec 'invis1)
(move-beginning-of-line nil)
(message "point #2: %s" (point))
(vertical-motion 0)
(message "point #3: %s, invisible-p: %s" (point) (invisible-p (point)))
(message "test end"))
Regards,
Dmitry
[1] http://notmuchmail.org/
next reply other threads:[~2011-07-03 2:59 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-03 2:59 Dmitry Kurochkin [this message]
2011-07-03 6:55 ` `vertical-motion', `goto-line' set point to invisible text Eli Zaretskii
2011-07-03 7:31 ` Dmitry Kurochkin
2011-07-03 13:33 ` Eli Zaretskii
2011-07-04 2:08 ` Dmitry Kurochkin
2011-07-03 14:50 ` Stefan Monnier
2011-07-03 15:14 ` Eli Zaretskii
2011-07-04 14:01 ` Stefan Monnier
2011-07-04 15:14 ` Eli Zaretskii
2011-07-04 18:10 ` Stefan Monnier
2011-07-04 20:06 ` Eli Zaretskii
2011-07-04 20:06 ` Eli Zaretskii
2011-07-05 2:22 ` Dmitry Kurochkin
2011-07-05 2:55 ` Eli Zaretskii
2011-07-05 3:52 ` Dmitry Kurochkin
2011-07-05 7:56 ` Eli Zaretskii
2011-07-09 13:13 ` Dmitry Kurochkin
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ei28f4re.fsf@gmail.com \
--to=dmitry.kurochkin@gmail.com \
--cc=emacs-devel@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 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.