GNU Emacs

See also

GNU Emacs
The official webpage for GNU Emacs.

GNU Emacs for Mac OS X

A tour of Emacs
A brief history and introduction to Emacs.

Warning

This page is obsolete, look at Ilya Sergey’s installation page instead. Thank you.

Installation

The following sections briefly describe where and how to install Emacs on the most common systems. You should install Emacs version 2x, where x > 3. If your system is not listed here, you might find help on installing Emacs in the official Emacs documentation or that of your host system.

Windows

Windows users can use the official Windows binary. Download the zip-file and unpack it to your desired install location. No further installation should be necessary. More information on installation and setup can be found in the README file.

Try it out: Run bin/emacs.exe from the Emacs installation folder. Emacs should start and a window should open. To stop Emacs and close this window,

  1. while pressing your control key, type x,
  2. while pressing your control key, type c, and
  3. answer y.

To install Emacs shortcuts in your menu run bin/addpm.exe.

Mac OS X

OS X users can find a “vanilla” Emacs for OS X which is recommended here. Alternatively Carbon Emacs and Aquamacs are variants of Emacs customized specifically for OS X.

Linux etc.

*nix users should use the package manager of their host system.

  • Ubuntu and Debian based systems: sudo apt-get install emacs
  • RedHat and Suse based systems: sudo yum install emacs
  • etc.

Setup

After installing Emacs, you should configure it by adding the following to your .emacs file which is your user configuration file for Emacs. To this end,

  1. press your control key and type x,
  2. press your control key and type f,
  3. type exactly ~/.emacs, and
  4. press your return key (the one written “enter” on your keyboard).

This maneuver will open up your .emacs file which is most likely empty. Paste the following code into the buffer by pressing Control + y:

(setq inhibit-startup-message t)  ; dont show the GNU splash screen
(transient-mark-mode t)           ; show selection from mark
(setq visible-bell 1)             ; turn off bip warnings
(show-paren-mode t)               ; turn on highlight paren mode
(fset 'yes-or-no-p 'y-or-n-p)     ; use y and n for questions
(global-font-lock-mode t)         ; enable syntax highlighting
(icomplete-mode 99)               ; better buffer switching

Now save your .emacs file by

  1. pressing your control key and typing x, and
  2. pressing your control key and typing s.

From now on, we will refer to the above sequence as C-x C-s, or in short C-x-s.

Mac OS X

Assuming your user name on your Mac is your-user-name,

  • create the subdirectory /Users/your-user-name/.emacs.d/lisp,

  • put Steve Purcell’s file exec-path-from-shell.el as found on GitHub in your subdirectory /Users/your-user-name/.emacs.d/lisp, and

  • add the lines:

    (setq load-path (cons "/Users/your-user-name/.emacs.d/lisp" load-path))
    
    (require 'exec-path-from-shell)
    (exec-path-from-shell-initialize)
    

    in your .emacs file.

Doing this will let you start OCaml inside Emacs.

OCaml mode for Emacs

See the Tuareg repository on github.

Usage

To start OCaml inside Emacs run: M-x run-ocaml RET [1]. This should open a new window with an OCaml read-eval-print loop:

        OCaml version 4.04.0

#

If you do not see the banner and the prompt above, there is an error in your installation.

If you see the banner and the prompt above, then type C-x 2 to split your screen horizontally into two windows, and then C-x b RET to get back to where you were. Type C-x o to switch windows, C-x 2 to split your current window horizontally into two, C-x 3 to split your current window vertically into two, and C-x 0 to close the current window.

The OCaml mode defines a numbre of useful features for programming in OCaml, as can be found through the help system with C-h m and of course through the Emacs tutorial (C-h t).

[1]M refers the Alt-key and is pronounced meta. RET refers to the return key (a.k.a. the enter key).

Version

Added the pointer to Ilya Sergey’s installation page [08 Jan 2021]

Created [14 Jan 2019]

Table Of Contents

Previous topic

Objective Caml

Next topic

Dramatis Personæ