I am trying to hide some text in my buffer using text property invisible. This works fine, except that the cursor is not moving correctly when the text is hidden. To reproduce this clearly I think I need a large text file, so to generate a dummy text file t.txt :

$ awk 'BEGIN { for (i=1; i<1400; i++) { printf "%4d ", i ; print "abcdedfghijklmnopqrstuvwxyz"; }}' > t.txt

Then consider the lisp code:

(defvar *my-hide* nil)
(defun my-hide ()
  (setq *my-hide* (not *my-hide*))
  (put-text-property 1 32968 'invisible *my-hide*))

When I open open the file t.txt and position the cursor at the beginning of the buffer and run (my-hide) it correctly hides the first 1000 lines. But if I now try to move the cursor with, for example, the page down key, it is moving one character position to the right on the first line but the right scroll bar is still moving. If I hit it again, it jumps to line 1026, the next time it jumps to line 1013 (the right scroll bar is moving down each time)..

I am using Emacs version 24.3.1 on Ubuntu 14.04.

1 Answer 1


The problem seems to be related to that I used (global-set-key [next] 'pager-page-down) and (require 'pager) in my ~/.emacs init file. It seems to work correctly if I remove those lines..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.