There are a number of predefined JOT command file in the ${JOT_HOME}/coms area - see installation. In general these have a one-line description at the start of the command file. The most useful ones are described below
These are run by first typing the name of the script, followed by any arguments and then pressing the 'F2' button i.e:
> <scriptName>[ <arg1>[ <arg2>[ ...]]]{F2}If the <<Do>> function has not been mapped to the F2 button then, as a temporary workaround you can type in the command %r=<scriptName>. If the script happens to be one that takes arguments then you must manually define the arguments in the $ buffer - this is always used to define script and macro arguments. Then run the script with %r=<scriptName> like this:
> %r=<scriptName>[ <arg1>[ <arg2> ...]]In addition to Do there are two script-search functions ScriptByName and ScriptByFunc. ScriptByName searches for scripts in ${JOT_HOME}/coms and your PWD for those with the '.jot' name extension whose names match the given string (if no string given then it just lists all scripts in the searched areas e.g:
> mc{Shift+F2}To apply the script on your buffer, move the cursor to the line with your script name and run macro 0 (normally {KP_0}.
By convention, all jot scripts should have a one-line comment in the first line. This should briefly describe what the script is intended to do. If it's a complicated script then detailed instructions should be left in the ? buffer.
ScriptByFunc searches these first-line comments in the search areas and returns a list of those matching the string e.g:
> multicolumn{Ctrl+F2}To apply a script on your buffer, first select one by moving the cursor to the line with your script name and run macro 0 (normally {KP_0}.
The script ${JOT_HOME}/coms/startup.jot is normally run by the editor as it starts up but if some other startup-script has been specified (see notes on the -startup section of command-line qualifiers) then that script can call this startup script normally (e.g: %r=startup; ) or if it is necessary to defer finalisation of the keymap setup, it can be called with the -nofinalize option (e.g: %r=startup -nofinalize; ) - see below for usage notes on the -nofinalize option.
It's principal functions are:
This script creates a mapping of xterm escape sequences to code calls. It's first requirement is to have a map detailing the translation of key codes the to key names that appear in all the documentation.
The mapping of key names to function calls is entirely for the the convenience of the user and can be changed to suit user requirements.
In linux, the mapping of keys to actual key codes is a two stage process, firstly the physical signals received from the keyboard must be identified, then they are translated to a set of hardware-independent keycodes. Many, but not all, modern linux distributions use X Keyboard Extension (XKB). Followed by terminfo/termcap database identified by your TERM variable. For most linux distributions this seems to default to "xterm". If you are interested in that sort of thing, there's a compiled terminfo database file below /usr/share/terminfo/... - if your $TERM is set to xterm, for example, you will pick up the file /usr/share/terminfo/x/xterm.
Although there seems to be pretty broad agreement on what the default setting for $TERM should be, there is no standardisation on what it's capabilities should be and, in particular, what keycodes should be returned for some of the Shift - Ctrl - Alt combinations (see translation of keyboard events to actions).
If the current directory contains a startup.jot file then jot picks up this in preference to the ${JOT_HOME}/coms version.
If the optional CLI arg -startup is specified (see command-line qualifiers), then this overrides any startup path from ${JOT_HOME}/coms or the current directory. if the qualifier is given without the '=<pathName>' value, this is equivalent to -startup=/dev/null i.e. no startup script.
In summary, the startup-file selection is, in order of precedence:
There are two mapping tables used to fully define the finished key translations table in the ( ^ ) buffer:
The startup script will finalize initialization of the editor by merging thes two tables into the key-to-function translation table in buffer ( ^ ) - see translation of keyboard events to actions. It is this last step that is suppressed by the -nofinalize option.
If the -nofinalize option is given, the macro to do the finalisation is defined in buffer ( # ) as the startup script exits, this allows your startup script to modify the final setup in some way before invoking this macro or maybe some different macro to setup the functions and keymap buffers.
The startup script also defines the following dats objects in the code-repository ( * ) hashtable:
$ jot ... -startup="<primaryStartupScript> -<argsList>"
$ jot <pathName> -st=nomod
This is an alternative startup script which modifies the key mapping to transform the standard {Ctrl|Shift|Alt+Fn} to a prefix style for those experiencing difficulty or discomfort reaching combinations of the Shift, Ctrl and Alt keys. In fact nomod.jot calls the normal startup script and modifies the keycodes data before finalising the key mapping.
Instead, a two-key prefix is typed in before hitting the function key - in this context Fn should be taken to mean any top-row function key, any mid, or numeric-keypad key or any arrow key:
The transformation assigns a weight of 1 to Shift, 2 to Ctrl and 4 to Alt. No prefix is required for the unmodified function keys.
In addition, qr.jot also accepts the qualifier -nomod, which causes it to display the prefix key sequence instead of modifiers.
Theses scripts are run by the standard startup.jot script, they define mapping of keys to whatever key codes are generated by your terminfo, these are then assigned functions by the startup.jot script. Currently there is a keymap file for the following:
These script only work when called by startup.jot this then attaches functions to the key definitions in these scripts. If run directly, it's only effect of these scripts is to load buffer @ with the key-names to key-codes map.
In addition to providing the all-important mapping of editing functions to keystrokes these files also map the unassigned and unassignable key combinations. Some key combinations are unassignable because they collide with other keys or because they've been hijacked by the operating system for some system shortcuts. Feel free to add your own functions or rearrange the or redefine the assignments as in whatever way seems appropriate.
The key mappings tend to vary significantly, so a utility is provided to assist with redefining and checking the key-map script - see define_keymap.jot and verify_keys.jot respectively.
The function of this is identical to the various flavours of curses_keys (see curses_keys_<version>.jot) in that it associates functions with their respective keycodes - i.e it defines key bindings.
This script defines a small number of basic unicode characters that may then be entered using a four-key sequence beginning {Esc}, {u}, {c1>} and {<c2>} where the characters c1 and c2 uniquely define a character in the supported unicode subset. The uc_basic script performs this substitution on the command line using %s=commandstring. See also about unicode.
These are the escape sequences and characters supported by uc_basic.jot:
- {Esc u ' a} á {Esc u ' A} Á {Esc u " a} ä {Esc u " A} Ä - {Esc u > a} à {Esc u > A} À {Esc u ~ a} ã {Esc u ~ A} Ã - {Esc u ^ a} â {Esc u ^ A} Â {Esc u c a} ǎ {Esc u c A} Ǎ - {Esc u o a} å {Esc u o A} Å {Esc u _ a} ā {Esc u _ A} Ā - {Esc u ; a} ą {Esc u ; A} Ą {Esc u b a} ă {Esc u b A} Ă - {Esc u , c} ç {Esc u , C} Ç {Esc u O R} ® {Esc u O C} © - {Esc u t m} ™ {Esc u < <} « {Esc u > >} » {Esc u " <} “ - {Esc u " >} ” {Esc u ' <} ‘ {Esc u ' >} ’ {Esc u . .} … - {Esc u . ^} · {Esc u x x} × {Esc u - :} ÷ {Esc u ^ 0} ⁰ - {Esc u ^ 1} ¹ {Esc u ^ 2} ² {Esc u ^ 3} ³ {Esc u 1 2} ½ - {Esc u 1 4} ¼ {Esc u 3 4} ¾ {Esc u s s} ß {Esc u s o} § - {Esc u / o} ø {Esc u / O} Ø {Esc u - d} đ {Esc u - D} Đ - {Esc u d h} ð {Esc u D H} Ð {Esc u ~ n} ñ {Esc u t h} þ - {Esc u T H} Þ {Esc u a e} æ {Esc u A E} Æ {Esc u ! !} ¡ - {Esc u ? ?} ¿ {Esc u = L} £ {Esc u = E} € {Esc u = Y} ¥ - {Esc u / C} ₡ {Esc u | c} ¢ {Esc u o x} ¤ {Esc u / /} \ - {Esc u o o} °e.g:
-{Esc q = Y} - is replaced by the Yen character ( ¥ ). -{Esc q o o} - is replaced by the degrees character ( ° ).This script sets up some characters used in maths and engineering, essentially it is used in the same way as uc_basic.jot. It follows the vim digraph scheme.
$ jot ${JOT_HOME}/coms/curses_keys_Vn.jot -in="%r=define_keymap[ -init]"
This script is used to map actual keycodes received from a real keyboard. It works by prompting for each of the various keystrokes in the nominated keys file and replacing the key code with whatever it picks up from your typing.
Be aware though, that certain keys are hardwired as system shortcuts. These can cause evil or, at least, bizarre unhelpful, things to happen. Alt+F12 on some systems, for example, closes the current window. Now why we should need a shortcut to close a window when there must be at least half a dozen other ways of doing it is a question beyond the scope of this user guide. But that's what it does, it's very annoying, and there seems to be no way of turning it off - not without re-coding and recompiling slabs of kernel. See also Translation of keyboard events to actions
The define_keymap script sniffs through the key map file you give it and wherever it finds "????????" in the escape-sequence field, it prompts you to hit the specified modifier and function-key combination. So first launch an ordinary editing session to reset the dodgy keys to "????????" before launching define_keymap:
$ jot new_keys.jot -in="%r=define_keymap"
It recognizes the special escape sequence {Esc s k} as an instruction to skip the current keycode. This causes the current line of the keycode file to be left unchanged.
If you've made a mistake or just want to take a break, you can interrupt with {Ctrl+c} and manually change the incorrect keycode back to "????????" then save your work, exit and restart.
In the unlikely event of you needing to redefine all keys codes, use define_keymap.jot with the -init qualifier:
$ jot new_keys.jot -in="%r=define_keymap -init"
The -init qualifier tells it to begin by scrubbing all keycodes in the file, replacing each with the string "????????". The main section of the script then searches these reset keycodes, prompts you to prod that combination of keys and picks up the keycode which then replaces the reset keycode. This process is repeated until all missing keycodes have been filled in.
$ jot -in=%r=verify_keys
This is a simple script that allows the user to verify the keyboard mappings. It simply prints the keycode and name of the function key to the console area as they are struck. Function-key names are assumed to be in a comment field of the keyboard map file e.g. ${JOT_HOME}/coms/curses_Vn.jot
This is normally invoked by a client-application script:
> %r=tk;It defines some functions used to create simple menu-driven interfaces.
Some important function it defines are:
Menus are defined in a tabular form - see below
The tk.jot script provides two demonstration functions:
These can be seen in action thusly:
$ jot ${JOT_RESOURCES}/Richard_III_Entire_Play.txt -in="%r=tk; %h=call tk_demo_buttonbox;"
or
$ jot ${JOT_RESOURCES}/Richard_III_Entire_Play.txt -in="%r=tk; %h=call tk_demo_menubar;"
A real-world example would be the jot debugging environment dbg.jot
A toolbox containing a bunch of features offered in support of the development of jot code.
$ jot -st="dbg[ -nostartup][ -testtree] $ jot -st="dbg[ -ide
[ -nomouse] [ -nocode] [ -height=<n>] [ -width=<n>] [ -codebuf=<bufferPath>] [ -setup=<jotCommands>] [ -function=<functionName>] [ -init=<commandSeq>] [ -run=<commandSeq>]]
At it's simplest, it just starts up with a much smaller main window (20 lines), which allows for a much bigger console area and better visibility of system messages:
$ jot -st=dbg ...
Or, it's sometimes expediant to not run the full startup at all (e.g. when using gdb and we don't want to wade through loads of breakpoints in the startup sequence.
$ jot -st="dbg -nostartup" ...
For debugging problems in data-object paths, the -testtree option creates a deep tree and populates it with a few leaf objects.
$ jot -st="dbg -testtree" ...
Finally, the -ide option. Purists may contend that for anything to qualify as an IDE it must be fully graphical - and doubtless they'd be right as purists so frequently and so anoyingly are but back here in the real world, the qualifier is -ide and that's the end of it.
$ jot ... -st="dbg -ide <ideQuals>":
This splits the screen into 5 areas, starting at the top of the screen:
The size of the last two items is adjusted to give the floating window about 2/3rds of the remaining screen and about 1/3 for the console.
The debugger script dbg.jot uses tk.jot to set up the top menu bar.
The dbg script supports a number of, mainly navigational, utility escape sequences.
> <objName>{Esc d q}Displays the value of the named object.
> {Esc d l}Runs your specified launch commands.
> {Esc d d}Takes you to the diagnostic screen.
> {Esc d t}Takes you to the menu definition table.
> {Esc d u}Takes you to the monitor/button-box buffer.
> {Esc d m}Takes you to the monitor buffer.
> {Esc d b}Adds a breakpoint to selected point in code - see dbg_addBreakpoint entry in dbg Breakpoints.
> <commandString>{Esc d c}Sets condition on the seleced breakpoint. - see dbg_setBreakCondition in dbg Breakpoints.
> <commandString>{Esc d a}Sets an action to be performed on entry to breakpoint - see dbg_setBreakAction in dbg Breakpoints.
> {Esc d v}Disables code tracing in the code window.
To trace code in the source-code window (the default) the system must refocus the source-code fiew to the step currently being executed. This is usually helpful but less so when some other function is being operated upon, then we want to remain focused on the target code.
The options here are to do with setting up the debugging environment.
The effect of this button is identical to the Run->Restart menu item but avoids having to drill down layers of menus.
These menu items ar used to launch a new run and stepping from breakpoints.
The dbg.jot script inserts breakpoints into the compiled code for the function under investigation. Breakpoints are a form of jot trace points (see the jot debugger) - essentially a trace point is created by inserting either a T or a %s=trace command into the code.
Ideally, one would set a breakpoint just ahead of a troublesome section of code then single-step through the code noting values on the stack and in relevant buffers and data objects to identify the problem. In reality it's not always quite as easy as that. One common difficulty is the breakpoint may be inside one or more loops and we are only interested in a specific pass. To do this we set a condition on the breakpoint.
The dbg script defines the following functions and associated menu items for breakpoints:
When stepping from a breakpoint it is frequently helpful to follow the state of various verious data objects and buffers as the code progresses. The dbg.jot monitor window is designed to faciitate that. Objects and buffers may be added to a list in the monitor buffer and the displayed values are updated at every breakpoint or at specified points.
The list of values and the distribution of monitor-update pints is controlled by the "Monitor" submenu:
One unfortunate aspect of jot langusge is the way command failures are handled - it sometimes happens that an unexpected failure burried deep an a stack of loops, function or macro calls can cause the entire ediface to mysteriously fail.
The command counter is an important element in the jot debugging toolbox (see using %s=commandcounter in debugging). Briefly, it is used in two ways:
Provided the failure is consistent and repeatable, we can use the command counter to trap execution at some point, hopefully, just before the failure occurs.
Displays control and unicode characters.
The -x option causes it to display all characters in Hex similarly the -o option causes it to display all characters in octal.
This script echos the current line along with a hex dump of any unicode or control characters. In order to display the original line as-is, the character decomposition is printed from top-to-bottom below each character.
For example:
$ jot ${JOT_RESOURCES}/UTF-8-demo.txt -in="m=16 %r=showline;"
This is a unicode sample file I picked up from the Cambridge University website - thanks. The selected line contains a mix of unicode and ASCII characters, this should display as follows, in the console area:
∮ E⋅da = Q, n → ∞, ∑ f(i) = ∏ g(i), ⎧⎡⎛┌─────┐⎞⎤⎫ 2 2 2 2 2 2 2222222222222 2 2 1 2 2 2 3335555555333 2 C 9 1 1 0 AA900000019AA E 5 2 E 1 F 71BC000000E4B
Note that anything displayed like this, in the console area, is highly ephemeral and will disappear next time you do anything - even just hitting {Return}. But not to worry - the report is still available in the ( @ ) buffer.
$ jot -st=qr
or for users of nomod.jot (an alternative startup for CTS/RSI sufferers):
$ jot -st="qr -nomod"
qr.jot reads the main jot user documentation in their raw ( .txt ) form to provide a useful quick-reference entry point to the words, using the linkdocs.jot script insert the link metadata. Valid links are highlighted in green.
A left-button click on a link will follow the link. A left-button click in any other part of the window will return to the previous view.
If you are in a non-mouse environment, macro_1 is set up to emulate mouse clicks - move the cursor to a link and {Esc 1} emulates a mouse click.
The -nomod qualifier changes toe {Ctrl|Shift|Alt+Fn} modified keystrokes in the documentation, to the prefix form defined by nomod.jot.
$ cd <projectDir>; jot <projectName>
e.g:
$ cd work ; jot ide_hello
or
$ cd work ; jot ide_jot
This is a very simple Integrated code Development Environment (IDE). It is set up to work in linux and wine with any command-driven compilers and gdb-like debuggers - typically gcc, cl, gdb and winedbg.
There is an internal switch to focus on either linux or windows versions of the executables.
Your projects directory should have it's own startup file which loads files and assigns buffers to the source files. (for examples, see ${JOT_RESOURCES}/ide/projects/startup.jot ). This local startup will normally call the main jot startup file at ${JOT_HOME/coms/startup.jot to give you all the usual jot functions.
On startup ide.jot splits the screen into the following fields:
The menu line offers the following items: _ - File - launches a submenu - see below.
The submenu (from the "File", above) replaces the initial menu, it offers the following:
The script operates by setting up a window on buffer ( L ) and associating it with an interactive command pipe (see %E), any suitable compilers can be used - typically gcc (linux) and cl (windows). The script runs windows programmes with wine and the winedbg debugger and gdb for linux.
The script defines the following data objects and default values as follows, these may be redefined in your startup script - for examples see ${JOT_RESOURCES}/ide/projects/startup.jot:
A typical session might begin with a bit of editing of the source in the main window, then either hit the "Save" button or manually type in the usual file-write command (%O) to save the source-file image, then press the "Compile" button to run your specified compile command. The script will refuse the compile request if the source has not yet been saved.
One might then hit "Run", which will run your compiled programme either in your default shell (linux) or in wine, if you have selected windows.
If you have bugs to diagnose, you might then invoke the debugger - gdb or, if you have selected windows, winedbg.
The selection of Linux (the default state) or windows is set by the "Linuxland" or "Windowsland" buttons below the "File" menu item.
For examples see working with ide.jot.
fake_nano.jot, fake_vim.jot and fake_emacs.jot are attempts at emulating the behaviour of these editors in jot.
A good question, at this point, would be "why bother with a nano/vim/emacs emulator when there are perfectly good versions available for free anyway?" Well, it would be true to say it's a good demonstration of the power and flexibility of jot that it can do reasonable emulations of two entirely different editors without resorting to magic modes or special tricks.
For occasional vim users or less experienced users wanting to progress, fake_vim.jot may, at some future point in it's development, offer a progression route for those daunted by the labyrinthine complexity of the emacs and, to a lesser extent, of vim and the immensity of it's user documentation (the vim quick-reference guide quickref.txt runs to over 1500 lines)
The end point for this project is defined by a vim quick-reference guide I found at http://users.ece.utexas.edu/~adnan/vimqrc.html. It's clearly not a complete guide to all the features but it looks like a good solid introduction.
$ jot -st="fake_nano <pathName/option1>[ <pathName/option2>[ ...]]"
or
$ jot -in="%r=fake_nano <path/opt1>[ <path/opt2>[ ...]];"
The fake-nano.jot script respects a few of the genuine nano command-line options, these must be added as qualifiers to the fake_nano script not as jot options.
If it is required to run some -init="..." commands these may also be added in the usual way (see -init) but note that these do not get executed until exiting nano mode. This is because fake_nano has it's own command scanner. This is not a big restriction as two {Alt+i} commands in quick succession will run your initialization and then return you to nano mode.
The startup options it currently accepts are:
The fake_nano.jot script also respects many of the most important nano hotkeys - one big problem is that each new version of nano seems to have an entirely different set of hotkey actions. In the end fake_nano approximates to nano v2.5.3
One significant difference is that fake_nano uses the jot console area to display messages - but jot, jot insists that the console must always follow the display windows. Thus it is that fake_nano messages appear in a one-line console at the bottom of the screen whereas, with genuine nano, these appear immediately above the help menu.
The help screen ( {F1} ) is copied from the v2.5.3 man page and the v2.5.3 help screen but with a hashmark prefix on line describing features not respected by fake_nano. At the very end of the help screen is a little report giving the current fake_nano setup.
Important deficiencies:
Initialization commands may be entered after the
$ jot -st="fake_vim <pathName1>[ <pathName2>[ ...]][ -<option1>[ -<option2>[...]]"
Valid options:
$ jot -st="fake_vim ... -c=<cmd1>[ +<cmd2>[ +<cmd3>[ +...]]];"
executes the specified vim commands before starting the interactive session. Commands using control characters should be escaped by prefixing with carat ( ^ ) - eg for an escape use "^[". There is no limit to the number of commands that may be passed in using -in and + they are executed in left-to-right order.
The remainder of this section is devoted to differences between the behaviour of fake_vim and that of standard vim, as defined by this guide. Different versions of vim have slightly different behaviours. for my analysis of vim behaviour I used two builds of the same version:
Also look at the ( ? ) buffer after starting fake_vim - this contains a complete list of vim actions supported by your version of the fake_vim script.
Why does jot rename something when there's already a perfectly good name that everyone knows and understands? Well, in jotspeak tags are little bits of metadata that can be sprinkled over an, otherwise, plain-text file image (for details take a look at About Tagged Text). Most native english speakers could probably guess what an index file might be used for. They would also probably be able to guess what a tag might be.
The native jot end-of-line behaviour is to allow the cursor to go just one character past the end of line displaying a tilde ( ~ ) after the actual end of the line. This native jot end-of-line behaviour is adopted in fake_vim.
$ jot <filePathName> -st=fake_emacs
The fake_emacs script is designed to replace the normal startup script - in fact it calls the normal startup script (see startup.jot) so most of the normal jot functionality is also available.
The end point for this project is a good implementation of the functions described in the mg man page (mg is a minimal-functionality emacs). Unfortunately, as it stands, fake_emacs.jot is not anywhere near that endpoint.
There are some features of emacs features which will probably never be fully implemented in jot because they're either too hard, impossible or because jot already has a better approach:
$ jot <pathName> -st=fake_emacs
or
$ jot <pathName> -st="fake_emacs -option1>[ -<option2>[ ...]]"
The fake_emacs script recognizes the following options:
The following have been tested and seem to work pretty-much as for the genuine article:
emacs_GotoChrForwards; {Ctrl+F} emacs_DownInColumn; {Ctrl+N} emacs_UpInColumn; {Ctrl+P} emacs_GotoChrBack; {Ctrl+B} emacs_ReadFile; {Ctrl+X Ctrl+F} emacs_GotoSentanceEnd; {Esc e} emacs_GotoSentanceStart; {Esc a} emacs_GotoParaStart; {Esc {} emacs_GotoParaEnd; {Esc} emacs_EnterJotMode; {Esc i} emacs_EraseCharacter; {Backspace} emacs_PageDown; {PageDown} emacs_PageUp; {PageUp} emacs_Exit; {Ctrl+X Ctrl+C} emacs_SaveFileImage; {Ctrl+X Ctrl+S} emacs_SaveAllFiles; {Ctrl+X S} emacs_InsertFileImage; {Ctrl+X i} emacs_ReplaceFileImage; {Ctrl+X Ctrl+V} emacs_WriteToPathName; {Ctrl+X Ctrl+W} emacs_ToggleReadOnly; {Ctrl+X Ctrl+Q} emacs_Help; {Ctrl+H Ctrl+H} emacs_HelpTutorial; {Ctrl+H t} emacs_HelpClose; {Ctrl+X 1} emacs_HelpScroll; {Esc Ctrl+V} emacs_HelpApropos; {Ctrl+H a} emacs_HelpDescribeKey; {Ctrl+H k} emacs_HelpFunction; {Ctrl+H f} emacs_HelpMode; {Ctrl+H m} emacs_RecoverSession; {Esc x} emacs_Undo; {Ctrl+X u} emacs_RestoreOriginal; {Esc x} emacs_IncrementalSearchNext; {Ctrl+S} emacs_IncrementalSearchPrev; {Ctrl+R} emacs_SearchRexNext; {Esc Ctrl+S} emacs_SearchRexPrev; {Esc Ctrl+R} emacs_SearchHistoryPrev; {Esc p} emacs_SearchHistoryNext; {Esc n} emacs_SearchExit; {Ctrl+M} emacs_GotoWordBack; {Esc b} emacs_GotoWordForwards; {Esc f} emacs_GotoLineStart; {Ctrl+A} emacs_GotoLineEnd; {Ctrl+E} emacs_GotoPageStart; {Ctrl+X [} emacs_GotoPageEnd; {Ctrl+X ]} emacs_GotoSexpStart; {Esc Ctrl+B} emacs_GotoSexpEnd; {Esc Ctrl+F} emacs_GotoFunctionStart; {Esc Ctrl+A} emacs_GotoFunctionEnd; {Esc Ctrl+E} emacs_GotoBufferStart; {Esc <} emacs_GotoBufferEnd; {Esc >} emacs_GotoPagePrev; {Esc v} emacs_GotoPageNext; {Ctrl+V} emacs_ViewScrollLeft; {Ctrl+X <} emacs_ViewScrollRight; {Ctrl+X >} emacs_ViewCentTopBot; {Ctrl+L} emacs_GotoLineNo; {Esc g g} emacs_GotoChrNo; {Esc g c} emacs_GotoFirstNonBlank; {Esc m} emacs_DeleteChrPr; {Ctrl+?} emacs_DeleteChrNx; {Ctrl+D} emacs_DeleteWordNx; {Esc d} emacs_DeleteWordPr; {Esc Delete} emacs_DeleteToLineStart; {Esc 0Ctrl+K} emacs_DeleteToLineEnd; {Ctrl+K} emacs_DeleteToSentanceEnd; {Ctrl+X Ctrl+?} emacs_DeleteToSentanceStart; {Esc k} emacs_DeleteSexpBackwards; {Esc - Esc Ctrl+K} emacs_DeleteSexpForwards; {Esc Ctrl+K} emacs_RegionKill; {Ctrl+W} emacs_RegionCopy; {Esc w} emacs_KillToChar; {Esc z} emacs_YankLastKilled; {Ctrl+Y} emacs_YankReplaceKill; {Esc y} emacs_MarkHere; {Ctrl+Space} emacs_SwapMark; {Ctrl+X Ctrl+X} emacs_RegionMarkNWords; {Esc @} emacs_MarkParagraph; {Esc h} emacs_MarkPage; {Ctrl+X Ctrl+P} emacs_MarkSexp; {Esc Ctrl+@} emacs_MarkFunction; {Esc Ctrl+H} emacs_MarkBuffer; {Ctrl+X h} emacs_ReplaceText; {Esc %} emacs_RegxReplace; {Esc x} emacs_RecursiveEdit; {Esc r} emacs_WindowDeleteallButCurrent; {Ctrl+X 1} emacs_WindowHorizSplit; {Ctrl+X 2{Ctrl+X 52} emacs_WindowDeleteCurrent; {Ctrl+X 0{Ctrl+X 50} emacs_WindowVertSplit; {Ctrl+X 3} emacs_ScrollOtherWindow; {Esc Ctrl+V} emacs_WindowSwapFocus; {Ctrl+X o} emacs_FrameSwapFocus; {Ctrl+X 5o} emacs_WindowSwap; {Ctrl+X 4b} emacs_FrameSwapFocus; {Ctrl+X 5b} emacs_WindowDisplayBuffer; {Ctrl+X 4Ctrl+O} emacs_FrameDisplayBuffer; {Ctrl+O Ctrl+X 5 Ctrl+O} emacs_WindowFile; {Ctrl+X 4f} emacs_FrameFile; {Ctrl+X 5f} emacs_WindowROFile; {Ctrl+X 4r} emacs_FrameROFile; {Ctrl+X 5r} emacs_WindowDired; {Ctrl+X 4d} emacs_FrameDired; {Ctrl+X 5d} emacs_WindowGotoTag; {Ctrl+X 4.} emacs_FrameGotoTag; {Ctrl+X 5.} emacs_WindowTaller; {Ctrl+X Ctrl+} emacs_WindowSlimmer; {Ctrl+X {} emacs_WindowFatter; {Ctrl+X} emacs_IndentRegion; {Esc Ctrl+\} emacs_IndentSexp; {Esc Ctrl+Q} emacs_IndentRegionTab; {Ctrl+X TAB} emacs_IndentForComment; {Esc ;} emacs_Break; {Ctrl+O} emacs_BreakShift; {Esc Ctrl+O} emacs_DeleteSurroundingBlankLines; {Ctrl+X Ctrl+O} emacs_JoinPrev; {Esc Ctrl+} emacs_DeleteSurroundingBlanks; {Esc \} emacs_InsertBlank; {Esc SPC} emacs_ParagraphFill; {Esc q} emacs_FillColumn; {Ctrl+X f} emacs_PrefixSet; {Ctrl+X .} emacs_FaceSet; {Esc o} emacs_UppercaseWord; {Esc u} emacs_LowercaseWord; {Esc l} emacs_CapitalizeWord; {Esc c} emacs_uppercaseRegion; {Ctrl+X Ctrl+U} emacs_LowercaseRegion; {Ctrl+X Ctrl+L} emacs_CompleteAndExecute; {Ctrl+M} emacs_CompleteSuggestions; {?} emacs_PreviousInput; {Esc p} emacs_LaterInput; {Esc n} emacs_HistorySearchBack; {Esc r} emacs_HistorySearchForwards; {Esc s} emacs_HistoryRepeat; {Ctrl+X Esc Esc} emacs_BufferSelect; {Ctrl+X b} emacs_BufferList; {Ctrl+X Ctrl+B} emacs_BufferKill; {Ctrl+X k} emacs_TransposeCharacters; {Ctrl+T} emacs_TransposeWords; {Esc t} emacs_TransposeLines; {Ctrl+X Ctrl+T} emacs_TransposeSexps; {Esc Ctrl+T} emacs_SpellWord; {Esc $} emacs_SpellRegion; {Esc x} emacs_SpellBuffer; {Esc x} emacs_SpellOnOff; {Esc x} emacs_IndexFindDef; {Esc .} emacs_IndexFindNx; {Esc .} emacs_IndexFindPr; {Ctrl+U Esc .} emacs_IndexNewFile; {Esc x} emacs_IndexSearchAllFiles; {Esc x} emacs_IndexQueryReplace; {Esc x} emacs_IndexContinueSearch; {Esc ,} emacs_ShellCommand; {Esc !} emacs_ShellCommandNowait; {Esc &} emacs_ShellCommandRegion; {Esc |} emacs_ShellCommandFilterRegion; {Ctrl+U Esc |} emacs_ShellStartInWindow; {Esc x} emacs_RectCopy; {Ctrl+X r r} emacs_RectKill; {Ctrl+X r k} emacs_RectYank; {Ctrl+X r y} emacs_RectOpen; {Ctrl+X r o} emacs_RectBlank; {Ctrl+X r c} emacs_PrefixLines; {Ctrl+X r t} emacs_AbbrAddGlobal; {Ctrl+X a g} emacs_AbbrAddLocal; {Ctrl+X a l} emacs_AbbrAddGlobalExp; {Ctrl+X a i g} emacs_AbbrAddLocalExp; {Ctrl+X a i l} emacs_AbbrExpand; {Ctrl+X a e} emacs_AbbrExpandPrev; {Esc /} emacs_PosArg; {Ctrl+U} emacs_NegArg; {Esc -} emacs_String; {Ctrl+Q} emacs_LanguageSet; {Ctrl+X Ctrl+M l} emacs_LanguageListInput; {Esc x} emacs_LanguageInputToggle; {Ctrl+\} emacs_LanguageSetCoding; {Ctrl+X Ctrl+M c} emacs_LanguageListCoding; {Esc x} emacs_LanguagePrefer; {Esc x} emacs_InfoStart; {Ctrl+H i} emacs_InfoFind; {Ctrl+H S} emacs_InfoScrollRev; {Delete} emacs_RegSaveRegion; {Ctrl+X r s} emacs_RegInsertHere; {Ctrl+X r i} emacs_RegSaveValue; {Ctrl+X r S P C} emacs_RegJump; {Ctrl+X r j} emacs_KbdDefineStart; {Ctrl+X (} emacs_KbdDefineEnd; {Ctrl+X )} emacs_KbdExLast; {Ctrl+X e} emacs_KbdAppend; {Ctrl+U Ctrl+X (} emacs_KbdName; {Esc x} emacs_KbdLisp; {Esc x} emacs_EvalSesp; {Ctrl+X Ctrl+E} emacs_EvalCurrent; {Esc Ctrl+X} emacs_EvalRegion; {Esc x} emacs_EvalRead; {Esc :} emacs_LoadLibLisp; {Esc x} emacs_Customize; {Esc x} emacs_InteractiveSpec; {Ctrl+H f} emacs_Interactive; {Ctrl+M} emacs_CompleteWord; {SPC} emacs_CompleteAll; {TAB}
If an initial path is given then the contents of the specified directory is displayed as the parent pathname followed by a list of it's children in the ( + ) buffer. The ( + ) buffer is effectively a menu - navigate up and down with the Up/DownArrow buttons and hit {F1} to descend to an item. Four types of item are recognized and the behaviour for each is as follows:
This get.jot script defines the function getDiag, this displays the state of important internal buffers and data objects etc. It is accessed via the escape sequence {Esc d i a g}.
The get.jot script modifies the behaviour of the Help function. Whereas {F1} normally enters the help pages unconditionally, the script causes it to first check the current buffer. If it's in buffer ( + ) then it descends to the selected file.
For each directory/archive entry in the menu buffer ( + ) the path is prefixed with a key followed by an ascii tab (ascii tabs are displayed as tildes ( ~ ) in jot). This is used to determine the correct approach for opening the object. The following keys are currently used:
If the original path contains wildcards then the filing system is searched for matching subpaths, the following wildcards are recognized:
On completion of a search entries are appended to the menu buffer - one for each matching path.
If the ( 3 ) macro is used and -toall= was given then all files listed in the menu buffer ( + ) are loaded in the specified buffer. If -toall was not given then macro-1 exits with an error message.
e.g.
> get ${JOT_RESOURCES}*.t{F2}The get script picks up a directory path and lists files in the directory in a simple menu-style buffer. The intrepid explorer of filing systems may then browse through this buffer using the cursor-control or find keys to select either a file or directory. The target is selected by running the 0 macro (bound to the numeric-keypad 0 button). e.g:
> '0{Return}or
> {KP_0}If the target file turns out to be some sort of archive (.tar, .tz, .zip and .cab are currently supported), then the file contents are listed and you are invited to select one of the member files. The selected file is then unpacked and it's image turns up in the nominated buffer.
If the target file is an MS-word document (.doc or .docx), a Portable document format document (.pdf) or Excel an appropriate conversion utility is deployed to translate it to plain text.
On completion of a search pass, the ( + ) buffer shows a directory listing shows one item to each line of the buffer, with the directory path at the head of the list, subdirectory names are suffixed with an oblique ( / ). The list contents of each directory is headed by the directory path, normally headed by the word "dir "followed by an ASCII tab this will be displayed as a tilde ( ~ ) in the window.
If no pathname is given, the current buffer is checked - if the cursor points to a string that matches a valid pathName relative to the current file then that is used. If not, then the env GetDefaultPath is used as a path prefix.
When a file is selected, the get script identifies the file type from the name extension:
If your selection is a directory (including the .. directory to descend the directory tree) then the new directory redefines the menu. If the target is a file and you did not specify a destination buffer on the command line, you will be prompted for a destination buffer and the file will be loaded into that buffer.
To force get to pick up the current file-image path, even when the text under the cursor could be interpreted as a pathName, then enter some wildcard as the path - e.g:
get *{F2}
The get script will open some classes of non-text documents and archive files using a helper app where necessary, this requires the installation of the helper:
Here is a full list of the various helper co-processors you may need
This sets up macros 4 and 5 to compare the contents of two buffers. The current buffer and a nominated reference buffer. If no comparison buffer is nominated, then the buffer is assumed to be a file image and is compared to the version spinning on disc.
It also sets up macro 6, initially this repeats the last given command in the other buffer,subsequent invocations of macro-6 repeat the same command in both buffers.
If the <key> arg value is given, this is the identity of the Reference buffer. If the reference buffer is not given, then the buffer is assumed to be a file image and the current filing-system version of the file is read into the ! buffer and that is compared to the current buffer.
If the -backup value is given, then the most recent backup version is read to the ! buffer - see backup.jot. The path for the backup directory is assumed to be <originalFilePath>/backup - if no backupVersion string is specified it takes the most recent backup version. If a backupVersion string is specified then the extracted version name will match this string. In the even of more than one backup versions matching the given string, an error message is issued.
By default, comp.jot will redefine the windows to give you a split-screen view of the two buffers. The left pane is floating and will show the current buffer, the right pane is fixed to the nominated reference buffer. To run comp.jot with your current window configuration - use the optional the -nosplit option.
The -horizontal qualifier causes the screen to be split into two equal-sized horizontal windows.
It also redefines macros 4, 5 and 6 (bound to numeric-keypad buttons 4, 5 and 6).
When the comparison reaches the end of a buffer all colour tags are removed from that buffer. This behaviour gives an easy way to remove the colour tags from the buffers:
> m0{KP_5}See also CompareBufs.
$ jot <fileName> -st=recover[ -norun]
Journal files are collected when the editor is started with the -journal qualifier see About not losing your work. These can be used to retrace every step in an editor session in the event of an abnormal exit. The journal files are held in a subdirectory alongside the primary file named <filename>.jnl (where fileName is the primary file). It holds snapshots of all files and system queries read by the session and a history.txt file containing a log of your keyboard and mouse activity. All these files are deleted when the editor restarts normally. The journal directory also holds a lockfile, imaginatively named LOCK, this is normally deleted as the session exits - unless the session terminates abnormally. The LOCK file has the effect of preventing a new session starting and destroying the journal files.
The recover.jot script works by translating the history.txt file into a command script (named recover_now.jot) that will retrace your interactive session with snapshot copies of your input files and then winding it's way through all of your interactive commands and keystrokes.
The identities of saved-copies of files is preserved but they are uniquified by suffixing them with the file modification-time datestamp. An extended session may read, modify and write a file and then read it in again later. It therefor keeps a separate snapshot of every read of the same file. If, on inspection, it finds the file's modification time is unchanged on the second or subsequent re-reads, the file is not copied again.
The history.txt file, in addition to all your interactive activity, contains the uniquified pathnames for the various snapshot files. As they are read, the editor checks that the files are read in the same order as in the original session. It does this by verifying the new pathname against the original, which is also held in the history file.
For the duration of the recovery run all file writes are disabled - when the recover_now script script terminates the session should continue normally, Appending any new commands to the original history.txt file and adding new snapshot files.
On completion of a successful recovery, the original journal files are left untouched, you must delete them before launching a new editing session.
The recovery process starts with a special initialisation script recover.jot which reads the history.txt file and creates a runnable recovery script in your pwd, named recover_now.jot it then runs this recovery script. Here is the full process, from the start of the crashing session:
$ jot <fileName> -journal
$ jot <fileName> -st=recover
This creates a customized recovery script recover_now.jot which runs through all the keystrokes and commands in the original session. this file is run - if all goes well you will end up exactly where you were. On completion of the recovery, any new commands or keystrokes are appended to the journal repository. In theory, you can keep on crashing and recovering the sessions.
In some instances you will want to edit the recovery file before running it. In this case use the -norun to exit before running the recover_now script - e.g. when winding back activity as a substitute for an undo function.
$ jot <fileName> -st="recover -norun"
The recommended method of analysing and editing these scripts is with the is to edit with the annotate_recovery_file.jot script.
Now, if the recovery session crashes in the same way at the same point, congratulations, you have probably discovered a genuine jot bug!! Please report your bug - a tarball of the journal directory would be most helpful to the investigation into what went wrong. To recover from such a situation, edit the recover_now.jot recovery script, removing the last command then restart using the modified script:
(rl)0 $ jot <fileName> -startup -init="%r= -asConsole ./recover_now.jot"
There are several things that might go wrong with this approach to session recovery:
The operation of the jot debugger is also different in recovery mode, if the original session invoked the debugger then the recovery session will emulate the debugger interaction from the original session. This could be a problem if it is required to single-step the recovery process.
In order to single step through the recovery process, set the Trace_Recovery bit (0x100) of the trace mask - see %S=trace e.g:
> %s=trace 0F901;to set an immediate breakpoint or
> %s=tracedefault 0F901;to enable the next t or %s=commandcounter command. Otherwise these will be treated as though they were from the original session.
When this condition is detected the recovery will normally stop abruptly with a message of the form:
At line <n> of recovery script "recover_now.jot": recovery file-name (<pathName1>) does not match original (<pathName2>)
It does not offer any "continue-anyway" option but, if you believe you understand what caused the pathnames discrepancy and you want to continue, it is still possible to wriggle out of it.
You should edit the recover_now script, first find a line of the form:
%%Recovery pathname: <n1> <journalPathName> <n2> <originalPathName>
Where:
To ignore the discrepancy, set n2 (the length of the original pathname) to zero then re-spin:
$ jot <pathName> -startup -in="%r= -asConsole ./recover_now.jot;"
Note: the history file in the journal area is entirely separate from the history maintained for the %Q query history and is not affected by the the CLI -history setting.
Every now and then even the most sure-fingered of us makes a mistake that means losing a lot of work. While many editors have an undo feature that allows us to restore the state of a file image and thus wriggle out of bad situation, jot has no such feature, which might be considered to be a bad omission. Here is the jot approach to the problem.
$ jot <yourFile> -jou
this creates the directory <yourFile>.jnl which contains a history.txt this is a record of how the session started and all of the keyboard and mouse activity. It also maintains snapshots of any files read by the session.
$ jot <yourFile> -st="recover -norun;"
$ jot recover_now.jot -in="%r=annotate_recovery_file;"
$ jot <yourFile> -startup -in="%r= -asconsole recover_now.jot;"
$ jot recover_now.jot -in=%r=annotate_recovery_file;
This script has two main uses;
The script reads the recover_now.jot script (this is generated by recover.jot, see also about not losing your work) and displays it in a vertically-split window with the recovery file in the righthand slice and the linenumbers and annotation in the left. Note that the recovery script contains escape sequences and this script is intended to simplify the manipulation of these scripts by showing the functions attached to the key codes in the recover_now script.
$ jot <fileName> -st=recover -norun
It is recommended that the recovery script be run with the -norun option - this exits immediately after creating the recover_now script.
You should now be the proud owner of a recover_now.jot script. Run this now (as described in recover.jot) and you should be in the same position as you were when the original session stopped.
However, since you are editing the recover_now script you are having problems with the recovery or, maybe you just want to let it run until some mistake was made in the editing - jot does not have an undo function. Now the recovery script contains the escape sequences picked up by the original session and, just looking at these, it is not always easy to see what's going on.
A simple editor session will involve only one file and will not involve any interactions with other files or the system.
More complex sessions can be problematic ... essentially the difficulty is that we tend to browse around text buffers and menus using cursor-control keys rather than searching. If a menu (say a list of files generated by get.jot) has a different number of entries because files have been added or removed from that pat of the filing system, then the recovery session might end up picking the wrong item.
In most cases, problems can be wriggled around by editing the recover_now.jot script and restarting as described above.
$ jot <fileName> -startup -init="%r= -asConsole ./recover_now.jot"
The query dir is most likely to cause trouble - the directory contents might change between the original session and the recovery session. Then scrolling down a fixed number of filename may lead to the wrong file. If the selected file is then read with the %i command, then it will always pick up the correct file from the journal area because the correct file name is picked up from the history.txt file.
These lines are passed to the recover_now.jot file unchanged.
%iq=x.lis %%Recovery pathname: 32 l99.t.jnl//x.lis_20220417_114221, Original pathname: 5 x.lis
The second line tells the recovery session which journal file to pick up. In the above case it's reading x.lis_20220417_114221 from the journal area in place of the original file ( x.lis ). The 32 and 5 indicate the lengths of the pathnames, the "20220417_114221" element is a datestamp. It keeps multiple copies of secondary files because these might have been changed in the original session and, possibly, re-read in a modified form.
%eq=ls wine; %%Recovery pathname: 41 x.lis.jnl//[ From CLI command ls wine ]_0, Original pathname: 28 [ From CLI command ls wine ]
Here, the result of the %E has been saved in the specified journal file. Note that any query requesting the current time or a file's datestamp will be given the original time in the recovery session.
%%Recovery open-ended report ends
(r, m, m-0)0<<INT 27745818 0>>
The command string is clearly going nowhere so it was interrupted with a {Ctrl+c} The first number in the INT parameter list is the command counter at the point of interrupt. The zero indicates that there are no other history-file lines separating the <<INT line from the original command line. The corresponding entry in the recover_now file:
%s=commandcounter 27745818; (r, m, m-0)0
It sets it up to stop at exactly the right place.
%qz=file .; z. (r, m, m-0)0 %%Recovery record: Name = "." %%Recovery record: inode = 410 %%Recovery record: Mode = 40755 %%Recovery record: uid = 1000 %%Recovery record: gid = 1000 %%Recovery record: size = 2920 %%Recovery record: writable by this UID = yes %%Recovery record: directory = 1 %%Recovery record: link = 0 %%Recovery record: Access time = 2022/04/17, 13:04:03 (1650197043) %%Recovery record: Modify time = 2022/04/17, 13:16:42 (1650197802) %%Recovery record: Creation time = 2022/04/17, 13:16:42 (1650197802)<<INT 32317555 12>>
The history file entries must go in the order the commands are received but the interrupt is only received after these entries have been made. The recover_now file looks something like this:
%s=commandcounter 32317555; %qz=file .; z. (r, m, m-0)0 %%Recovery record: Name = "." %%Recovery record: inode = 410
...
There is a special problem that arises when debugging the operation of the recovery commands - by default the debugger will take commands from the recovery script not the keyboard. The Trace_Recovery bit of the %s=trace vector tells the debugger to accept commands from the keyboard. So to debug the recovery script, instead of inserting a simple T command insert %s=trace F901;
This picks up a compiler report and defines macros 3 and 4 which allow you to step between error or warning reports in the C source.
For this to work you must have the C source file in the current buffer and the compiler report must be in the same directory and with the same filename as the source but with the .lis name extension.
The script uses line numbers picked up from the compiler report even if the actual line numbers have shifted because of changes already made to the source file. The report linenumber is adjusted linenumbers to compensate for lines added or removed before the current line. This only works if your compiler reports problems in line-number order.
The current version of cerr.jot will work with the output from either gcc or microsoft cl compilers.
This simply performs the shell commands and it's arguments, the result is read back into the @ buffer.
Transforms the output of a unix ls -laRF listing to a list of paths for multi_do.jot, multi_ed.jot etc.
This script assumes that the current buffer is a list of pathnames. It takes a CLI command as it's argument this is applied to all files in the list and the results are captured in the @ buffer. See also ls2list.jot.
Examples:
$ ls $JOT_RESOURCES/*.txt | jot_dev -in="%r=multi_do cat \$1 | sed s/ and / AND / -quick" $ ls $JOT_RESOURCES/*.txt | jot_dev -in="%r=multi_do cat \$1 | sed s/ and / AND /"
The multi_pair.jot script applies pairs of arguments (typically pathnames) to a unix command requiring two arguments - e.g cp, ln, mv, diff etc.
This requires the current buffer to contain a two-column tab separated table, each entry being a pathname. The Unix command is applied to each pair of pathnames in turn. This is only useful for unix commands which apply to two pathnames.
Typically, you start off with a list of pathnames (derived, perhaps, using 'ls2list.jot') then copy, filter and modify each path to obtain the secondary pathname.
It works by creating a temporary command file containing the expanded command string for each pair of operands. The generated script is written for bourne shell and, consequently, multi_pair will not work in windows environments.
This example demonstrates multi_pair used with ls2list.jot to compare the contents of two directory subtrees.
$ mkdir test; cd test
Copy the resources tree to the test directory
$ cp -R $JOT_RESOURCES/* .
Compare all files with their originals - here, each pathname has been copied and modified by prefixing it with '\t$JOT_RESOURCES/':
$ ls -aRF | jot -in="%r=ls2list; (rr-n.r0aa&i:\t$JOT_RESOURCES/:ham)0 %r=multi_pair diff"
Now change a local file and one deeper down the tree.
$ jot l99.t -in=f/__50/s/zzz/ %c $ chmod u+w test_get/another_dir1/t.t; jot test_get/another_dir1/t.t -in=f/jon/s/zzz/ %c
This time diff should find two changes:
$ ls -aRF | jot -in="%r=ls2list; (rr-n.r0aa&i:\t$JOT_RESOURCES/:ham)0 %r=multi_pair diff"
This script requires that that the current buffer is a list of valid pathNames. It prompts you for a series of jot commands, when you've finished entering the jot commands, the complete set of jot commands is applied to every file in the list.
This script picks up your specified commands and constructs a command macro to execute these commands for all of the files in the list (in the @ buffer, by default). This macro reads each of the files in turn to a working buffer (!, by default) where the commands are run.
If no -commands list is given, it prompts you to give it some, theses commands may extend over several lines, the list of commands is terminated with a line containing only a colon ':'.
Note - many command scripts us either or both of the default working buffers used by this script, to wriggle around this problem, the -use <key> <key> qualifier allows you to nominate an alternative pair of buffers. Typically you should chose a pair of buffers in the range A to Z, since jot scripts normally avoid these.
Also use the -command qualifier to specify commands from the command line.
Note that multi_ed does not write out anything so, if you want to write the modified files, the last command must be %o.
e.g If this these are the commands we want to run:
> f/chapter/l0i/1 /{Return} > doc2fold{F2} > %o{Return}We want to apply the same process to a list of pathnames, in this example they are generated by ls, processed by ls2list and filtered to extract just .doc files:
> %ep=ls -laRF{Return} > ls2list{F2} > m-0 (r0v-/.doc/m,k)0{Return} > multi_ed -use q w -command f/chapter/l0i/1 / %r=doc2fold; %o;{F2}or something like this, starting from a unix prompt:
$ ls *.doc | jot
then, in jot:
> multi_ed -use q w -command f/chapter/l0i/1 / %r=doc2fold; %o;{F2}Synchronizes a memory stick and the main filing system by copying recent versions of files.
$ jot -st=sync
or
$ jot -st="sync[ -check|tostick|fromstick][ -bydate][ -newstick][ -newfs][ -localpath <path>][ -debug][ -setstick][ -newfs]"
By default, sync.jot synchronizes selected directories in the local the local filing system with a memory stick.
-localpath <localPath> - Specifies local path for cases where this cannot be determined automatically (e.g. when running under wine). -debug -- for debugging the sync script. -listdevs -- reports names of all storage devices currently mounted. -setstick -- sets the stick name - only when other devices are mounted. -check -- lists files that appear require updating copying any files. -tostick -- Archives selected files on a USB memory stick. -bytagfile -- copies only files modified since last sync operation. -fromstick -- Copies only from the stick to the local filesystem. -newstick -- creates the directory structure on the memory stick. -touchStick -- Identifies target files in the stick and touches them. -newfs -- creates the directory structure on the local file system.
By default sync.jot is driven by differences in file datestamps. A similar file tree exists both in the local and in the stick, when sync.jot detects an instance of a file with different datestamps then it copies the newer version to replace the older one.
So what can possibly go wrong ... er well, the datestamps on linux memory sticks are not very reliable. The datestamps are frequently frequently one second earlier than the corresponding datestamp in the main filing system. Also, following a change to daylight-saving time datestamps there could be a one-hour discrepancy in the datestamps. It deduces the time the local and stick trees were updated by placing special tag files (named syncTimeTagFile) in you're home area and in the tom directory of the memory stick.
The sync.jot script has the directory tree hard coded inside - to change this you need to change the coding.
There are some sync.jot features designed to avoid problems with memory-stick datestamps.
Other options:
Compiles a development version of the jot editor for linux (using gcc) or windows ( using cl).
$ jot -st="ced [-lin][ -win][ -notest][ -preproc][ -debug][ -dynamic][ -strip]
This compiles a jot executable. The linux compiler is gcc with gnu libraries. The windows compiler is cl (part of VC) with VC libraries.
Note that the following paths must be registered:
Searches the entire buffer for the given string, when found, the first instance of the string in any line is prefixed with a tab character. Also removes any whitespace adjacent the inserted tab. Note that jot displays tabs, along with other control characters are displayed as tildes ( ~ ).
This script is intended for use as a precursor to autotab.jot, autotabjust.jot, autotabdp.jot - see tabulated text.
This inserts tabs in the current-character column. This is used in conjunction with retab.jot, autotab.jot and autotabjust.jot.
This script is useful for preservation of one column of a partly-formatted table - see tabulated text. If you have several tab points to insert, it is important to start with the rightmost tab point and work leftwards.
Aligns tab points in a buffer.
This operates by searching the buffer for lines containing tabs, it locates the leftmost tab character on each line and finds the rightmost first tab. The position of the rightmost first tab defines the tab points for all the other first tabs.
It then replaces the first tab on any line with sufficient whitespace to align the text following the first tab on any line.
Lines which do not contain any tabs are ignored - see tabulated text.
Similar to autotab, but right-justifies so that, on any line containing tabs, the following tabs are aligned - see tabulated text.
Similar to autotab but inserts blanks so as to align decimal points in the column following the tab - see tabulated text.
Resolves all tabs to the specified tab spacing - defaults to 8.
-FOlder foldername - loads the specified mail folder from ~/Mail/<folderName> -Last <n> - loads only the last n mail messages -FINd <string> - loads only the messages containing the string. -New - Read no mail just create a new mail message. -File <fileName> - Read the specified file as a mail message.
jot -in="%r=mail -file=${JOT_RESOURCES}/mail"
{Esc+o} - Open selected message. {Esc+x} - eXtracts message to file
<list> {Esc+m} - send current buffer as mail using "To:" , "Cc:" and "Bcc:" lines
[<CClist>] {Esc+r} - reply to sender [and users on CC list], if list contains a '*'
the list will reply to all recipients of original message.
[<n>] {Esc+i} - include indented current [or nominated] message, in current buffer
{Esc+a} - autograph - add the autograph message to the current folder.
This script is not really seriously intended to be used as a general-purpose mailer. However with the mail handling agents correctly set up for a local POP mail file it can read and send mails. It may be useful to users of MUTT or similar POP-based mailers as a means of integrating with an editor session.
This script sets up a simple Mail User Agent (MUA) - a programme that reads from a POP file and constructs a mail index. POP (Post Office Protocol) is a simple text-based format. This POP file is generally created by your Mail Delivery Agent (MDA) working with your Mail Transfer Agent (MTA) which interacts with your mail provider.
Linux users should set up their MDA to deliver in POP3 form to /var/spool/mail/<yourUserName> a reasonably simple and robust setup involving fetchmail and procmail is described in http://www.andrews-corner.org/mutt.html You can test your setup using mutt - a useful text-based MUA.
The POP-file image and mail index are held in the * buffer, to return to the mail index, type in the z* command.
Mail adds the following control functions:
{Esc o} - Open - opens the message indicated at the current line
of the mail index.
{Esc x} - eXtracts message to file
<list> {Esc m} - send (Mail) current buffer using "To:" , "Cc:" and
"Bcc:" lines.
[<CClist>] {Esc r} - Reply to sender [and users on CC list], if list
contains a '*' the list will reply to all recipients of original message.
[<n>] {Esc i} - Include indented current [or nominated] message, in
current buffer
{Esc a} - Autograph - add the autograph message to the current
folder.
Redefines macros 1 and 2 (bound to numeric-keypad 1 and 2) to functions suitable for browsing C code. It is reasonably bulletproof but it will fail to set up the hashtables when it finds a mismatch in the curly-brace structure of your coding. Note that c.jot has no knowledge of what compile-time variables are set - it assumes #ifdefs are TRUE. Hence c.jot can fail to match braces even valid C when braces are inside #ifdef (etc.) blocks.
Once set up, macros 1 and 2 (numeric keypad buttons 1 and 2) will first create a block index for the current c function. With the index set up, the 2 macro will locate the next block-start character '{' in the c code or, if already at a block-start, will locate the corresponding block-end character '}'. Similarly, macro 1 will locate the move back in the c code to the nearest block-end character or, if already at a block-end, move to the corresponding block start character.
The optional -tag qualifier adds colour tags to comments.
It also sets the env variable GetDefaultPath to /usr/include - the effect of this is to tell the get.jot script to default to the specified path, with this set you can set the cursor to a library include file and it will find it.
The speedup due to the hashtables, although welcome, is not really the principal motivation for their use. Because C allows multi-line comments and text strings, it is difficult, perhaps impossible, to reliably parse C when plodding back through the code. The c script plods forwards once to get forward and back links for the hashtable.
Sets up macros 1, 2 and 3 (bound to numeric-keypad 1-3) to functions suitable for browsing jot command scripts. As with the c.jot script, it uses hash tables. Jot code is another one of those difficult ones where it's difficult to plod back through the code.
In interactive usage, unterminated strings are allowed - e.g. f/fred{Return}, jot also allows these in macros although this is not recommended. When one of these is left unterminated in a script it is generally a coding mistake, but it might lead to the jot command parser being unable to match parenthesis. Such errors are difficult to trace. Use {* KP_3} to locate unterminated strings in your scripts.
Note that jot.jot adds tags to the code, this will cause code called via the %H=call command to fail when it is next recompiled. See Calling functions by name.
Something like the following was used to to modify scripts when the old W command was abolished and replaced by %w=refresh;
> (v/w/s/%w=refresh;/ %o;, ){Esc 3}When the macro encounters a "W" command in the script being scanned, it is replaced by "%w=refresh;" The following command line was used to find all instances of "%W;" in every jot script and replace each them with %w= -refresh;
$ jot -in="%r=jot.jot; %eq=ls ${JOT_HOME}/coms/*.jot; ( %iw='q; %d$=(v/%w\\;/s/%w=refresh\\;/ %o\\;, ); '3 zqm)0"
Defines macros 1 and 2 (bound to numeric-keypad 1 & 2) assigning functions suitable for browsing perl code.
Normally, macro 1 should be started with the cursor over a block-end brace (a '}'} or ']' character) or over whitespace to the right of one. If started with the cursor at some other point, the macro locates a suitable start point and stops - you need to check the chosen start point and press the '1' key once more.
Similarly, macro 2 matches to the current open-brace character or the whitespace immediately before one, if the cursor is over some other character, it locates a suitable start point and stops to let you check before restarting.
This is one for users of Cadence design frameworks interface language (skill) - a lisp-like language.
Defines macros 1, 2, 3, 4 and 5 (bound to numeric-keypad 1-5) assigning functions useful for browsing skill code. The functions dedicated to skill keywords recognize the following skill keywords: if, when, unless, foreach, for, while, case, cond and procedure
Redefines macros 1, 2, 3, 4 and 5 to functions suitable for browsing C-shell scripts (these macros are normally bound to Numeric-keypad buttons 1, 2, 3, 4 and 5 respectively).
In the context of a C-shell script, a block is a series of commands controlled by some recognized C-shell built-in structure. The following structures are supported:
The following macros are defined:
Redefines macros 1 and 2 (bound to numeric-keypad 1 and 2) to functions suitable for browsing Bourne-shell scripts.
N.B.
Both functions work by counting block depth, there is no checking of block-start to block-end keyword-consistency, e.g. an 'if' block terminated by 'end' is matched without complaint.
Similar to sh.jot but supports some additional ksh keywords.
Sets up macros 1, 2 and 3 (bound to numeric-keypad 1-3) for browsing mif files.
<
P>
edif{F2}<
/P>
Sets up macros 1, 2 and 3 (bound to numeric-keypad 1-3) to functions suitable for browsing edif files.
Sets up editor for navigating verilog files.
No line breaks between the end of a netname and the ')' in an instance-terminal connection.
the '0 macro assumes a flat netlist - leads to problems when a signal name exists in more than one module.
Assumes the hierarchy delimiter to be "|".
0 - Command macro to find other instance terminals on a net. @ - Journal of net names visited. + - In '0 macro holds list of Instance-terminals visited by the net.
For Esc+n and Esc+i reports block names for instance names in the path.
$ - Temporary names,
Esc-d descends into the definition of the current module.
<netName>Esc-n - descends hierarchy and locates first instance terminal on the net.
<instName>Esc-i - descends hierarchy and locates the first instance-terminal in the instance.
0 - Makes list of instance terminals, then moves to selected inst term.
Select one of the inst-terms indicated in the menu ans press the 0 button again.
This sets up macros 1 to 5 (bound to numeric-keypad 1-5) to functions suitable for browsing VHDL files.
Notes and restrictions:
Sets up macros 1, 2 and 3 (bound to numeric-keypad 1-3) to functions suitable for browsing edif files.
This script is useful when debugging complicated modular jot scripts. It sets up some backtrace functions using the query backtrace report.
> {Esc b t}The backtrace query only gives the linenumbers as they are in the code-repository buffer ( * ). This report would be more useful if the line numbers referred to the linenumbers in the source file. It attempts to identify the source file using grep - searching for the last function name in the code repository buffer. It then calculates the correct line-number offset to get the lines in the source file and adjusts the linenumbers accordingly.
There are at least two ways in which this can fail to give an accurate result:
or
> trap_failure [ -init=<initializationSequence>]{F2}This script can be useful for debugging scripts, functions and commands. When something fails it's not always immediately obvious what went wrong. This script runs the command sequence (or macro or function) through to failure, notes the command counter and then re-launches the command with the command counter set to trigger a breakpoint at the point of failure - see the jot debugger and %s=commandcounter.
Note that, in order to get a repeatable command count, the initialization must be consistent. Many initialization command sequences can just be included in the command sequence but, where the initialization involves conditional commands this might not be the case and a separate initialization sequence must be specified using the optional -init=... modifier.
See setting command-counter breakpoints for examples of usage.
This searches all buffers for the string, results are presented in the form of a list of buffers where a string match was found. In each buffer where the string-match was found, the current line is set to the first matching line, for other buffers the current line ends up being the last line of the buffer.
This script searches for buffers containing images of files and data objects. It recursively trawls through all the ( A to Z ), ( . ) and ( ' ) primary buffers and any secondary buffers. It has two main uses:
The -demo qualifier causes the script to add a sample datastructure containing a variety of data-objects in a tree of some depth.
The -system qualifier causes it to trawl through all primary buffers except ( $ ) and ( @ ), in addition to buffers ( A to Z ), ( . ) and ( ' ).
The -changed qualifier suppresses reporting of any buffer except those which are valid images of files and have been modified since the last I/O operation.
Tells you the age of the file in the current buffer. Note that it takes no account of leap years - each year is assumed to be 365 days. Hence, for files older than one year, the day-count is less than totally accurate.
Inserts the current date at the current-character position in the text. If there is a substring, then the selected text is replaced by the current date.
If the -r qualifier is given, the date section is reversed and the separating slashes removed.
if the -t qualifier is given, then also inserts current time.
This script makes a backup copy in the <path>/backup subdirectory, where <path> is the path element of the file being backed up. It also maintains a README_backup file in the same area, this contains the comments.
Before doing anything the script checks for existence of <path>/backup if it does not exist, the script fails immediately with a suitable message.
The buffer is written to the backup area with it's normal name suffixed with '_<dateStamp>'
The script insists on being given either a comment or the -a modifier, this is included in the metadata in the README_backup file in the backup subdirectory. If -a (again) is given it inherits the datestamp and comment from the last entry in the same README_backup file.
Copies all of the current buffer into the X-windows PRIMARY selection buffer (see the xsel (1x) man page for details). This is useful for exporting an entire buffer to some x application.
N.B: This script requires the unix utility xsel to be on your search path and, it kind of goes without saying really, copy.jot does not work in windowsland.
If neither the destination buffer or -here is specified it prompts for the destination buffer.
If the destination buffer is specified then the contents of that buffer are replaced with the contents of the x-windows paste buffer.
The current contents of the X-windows PRIMARY selection buffer buffer is inserted into the nominated buffer (see the xsel (1x) manpage for details). If -here is specified then it is inserted at current character position of the current buffer.
N.B: This script requires the unix utility xsel to be on your search path and, it kind of goes without saying really, paste.jot does not work in windowsland.
Counts the number of words in the current buffer.
This script predates the ability to pipe the current buffer into a unix command - the unix wc command should do the job just as well:
> %e$=|wc;Goes to every buffer activated in your session and sets the write lock to unrestricted.
Unlocks and then deletes all buffers.
Frees all buffers then exits the editor without saving any files.
This translates a document to a folded help document suitable for use in the jot help system. The document sections and paragraphs must be structured according to the jot document form - see text document preparation and about help files.
This performs the reverse of the doc2fold.jot process, it is only useful when a help file requires major changes and the original source document is not available - see also about help files.
Translates the text in the current buffer into a framemaker mif file - sections and paragraph format - see text document preparation
[ -split [ -head <fooheadterImagePath>][ -foot <footerImagePath>][ -index]]{F2}
Translates the text in the current buffer into html.
Any text in backticks is assumed to be a hyperlink - several forms are supported:
For example, the following line (from the examples text), refers to functions defined at startup and key bindings.
HREF references are checked - these must match a section heading either in the current document or in some other html in the same directory. If, after searching these, it still cannot resolve the HREF then the HREF target is added to a list of unresolved HREFs and the script terminates without writing any html.
If the document contains more than one section with the same section-name string, then this is listed and the script terminates without writing any html.
Extracts text from a PDF document, extracted text is appended to the current buffer.
Extracts text from an MS-word document, extracted text is appended to the current buffer.
Transforms an jot doc-format document into a folded-help file suitable for including in the jot help system.
or (from the CLI):
$ jot [listPathName>] -in="%r="html2txt [{-url=<url>|-seturl=<url>|-raw=<pathName>|-list}];"
Transforms an html document or a simple list of documents) to the jot text-document format. Some examples:
> html2txt[ -url=<a valid URL pointing to an html>]|{F2}Pulls the specified html, using curl, and translates it. The translated text is appended to the current buffer.
> html2txt -seturl<originalUrl>{F2}The current buffer is assumed to contain an html, the -seturl specifies the documents original URL - this is used to resolve references contained in the document.
> html2txt -list{F2}or
$ ls ~/Downloads/* | jot -in="%r=html2txt -list;"
The current buffer must contain a simple list of local files and hyper-text references. File types are identified by their extension name:
The -list qualifier causes the plain-text translations of each document to appear as a separate chapter appended to the original buffer.
Note: the list is terminated by the first blank line.
Each item is appended to the current buffer.
The html2txt.jot script defines two functions and two macros, it also uses pdf2txt.jot and doc2txt.jot to define functions pdf2txt_translate and doc2txt_translate respectively. It also uses curl to download references.
Note that it can only descend into referenced documents for simple web sites
If the document contains hypertext links, these are represented by green-background text in the text document, local links can be clicked as in a linkdocs.jot document. If the link is to an external document, then this document downloaded, converted to text and appended to the current document. If the external reference is to a PDF or MS-word document then pdf2txt.jot or doc2txt.jot are used to extract text from these document types.
The objective of all this is not to invent yet another web browser, but to bring web documents into a form where jot's powerful search features (see Navigation by context and, most especially, the proximity search functions) may be used.
Examples:
$ jot -st=dbg -in="%r=html2txt -url=file://${JOT_HOME}/docs/jot_ug.html;" $ jot docs/jot_qr.html -st=dbg -in="%r=html2txt -seturl=file://${JOT_HOME}/docs/jot_qr;"
This looks up definitions of words using the gutenberg.org version of the websters dictionary. You must first download a copy of the dictionary from the Gutenberg project www.gutenberg.org
http://www.gutenberg.org/cache/epub/29765/pg29765.txt
and save it in your JOT_RESOURCES area naming it websters.txt
When you run dic.jot for the first time an index file is written to your JOT_RESOURCES area - you must have write access to this area. The index file is named ${JOT_RESOURCES}/websters_index.txt it is plain text file, about one tenth the size of the actual dictionary (about 2.2Mb compared to about 28Mb for the complete dictionary). The index file structure is a bit more complicated than the index files used by big_file.jot - it has an explicit entry for the length of each section.
$ jot -in="%r=dic"
Typical usage, launched from the shell command line:
$ jot -in="%r=big_file -file=<pathName>[ -size=<n>][ -all][ -cdlIndex|-vlogindex]
[ -index=<indexPathName>] [ -grep=<grepCommands>[ -trim=<jotCommands>] [ -bucketsize=n];"
The big_file script will collect sections in the primary buffer ( . ) this buffer also hods the big_file hashtable.
Or, it can be launched from a jot session from any empty buffer, this buffer will be used to collect sections of the big file, the big_filehashtable is still created in the primary buffer ( . ):
> big_file [<options as above>]{F2}The big_file script defines the following escape sequences:
This script is designed to facilitate browsing and, to a limited extent, editing of very large files (see about large files). It works on the assumption that nobody's ever going to want to look at all of some huge file and that these files are structured and sections and that each section be identified by a unique name. The file is first scanned to create a section-name index which can be read by the editor. The user can then interactively pull sections into the editor session.
If there is some text before the first section listed in the index, this is assigned the section name "Initial_gumpf" to make it accessible.
In practice, grep, or something similar, can be used to create the index, this task can be performed in advance, maybe as part of the batch job that created the big files. The jot session reads the index file, and responds to interactive requests to view named sections of the big file by pulling them into view. The index provides jot with two values a byte-count offset to the start of the section and a byte-count length of the section. It uses the offset and byte-count to read these sections using the -seek=<value> and -bytes=<value> %I qualifiers.
The index file can be prepared earlier and read from disc or it can be generated as the session starts up. The index file is marked with with the big-file's original datestamp. When the index file is contains this datestamp the big_file.jot script can detect situations when the index is out of date e.g: the big-file has been re-extracted or edited in some way.
The optional -index qualifier specifies an index-file pathname - this defaults to the big-file's pathname with "_index" appended. The script uses the index file to reference your big file.
If either the -grep=<Rex>, -vlogindex or cdlindex qualifiers are given then the script will generate a new index file, even if the file already exits. Otherwise it fails if the index file does not exist.
The -grep qualifier is grep command string that can be used to create a new index file with the appropriate datestamp mark. The -trim qualifier specifies some jot commands that transform a line of raw grep output to a usable entry for the index file. Typically grep outputs three colon-separated fields - linebumber, byte startpoint and the matching line. The trim command is required to reduce the matching line to a useful key.
The script defines these functions:
e.g:
> fred{Esc b q}In this case it reads the section "fred", appending it's contents to the primary buffer ( . ). Note that sections appear in the order in which you query them *not* in the order they appear in the original text.
e.g:
> VDD_1234{Esc b g} -- this might load all subcircuits touching the net VDD_1234In the new version all the sections read into the editor replace those in the original file. Other sections are copied from the original file, preserving original section order. Before beginning to write the new version of the file, it renames the original to <pathName>_orig. As the modified file is written, a progress monitor popup appears in the top-right corner of the display.
The index file is used to create hashtable entries for the named sections which can then be accessed reasonably quickly using the -section=<key> qualifier of the %I command.
The index file contains a one-line header followed by any number of one-line entries - one for each for each section in the file.
The header line specifies the index creation time, f the file is found to be later than this, the index is deemed to be obsolete and is rejected.
Each section entry has three colon-separated fields.:
<StartLineNumber>:<startByteNumber>:<key>Sections are assumed to end immediately before the next one starts and entries must be in ascending byte order. Section-keys must, of course, be unique. This structure is exactly compatible with the output of the grep command when used with the -b option.
To generate the index at the start of the session - specify the grep and trim commands on the command line - these is an example of this in working with large files.
For CDL files there is a predefined grep and trim activated with the -cdlindex modifier:
$ jot -in="%r=big_file -file=<bf_name>.cdl -cdlindex;"
This will create and write the index file and you can then use the {KP_7} to pull any subcircuits of interest.
If the jot session is to be run as a batch job then add the exit command %A to terminate the session:
$ jot -in="%r=big_file -file=<bf_name>.cdl -cdlindex; %a;"
The index file will be assigned the name <bf_name>.cdl_index
Subsequent interactive sessions can then be started using the batch-job generated index:
$ jot -in="%r=big_file -file=<bf_name>.cdl;"
It is possible to write a modified version of the complete file but some care is required. The big_files.jot script defines the function <<bf_writeModifiedFile>> for this. It writes all sections in their original order but any section you've loaded using the section-reading functions will be written from the editors memory, replacing the original. This is one very good reason for using internally-generated index files which allow date-stamp checks.
If your changes should change the total number of characters in a section, then the index file will be wrong. The big_file script seeks to avoid this situation by writing the original big file's datestamp in the index - the big_file script checks this against current big file datestamp.
There's an example for you to try in the examples - Working with large files
or, a more typical usage, from the shell command line, to create a new index:
$ ls -aRF <rootDir> | jot -in="%r=multi_file [ ... ]"
or, to use an existing index:
$ jot -in="%r=multi_file[ <options as above>"
There is an example at first with multi_file.jot index files (a subsection of working with collections of source files).
The multi_file script is intended for browsing large collections of source files belonging to some system see about large collections of files. Selected sections are read into a buffer for viewing - typically the sections will correspond to programming-language modules. These are typically referenced by module name.
The optional arguments are:
This catches almost all valid function definitions and rejects almost all non-function-definition lines.
The script define these functions:
Usage:
> <sectionName>{KP_7}or, if you're lacking a numeric keypad:
> <sectionName>{Esc 7}Passes the section name to multi_file_simpleQuery. If successful, the module text is appended to the primary buffer.
> <string>{KP_8}or, if you're lacking a numeric keypad:
> <string>{Esc 8}Passes the string to multi_search_section_names, this searches all the valid keys for any matching the string. The matching process is pretty crude - it obtains a list of keys and then filters out lines that don't match the string. Note that queries using the strings Byte, Section, Seek or any other strings that appear a lot in query keys reports are going to return lots of results.
Note that there is no facility for writing back modified versions of these files from a multi_file session - you must load the relevant files normally, in a separate buffer, then make your changes and write the complete file.
As with big_file.jot, multi_file.jot is driven by user queries and an index file. In this case, however, the files will normally be of moderate size but there may be hundreds of them with each one defining dozens of sections.
In the event of a name collision, the first instance of a name, as it appears in the index file, is taken as-is. Subsequent instances are uniquified by suffixing the name with __nnn, where nnn is the index-file line number for the duplicated name.
$ jot <tagsFile> -in=%r=ctags;
and
$ jot <tagsFile> -in=%r=ctags -AtoZ;
There is an example in now a ctags-generated index (a subsection of working with collections of source files).
Exuberant Ctags is a GNU tool that generates source-code index files except that these are, for reasons unknown, called tags files. Anyway these function as index files and can be picked up by jot using this script. The script was developed and tested using ctags files generated by ctags 5.9, this announces it's _TAG_FILE_FORMAT as being type 2. The ctags.jot script therefore performs a similar function to multi_file.jot
Once it has read and inwardly-digested the ctags-generated index you can launch queries using macro ( 7 ), which is bound to key 7 on the numeric keypad ( {KP_7} ). If you do not have a numeric keypad or, if you have not set it up for jot (see X-windows setup) then Escape followed by 7 {Esc 7} will do. There is an example exercise - see working with collections of source files and now a Ctags-generated index e.g:
$ jot -st=dbg ${JOT_HOME}/source/tags -in="%r=ctags;"> SubstituteString{Esc 7}
This opens an editor view of source file ${JOT_HOME}/source/jot.c and sets up the view to the start of the function SubstituteString.
> FreeTag{Esc 7}In the same editor buffer it changes view to the start of the c function FreeTag.
ctags.jot reads the ctags-generated index file and defines a macro which takes an index-key and checks to see if it already has the relevant source file in memory. If not, the source file is read before the editor focuses to the start of the relevant section.
If you have more than a handful of source files in memory, you may find it helpful to run the listbufs.jot script especially with the -changed option, this reports the status of file images in jot buffers.
Without the -AtoZ qualifier, the script will always display the requested definition in a secondary buffer - that is a buffer created on the stack, with the buffer key ( ~ ). This allows the session to hold and display any number of source files but, in the general case, it's not possible to switch between them.
In contrast, with the -AtoZ qualifier, the source files are read into buffers A, B, ... Z, this limits the number of viewable files to 26 but navigating between them is quick and convenient. For collections of 26 files or less, the buffer keys are allocated at the start of the session, then all sessions using the same ctags index will have the same, fixed, buffer-key assignments.
If, however, there are more than 26 source files but you won't need to view more than 26 but maybe this doesn't matter since keeping track of more than 26 source files in a session would take some doing. The buffer keys are allocated at query time - the first will be ( A ), then ( B ) ... to ( Z ).
This script may be combined with ide.jot if desired.
This reads the Gutenberg Ebook version of Roget's thesaurus and sets up a simple macro to process queries. It reads the Ebook from ${JOT_RESOURCES}/thesaurus.txt, this can be downloaded from the gutenberg project - www.gutenberg.org.
The query macro expects a list of words, it then returns all Roget's sections which contain all of the given words, the results are in the @ buffer.
The current buffer is searched for duplicated lines, starting from the current line. The script halts at a duplicated line or the end of the buffer.
The current buffer is searched for duplicated lines, starting from the current line. Duplicated lines are removed leaving just the first instance of each unique line of text.
If the optional qualifier -rev is given, then it is the unduplicated lines that are removed.
If the optional qualifier -count is given then the number of purged duplicate lines is appended to the undeleted lines separated by a tab character.
mc is useful for scanning through long files with very short lines. Such files are reasonably common when maintaining IT system files and CAD files etc - but it's not usually much use for viewing natural language documents.
The mc script calculates your window size and then chops up a copy of your buffer into columns to fill the display. You may be more interested in printing the multicolumned text in which case the size of the window is irrelevant - you can specify the size of your paper with the -size qualifier.
The script also defines macro 1 and macro 2 as page-up and page-down functions, respectively. The standard page-up and page-down functions are not suitable for viewing the mc result buffer.
e.g:
$ jot ${JOT_HOME}/docs/spell.dic -ini="%r=mc" $ ls /usr/lib64 | jot -ini=%r=mc $ ls /usr/lib64 | jot_dev -ini="%r=mc -size=80x90"
Similar to mc.jot except that it always splits the page int two columns.
Similar to mc.jot except that it always splits the page int three columns.
Similar to mc.jot except that it always splits the page int four columns.
Similar to mc.jot except that it always splits the page int five columns.
Similar to mc.jot except that it always splits the page int six columns.
Locates verilog busses of the form name[start:end] (where end < start), and replaces them with fully-expanded form
The current buffer is assumed to be text written written vertically top-to-bottom. The current column is searched for the string.
The ${JOT_RESOURCES}/help tree is searched for the string, results appear in the help menu buffer.
This uses the unix find and egrep commands, this search is always case insensitive.
This simple script appends a text annotation to each line in the hex dump generated by the -binary option of %I.
Example output - this is a fragment of hex dump of the test file ${JOT_RESOURCES}/l99.t, the text "80: abc ..." was added by hex2ascii.jot notice that any nonprinting characters are represented by carats ( ^ ).
2 1 1 A 20 61 62 63 20 64 65 66 20 67 68 69 20 80: abc def ghi 3 A 6B 6C 20 6D 6E 6F 20 70 71 72 20 73 74 75 20 jkl mno pqr stu 4 1 1 1 1 A 3A 30 31 32 33 34 35 36 37 38 39 vwxyz:0123456789 5 1 F 5F 37 39 3A 20 61 62 63 20 64 65 66 20 67 ^__79: abc def g
This command file is used after you've updated an entry in the help buffer (;). The current buffer must be the help buffer and the fold marks must be unchanged (these are used to locate the fold in the file). It locates the current file fold by searching for the previous file fold in the help buffer (:) then reads the file into a temporary buffer and updates it with your revised fold.
The changes must not affect the fold structure in any way, or the script will fail.
The updatehelp script will insert a datestamp mark near the start of the fold indicating when the change was made. The -nodatestamp qualifier will prevent it doing this
Generates requested man page and adds it to sessions help repository.
The manargs are passed directly to the man utility and the reply becomes a new page in the jot-sessions help repository.
The -fold option folds sections inside the new help page.
Detects any nonprinting characters in the current buffer.
Sets up macro 3 to follow values in a tab-separated table where the first nonblank entry at the top of each column is the property name e.g (for a property named fred):
> fred{Esc 3}The cli script assumes that the current buffer is a file image, the file's pathName is picked up and the specified CLI (Command-Line Interpreter - or shell, in unix parlance) command is applied to it.
The path script assumes that the current buffer is a file image, the file's path is picked up and the specified command is applied to it.
This assumes that the current buffer is a file image, it applies the sccs command to the current file.
This script uses the %b=sort command to reorder the lines in a buffer. Whereas the sort command will only sort by UTF-8 character codes (typically ASCII codes), the sort.jot script allows various alternatives.
Optional qualifiers
The date specification expression may contain the following elements:
Some examples:
This replaces the contents of the current buffer with the first n rows of pascals triangle.
The number of rows defaults to 30 but can be set as an argument to the script. Note that the size of the numerical values in the triangle increases very rapidly, 30 rows is about as many as can be accommodated with 64-bit integer arithmetic.
> pascal{F2}The current buffer is checked and, if there are no unresolved tabs or overlong lines, it is written out to a temporary file, this temporary file is printed using a2ps.
The optional -break qualifier causes overlong lines ( >80 characters) to be broken at a suitable point.
The current buffer is checked and, if there are no unresolved tabs or overlong lines, it is written out to a temporary file, this temporary file is printed using a2ps.
The line numbers in the current buffer are reset so that the first line becomes line no. 1 again.
Sets up macro 1 to generate an activity summary report from your titracks (formerly known as timex) files.
This sets the trace-vector bits (see %s=trace) symbolically. If no args are given, it displays the options (shown below) and prompts.
Trace bits 0x0001 to 0x0040 define the trigger points - i.e. they select which class of event will trigger a trace or other diagnostic response. Trace bits 0x1000 to 0x8000 define the desired action.
These can be set directly - e.g. to set a breakpoint on the start of each new command line we would say %s=trace 8002 to dump the stack we would OR with 0x1000 giving %s=trace 9002 - trace.jot sets these symbolically.
Trace arguments - trigger points:
Trace arguments - trace actions:
So to dump the stack and breakpoint at each new line of a script or macro:
> trace lsb{F2}This runs the unix cal command, by default, it takes the current year.
The result is similar to that of the unix cal command except that week numbers are prefixed before each week.
The -split qualifier splits the output listing each day on a separate line.
This The object of this script is to match lists of words in various buffers. Typically, the words will be the names of objects defined in different places (e.g. file names in various directories or backup discs or module names from a linker map).
This script identifies links in jot-style documents (see text document preparation) and add colour tags, hashtables and sets up a mouse-event handler to allow clicking through the links.
The -bufs qualifier introduces a whitespace-separated list of buffer keys, these are the buffers to be analyzed. If -bufs list is not given, then it analyses the primary buffer ( . ) and all buffer with an alphabetical buffer key (a, b, c ...).
The -allxrefs matches references to headings in all text - by default it only matches to cross-references enclosed in backticks.
Macro_1 is defined for users without mice - first navigate the cursor to a link (or a non-link if returning) then {Esc 0}
The list of buffer keys specifies the buffers containing suitable documents, if this list is not given then linkdocs inspects each buffer in the range A-Z and processes those which appear to have doc-style section headings - see text document preparation.
A good example to try would be the jot user documents:
$ jot ${JOT_HOME}/docs/jot_qr.txt -in="%it=jot_tech; %ic=jot_coms; \
%iu=jot_ug; %iw=jot_examples; %r=linkdocs -bufs=. c t u w;"
The file images are displayed normally except that links are highlighted in green (unresolved links are highlighted in red). Clicking the left button with the mouse over over a green link will switch context to that section.
The linkdocs script also checks for obvious errors such as duplicated headings and unresolved references. If any are detected, the script displays these in buffer ( ; ) and invites the user to hit return to continue.
See also qr.jot
$ jot -in="%r=time_trial [ -tasks <taskSpec>]
[ -logfile <pathName>][ -append][ -viasvim][ -small| -tiny];"
Runs execution-time trials for a selection of editors. Each of the editors is given a selection of simple tasks, the script reports the elapsed times for each editor/task.
The editors currently included are (the letters are used to select an editor in the -tasks option):
-viasvim qualifier - see above).
long-line-file tasks.
The tasks
occurs at the end of the file.
of the file then exit.
string that only appears at the start of the file.
with the replacement string of the same length as the original.
with the replacement string longer than the original.
with the replacement string shorter than the original.
replace, with the replacement string shorter than the original.
occurs at the end of the file.
of the file then exit.
string that only appears at the start of the file.
with the replacement string of the same length as the original.
with the replacement string longer than the original.
with the replacement string shorter than the original.
The script launches the editors with a number of different tasks designed to evaluate the raw performance of the editors. In order to detect the time taken for each task a fairly big files were used. One file (big_file.txt) is just plain big - 100Mb . The other (fat_file.txt) is the same size but has stupidly long lines - but only a few hundred of them.
On completion, the results are copied into tabular form and appended to the main report.
or from a unix prompt:
$ jot <pathname> -in=%r=iconv
This uses the linux utility iconv to convert a UTF-n file to UTF-8 that jot can read and display. It uses the iconv utility to create a temporary version in /tmp/... and then reads the converted file into the specified buffer.
If the buffer is not specified it reads the converted file into the current buffer. If the pathName is not specified then it assumes the current-buffers file requires converting and rereading.
It defines macro '4, this will write the file back to it's original pathname and in it's original format.
See also practicalities of unicode etc. and jot
$ jot ${JOT_RESOURCES}/resources.txt -in="%r=bookings -mail=${JOT_RESOURCES}/mail -resource=The House"
This is an application designed to simplify the process of maintaining a bookings register for a holiday let or some similar resource that's hired out on a weekly basis. One of the worst things that can happen, apart from getting the place totally trashed, is a double booking. This app is designed to provide strict control of the bookings calendar and the associated database to prevent double bookings keep track of payments and client details etc.
Although few jot users will actually require such an application, it is a useful example of how to implement similar interactive applications. It maintains various different views (e.g. the calendar, the accounts table, emails and various lists relating to each booking. These views are linked by hash-tables and tags containing metadata (typically hashtable keys).
Looking at the calendar (in buffer C) we notice that it's organized from Saturday to the following Saturday - this is because the letting week starts Saturday afternoon and ends the following Saturday morning - that's because Saturday is the default changeover day.
The changeover day is an important day in the world of holiday letting. It's intended to give the previous weeks guests time to pack up their things and get off home while also allowing the incoming guests time for their travelling and getting themselves organized as well as giving the housekeeper a chance to prepare the house for the incoming guests.
Many operators chose either Friday or Saturday for their changeover day - bookings.jot defaults to Saturday but can be set for changeover on any other day of the week.
The most important document is the resources.txt file - this contains a list of resources (e.g. properties to let) and, for each resource, an accounts table and bookings, each consisting of lists of emails and notes relating to the booking.
The bookings system also has a simple Email reader. Although this lacks even the ability to send emails, it can still be useful because incoming messages are integrated into the bookings system. It is assumed that most users will be using a modern webmail mailer based on a remote imap server, bookings.jot uses a local POP mail file. POP is a simple plain-text file containing mail messages. In most cases this will be copied from the remote imap server using a mail-retrieval agent (MRA) such as fetchmail. Messages are then assembled in a POP mail file using a mail delivery agent (MDA) such as procmail. See http://dev.mutt.org/trac/wiki/MailConcept for a basic description of how this works and http://www.andrews-corner.org/mutt.html for a description of how to set up your MRA and MDA.
At the top of the screen are two lines with mauve-tagged text - clicking on these has the following effects:
The "Options:" menu, below, changes according to view:
mail, to the mailthread for the current booking.
In any view, position the cursor onto some colour-tagged text and the following actions are defined:
The "Goto:" group of buttons:
The "Emails:" group of buttons:
When viewing a mail message it displays the mail "Options:" buttons:
When viewing the calendar it displays the calendar "Options:" buttons:
Alternatively, if you prefer, you can drive the bookings script with escape sequences:
This is a little fun script primarily intended to demonstrate features of jot. It's a crossword puzzle assistant, it looks up words and phrases of a predetermined length matching various criteria.
The words and phrases are read from the on-line Roget's (see thes.jot), these are munged into a database that's saved as xword_db.txt in your JOT_RESOURCES area. The xword_db.txt file is designed for speedy searching, altough takes a few moments to create, subsequent calls take no time to read the database.
The query syntax is
<n> <c1>=<l1>[<l2>[<l3>...]]] [<c2>=<l1>[<l2>[<l3>...]]]...
where
Queries are entered using macro 4, defined by xword and attached to {KP_4}. Suppose we're looking for a 6 letter word with the 3rd. letter t and the 5th letter e - then any of these queries would identify the same set of matching words:
> 6 3=t 5=e{KP_4} > 6 5=e 3=t{KP_4}The jot installation contains more scripts of variable usefulness - they are listed here along with a brief description:
Many are obsolete/superseded/incomplete or otherwise broken, some may serve as examples of how to perform various tasks but most are, most likely, examples of how not to do something.