adding web browser keys to emacs info mode

Perm url with updates:

Adding Web Browser Keys to Emacs

Xah Lee, 2010-12-20

Emacs has extensive documentation. The doc format is called “info”, and is a tree structure, very similar to how you browse a website.

To view the complete documentation index, press 【Ctrl+h i】. Once you are in the Info doc, you can use the mouse to navigate, or using keyboard.

Here's the most important navigation keys:

PurposeEmacs KeyWeb Browser key
BacklBackspace or 【Alt+
ForwardrShift+Backspace】 or 【Alt+
Go Up u
Focus on Next LinkTabTab
Visit LinkEnterEnter

Web browsers use the Backspace for moving to last viewed page and 【Shift+Backspace】 for moving forward. If you have 5 button mouse, by default the 4th and 5th button also works. (【Alt+】 and 【Alt+】 also works.)

These keys don't work in emacs. If you use emacs in a graphical window, using the mouse's 4th and 5th button are quite convenient. Here's how to add to emacs. Put the following in your emacs init file.

(defun browser-nav-keys ()
  "Add some browser styled nav keys for Info-mode.
  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)

Popular posts from this blog

Browser User Agent Strings 2012

11 Years of Writing About Emacs

does md5 creates more randomness?