tags:

views:

46

answers:

3

For some reason, "C-z" is mapped to suspend-or-iconify-emacs and I can't seem to get it to rebind to something less annoying. (I like using ctrl-z for undo, but doing nothing would at least be better than suspending every time I accidentally hit the key)

I've tried doing it interactively: M-x global-set-key, then Set key C-z to command: undo.
M-x describe-key-briefly gives me C-z runs the command suspend-or-iconify-emacs

I've tried going to the scratch buffer and evaluating: (global-set-key (kbd "C-z") 'undo) and (global-set-key "\C-z" 'undo), and it is of course in my .xemacs/init.el file.

Nothing seems to actually rebind the key.

This is happening on XEmacs 21.5, in Fundamental mode. Any ideas on how to troubleshoot this?

edit: Ok here is a hack that gets around the problem by redefining the suspend function to undo:

(defun suspend-or-iconify-emacs () (interactive) (undo))

I can't actually suspend emacs anymore, but that's actually ok with me.

A: 

Put that at the end of your .xemacs/init.el :

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

Or maybe you have a misconfigured keyboard or operating system.

Do C-h k C-z to see if xemacs really receives a C-z key.

Jérôme Radix
`M-x describe-key-briefly` is basically a short version of C-h k.
Goladus
Did you try your own suggestion? It doesn't work for me, I think due to C-z not being defined in global-map, but in global-window-system-map.
asjo
That's why you should try, I've not said that C-z works on your computer.
Jérôme Radix
A: 

Try evaluating this:

(define-key global-window-system-map [(control z)] 'undo)

(assuming that you aren't running XEmacs in tty-mode, but I guess you are not, if you want to iconify :-))

I used C-h b to find out what *-map to modify.

asjo
A: 

I have the following code in my .emacs:

(global-set-key (kbd "C-z") 'eshell)

It will start an eshell, and it works.

The C-z combination is pretty standard on Unix/Linux, if you're working in a terminal with e.g. vi, lynx or mutt and presses C-z the program will suspend and you will be back in the shell. Issuing the 'fg' command will pop the program back again. As Emacs has its own shell, I like spawning that when pressing C-z in Emacs.

You can also add the following hook, that will remap C-z in the eshell. That way pressing C-z in the eshell with get you back to the buffer you were editing.

(add-hook 'eshell-mode-hook
  (lambda ()
    (local-set-key (kbd "C-z") 'bury-buffer)))
slu