Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!ames!ptsfa!ihnp4!alberta!calgary!danny From: danny@calgary.UUCP Newsgroups: comp.emacs Subject: Re: If you REALLY don't like the arrangement of C-h and DEL in GNU... Message-ID: <979@vaxb.calgary.UUCP> Date: Fri, 19-Jun-87 12:12:38 EDT Article-I.D.: vaxb.979 Posted: Fri Jun 19 12:12:38 1987 Date-Received: Sun, 21-Jun-87 05:00:49 EDT References: <247@cbstr1.att.com> <3038@cit-vax.Caltech.Edu> Organization: U. of Calgary, Calgary, Ab. Lines: 70 Keywords: keyboard-translate-table Summary: another way to rebind C-h In article <3038@cit-vax.Caltech.Edu>, walton@tybalt.caltech.edu (Steve Walton) writes: > > Karl describes keyboard-translate table in the referenced message for > swapping C-H and DEL. One real anamoly of doing it this way is that > quoted-insert (C-Q by default) will insert a DEL if you type C-Q C-H > at your keyboard; similarly, C-Q followed by the DEL key will insert > a C-H. There's gotta be a better way... There is: (aset global-map 8 'delete-backward-char) overrides the binding of C-h to 'help-command while bypassing the checking for a keymap performed by define-key. Thenceforth, both C-h and DEL will delete characters backwards, although, in some modes, DEL may get locally bound to 'backward-delete-char-untabify. You can also bind 'help-command to anything you want. I bind it to a function key transmitting a multi-character sequence (esc-[-208z on the sun). Unfortunately, I like to have a double hit of the help key do a 'describe-key-briefly (aka help-c). This is tricky as, although global-set-key and local-set-key create extra keymaps as required, define-key doesn't. The code I am forced to is: (setq special-help-map1 (make-sparse-keymap)) (setq special-help-map2 (make-sparse-keymap)) (setq special-help-map3 (make-sparse-keymap)) (setq special-help-map4 (make-sparse-keymap)) (setq special-help-map5 (make-sparse-keymap)) (define-key help-map "\e" special-help-map1) (define-key help-map "\e[" special-help-map2) (define-key help-map "\e[2" special-help-map3) (define-key help-map "\e[20" special-help-map4) (define-key help-map "\e[208" special-help-map5) (define-key help-map "\e[208z" 'describe-key-briefly) On a related topic, I have had a lot of difficulty binding 'universal-argument (simple.el) to a multicharacter function key. Eventually I came up with the following alternative function: (defun my-universal-argument () "Begin a numeric argument for the following command. Digits or minus sign following this command make up the numeric argument. If no digits or minus sign follow, this command by itself provides 4 as argument. Used more than once, this command multiplies the argument by 4 each time." Fixed for tying to a function (multi-char sequence) key." (interactive nil) (let ((c-u 4) key-seq) (setq key-seq (read-key-sequence nil)) (while (eq (key-binding key-seq) 'my-universal-argument) (setq c-u (* 4 c-u)) (setq key-seq (read-key-sequence nil))) (if (equal (length key-seq) 1) (prefix-arg-internal (string-to-char key-seq) c-u nil) (setq prefix-arg (list c-u)) (command-execute (key-binding key-seq))))) Note: the else part of the if statement is needed because 'prefix-arg-internal uses "unread-command-char" to dispose of its first argument if it is not a digit or "-". I don't guarantee that my fix will work in all circumstances but I have not mayself found any problems. Of course, the clean way to handle it (HINT, HINT) would be for gnu emacs to permit pushing back (i.e. unreading) more than a single character as gosmacs does. Oh well, perfection is not achieved in a day. -- danny levinson ...ihnp4!alberta!calgary!danny (?) university of calgary [Seen on a local door: "So many pedestrians, so little time"]