home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / usr.bin / lisp / lispnews / text0356.txt < prev    next >
Encoding:
Text File  |  1985-11-10  |  1.1 KB  |  28 lines

  1. Lisp hackers who use Gnu EMACS might want to try this useful
  2. customization.  It emulates the standard keybinding of CCA EMACS
  3. that makes C-Z (i.e. control-Z) a prefix which both CONTROL- and
  4. META-izes to the following keystroke.  This is particularly useful
  5. for Lisp because most of the special Lisp editing commands are bound
  6. to ESC CONTROL characters.
  7.  
  8. This text can be placed in the personal .emacs file in your home
  9. directory.  The suspend-emacs function previously run by C-Z is
  10. still available as either C-X C-Z or C-Z C-Z .
  11.  
  12. But first: The two "^Z" strings in the text below have been sanitized
  13. to pass through mailers and, as mailed, contain a two character
  14. sequence representing CONTROL-Z to humans.  You will have to edit
  15. them to contain the single literal character C-Z, which can be typed
  16. in EMACS via the two-keystroke sequence: C-Q C-Z .
  17.  
  18. ======================================
  19. (defun c-m-prefix ()
  20.  "Apply both META and CONTROL to the next command character"
  21.  (interactive)
  22.  (command-execute
  23.   (lookup-key esc-map (char-to-string (logand 31 (read-char))))))
  24.  
  25. (define-key global-map "^Z" 'c-m-prefix)
  26. (define-key esc-map "^Z" 'suspend-emacs)
  27.  
  28.