From: dsg@blackbird.mitre.org (David S. Goldberg)
Subject: Re: IMPOSSIBLE hacks?  or just very hard to do?
Organization: The Mitre Corp., Bedford, MA.
Date: Mon, 11 Jan 1993 15:53:10 GMT


>>>>> In article <KPC.93Jan9095536@zog.arc.nasa.gov>,
>>>>> kpc@pluto.arc.nasa.gov (k p c) writes:

k> here are some hacks that i've thought of as MUCH too hard (in elisp
k> anyway).  but i'd love to have them!  are they even possible?

k> 1.  sticky shift and control keys.

k> you know how you can use ESC instead of a meta key?  i'd LOVE to use a
k> key (maybe ESC ESC) to do the same for a control key.  ESC ESC f would
k> then be forward-word.  and ideally ESC ESC ESC f would be
k> forward-sexp.  transparently.

k> this is nice for people with CTS and other RSI problems.  (i think
k> xmodmap might work but i want emacs to do it so that terminals can do
k> it also.)  (i'd put eval-expression somewhere else to be able to do
k> ESC ESC.)  (pc-write can do stickiness.)

I suppose you could do this (albeit with difficulty) using alot of sub
keymaps, but it would make it alot harder for people to remap their
key bindings.  You probably couldn't do it in such a way that
remapping "\C-f" would also remap "\e\e\e\ef" or whatever
automatically.

This is really a hardware issue.  What's needed is a way to make the
terminal generate a control key or a shifted key after pressing a
sticky key.  In fact, this issue came up just a couple of weeks ago in
comp.unix.misc (or maybe it was questions, I forget).  I remember one
of the responses referencing special keyboards that do just this.

Doing it in software, with the exception of the terminal driver,
limits the change to that piece of software.  But by modifying the
terminal driver, you force the change on everyone on the system.
Maybe that's OK in your environment, but maybe it's not.  The ESC for
Meta hack is great because alot of terminals don't have a Meta key and
so it's convenient to sort of equate an ESC prefix with the Meta key.
But they aren't exactly the same - if you build epoch with the
EIGHTBIT_KEYBOARD defined, you lose key definitions defined as "M-",
but using "\e" as a prefix works fine.  I don't know (and have no way
of checking) if that is only an epoch issue, though.

k> 2.  word motion and word deletion to treat punctuation in a special way.

k> in the last paragraph there is the string "control key.  ESC ESC".
k> i'd LOVE to have forward-word (M-f) and kill-word (M-d) and their
k> backward equivalents think of sets of punctuation as just different
k> kinds of words.  so i'd be able to do this (' indicates point):

It's been a long time since I played with syntax tables, but I believe
you can set one up to do just what you want.  If nothing else, that's
the place to start looking.

k> 3.  mode line functions.

k> i'd like to be able to do arbitrary things to the mode line on
k> redisplay.  like printing the value of the variable major-mode after
k> deleting the substring "-mode".  and like putting the
k> file-name-nondirectory of the default directory right-justified after
k> the %- string, if there is enough space.

Couldn't you just write a wrapper around redisplay that calls your
arbitrary functions in a hook?  I don't see any redisplay-screen-hook
in the docs, but maybe it exists.

--
Dave Goldberg                      UNIX Systems Programmer/Administrator
Post: The Mitre Corporation MS B020 202 Burlington Rd. Bedford, MA 01730
Phone: 617-271-2460
Domain: dsg@mbunix.mitre.org  UUCP: {your neighborhood}!linus!mbunix!dsg