emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Default Emacs keybindings


From: Robert J. Chassell
Subject: Re: Default Emacs keybindings
Date: Tue, 4 May 2004 12:20:17 +0000 (UTC)

   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,                     address@hidden
        I rewrite a "What's New" segment for   http://www.rattlesnake.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]