[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Gnu EMACS customization for Lisp



Lisp hackers who use Gnu EMACS might want to try this useful
customization.  It emulates the standard keybinding of CCA EMACS
that makes C-Z (i.e. control-Z) a prefix which both CONTROL- and
META-izes to the following keystroke.  This is particularly useful
for Lisp because most of the special Lisp editing commands are bound
to ESC CONTROL characters.

This text can be placed in the personal .emacs file in your home
directory.  The suspend-emacs function previously run by C-Z is
still available as either C-X C-Z or C-Z C-Z .

But first: The two "^Z" strings in the text below have been sanitized
to pass through mailers and, as mailed, contain a two character
sequence representing CONTROL-Z to humans.  You will have to edit
them to contain the single literal character C-Z, which can be typed
in EMACS via the two-keystroke sequence: C-Q C-Z .

======================================
(defun c-m-prefix ()
 "Apply both META and CONTROL to the next command character"
 (interactive)
 (command-execute
  (lookup-key esc-map (char-to-string (logand 31 (read-char))))))

(define-key global-map "^Z" 'c-m-prefix)
(define-key esc-map "^Z" 'suspend-emacs)