简体   繁体   中英

customizing .emacs file broke my Meta key

I've customized my .emacs file but only to have broken my Meta key. Keystrokes like Mx are undefined now. Here's my .emacs:

(setq default-major-mode 'text-mode)
(setq column-number-mode t)

;; haskell support
(load "/usr/local/lib/haskell-mode-2.8.0/haskell-site-file")
(add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)

;; key bindings
(global-set-key "\C-xl" 'goto-line)
(global-set-key "\C-xc" 'goto-char)
(global-set-key "\C-x?" 'help-command)
(global-set-key "\C-xp" 'previous-buffer)
(global-set-key "\C-xn" 'next-buffer)

(global-set-key "\C-h"  'backward-char)
(global-set-key "\C-l"  'forward-char)
(global-set-key "\C-k"  'previous-line)
(global-set-key "\C-j"  'next-line)
(global-set-key "\C-b"  'backward-word)
(global-set-key "\C-f"  'forward-word)
(global-set-key "\C-p"  'backward-sentence)
(global-set-key "\C-n"  'forward-sentence)
(global-set-key "\C-["  'beginning-of-defun)
(global-set-key "\C-]"  'end-of-defun)
(global-set-key "\C-[]" 'c-mark-function)

Where have I been doing wrong?

UPDATES :
I don't know why but the Meta key works fine when I comment out last three lines.

The problem is with this line:

(global-set-key "\C-["  'beginning-of-defun)

Hitting Control-[ is the same as pressing the escape key, which can be used as the meta key (eg ESC x is the same as Mx ), so this key binding breaks the meta key.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM