- Subject: Re: xjed and keypad, pc-select-mode
- From: Guenter Milde <G.Milde@xxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 7 Aug 2002 10:53:20 +0200 (CEST)
On Tue, 6 Aug 2002 16:18:32 +0200 wrote Nicolas Burrus <nicolas.burrus@xxxxxxxxxxxxx>:
> I'm a new (x)jed user, and I got some problems with keypad and xjed.
...
> Finally the following workaround seems to work :
>
> #ifdef XWINDOWS
...
> variable KP_Substract = 0xFFAD;
> variable KP_Enter = 0xFF8D;
> variable KP_0 = 0xFFB0;
> variable KP_1 = 0xFFB1;
...
> x_set_keysym (KP_Substract, 0, "-");
> x_set_keysym (KP_Enter, 0, "\r");
> x_set_keysym (KP_0, 0, "0");
> x_set_keysym (KP_1, 0, "1");
...
> #endif
From the above code I suppose you want the keypad keys to behave the same as
the similar keys on the main keybord.
Did you test, whether the Num-Lock changed the behaviour in some way?
What do you get with >Help>Show_Key for the Keypad keys (without your
workaround)? Some strings like "\eOp", "\eOq", ...?
In this case, a different workaround would be
1. expand the keydefs.sl file to set up symbolic names for the
keystrings, and
2. bind these to the desired action.
% --- excerpt from gkeydefs.sl (gm-s variant of keydefs.sl) ---------
% A function to define symbolic keynames to count for
% different operating systems
static define set_keyvar (ibmpc, termcap, default)
{
#ifdef IBMPC_SYSTEM
return ibmpc;
#endif
#ifdef XWINDOWS
return default;
#endif
#ifexists get_termcap_string
variable s = get_termcap_string (termcap);
if (s == "")
return default;
return s;
#else
return default;
#endif
}
% Numeric Keypad (without Num Lock)
variable Key_KP_0 = set_keyvar ("\eOp", "", "\eOp");
variable Key_KP_1 = set_keyvar ("\eOq", "", "\eOq");
variable Key_KP_2 = set_keyvar ("\eOr", "", "\eOr");
variable Key_KP_3 = set_keyvar ("\eOs", "", "\eOs");
variable Key_KP_4 = set_keyvar ("\eOt", "", "\eOt");
variable Key_KP_5 = set_keyvar ("\eOu", "", "\eOu");
variable Key_KP_6 = set_keyvar ("\eOv", "", "\eOv");
variable Key_KP_7 = set_keyvar ("\eOw", "", "\eOw");
variable Key_KP_8 = set_keyvar ("\eOx", "", "\eOx");
variable Key_KP_9 = set_keyvar ("\eOy", "", "\eOy");
variable Key_KP_Subtract = set_keyvar ("\eOS", "", "\eOm");
variable Key_KP_Enter = set_keyvar ("\eOM", "", "\eOM");
variable Key_KP_Separator = set_keyvar ("\eOn", "", "\eOn");
% variable Key_KP_Add = set_keyvar ("\eOm", "", "+"); % key sends "+"
% variable Key_KP_Multiply = set_keyvar ("\eOR", "", "*"); % key sends "*"
% variable Key_KP_Divide = set_keyvar ("/", "", "/"); % key sends "/"
% ------------------- end of gkeydefs excerpt ----------------------------
% Let the keypad keys behave like "normal" keys
setkey("insert(\"0\")", Key_KP_0);
setkey("insert(\"1\")", Key_KP_1);
...
The advantage of this approach is, that in a different keymap you can still
have special bindings to the KP-keys (e.g. in some modes KP_Enter starts a
calculation or compiling, or KP_Subtract removes a selection...)
> BTW, why #ifdef XWINDOWS and not XWINDOW ?
Maybe becouse you normally open more than one window? ;-)
> Do you know any equivalent of emacs's pc-select-mode, I can't find some, and
> I'm going to write one if it doesn't exist yet.
Actually, I don't know what emacs's pc-select-mode is, but if you are
looking for marking a region with Shift-Arrow, there are two modes that
provide this:
wmark.sl % the one included in the jed distribution
cuamark.sl % my version (IMHO the better one :-), to be found at the jed
modes repository (http://jedmodes.sf.net/devel)
to use e.g. wmark.sl, put
require("wmark") in your .jedrc
>
> Last thing, is there an equivalent of "C-c C-\" binding in emacs (add slashes
> at the end of each line of a region, useful in C macros definition) ?
I don't know, but it should be fairly easy to program. You might have a look
at comments.sl, to see how the commenting/uncommenting is done there (you
might even try if you could do with a call to the commenting functions there).
Guenter
--
G.Milde at physik.tu-dresden.de
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.
[2002 date index]
[2002 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]