User:Andrew Nikitin/jhelp

From J Wiki
Jump to: navigation, search

File system\extras\util\help.ijs defines verb help_jhelp_ which is called whenever user hits Ctrl+F1 in wd session. The following lines pretty much summarize what it does:

if. #ndx=. helpndx y do.
  htmlhelp 'dictionary/',ndx
elseif.
  ndx=. 4!:4 :: _1: boxopen y
  _1 < ndx
do.
  scriptdoc ndx { 4!:3 ''
elseif. do.
  wdinfo 'Help';'Help topic not found: ',":y
end.

In english: if word is listed as having html help page, this page is called, if name is defined in some script, then scriptdoc is run on this script, otherwise error.

This scheme works for verbs in z locale, but does not work for verbs in base locale: base is not in jhelp's path and 4!:4 returns _1. Since my verbs end up in base locale most of the time I need to fix it.

For now, I use workaround. I replace line

coinsert 'jijs';'j'

with line

coinsert 'jijs';'j';'base'

Probably, the better way is to determine session's current locale and temporary include it and all locales in its path into the path of jhelp locale.

See Also