emacs-devel
[Top][All Lists]
Advanced

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

`vertical-motion', `goto-line' set point to invisible text


From: Dmitry Kurochkin
Subject: `vertical-motion', `goto-line' set point to invisible text
Date: Sun, 03 Jul 2011 06:59:49 +0400
User-agent: Notmuch/0.5-321-g41686e2 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu)

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/



reply via email to

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