Emacs: Add Web Browser Back Key/Button to Info mode

By Xah Lee. Date: . Last updated: .

Web browsers on Windows use the ⌫ Backspace for moving to last viewed page.

Here's how to make ⌫ Backspace key to emacs's info mode 〔►see Emacs: View Info Page〕. Put the following in your emacs init file.

(defun add-browser-backspace-key-to-Info-mode ()
  "Add some browser styled nav keys for `Info-mode'.
  The following keys are added:
 【Backspace】 for `Info-history-back'
 【Shift+Backspace】 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-8>") 'Info-history-back) 5-button mouse. the mouse numbering depends on your OS and mouse. Call “describe-key” then press mouse button to find out
  ;; note: on Linux Firefox, you have to turn on Backspace key for previous page. In the preference. http://xahlee.info/mswin/Firefox_set_backspace_previous_page.html

(add-hook 'Info-mode-hook 'add-browser-backspace-key-to-Info-mode)

〔►see Firefox: Set Backspace Key to Go Back To Previous Page

5 Buttons Mouse, Setting Forward/Backward Thumb Buttons for Info

if you have 5-buttons mouse, you can also make the 4th button do “previous page”.

Here's how.

Alt+x describe-keyCtrl+h k】, then press the mouse button. Emacs might say:

<mouse-8> … undefined

② add the following in your info key function given above.

(defun add-mouse-back-button-to-Info-mode ()
  "Add some browser styled nav keys for `Info-mode'."
  (local-set-key (kbd "<mouse-8>") 'Info-history-back))

(add-hook 'Info-mode-hook 'add-mouse-back-button-to-Info-mode)

I recommend you get a 5-buttons mouse, because the extra buttons lets you do lots of things. You do use mouse a lot, because 50% of time you spend in browser even for coding, and in browser the mouse is most efficient.


For more about how to set mouse buttons, see: Emacs: How to Set Mouse Buttons.

Liket it? Put $5 at patreon. Or Buy Xah Emacs Tutorial. Thanks.