unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* (vertical-motion -1) misbehaves in outline-minor-mode
@ 2004-10-22 22:44 Peter Heslin
  2004-10-22 23:34 ` Peter Heslin
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Heslin @ 2004-10-22 22:44 UTC (permalink / raw)


According to the doc-string for vertical-motion, (vertical-motion 1)
should put you at the start of the next screen line and
(vertical-motion -1) should put you at the start of the previous
screen line.

It does, except that, when viewing the headings of a file in
outline-minor-mode after running hide-body, (vertical-motion -1) puts
point at the *end* of the previous screen line.

I use screen-lines.el and scroll-in-place.el, both of which use
vertical-motion to scroll, and both of which behave weirdly when
scrolling upwards in buffers where hide-body has been used.  That's
what led me to find this bug.

To reproduce it: on my month-old CVS checkout, I ran emacs -q, then
find-library to find any biggish elisp file, then M-x
outline-minor-mode and M-x hide-body.  I put point somewhere in the
middle of the folded defuns, and compared the behavior of
(vertical-motion 1) and (vertical-motion -1)

I tried to see if the same bug appeared when hiding the defun forms
with hs-hide-all, but (vertical-motion -1) seems to work just fine
with hideshow.

Peter

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

* Re: (vertical-motion -1) misbehaves in outline-minor-mode
  2004-10-22 22:44 (vertical-motion -1) misbehaves in outline-minor-mode Peter Heslin
@ 2004-10-22 23:34 ` Peter Heslin
  2004-10-25  0:35   ` Peter Heslin
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Heslin @ 2004-10-22 23:34 UTC (permalink / raw)


On 2004-10-22, Peter Heslin <usenet@heslin.eclipse.co.uk> wrote:
> ... when viewing the headings of a file in outline-minor-mode after
>  running hide-body, (vertical-motion -1) puts point at the *end* of
>  the previous screen line.

Some experimentation shows that this bug only manifests itself when
the folded entries include trailing whitespace.  This would explain
why hideshow does not normally trigger this bug: it folds from the
start of a construct up to the delimiter at the end, and does not
include any whitespace afterwards.  On the other hand,
outline-minor-mode only knows that one entry has ended when the next
one starts, so it includes anything up to the start of the next
heading.

Thus, an elisp file like the following does not show the bug when
folded with hide-body:

(a
)
(b
)
(c
)

But this file does:

(a
)

(b
)

(c
)

Peter

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

* Re: (vertical-motion -1) misbehaves in outline-minor-mode
  2004-10-22 23:34 ` Peter Heslin
@ 2004-10-25  0:35   ` Peter Heslin
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Heslin @ 2004-10-25  0:35 UTC (permalink / raw)


On 2004-10-22, Peter Heslin <usenet@heslin.eclipse.co.uk> wrote:
>  On 2004-10-22, Peter Heslin <usenet@heslin.eclipse.co.uk> wrote:
> > ... when viewing the headings of a file in outline-minor-mode after
> >  running hide-body, (vertical-motion -1) puts point at the *end* of
> >  the previous screen line.

I was asked to provide an exact recipe for reproducing the bug, so
here it is:

In a freshly checked out CVS emacs -q, do M-x load-library RET simple
RET.  After you see simple.el, do M-x outline-minor-mode RET and then
M-x hide-body RET.  Now do M-: (vertical-motion 1) RET a few times,
and observe how the cursor moves down one line each time, and point is
positioned at the start of the next line each time.  Now try M-:
(vertical-motion -1) RET a few times, and see how the cursor moves
back up one line, and each time, contrary to the documentation, the
cursor is put at the end of the previous line.

Point is normally put at the start of the line by vertical-motion,
both moving up and moving down.

Peter

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

end of thread, other threads:[~2004-10-25  0:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-22 22:44 (vertical-motion -1) misbehaves in outline-minor-mode Peter Heslin
2004-10-22 23:34 ` Peter Heslin
2004-10-25  0:35   ` Peter Heslin

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).