Some .emacs items for a more "Mac"

I developed these to convert Andrew Choi's Carbon Emacs distribution, which has been rolled into the standard Emacs CVS distro; so future versions of Emacs on the Mac may be able to take advantage of this stuff too.

The standards

Turn off startup message, use GUI-style selection, make Option the meta key.

(setq inhibit-startup-message t)
(setq mac-command-key-is-meta nil)

Real Mac Cut/Copy/Paste

Cued to command-x, command-c, command-v. (command freed up to do the right thing now that option is meta). The built-in 'mac'-style cut/copy/paste functions don't interoperate in a proper fashion with the Mac environment. These do.

(setq *true-mac-cut-buffer* "")
(setq *true-mac-cut-buffer2* t)

(setq interprogram-cut-function
      '(lambda (str push)
         (setq *true-mac-cut-buffer* str)
         (setq *true-mac-cut-buffer2* push)))

(setq interprogram-paste-function
      '(lambda () nil))

(defun true-mac-cut-function () (interactive)
  (if mark-active
        (kill-region (point) (mark)))
(defun true-mac-copy-function () (interactive)
  (if mark-active

(defun true-mac-paste-function () (interactive)
  (if mark-active
      (kill-region (point) (mark)))
  (insert (mac-paste-function)))

(global-set-key [?\A-x] 'true-mac-cut-function)
(global-set-key [?\A-c] 'true-mac-copy-function)
(global-set-key [?\A-v] 'true-mac-paste-function)

Other commands to make you feel at home

(global-set-key [?\A-a] 'mark-whole-buffer)
(global-set-key [?\A-s] 'save-buffer)
(global-set-key [?\A-S] 'write-file)
(global-set-key [?\A-p] 'ps-print-buffer)
(global-set-key [?\A-o] 'find-file)
(global-set-key [?\A-q] 'save-buffers-kill-emacs)
(global-set-key [?\A-w] 'kill-buffer-and-window)
(global-set-key [?\A-z] 'undo)
(global-set-key [?\A-f] 'isearch-forward)
(global-set-key [?\A-g] 'query-replace)
(global-set-key [?\A-l] 'goto-line)
(global-set-key [?\A-m] 'iconify-frame)
(global-set-key [?\A-n] 'new-frame)

Change the font to Monaco 10 (like

 '((font . "-*-monaco-*-*-*-*-10-*-*-*-*-*-*")))

(add-hook 'after-make-frame-functions 
          (lambda (frame)
             '((font . "-*-monaco-*-*-*-*-10-*-*-*-*-*-*")))))

Hard-set the Path

MacOS X's doesn't set the path when you launch it. This messes up the ability to do a lot of stuff. Here's my path, but you'll get the idea.

(setenv "PATH" "/Users/sean/bin/powerpc-apple-darwin:/Users/sean/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/teTeX/bin/powerpc-apple-darwin1.3.7:/usr/X11R6/bin:/usr/local/bin:/usr/X11R6/bin")