emacs on Mac OS X

The emacs icon

GNU emacs is a powerful text editor found on many Unix based/related systems. My main interest in using the emacs that comes with Mac OS X (currently 20.2.1) is the Lisp interpreter that is a fundamental part of the editor. Most of the functionality of the editor is built using emacs lisp, and extra ‘packages’ can be written and added into emacs to provide functions. As emacs ports exist for most operating systems, a set of astronomical routines written as a package would then be movable between platforms.

GNU emacs uses the ctrl key to issue commands, and also makes use of a ‘meta’ key to increase the number of shortcuts available. Mac OS X Terminal ‘catches’ the Apple key so the ESC key ends up being used as the meta key. This is difficult to use and makes some key combinations that are used in emacs impossible to access. A partial workround (which dawned on my conciousness after some Web searching) is to use X11 and an xterm window. Just

  • Load X11
  • Go to X11 menu on the menu bar
  • Click Preferences
  • Click on the Input tab
  • Uncheck the Enable Key Equivalents Under X11 option (last of 3 on the list)
  • Start an xterm session
  • Type emacs and you are away with the apple or command key aka ‘the 4-leaf clover’ acting as meta

You can put a .emacs customisation file in your ‘home’ directory and emacs picks this up when starting. I start my emacs in text edit mode with the autofill submode running.

Comments are closed.