There are two things going on. First, Aquamacs has remapped the Mac OS X command key to alt. So it should be (global-set-key '[(alt w)] 'kill-current-buffer)
.
But that gives a warning because of the second thing, osx-key-mode
has defined its own osx-key-mode-map
. Emacs suggests to redefine that key in that keymap with define-key
.
(defun kill-current-buffer () (interactive) (kill-buffer (current-buffer))) (when (boundp 'osx-key-mode-map) (define-key osx-key-mode-map '[(alt w)] 'kill-current-buffer))