Take the 2-minute tour ×

I use emacs via Putty and since Putty doesn't send certain key combinations to the remote console I generally need to re-bind them to other key combinations.

After installing the amazing Zen-Coding mode I had some trouble with the preview it generated; I couldn't get it to insert the output it was previewing. I got around this with the following keybindings:

(global-set-key "\M-\r" 'zencoding-expand-line)
(global-set-key "\M-]" 'zencoding-preview-accept)

However, what I'd like to do is be able to hit M-RET again when the preview is open and have it insert the output.

My emacs-lisp-fu is extremely weak, however.

Is there a way I can test whether the preview is open and capture/bind another M-RET keypress?

share|improve this question
add comment

2 Answers

You can modify the key that does preview accept in this function at line 585 or so, like this:

(defvar zencoding-preview-keymap
    (define-key map "\M-\r" 'zencoding-preview-accept)
    (define-key map [(control ?g)] 'zencoding-preview-abort)
share|improve this answer
Is editing the elisp mode file itself a better idea than putting overrides in your .emacs? –  Sean M Oct 19 '11 at 20:46
add comment

You can also use the buffer specific key bindings instead of the global ones.

share|improve this answer
add comment

Your Answer


