home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / emacs / 3965 < prev    next >
Encoding:
Text File  |  1993-01-12  |  4.4 KB  |  111 lines

  1. Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!howland.reston.ans.net!usc!news.service.uci.edu!hardy
  2. From: hardy@golem.ps.uci.edu (Meinhard E. Mayer (Hardy))
  3. Subject: Re: demacs and execution problems
  4. Nntp-Posting-Host: golem.ps.uci.edu
  5. Message-ID: <HARDY.93Jan12204918@golem.ps.uci.edu>
  6. In-reply-to: milt@lax.pe-nelson.com's message of 11 Jan 93 22:20:22 GMT
  7. Newsgroups: comp.emacs
  8. Organization: Department of Physics, UC Irvine, CA 92717-4575, USA
  9. Lines: 98
  10. References: <738@mem.lax.pe-nelson.com>
  11. Date: 13 Jan 93 04:49:22 GMT
  12.  
  13. In article <738@mem.lax.pe-nelson.com> milt@lax.pe-nelson.com (Milt Ratcliff) writes:
  14.  
  15.  
  16.    2. In DOS when I run demacs, I have NO delete key.  Neither the backspace
  17.    nor the delete key works.  How do I get the backspace key to delete 
  18.    characters?
  19.  
  20. Try loading bobcat.el (which interchanges backspace and delete) or 
  21. swap-bsdel.el (the former comes with demacs, the latter follows):
  22. ;Article 1126 of gnu.emacs:
  23. ;Path: ark1!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!rpi!netserv2!deven
  24. ;From deven@rpi.edu (Deven T. Corzine)
  25. ;Newsgroups: gnu.emacs
  26. ;Subject: Re: how to use emacs with 'backspace' as 'delete'
  27. ;Message-ID: <DEVEN.90Feb9200209@netserv2.rpi.edu>
  28. ;Date: 10 Feb 90 01:01:42 GMT
  29. ;References: <7813@chaph.usc.edu> <1990Feb3.183918.17186@eagle.lerc.nasa.gov>
  30. ;Organization: Rensselaer Polytechnic Institute, Troy, NY
  31. ;Lines: 69
  32. ;In-Reply-To: mikef@sarah.lerc.nasa.gov's message of 3 Feb 90 18:39:18 GMT
  33. ;
  34. ;
  35. ;On 3 Feb 90 18:39:18 GMT, mikef@sarah.lerc.nasa.gov (Mike J. Fuller) said:
  36. ;
  37. ;mikef> I'm posting this because I have seen more than a few requests
  38. ;mikef> for this recently.  Just put this in your .emacs file:
  39. ;
  40. ;mikef> (progn
  41. ;mikef>   (setq keyboard-translate-table (make-string 128 0))
  42. ;mikef>   (let ((i 0))
  43. ;mikef>     (while (< i 128)
  44. ;mikef>       (aset keyboard-translate-table i i)
  45. ;mikef>       (setq i (1+ i)))))
  46. ;mikef> (aset keyboard-translate-table ?\^? ?\^h)
  47. ;mikef> (aset keyboard-translate-table ?\^h ?\^?)
  48. ;
  49. ;This seems to be the solution everyone has posted.  I wrote a somewhat
  50. ;more extensive function, which is intended to work even if
  51. ;keyboard-translate-table already exists, and it swaps the real
  52. ;bindings of backspace and delete, not hardcoding the real values.
  53. ;Also, the function can be called interactively to swap the keys at any
  54. ;time, and can be called noninteractively, forcing swapped or unswapped.
  55. ;(When forcing one or the other mapping, it does use hardcoded bs or
  56. ;del chars instead of what's in their positions in the current
  57. ;keyboard-translate-table.
  58. ;
  59. ;Here is the function:
  60.  
  61. (defun swap-bs-del (&optional arg)
  62.   "Accepts single optional argument.  If no argument, or nil, swaps values
  63. for backspace and delete keys in keybpoard-translate-table, initializing
  64. table if necessary.  If arg is t or an integer greater than 0, forces a
  65. mapping of bs->del and del->bs.  Any other argument forces untranslated
  66. mapping of bs->bs and del->del."
  67.   (interactive)
  68.   ;; initialize keyboard-translate-table
  69.   (if (not keyboard-translate-table)
  70.       (setq keyboard-translate-table ""))
  71.   (let ((char (length keyboard-translate-table)))
  72.     (while (< char 128)
  73.       (setq keyboard-translate-table
  74.             (concat keyboard-translate-table (char-to-string char))
  75.             char (1+ char))))
  76.   ;; check arg
  77.   (if (not arg)
  78.       ;; no arg or nil, swap backspace and delete
  79.       (let ((bs (aref keyboard-translate-table 8))
  80.             (del (aref keyboard-translate-table 127)))
  81.         (aset keyboard-translate-table 8 del)
  82.         (aset keyboard-translate-table 127 bs))
  83.     ;; argument given
  84.     (if (or (eq arg t)
  85.             (and (integerp arg)
  86.                  (> arg 0)))
  87.         ;; t or integer greater than zero, force bs->del, del->bs
  88.         (progn
  89.           (aset keyboard-translate-table 127 8)
  90.           (aset keyboard-translate-table 8 127))
  91.       ;; other argument, force untranslated bs->bs, del->del
  92.       (aset keyboard-translate-table 8 8)
  93.       (aset keyboard-translate-table 127 127))))
  94.  
  95. ;Enjoy!
  96. ;
  97. ;Deven
  98. ;-- 
  99. ;Deven T. Corzine        Internet:  deven@rpi.edu, shadow@pawl.rpi.edu
  100. ;Snail:  2151 12th St. Apt. 4, Troy, NY 12180   Phone:  (518) 274-0327
  101. ;Bitnet:  deven@rpitsmts, userfxb6@rpitsmts     UUCP:  uunet!rpi!deven
  102. ;Simple things should be simple and complex things should be possible.
  103.  
  104.  
  105. --
  106. Hardy 
  107. -----
  108. Meinhard E. Mayer,  Department of Physics, UC Irvine 
  109. e-mail: hardy@golem.ps.uci.edu (preferred) or MMAYER@UCI.BITNET
  110. !!!! NO NEXTMAIL TO THESE ADDRESSES, PLEASE !!!!!
  111.