[comp.emacs] GNU Emacs and the use of Left Function keys on the SUN

zjam0b@apctrc.trc.amoco.com (Andrew Montgomery) (02/14/90)

I am currently running GNU Emacs 18.55.3 and trying to define the 
function keys on a SUN-3 terminal, and am finding it impossible to 
properly define some of the Left function keys (L6, L9, F1, and more).

How can I do this?  I am currently trying to use the `define-key' command:

  (global-set-key "\e[200z" 'find-file);L9:VISIT NEW FILE

and am having no success what so ever.  The "special" function keys are
not being redifined, while the other function keys are. 

If there are any old postings or notes on this subject, please send 
them to me.

Any help is greatly appreciated.

Andrew Montgomery              zjam0b@apctrc.trc.amoco.com 

deven@rpi.edu (Deven T. Corzine) (02/27/90)

On 13 Feb 90 17:26:40 GMT,
zjam0b@apctrc.trc.amoco.com (Andrew Montgomery) said:

Andrew> I am currently running GNU Emacs 18.55.3 and trying to define
Andrew> the function keys on a SUN-3 terminal, and am finding it
Andrew> impossible to properly define some of the Left function keys
Andrew> (L6, L9, F1, and more).

Andrew> How can I do this?  I am currently trying to use the
Andrew> `define-key' command:

Andrew>   (global-set-key "\e[200z" 'find-file);L9:VISIT NEW FILE

Andrew> and am having no success what so ever.  The "special" function
Andrew> keys are not being redifined, while the other function keys
Andrew> are.

Odds are high that your windowing system is eating those key
sequences.  If you want to see if you can use it, you can simply edit
your .emacs and type in the global-set-key, but to enter the sequence,
type the opening quote, C-q (or if flow control is a problem, use "M-x
quoted-insert" if you must) then type the function key itself and the
closing quote.  If the window system isn't trapping that key, you
should get the proper string in quotes.  (then, if you want, replace
the literal escape with "\e" -- shouldn't matter.)

Deven
-- 
Deven T. Corzine        Internet:  deven@rpi.edu, shadow@pawl.rpi.edu
Snail:  2151 12th St. Apt. 4, Troy, NY 12180   Phone:  (518) 274-0327
Bitnet:  deven@rpitsmts, userfxb6@rpitsmts     UUCP:  uunet!rpi!deven
Simple things should be simple and complex things should be possible.

jac@muslix.llnl.gov (James Crotinger) (02/28/90)

deven@rpi.edu (Deven T. Corzine) said:
>                                         but to enter the sequence,
>  type the opening quote, C-q (or if flow control is a problem, use "M-x
>  quoted-insert" if you must) then type the function key itself and the
>  closing quote.

  Just tried this. The escape sequence does get inserted into the
file. I then tried to evaluate the command, and emacs complains that
I'm using an invalid prefix key.

  Jim

jr@bbn.com (John Robinson) (02/28/90)

In article <50261@lll-winken.LLNL.GOV>, jac@muslix (James Crotinger) writes:
>deven@rpi.edu (Deven T. Corzine) said:
>>                                         but to enter the sequence,
>>  type the opening quote, C-q (or if flow control is a problem, use "M-x
>>  quoted-insert" if you must) then type the function key itself and the
>>  closing quote.
>
>  Just tried this. The escape sequence does get inserted into the
>file. I then tried to evaluate the command, and emacs complains that
>I'm using an invalid prefix key.

The problem is that ESC-[ is bound to the function backwards-paragraph
already, so it can't be the beginning of a longer sequence at the same
time.  You have to say:

  (global-unset-key "\e[")

before the global-set-key.  If you use sunwindows, I recommend that
you use emacstool instead; it encodes the function keys differently
and compatibly.  If this isn't installed at your site, it should be
the file $EMACS/etc/emasctool.  (Actually, I recommend you obtain and
use the window system named X in preference to any of this).

Otherwise, look at the file $EMACS/lisp/term/sun.el; here's the relevant
bit:

  (defvar sun-esc-bracket nil
    "*If non-nil, rebind ESC [ as prefix for Sun function keys.")

Basically, this means that, if you say:

  (setq sun-esc-bracket t)

in your .emacs file, the function keys on the Sun will all be enabled
for you (modulo .ttyswrc).  (Under emacstool, they are all enabled,
and emacs sees sequences starting with C-x *).

They dispatch through the keymap sun-raw-map.  See sun.el, and
$EMACS/etc/SUN-SUPPORT.

This ought to be recurrent comp.emacs posting number 1.  Maybe it
could be the only posting ever in comp.emacs.sun, with an
expire: never.  :-)
--
/jr, nee John Robinson     Life did not take over the globe by combat,
jr@bbn.com or bbn!jr          but by networking -- Lynn Margulis

deven@rpi.edu (Deven T. Corzine) (03/02/90)

deven@rpi.edu (Deven T. Corzine) said:

Deven> but to enter the sequence, type the opening quote, C-q (or if
Deven> flow control is a problem, use "M-x quoted-insert" if you must)
Deven> then type the function key itself and the closing quote.

On 27 Feb 90 21:24:13 GMT, jac@muslix.llnl.gov (James Crotinger) said:

James> Just tried this. The escape sequence does get inserted into the
James> file. I then tried to evaluate the command, and emacs complains
James> that I'm using an invalid prefix key.

That means that you have some function assigned to a sequence which is
part of that full sequence.  In this case, almost certainly the
culprit is ESC [ -- so include (global-unset-key "\e[") before you try
the global-set-key's...

Deven
-- 
Deven T. Corzine        Internet:  deven@rpi.edu, shadow@pawl.rpi.edu
Snail:  2151 12th St. Apt. 4, Troy, NY 12180   Phone:  (518) 274-0327
Bitnet:  deven@rpitsmts, userfxb6@rpitsmts     UUCP:  uunet!rpi!deven
Simple things should be simple and complex things should be possible.