[OS X Emacs] Re: Aquamacs mucks up my key-bindings in one-buffer-one-frame-mode

cytan cytan299 at netzero.net
Mon Jan 4 09:40:26 EST 2010

Here's my preferences.el file. I know ... I know ... I should learn Emacs
keybindings but my fingers have been programmed for Wordstar for the last 20-30
years (is it that long already :-) ). I do know mode the wordstar mode in Emacs
but that's not exactly what I want. 

Any pointers appreciated.



;; This is my wordstar keybindings that will be used globally in all modes
;; in WORDSTAR like mode
;; C.Y. 25 Dec 2009

;; some initial settings for Aquamacs

;; make sure we always open up a new frame when we invoke aquamacs

;;(load-file "~/Library/Preferences/Aquamacs Emacs/minor-map.el")

;;(one-buffer-one-frame-mode t)
;;(unbind-minor-mode one-buffer-one-frame-mode)

;; try and kill off scratch file and startup messages
(setq aquamacs-scratch-file nil)
(setq inhibit-startup-message t)
;; (setq inhibit-copyright-message t)

(global-unset-key (kbd "C-x"))
(global-unset-key (kbd "C-h"))
(global-unset-key (kbd "C-c"))

(global-set-key (kbd "C-v") 'overwrite-mode)
(global-set-key (kbd "RET") 'newline-and-indent)

(global-set-key (kbd "C-a") 'backward-word)
(global-set-key (kbd "C-f") 'forward-word)
(global-set-key (kbd "C-s") 'backward-char)
(global-set-key (kbd "C-d") 'forward-char )
(global-set-key (kbd "C-x") 'next-line )
(global-set-key (kbd "C-e") 'previous-line)
(global-set-key (kbd "C-r") 'scroll-down)
;; have to re-define C-c for page down this way!!!!
(define-key osx-key-mode-map (kbd "C-c") 'scroll-up)

(global-set-key (kbd "C-h") 'delete-backward-char)
(global-set-key (kbd "C-g") 'delete-char)
(global-set-key (kbd "C-t") 'kill-word)
(global-set-key (kbd "C-y") 'kill-line)

(global-set-key (kbd "C-i") 'indent-for-tab-command)
(global-set-key (kbd "C-l") 'isearch-repeat-forward)

(global-set-key (kbd "C-b") 'fill-paragraph)

(global-set-key (kbd "C-u") 'undo)

(defun match-paren (arg)
"Go to the matching paren if on a paren; otherwise insert %."
 (interactive "p")
 (cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
 ((looking-at "\\s\)") (forward-char 1) (backward-list 1))
 (t (self-insert-command (or arg 1)))))
(global-set-key (kbd "C-]") 'match-paren)
;; C-k keys
;; define C-k as a prefix key
(global-unset-key (kbd "C-k"))
(global-set-key (kbd "C-k C-c") nil)
(global-set-key (kbd "C-k") nil)

(global-set-key (kbd "C-k C-f") 'find-file)
(global-set-key (kbd "C-k C-r") 'insert-file)
(global-set-key (kbd "C-k C-u") 'revert-buffer)
(global-set-key (kbd "C-k C-q") 'close-window)
(global-set-key (kbd "C-k C-s") 'save-buffer)
(global-set-key (kbd "C-k C-x") 'save-buffers-kill-emacs)
(global-set-key (kbd "C-k C-w") 'write-file)

(global-set-key (kbd "C-k C-b") 'set-mark-command)
(global-set-key (kbd "C-k C-k") 'copy-region-as-kill)
(global-set-key (kbd "C-k C-r") 'insert-file)
(global-set-key (kbd "C-k C-u") 'revert-buffer)
(global-set-key (kbd "C-k C-q") 'close-window)
(global-set-key (kbd "C-k C-s") 'save-buffer)
(global-set-key (kbd "C-k C-x") 'save-buffers-kill-emacs)
(global-set-key (kbd "C-k C-w") 'write-file)

(global-set-key (kbd "C-k C-b") 'set-mark-command)
(global-set-key (kbd "C-k C-k") 'copy-region-as-kill)
(global-set-key (kbd "C-k C-y") 'kill-region)
(global-set-key (kbd "C-k C-c") 'yank)

;; C-q keys
(global-unset-key (kbd "C-q"))
(global-set-key (kbd "C-q") nil)

(global-set-key (kbd "C-q C-s") 'move-beginning-of-line)
(global-set-key (kbd "C-q C-d") 'move-end-of-line)
(global-set-key (kbd "C-q C-r") 'beginning-of-buffer)
(global-set-key (kbd "C-q C-c") 'end-of-buffer)

(global-set-key (kbd "C-q C-f") 'isearch-forward)
(global-set-key (kbd "C-q C-a") 'query-replace)

(load-file "~/Library/Preferences/Aquamacs Emacs/linum.el")
(global-set-key (kbd "C-q C-n") 'linum-mode)
(global-set-key (kbd "C-q C-l") 'goto-line)

;; C-w keys
(global-unset-key (kbd "C-w"))
(global-set-key (kbd "C-w") nil)

(defun previous-window ()
   "Move to previous window"
   (other-window -1))

(global-set-key (kbd "C-w C-w") 'split-window-vertically)
(global-set-key (kbd "C-w C-x") 'other-window)
(global-set-key (kbd "C-w C-e") 'previous-window)
(global-set-key (kbd "C-w C-k C-y") 'delete-window)

;; C-o keys
(global-unset-key (kbd "C-o"))
(global-set-key (kbd "C-o") nil)

(global-set-key (kbd "C-o C-w") 'toggle-word-wrap)

;; Set up cursor types and colour according to whether it is over-write or not,
;; and readonly

(setq djcb-read-only-cursor-type 'bar)
(setq djcb-overwrite-color       "red")
(setq djcb-overwrite-cursor-type 'hbar)
(setq djcb-normal-color          "red")
(setq djcb-normal-cursor-type    'box)

(defun djcb-set-cursor-according-to-mode ()
  "change cursor color and type according to some minor modes."
          (set-cursor-color djcb-read-only-color)
          (setq cursor-type djcb-read-only-cursor-type))
          (set-cursor-color djcb-overwrite-color)
          (setq cursor-type djcb-overwrite-cursor-type))
          (set-cursor-color djcb-normal-color)
          (setq cursor-type djcb-normal-cursor-type))

(add-hook 'post-command-hook 'djcb-set-cursor-according-to-mode)

More information about the MacOSX-Emacs mailing list