简体   繁体   中英

Emacs - Getting PgDn to End of Buffer

I'm fairly new to Emacs, and I was wondering how to get the PageDown key to function so that it will send the point to the end of the buffer on the last PageDown instead of just printing "End of Buffer" in the minibuffer.

If there is some kind of benefit to keeping this behavior as-is, that would be interesting and helpful information as well.

Set scroll-error-top-bottom to a non-nil value, either via Mx customize-variable RET scroll-error-top-bottom , or by adding the following line to your init.el :

(setq scroll-error-top-bottom t)

From Ch v scroll-error-top-bottom :

Move point to top/bottom of buffer before signaling a scrolling error. A value of nil means just signal an error if no more scrolling possible. A value of t means point moves to the beginning or the end of the buffer (depending on scrolling direction) when no more scrolling possible. When point is already on that position, then signal an error.

This is the standard solution without CUA or key remapping.

The cua mode provides a cua-scroll-up command which does this. There are several ways to use it:

  1. activate cua-selection-mode , to get not only this scrolling behaviour, but also a large number of improvements in CUA. This is the solution I would recommand. Just put this in your init file ( .emacs or .emacs.d/init.el ) :

     (cua-selection-mode +1) 
  2. import only the scrolling behaviour from cua:

     (require 'cua-base) (global-set-key [remap scroll-up] 'cua-scroll-up) (global-set-key [remap scroll-down] 'cua-scroll-down) 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM