all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* `vertical-motion', `goto-line' set point to invisible text
@ 2011-07-03  2:59 Dmitry Kurochkin
  2011-07-03  6:55 ` Eli Zaretskii
  2011-07-03 14:50 ` Stefan Monnier
  0 siblings, 2 replies; 17+ messages in thread
From: Dmitry Kurochkin @ 2011-07-03  2:59 UTC (permalink / raw
  To: emacs-devel

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/



^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2011-07-09 13:13 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-03  2:59 `vertical-motion', `goto-line' set point to invisible text Dmitry Kurochkin
2011-07-03  6:55 ` 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

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.