From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Robert J. Chassell" Newsgroups: gmane.emacs.devel Subject: Re: Default Emacs keybindings Date: Tue, 4 May 2004 12:20:17 +0000 (UTC) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <20040502211541.GA26227@fencepost> <85y8oa6nwi.fsf@junk.nocrew.org> <87n04paner.fsf@peder.flower> Reply-To: bob@rattlesnake.com NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1083675696 27585 80.91.224.253 (4 May 2004 13:01:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 4 May 2004 13:01:36 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Tue May 04 15:01:23 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BKzY0-0002rg-00 for ; Tue, 04 May 2004 15:01:20 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BKzY0-0007rN-00 for ; Tue, 04 May 2004 15:01:20 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BKz05-0005f6-8g for emacs-devel@quimby.gnus.org; Tue, 04 May 2004 08:26:17 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1BKyur-0004dw-0x for emacs-devel@gnu.org; Tue, 04 May 2004 08:20:53 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1BKyuK-0004Yq-Q6 for emacs-devel@gnu.org; Tue, 04 May 2004 08:20:51 -0400 Original-Received: from [140.186.114.245] (helo=rattlesnake.com) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BKyuI-0004Y8-TG for emacs-devel@gnu.org; Tue, 04 May 2004 08:20:19 -0400 Original-Received: by rattlesnake.com via sendmail from stdin id (Debian Smail3.2.0.115) Tue, 4 May 2004 12:20:17 +0000 (UTC) Original-To: emacs-devel@gnu.org In-reply-to: (message from Richard Stallman on Mon, 03 May 2004 18:21:22 -0400) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:22702 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:22702 What we should do is include prominent documentation telling users how to remap their caps-lock key, with specific recipes. (I have no idea where to find this information for GNU/Linux.) I agree. Here are my notes on installing sensible bindings in plain text consoles, virtual consoles, using a shell and in X Windows. These bindings apply to all applications, not just Emacs. This is just a beginning. Someone who knows more than I needs to write the documentation to be more general and to work well. First, plain text consoles: The following is easiest for plain text consoles, but may not always work: install-keymap emacs2 This command packages package all the keymaps needed for the complete emacs2 keymap (i.e. linux-keys-bare.inc.gz, linux-with-alt-and-altgr.inc.gz, qwerty-layout.inc.gz, and of course, emacs2.kmap.gz) and puts them all together as: /etc/console/boottime.kmap.gz and loads that file. If `install-keymap' fails, the following succeeds, also for plain text consoles: loadkeys /usr/share/keymaps/i386/qwerty/emacs2.kmap.gz On my system, sensible key bindings are loaded at boottime by /etc/rcS.d/S05keymap.sh That file is a link to /etc/init.d/keymap.sh which contains a command to loadkeys /etc/console/boottime.kmap.gz (Actually, the command is `loadkeys ${CONFFILE}' where `CONFFILE=${CONFDIR}/${CONFFILEROOT}.${EXT}.gz' and that ends up being `/etc/console/boottime.kmap.gz'.) Second, X Windows: The `loadkeys' and `install-keymap' commands do not work with X Windows. Instead, it is necessary to use `xmodmap'. (Other commands may also work, but I do not know them.) You can put the following commands in the global Xmodmap file which is used by both xdm and xinit (startx) to change the X keymaps for all users: /etc/X11/Xmodmap Or you can put the commands in various users' ~/.xinitrc files. When the commands go into a user's ~/.xinitrc file, the commands are executed when the user starts X and apply only to that user. Please note that these keycodes are specific to my keyboard. I suspect that the commands suggested in the man page for `xmodmap' are better than these, but have not tried them. Alternatively, whoever writes the documentation should describe a simple way to discover the keybinds. I use `xev' and `xkeycaps', but can never remember what is what. Please describe a fool proof technique, so people like me do not need to think or know anything. xmodmap -e "clear Lock" xmodmap -e "add Control = Caps_Lock" xmodmap -e "keycode 22 = BackSpace" xmodmap -e "keycode 107 = Delete" The previous commands are different from the commands suggested in the man page for xmodmap. I suspect the man page commands are better, but do not know enough myself to choose: # ! # ! Swap Caps_Lock and Control_L # ! # remove Lock = Caps_Lock # remove Control = Control_L # keysym Control_L = Caps_Lock # keysym Caps_Lock = Control_L # add Lock = Caps_Lock # add Control = Control_L In addition, here are commands to set the right ALT and CTL keys to be Super and Hyper respectively. These are useful keys, both in Emacs and in other X applications. I think we should tell people how to do this. Please note the keycode. Again, whoever writes the final documentation should offer a better way. # Set right ALT key to be Super_R with mod3 xmodmap -e "keycode 0x71 = Super_R" xmodmap -e "keysym Super_R = Super_R" \ -e "add Mod3 = Super_R" \ -e "remove Mod1 = Super_R" xmodmap -e "remove Mod2 = Super_R" # Set right CTL key to be a Hyper key with mod4 xmodmap -e "keycode 0x6d = Hyper_R" xmodmap -e "keysym Hyper_R = Hyper_R" \ -e "remove Control = Hyper_R" xmodmap -e "remove Mod2 = Hyper_R" \ -e "add Mod4 = Hyper_R" Here are my comments on how to set the right ALT key to be a true ALT, rather than a Meta key. # # Set right ALT key to be an ALT with mod3 # xmodmap -e "keycode 0x71 = Alt_R" # xmodmap -e "keysym Alt_R = Alt_R" \ # -e "add Mod3 = Alt_R" \ # -e "remove Mod1 = Alt_R" # xmodmap -e "remove Mod2 = Alt_R" In addition, I found that Shift-Tab works when I do the following: xmodmap -e 'keysym Tab = Tab' Emacs should contain default key bindings and menu bindings to run a shell command that changes the key bindings both for all the virtual consoles and, if the user is in X Windows, for that session of X. The command should appear on the Emacs splash page. Also, the documentation should explain what to put in both general and user specific shell scripts that can be run from a shell. Moreover, it should tell how how to invoke one or other shell script automatically at boot. -- Robert J. Chassell Rattlesnake Enterprises As I slowly update it, bob@rattlesnake.com I rewrite a "What's New" segment for http://www.rattlesnake.com