home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / os / os2 / apps / 5454 < prev    next >
Encoding:
Text File  |  1992-08-21  |  2.5 KB  |  96 lines

  1. Path: sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!yale!gumby!wmichgw!754clifton
  2. From: 754clifton@gw.wmich.edu
  3. Newsgroups: comp.os.os2.apps
  4. Subject: Elisp code to map alt to meta:
  5. Message-ID: <1992Aug21.151018.5047@gw.wmich.edu>
  6. Date: 21 Aug 92 15:10:18 EST
  7. Organization: Western Michigan University
  8. Lines: 86
  9.  
  10. By popular demand here is the elisp code to use alt for meta on some
  11. (not all) of your keys.
  12.  
  13. This is from Eberhard Mattes, prolific porter of GCC, Emacs and author
  14. of emTeX:
  15.  
  16. -------------------------------- snip, snip --------------------------------
  17. ;; em-meta.el
  18. ;;
  19. (defun em-alt-meta (code name)
  20.   "Put the meta NAME (a string) binding on extended scan code CODE."
  21.   (let ((definition (lookup-key esc-map name)))
  22.     (if (eq definition 'digit-argument)
  23.         (setq definition 'em-alt-digit-argument))
  24.     (if definition
  25.         (define-key ext-map (char-to-string code) definition))))
  26.  
  27. (defun em-alt-digit-argument (arg)
  28.   "A version of digit-argument which works with A-digit keys."
  29.   (interactive "P")
  30.   (setq last-command-char
  31.         (if (or (= last-command-char 129) (= last-command-char -127))
  32.             ?0
  33.           (- last-command-char 71)))
  34.   (digit-argument arg))
  35.  
  36. (em-alt-meta  14 "\^?")
  37. (em-alt-meta  16 "q")
  38. (em-alt-meta  17 "w")
  39. (em-alt-meta  18 "e")
  40. (em-alt-meta  19 "r")
  41. (em-alt-meta  20 "t")
  42. (em-alt-meta  21 "y")
  43. (em-alt-meta  22 "u")
  44. (em-alt-meta  23 "i")
  45. (em-alt-meta  24 "o")
  46. (em-alt-meta  25 "p")
  47. (em-alt-meta  26 "[")
  48. (em-alt-meta  27 "]")
  49. (em-alt-meta  28 "\r")
  50. (em-alt-meta  30 "a")
  51. (em-alt-meta  31 "s")
  52. (em-alt-meta  32 "d")
  53. (em-alt-meta  33 "f")
  54. (em-alt-meta  34 "g")
  55. (em-alt-meta  35 "h")
  56. (em-alt-meta  36 "j")
  57. (em-alt-meta  37 "k")
  58. (em-alt-meta  38 "l")
  59. (em-alt-meta  39 ";")
  60. (em-alt-meta  40 "`")
  61. (em-alt-meta  43 "\\")
  62. (em-alt-meta  44 "z")
  63. (em-alt-meta  45 "x")
  64. (em-alt-meta  46 "c")
  65. (em-alt-meta  47 "v")
  66. (em-alt-meta  48 "b")
  67. (em-alt-meta  49 "n")
  68. (em-alt-meta  50 "m")
  69. (em-alt-meta  51 ",")
  70. (em-alt-meta  52 ".")
  71. (em-alt-meta  53 "/")
  72. (em-alt-meta 120 "1")
  73. (em-alt-meta 121 "2")
  74. (em-alt-meta 122 "3")
  75. (em-alt-meta 123 "4")
  76. (em-alt-meta 124 "5")
  77. (em-alt-meta 125 "6")
  78. (em-alt-meta 126 "7")
  79. (em-alt-meta 127 "8")
  80. (em-alt-meta 128 "9")
  81. (em-alt-meta 129 "0")
  82. (em-alt-meta 130 "-")
  83. (em-alt-meta 131 "=")
  84. -------------------------------- snip, snip -------------------------------
  85.  
  86. Create a file called alt-meta.el, put it in your Emacs lisp directory and
  87. and add the following line to your .emacs file:
  88.  
  89. (load "alt-meta.el")
  90.  
  91. Enjoy,
  92.  
  93. /Doug
  94. --
  95. Douglas Clifton [99clifto@lab.cc.wmich.edu]
  96.