🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by moss_r Tue, 21 May 1991 05:13
keysym binding - how ??
#1970
Author: moss_r
Date: Tue, 21 May 1991 05:13
29 lines
1715 bytes
Can anyone help me with some basic epoch keyboard setup instructions.

First, can someone give me some code that shows how epoch::rebind-key
works, as the doc. on it is a *bit* un-obvious.

Second, the variable epoch::function-key-mapping supposedly turns off
the translation of the X keysyms into escape sequences....

If no translation is taking place, can you redefine the keysyms 
themselves, ie something like (global-set-key F1 'dired) - the sought of
thing you would do in emacs ?

If translation is taking place, do you have to define a new \e-[ key map
to stop the translations throwing random-ish ~[12 and [OA keysequences
into text if you hit one of them accidently ?

Lastly, is there some simple explantion ( or some sample code ) showing
how you redefine such events as mouse key presses/releases ?  ( I'm used
to emacs on a vt220 terminal, all this talk of X events, resources, keysyms
etc, etc is still a bit confusing! ).


thanks for any possible help,

	Richard Moss
	Dep't Theoretical Chemistry
	University of Sydney, Australia
	moss_r@summer.chem.su.oz.au
Re: keysym binding - how ??
#1974
Author: Alan M. Carroll
Date: Mon, 20 May 1991 20:59
64 lines
3398 bytes
In article <1991May21.001313.1@summer.chem.su.oz.au>, moss_r@summer.chem.su.oz.au writes:
> First, can someone give me some code that shows how epoch::rebind-key
> works, as the doc. on it is a *bit* un-obvious.

I'd suggest looking at ./contrib/amc/keys.el. That's the file that I
was using for my keybindings when 3.2 was released.

> Second, the variable epoch::function-key-mapping supposedly turns off
> the translation of the X keysyms into escape sequences....

For compatability with Emacs, function keys are mapped to bizarre
escape sequences by default. This "feature" can be disabled by setting
the variable epoch::function-key-mapping to nil, in which case
function keys are ignored unless explicitly rebound via
epoch::rebind-key.

> If no translation is taking place, can you redefine the keysyms 
> themselves, ie something like (global-set-key F1 'dired) - the sought of
> thing you would do in emacs ?

I don't think you can do something like that in Emacs. What you
actually must do is bind the function key to some other sequence of
characters, and then bind that sequence to the function you want. For
instance, I bind "Home" to "\C-^k7" with

(rebind-key "Home" 0 "\C-^k7")

and then bind that to move to the start of the line with

(global-set-key "\C-^k7" 'beginning-of-line)

> If translation is taking place, do you have to define a new \e-[ key map
> to stop the translations throwing random-ish ~[12 and [OA keysequences
> into text if you hit one of them accidently ?

Effectively, yes. That's why I put the mapping variable in.

> Lastly, is there some simple explantion ( or some sample code ) showing
> how you redefine such events as mouse key presses/releases ?

You can redefine a mouse event using the (global-set-mouse) or
(local-set-mouse) functions. Here is an example that tells the line
number of the line that the shifted left mouse button is clicked on:

(defun mouse-buffer-line (marg)

  "Show the line number and buffer of the mouse EVENT"

  ;; marg is (point buffer window screen)
  ;; Pop over to the clicked buffer
  (save-excursion (set-buffer (cadr marg))
    ;; Figure out how far down the mouse point is
    (let ((n (count-lines (point-min) (car marg))))
      ;; display it. Include the buffer name for good measure.
      (message (format "Line %d in %s" n (buffer-name (cadr marg))))
)))

;; Bind shift left down to display the line number.
(global-set-mouse mouse-left mouse-shift 'mouse-buffer-line)

-- 
Alan M. Carroll          <-- Another casualty of applied metaphysics
Epoch Development Team   
Urbana Il.               "I hate shopping with the reality-impaired" - Susan
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads