Emacs for MacOS X

I've put together binary packages of GNU Emacs compiled for MacOS X 10.2, 10.3 and 10.4. These packages were created by extracting the source code from the CVS repository and compiling it.

Note I didn't do anything more than building the code from CVS, package it with the provided scripts and put it up here. The person who developed all you see is Andrew Choi. For more information on this project, check out Andrew's Emacs 21 for MacOS X Web page.

Here's a screenshot of GNU Emacs running on MacOS X Jaguar.

Download

Setup for MacOS X 10.4

Here are some customizations you may want to do to have GNU Emacs behave closer to MacOS X applications. For your convenience I've put the below customizations in two files, .emacs and redo.el. Save the .emacs file in your home directory. Then create a emacs directory in your home directory, and save the redo.el file in that directory.

(require 'cl)

(defvar emacs-directory "~/emacs/"
  "The directory containing the emacs configuration files.")

; Define the load-path
(pushnew (expand-file-name emacs-directory) load-path)

;;; MacOS X specific stuff
(setq mac-option-modifier 'meta)
(setq mac-command-modifier 'hyper)

(global-set-key [(hyper a)] 'mark-whole-buffer)
(global-set-key [(hyper v)] 'yank)
(global-set-key [(hyper c)] 'kill-ring-save)
(global-set-key [(hyper x)] 'kill-region)
(global-set-key [(hyper s)] 'save-buffer)
(global-set-key [(hyper l)] 'goto-line)
(global-set-key [(hyper o)] 'find-file)
(global-set-key [(hyper f)] 'isearch-forward)
(global-set-key [(hyper g)] 'isearch-repeat-forward)
(global-set-key [(hyper w)]
                (lambda () (interactive) (kill-buffer (current-buffer))))
(global-set-key [(hyper .)] 'keyboard-quit)

;; I disabled this since I want to avoid hitting Cmd-q accidentally.
(global-set-key [(hyper q)] 'save-buffers-kill-emacs)

(require 'redo)
(global-set-key [(hyper z)] 'undo)
(global-set-key [(hyper shift z)] 'redo)

These settings emulate the Mac copy/cut/paste commands as well as other well known keyboard bindings. The settings move the M-x to use the Option key on the Mac keyboard instead of the Apple key.

Setup for MacOS X 10.3 and 10.2

Here are some customizations you may want to do to have GNU Emacs behave closer to MacOS X applications. For your convenience I've put the below customizations in two files, .emacs and redo.el. Save the .emacs file in your home directory. Then create a emacs directory in your home directory, and save the redo.el file in that directory.

The define-key setting seems to be mandatory on my PowerBook 800MHz system, otherwise the return key doesn't work (thanks to Andrew Choi for providing the hint).

;;; MacOS X specific stuff
(setq mac-command-key-is-meta nil)

;; Define the return key to avoid problems on MacOS X
(define-key function-key-map [return] [13])

(global-set-key [(alt a)] 'mark-whole-buffer)
(global-set-key [(alt v)] 'yank)
(global-set-key [(alt c)] 'kill-ring-save)
(global-set-key [(alt x)] 'kill-region)
(global-set-key [(alt s)] 'save-buffer)
(global-set-key [(alt l)] 'goto-line)
(global-set-key [(alt o)] 'find-file)
(global-set-key [(alt f)] 'isearch-forward)
(global-set-key [(alt g)] 'isearch-repeat-forward)
(global-set-key [(alt w)]
                (lambda () (interactive) (kill-buffer (current-buffer))))
(global-set-key [(alt .)] 'keyboard-quit)

;; I disabled this since I want to avoid hitting Cmd-q accidentally.
;(global-set-key [(alt q)] 'save-buffers-kill-emacs)

(require 'redo)
(global-set-key [(alt z)] 'undo)
(global-set-key [(alt shift z)] 'redo)
    

For your convenience, I've put the redo package locally. Just make sure you put the redo.el in the load path of Emacs. A good place is in the ~/emacs/ directory. This assumes you have this directory in the load path:

(require 'cl)

(defvar emacs-directory "~/emacs/"
  "The directory containing the emacs configuration files.")

; Define the load-path
(pushnew (expand-file-name emacs-directory) load-path)
    

Ovidiu Predescu
Last modified: Wed Dec 8 09:10:54 PST 2010
Home