ErgoEmacsEmacsLispBlogEmacsLispBuy Tutorial
Web Hosting by 1&1

Emacs: Info-mode Keys and How to Add Web Browser Keys

Xah Lee, ,

This page shows you the keyboard shortcuts for navigating emacs's “Info-mode”, and how to set web-browser keys for it.

Emacs has extensive documentation, in a format called Texinfo. It is a tree structure, very similar to how you browse a website. To view the complete documentation index, call infoF1 i】. Once you are in the Info doc, you can use the mouse to navigate, or keyboard.

Here's the most important navigation keys:

PurposeEmacs KeySimilar Key in Web Browser
Backl⌫ Backspace or 【Alt+
Forwardr⇧ Shift+⌫ Backspace】 or 【Alt+
Go Up u
Focus on Next LinkTab ↹Tab ↹
Visit LinkEnter ↵Enter ↵

Setting Emacs Info to Use Web Browser Keys

Web browsers on Windows and Mac use the ⌫ Backspace for moving to last viewed page. Also, if you have 5 button mouse, by default the thumb buttons acts as backward and forward buttons, very convenient.

Here's how to add web browser keys to emacs. Put the following in your emacs init file.

(defun browser-nav-keys ()
  "Key settings for `Info-mode-hook'.
Add some browser styled nav keys.
  The following keys and mouse buttons are added:
 【Backspace】 and <mouse-4> for `Info-history-back'
 【Shift+Backspace】 and <mouse-5> for `Info-history-forward'."
 (local-set-key (kbd "<backspace>") 'Info-history-back)
 (local-set-key (kbd "<S-backspace>") 'Info-history-forward)
 (local-set-key (kbd "<mouse-4>") 'Info-history-back)
 (local-set-key (kbd "<mouse-5>") 'Info-history-forward)
  )

(add-hook 'Info-mode-hook 'browser-nav-keys)

Note that mouse button numbering depends on your mouse hardware, driver, and operating system. In emacs, you can find out the button's number by calling describe-key then press the button. For detail, see: Linux/Unix X11 Mouse Button Numbering Scheme.

blog comments powered by Disqus