kondaman@aludra.usc.edu (Arjun Krishna Kondamani) (02/03/90)
To all you professional emacs programmers, a question from an amateur: I login to my unix account with an ADDS 2020 terminal. The location of the 'backspace' and 'delete' keys is such that I prefer to use the 'backspace' key to delete text rather than the 'delete' key itself. I have accomplished this in the shell region with my .cshrc file but still haven't found a way to do so in emacs. I have noticed though that 'backspace' translates to ^H which brings up the help. 'Delete' translates to ^?. I will be grateful to netters for their suggestions and comments. --Arjun. kondaman@castor.usc.edu@usc.edu 213-746-1151 (evening) 213-743-2666 (day) Don't go around saying the world owes you a living. The world owes you nothing. It was here first. -- Mark Twain
gm@keysec.kse.com (Greg McGary) (02/03/90)
In article <7813@chaph.usc.edu> kondaman@aludra.usc.edu (Arjun Krishna Kondamani) writes: >The location of >the 'backspace' and 'delete' keys is such that I prefer to use the >'backspace' key to delete text rather than the 'delete' key itself. (defun swap-ctl-h-and-del () "Swap the C-h and C-? keys at the lowest level. Beware, this will swap related key-sequences as well: e.g., C-M-h and C-M-?" (interactive) ;; First make a translate table that does the identity translation. (setq keyboard-translate-table (make-string 128 0)) (let ((i 0)) (while (< i 128) (aset keyboard-translate-table i i) (setq i (1+ i)))) ;; Now alter translations of some characters. (aset keyboard-translate-table ?\C-? ?\C-h) (aset keyboard-translate-table ?\C-h ?\C-?)) (swap-ctl-h-and-del) -- -- Greg McGary -- Key Systems Engineering -- Work: (703) 742-7870 Home: (703) 352-0407 -- gm@kse.com, gm@cs.duke.edu, ..!uunet!keysec!gm
mikef@sarah.lerc.nasa.gov (Mike J. Fuller) (02/04/90)
In article <7813@chaph.usc.edu> kondaman@aludra.usc.edu (Arjun Krishna Kondamani) writes: >To all you professional emacs programmers, a question from an amateur: > >I login to my unix account with an ADDS 2020 terminal. The location of >the 'backspace' and 'delete' keys is such that I prefer to use the >'backspace' key to delete text rather than the 'delete' key itself. I'm posting this because I have seen more than a few requests for this recently. Just put this in your .emacs file: (progn (setq keyboard-translate-table (make-string 128 0)) (let ((i 0)) (while (< i 128) (aset keyboard-translate-table i i) (setq i (1+ i))))) (aset keyboard-translate-table ?\^? ?\^h) (aset keyboard-translate-table ?\^h ?\^?) This will swap backspace and delete (^H and ^?) EVERYWHERE in Emacs. You can use a similar method to assign ^S and ^Q to other keys if you enable software flow control (via set-input-mode) and to assign Escape (^[) to another key if you lack an Escape key (vt200 type keyboard and some Macs). This changes the keys at a lower level than the key bindings and thus eliminates problems with local key bindings in some buffers like dired. /-----------------------------------------------------------------------------\ | Mike J. Fuller |Internet: mikef@sarah.lerc.nasa.gov |You'd be paranoid, | |----------------| mikef@zippysun.math.uakron.edu|too, if everyone | |/\/\/\/\/\/\/\/\|Bitnet: r3mjf1@akronvm |was out to get you!| \-----------------------------------------------------------------------------/
jma@abel.UUCP (Jeff Abrahamson) (02/07/90)
Put (load-library "term/bobcat") in your .emacs file. Look at .../term/bobcat for more info. -Jeff -- -------- Jeff Abrahamson abel!jma@manta.pha.pa.us UPenn Mathematics (jma@grad1.cis.upenn.edu) Bicycle Coalition of the Delaware Valley
deven@rpi.edu (Deven T. Corzine) (02/10/90)
On 3 Feb 90 18:39:18 GMT, mikef@sarah.lerc.nasa.gov (Mike J. Fuller) said: mikef> I'm posting this because I have seen more than a few requests mikef> for this recently. Just put this in your .emacs file: mikef> (progn mikef> (setq keyboard-translate-table (make-string 128 0)) mikef> (let ((i 0)) mikef> (while (< i 128) mikef> (aset keyboard-translate-table i i) mikef> (setq i (1+ i))))) mikef> (aset keyboard-translate-table ?\^? ?\^h) mikef> (aset keyboard-translate-table ?\^h ?\^?) This seems to be the solution everyone has posted. I wrote a somewhat more extensive function, which is intended to work even if keyboard-translate-table already exists, and it swaps the real bindings of backspace and delete, not hardcoding the real values. Also, the function can be called interactively to swap the keys at any time, and can be called noninteractively, forcing swapped or unswapped. (When forcing one or the other mapping, it does use hardcoded bs or del chars instead of what's in their positions in the current keyboard-translate-table. Here is the function: (defun swap-bs-del (&optional arg) "Accepts single optional argument. If no argument, or nil, swaps values for backspace and delete keys in keybpoard-translate-table, initializing table if necessary. If arg is t or an integer greater than 0, forces a mapping of bs->del and del->bs. Any other argument forces untranslated mapping of bs->bs and del->del." (interactive) ;; initialize keyboard-translate-table (if (not keyboard-translate-table) (setq keyboard-translate-table "")) (let ((char (length keyboard-translate-table))) (while (< char 128) (setq keyboard-translate-table (concat keyboard-translate-table (char-to-string char)) char (1+ char)))) ;; check arg (if (not arg) ;; no arg or nil, swap backspace and delete (let ((bs (aref keyboard-translate-table 8)) (del (aref keyboard-translate-table 127))) (aset keyboard-translate-table 8 del) (aset keyboard-translate-table 127 bs)) ;; argument given (if (or (eq arg t) (and (integerp arg) (> arg 0))) ;; t or integer greater than zero, force bs->del, del->bs (progn (aset keyboard-translate-table 127 8) (aset keyboard-translate-table 8 127)) ;; other argument, force untranslated bs->bs, del->del (aset keyboard-translate-table 8 8) (aset keyboard-translate-table 127 127)))) Enjoy! Deven -- Deven T. Corzine Internet: deven@rpi.edu, shadow@pawl.rpi.edu Snail: 2151 12th St. Apt. 4, Troy, NY 12180 Phone: (518) 274-0327 Bitnet: deven@rpitsmts, userfxb6@rpitsmts UUCP: uunet!rpi!deven Simple things should be simple and complex things should be possible.