Rodolfo Medina wrote: >> Also with your modified version, such as with the original one, we leave >> point >> in the same place after C-v and M-v, but we lose the >> `next-screen-context-lines' property in TeX mode and info buffers (and maybe >> also in buffers with very long lines, longer than screen width). The same >> happens with scroll-in-place.el. >> >> I find it strange that noone apparently seems to have arose the problem and >> fixed it. Adrian Robert writes: > Could you describe a bit more clearly what the problem with > next-screen-context-lines is? Is there any way to reproduce > it without having a TEX file with certain contents at hand? > From a -Q emacs? > I'm puzzled what the issue is because the lisp code I posted > (and maybe the original pager.el) appear to explicitly take the > next-screen-context-lines variable into account. The problem is probably related to the use of the `window-height' variable in pager.el macros, that measures the window height in regular lines, not in actual lines. The use of `window-height' should be avoided in such macros. In its place, something different should be used. Suppose you do five times `C-v' and then five times `M-v'. At any `C-v', the *actual* number of lines scrolled should be stored somewhere: the first C-v scrolled screen 31 lines forward the second C-v scrolled screen 31 lines forward the third C-v scrolled screen 33 lines forward the fourth C-v scrolled screen 32 lines forward the fifth C-v scrolled screen 31 lines forward . So, any M-v should scroll screen back by the same number of lines of its correspondent C-v: the first M-v must scroll screen 31 lines backward the second M-v must scroll screen 31 lines backward the third M-v must scroll screen 33 lines backward the fourth M-v must scroll screen 32 lines backward the fifth M-v must scroll screen 31 lines backward To reproduce the problem you have to have auctex installed in your system. Once auctex is installed, load it putting the following line in .emacs: (load "auctex.el" nil t t) and restart Emacs. Open the file test.tex that I'm attaching and do `C-v'. If pager.el is *not* installed, you will see now on the first line the verse: Is this a holiday? What! know you not, ; instead, if pager.el is installed, you will see on the first line the verse: Where is thy leather apron and thy rule? . So, with pager.el installed 7 lines will have disappeared from your screen. Please let me know if you can't reproduce the problem and I'll try some other way to reproduce it. I hope the problem will be solved. Thanks for your attention. Bye Rodolfo