Jim - I think the short answer is that it can't be done in the J session
manager.

I looked into this - all the relevant stuff is in
~system/extras/utl/jijs.ijs.

The problem is that the J session is an edit window - something that does
not appear
to have a command to move a cursor to a particular position.  I've extracted
the relevant
code to get as close as I can to what you want to do but all I'm able to do
is to select
the last command.  The cursor is still at the end because all I'm doing is
replacing the
session text with the same text with the last command on the end; the cursor
seems to
wind up at the end by default.

I've included my sample code so you can see how it works and try to figure
out
something to accomplish what you want.  Another way would be to run the
jconsole
under, say, emacs which has a full-fledged language (albeit emacs-lisp)
behind it
that lets you do anything.

To use this code, define the following 2 functions in your J window and
define, e.g.
F-5 to be
solc ''
to recall the last command.

Good luck,

Devon
     +----------------- code follows ----------------+
NB.* sessionCmdOut.ijs: output command to J session manager.

NB.* solc: send out last command.
solc=: 3 : 0
  lc=. getLastCmd ''              NB. Get last command from input log.
  smsel_jijs_ qsmout_jijs_''      NB. Select session form.
  wd 'psel ',SMSEL_jijs_          NB. Select the parent window of session.
  dat=. wd 'qd'                   NB. Get info about parent, including
  ndx=. ({."1 dat) i. <,'e'       NB.  where "e" (session data) is.
  sess=. 1 pick ndx { dat         NB. Get session data as char vec.
  sess=. sess, LF#~LF~:{:sess     NB. Ensure it has LF at end.
  lc=. utf8 lc                    NB. Ensure last command is proper text.
  wd 'set e *',sess,lc            NB. Replace session text with lc on end.
  wd 'setselect e ',": ((#sess)+0,#lc), 0   NB. Highlight inserted command.
)

NB.* getLastCmd: get most recent command from input log.
getLastCmd=: 3 : 0
  log=. wd 'sminputlog'           NB. Get inputs as LF-delimited vector.
  lastcmd=. }:log}.~>:LF i:~ log{.~log i: LF
NB.EG lc=. getLastCmd ''
)


On 9/25/06, James Korn <[EMAIL PROTECTED]> wrote:

I am trying to define function keys.

Using Edit|Configure ...   Add

I attempted to add a  function  key combining the functionality of the
Ctrl+Shift+Up Arrow (Last Command) and Home (Left Most Position) keys.

Merely substituting the keys strokes didn't work, so I thought some
command definition syntax might be involved, so I cut and pasted
'Ctrl+Shift+Up Arrow'  to see what I would get.  I then pressed F2.
What I got was an unresponsive keyboard.

Two questions:

1) how do I get the keyboard back after such a mistake?

2) how do I go defining Fkeys like the one described above?

Thanks,
Jim
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm




--
Devon McCormick
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to