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

Escape as Meta prefix



Here's a small contribution to the info-macl library.  People who learned
EMACS on terminals without real Meta keys might find it useful.

;Steve

---------------------- Cut Here -------------------


;;; escape-meta-prefix.lisp
;;; for use with MACL 1.3.2.
;;; This code is in the public domain.  Use it as you wish.
;;;   Stephen E. Miner (miner@parc.xerox.com)
;;;   5/25/90

;;; Loading this file causes FRED Windows to use the Escape key as a Meta
;;; prefix (like usings EMACS on a VT100 terminal.)  Of course, the normal
;;; Option key still works as a "real" Meta key.

(eval-when (compile eval)
  (defconstant option-key-mask #x800 "Option key bit in the event.modifiers
field.")
  (require 'records))

(defobfun (sem-meta-prefix *fred-window*) ()
  "Treats the current keystroke as if the META key were down."
  (setq *fred-keystroke-hook* nil)
  (set-mini-buffer "")
  (ccl::run-fred-command
   (keystroke-function (event-keystroke 
                        (rref *current-event* :Event.message)
                        (logior #.option-key-mask 
                                (rref *current-event* :Event.modifiers))))))

(defobfun (sem-escape-key *fred-window*) ()
  "Treats the current keystroke as a META prefix.  The next keystroke will be
treated as if the META key were held down.  This function is normally bound to
the ESCAPE key."
  (setq *fred-keystroke-hook* 'sem-meta-prefix)
  (set-mini-buffer "m-"))

(def-fred-command #\escape sem-escape-key)