Clone wiki

autopager / Home


autopager is an extension for Mercurial that pages output only if it exceeds the terminal's height

On Unix, this extension uses ioctl(2) to determine the terminal's dimensions. On Windows, GetConsoleScreenBufferInfo is used. If neither is available or unable to determine the dimensions, the LINES and COLUMNS environment variables are used.

Default settings:

; Like in the pager extension, this helps alleviate broken pipes
quiet = False
; The size of your shell prompt in lines
promptsize = 1
; The pager to use
pager = [environment variable PAGER]

If neither pager nor PAGER is set, the extension does nothing.

Note: Output to stderr is sent to the pager as well. If the pager isn't invoked, it's preserved (instead of being sent to stdout).

Paging for certain commands can be enabled or disabled:

ignore = version, help, update
; or...
attend = log

Tips for using this extension with less

  • If you don't like how less clears the screen when you quit, try the -X/--no-init switch. This could cause other issues depending on your terminal emulator - or it could work fine.
  • If you're using another extension that colorizes a command's output, try the -R/--RAW-CONTROL-CHARS switch. This will cause less to avoid escaping color control codes.

Debugging tips

  • If you get an exception without the traceback, try setting the DEBUGAUTOPAGER environment variable when running hg. The extension will then wrap only stdout