ctarbide / j89

Jonathan's Own Version of Emacs (C89 Edition, for study and experiments)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This is a fork of JOVE from [1] that I use to study and experiment.

The canonical source for this version is https://github.com/ctarbide/j89.

- [1]: https://github.com/jonmacs/jove

Original README follows


# This program is Copyright (C) 1986-2002 by Jonathan Payne.  JOVE is    #
# provided by Jonathan and Jovehacks without charge and without          #
# warranty.  You may copy, modify, and/or distribute JOVE, provided that #
# this notice is included in all the source files and documentation.     #

[Updated in 2021 February]

JOVE on UNIX/Linux/MacOS X/*BSD/CygWin Systems

For information about other systems, see the other README files:
  README.dos for MS-DOS
  README.win for MS Win32

Quick Summary of Installation

Unpack the tar file somewhere convenient and cd into it:
    tar tzf jove-VERSION.tgz
    cd jove-VERSION

Ensure you have the tools required to build Jove.  You need a C compiler
(classic Unix cc, gcc or clang should work), the make utility, 
and basic headers for libc, which may require extra packages on
some Linux distributions.
    Debian, Ubuntu, Mint: apt-get update && apt-get install gcc make
    Alpine: apk update && apk add gcc make musl-dev
    MacOSX/Darwin: brew install make # ncurses 
    Nix: nix-shell -p gnumake 
    Arch: pacman -Sy gcc make # pkgconf ncurses
    Gentoo: # comes with gcc and make and headers by default!

For many modern systems (Linux, various BSDs, MacOSX/Darwin,
Solaris, OpenIndiana), an auxiliary script called
buildflags.sh is provided that should help 'make' work out
of the box, so not much configuration is needed:  just
specify JOVEHOME to change where you want jove installed
(default JOVEHOME is /usr/local, which puts the binaries in
$JOVEHOME/bin, manuals in $JOVEHOME/man/man1, other
documents and help and config in $JOVEHOME/share/jove,
helper programs in $JOVEHOME/lib/jove
     make # to build
     make install # to install

If that does not work, please do file a bug, indicating
your system.  One can also pass SYSDEFS and TERMCAPLIB
(and other variables in the Makefile) by hand.

BSD/Darwin/Mac OS X:
  use the first of the following that works:
  make install
  make SYSDEFS=-DXBSD install
  make SYSDEFS="-DBSDPOSIX_STDC" install
  make SYSDEFS="-DBSDPOSIX" install

  Using RPM (if sufficiently close to Red Hat; make sure RPMHOME is correct
  in the Makefile, that you have the rpm-build package, a compiler and
  and use:
    make rpm
  and them install the resulting rpm from
  $HOME/rpmbuild/RPMS with "rpm -i"

  To compile and install from source, set JOVEHOME
  appropriately.  By default, Jove has internal support for
  ansi/vt[1234]xx terminals that are emulated by every
  modern desktop environment (i.e xterm, rxvt, st, vte,
  konsole, {gnome,mate}-terminal, ...), so unless you have
  some very special terminal, you should not need a general
  purpose terminal handling library like termcap or curses.
  But if you need one, the packages go by different names on
  various Linux.  If you install pkgconf (for the pkg-config
  program) and the ncurses (which sometimes goes by names
  like ncursesw, ncurses-base, ncurses-dev, ncurses-devel,
  libncurses-dev, libtinfo-dev, sys-libs), that should be
  enough on most Linux systems.  Otherwise, you can
  explicitly ask for it is using something like
     make SYSDEFS=-D`uname` TERMCAPLIB=-lncursesw
  If you link with one of the general terminal handling
  libraries rather than using Jove's builtin handling, then
  you will also need to ensure you have terminal
  descriptions, which are sometimes in separate packages
  (e.g. called ncurses-terminfo-base or ncurses-base or ncurses-term)

Solaris 5.1 or newer:
  make install

Other systems:
  Read comments about SYSDEFS settings in Makefile, check sysdep.h
  for recently tested system settings or old/sysdep.h for once-working
  but currently untested settings that will need to be copied into sysdep.h,
  or just set on the command-line with SYSDEFS="-D...", TERMCAPLIB 
  and EXTRALIBS if needed.


The Jove Makefile has some support for cross-compiling.  You
need to set CC to the cross-compiler, SYSDEFS, TERMCAPLIB,
and perhaps EXTRALIBS for the target system, while you set
LOCALEXT for the local machine (used when building the
setmaps program, which generates keys.c, which will then be
cross-compiled for the target) e.g.
    make CC=/cross/bin/cc-armv7 SYSDEFS="-DLinux -DJTC" TERMCAPLIB= LOCALCC=cc

For another example, see README.win for cross-compiling
using MinGW for a Windows target.

Please help us keep up with new systems.  If your system isn't covered
here on in the SYSDEFS section of Makefile, tell us what works.  If
your system is covered, but the documented procedure doesn't work,
tell us by filing a bug on http://github.com/jonmacs/jove

Full Story of Installation

JOVE does not use any automatic configuring mechanism other
than the very simple buildflags.sh script, which only works
on modern Linux/*BSD/MacOSX/Darwin/Solaris.  Fine-tuned
configuring is done by editing definitions in Makefile (in
some situations it is handier to override definitions by
supplying them on the make command line).

JOVE has been around for a *long* time, and a lot of care has been taken
to make it work on many systems, new and old.  For current systems,
less configuring is require -- hurray for standards!

Makefile specifies paths for installing JOVE components (JOVEHOME,
and the default shell (DFLTSHELL).  Although the defaults are
reasonable, you may wish to change them.

For many systems, you will need to change the definition of SYSDEFS.
to the symbol that identifies your system's characteristics, using the
notation for a macro-setting flag to the C compiler.  For modern
systems, that symbol is often the output of the uname command.
For example, on a machine running NetBSD, use "SYSDEFS=-DNetBSD".
The Makefile describes suitable settings of SYSDEFS for many configurations.
If yours isn't mentioned, use "grep System: sysdep.h" to find all
currently supported system configurations.  If there is no canned
configuration for your system, you will have to define a new symbol
and edit sysdep.h suitably.  See "sysdep.doc" for the possible set of
system-dependent aspects that you can select/tune. 

On some systems, you may need to change the flags passed to the

Systems on which 4.17 was tested include the following
(and their SYSDEFS and TERMCAPLIB will usually be
correctly set by the buildflags.sh script that is invoked
by the Makefile).  The following explicit settings also work
and may provide a guide to customization.

#	Cygwin 3.1.2			SYSDEFS=-DCYGWIN TERMCAPLIB= # builtin vt100/xterm/rxvt etc support, no need for curses dependency
#	Darwin aka MacOS X onwards	SYSDEFS=-DDarwin
#	FreeBSD 12.1			SYSDEFS=-DFreeBSD EXTRALIBS=-lutil
#	Linux (modern, UNIX98 PTYS)	SYSDEFS=-DLinux
#	Linux (modern, UNIX98 PTYS)	SYSDEFS=-DLinux TERMCAPLIB=-lncursesw
#	Linux (modern, glibc pty.h)	SYSDEFS=-DGLIBCPTY EXTRALIBS=-lutil
#	MacOS X aka Darwin 		SYSDEFS=-DDarwin
#	OpenBSD 6.6			SYSDEFS=-DOpenBSD EXTRALIBS=-lutil
#	SunOS5.1 onwards (Solaris/OpenIndiana/Illumos/Joyent)	SYSDEFS=-DSunOS

The following used to work circa Jove 4.16 in the 1990s and have probably not
been tested in the 21st century, they may still work but some of this
ancient support may be deleted from Jove at some point, we welcome
any recent success stories from jove builders/packagers to refresh
or maintain these. Pretty please! Almost all these need TERMCAPLIB=-ltermcap

#	Apple A/UX on macIIs		SYSDEFS=-DA_UX
#	BSD4.2,4.3			SYSDEFS=-DBSD4
#	Compaq Tru64 UNIX V4.0g, 5.1	SYSDEFS=-DSYSVR4
#	DEC OSF/1 V2.0 and later	SYSDEFS=-DSYSVR4
#	Digital UNIX V4.0 and later	SYSDEFS="-DSYSVR4 -DGRANTPT_BUG"
#	HP/UX 8 or 9			SYSDEFS="-DHPUX -Ac"
#	HP/UX 11 (-Ac redundant)	SYSDEFS=-DHPUX
#	IBM AIX 4.2, 5.2		SYSDEFS="-DAIX4_2" TERMCAPLIB="-lcurses -ls"
#	Irix 3.3-4.0.5			SYSDEFS="-DIRIX -DIRIX4"
#	Irix 5.0 onwards		SYSDEFS="-DIRIX -prototypes"
#	Linux (older, eg. RedHat 4, 5)	SYSDEFS=-DBSDPOSIX
#	MIPS RiscOS4.x			SYSDEFS="-systype bsd43 -DBSD4"
#	SunOS5.0 (Solaris 2.0)		SYSDEFS="-DSYSVR4 -DGRANTPT_BUG"
#	Sys V Release 4.x		SYSDEFS=-DSYSVR4
Some systems based on System V release 4 have a bug affecting interactive
processes.  This bug can be worked around by defining GRANTPT_BUG.
Read the explanation of GRANTPT_BUG in sysdep.doc.

Next you may edit "tune.h" to select the compile time features you care
about.  See "tune.doc" for a description of all the compile time options.
The default options are quite reasonable so, in most cases, you should
leave them alone.  If you are really short on space, or are porting JOVE
to a new system, you may want to define -DBAREBONES in SYSDEFS to avoid
some of the less-portable features of JOVE initially.

You can type "make" to compile "jjove", "portsrv" (this is compiled on
every system, but is only used if JOVE is compiled with the PIPEPROCS
feature selection, typically on UNIX systems without pseudo ttys),
"recover" and "teachjove".  Test jjove to see if it works (remember that it
won't be able to access its subsidiary files until they are installed, so
you will need to call it with "./jjove -l . -s doc ..." -- assuming you are
in the main JOVE directory).  If it works, type "make install" to install
everything where it belongs.

Here are some things to consider when choosing a definition for
JTMPDIR, the directory where JOVE puts temporary files.  The obvious
place is /tmp, but many systems delete all files in /tmp when they are
rebooting.  If you hope to recover buffers from a system crash, TMPDIR
lets you specify a safer place.  If your system does not remove
subdirectories of /tmp on reboot (lots do remove them these days) then
it makes sense to make TMPDIR be /tmp/jove; otherwise, /var/tmp may be
better.  But if you use /tmp and want to recover buffers on system
crashes, you should put the lines:
	(echo preserving JOVE files)	>/dev/console
	(cd /tmp; /usr/local/lib/jovelib/recover -syscrash) >/dev/console
in the /etc/rc file BEFORE /tmp is cleared, so that you can recover
files after reboots (hint: look for the equivalent code to preserve vi
tempfiles).  You should then create a crontab entry to clear out old files
in /usr/preserve.

If you plan on using JOVE with a xterm, look at doc/XTermresource.
This file contains resource declarations that allow JOVE to respond to
more function keys and mouse gestures.

For the pdp11 version there is the Ovmakefile.  This has only been
tested on 2.9bsd, and not recently.  It worked pretty well, actually,
and it was possible to turn on all the compile time options with this

For RPM-based Linux, jspec.in specifies how an RPM should be created.
On Red Hat Linux 7.x, 8.0, and 9, "rpmbuild -ta jove*.tgz" will build
source and binary RPMs -- rpm looks inside the .tgz to find jove.spec.
(Need to 'yum install rpm-build groff' or similar)

It is possible to build a widely portable Linux binary using
static compilation, perhaps using the musl library to keep
size small.  E.g., using the small Alpine Linux docker image,
one can use:

	docker pull alpine
	apk add gcc musl-dev make
	make 'CC=gcc --static'
The resulting jjove can be run standalone pretty-much anywhere,
though the doc/jove.rc file might also be useful.

Some features.

"doc/jove.rc" and "doc/example.rc" are JOVE initialization
files.  "jove.rc" is the recommended "system" rc file (until
you are ready to roll your own, that is).  It gets read
every time JOVE starts up FOR EVERYONE ("make install"
should copy it to the right place automatically).  After
that JOVE reads the initialization file .joverc in the
user's home directory.  "example.rc" is taken from a
personal .joverc.

The files intro.nr and cmds.nr in the doc directory are the
official JOVE manual.  Jonathan got permission from Richard
Stallman to use his manual for the original EMACS, modifying
it where necessary for JOVE.  Lots of work was done by Brian
Harvey on this manual.

There are Unix-style manual pages for jove and teachjove.
Teachjove is for people who have never used EMACS style editors.
It is an interactive tutorial, THE tutorial written by Stallman
for the original EMACS, only slightly modified for JOVE in
the appropriate places.  The man pages are completely up to
date, thanks to Jon.

Optionally, if you want to use Jove to work with C source code, and
know/like tags, you will need ctags or etags on your system so that you
can generate tags files to use with jove -t or Jove's find-tag command
(bound to the keys "^X t").

If you use Jove to work with text documents, and use the built-in
spell-check support (i.e. Jove's spell-buffer command), you will
need to install spell-checker program (spell on classic Unix, aspell
on Linux/BSD).

Optionally, if you want to modify, rebuild or reformat the
documents, you will need a troff-style formatter (the package
called groff on modern Linux/*BSD.  You will also need the "ms"
macros, should be included with most modern groff, though not
in the scaled-down groff-base packages)

Optionally, if you want to use 'make zip' to build a source 
archive suited to DOS/Windows, you will need the zip program
(generally, a package called zip on most Linux/*BSD)

Some acknowledgments.

Thanks to Jay (hack) Fenlason for writing the original pty code.

Thanks to Dave Curry at Purdue for putting in tons of time and effort
into getting JOVE ready.  It just wouldn't be working without his help.

Thanks to Jeff Mc Carrell at Berkeley for finding bugs and adding
features, in particular, the comment formatter.

Thanks to Karl Gegenfurtner for making the PC version.

Thanks to Ken Mitchum for the Macintosh version.

Thanks to Hugh Redelmeier for his input, his experience, countless bug
fixes, and ... that's it, I guess.

(Thanks to Brian Harvey for teaching me about linked lists ...)

Good luck, have fun.

	Jonathan Payne (once jpayne@starwave.com, sun.com, marimba.com :-)

Thanks to Charles Lindsey for the xjove/jovetool and xterm mouse support.

Thanks to Jim Patterson for the Win 32 port.

Thanks to the other JoveHacks for testing and for contributing numerous
fixes, portability enhancements, and pieces of sage advice.

	D. Hugh Redelmeier

Thanks to Arlindo da Silva and Dave Curry for the original Cygwin ports.

Thanks to Ken Mitchum for the original Mac port.

Changes since 4.16

- Portability fixes.  Most important: work around a never-to-be-fixed
  bug in ncurses (the freely redistributable termcap/terminfo

- Various minor bug fixes.  Highlights:
  + use mkstemp to avoid a security loophole
  + avoid bad interaction between metakey and xterm mouse support
    in windows wider than 95 characters
  + handle symlinks better
  + obscure bug in text justification that could hang JOVE
  + misuse of stat that only misbehaved on LINUX

Changes since 4.16beta

- Added the variable paragraph-delimiter-pattern to customize paragraph

- Ported to Win 32 (but not Win 32s)

- Several variables have been renamed to more clearly indicate their function.
  The old name will still work, but eventually it will be eliminated.
	allow-bad-filenames => allow-bad-characters-in-filenames
	display-bad-filenames => display-filenames-with-bad-extensions
	internal-tabstop => tab-width

- Several minor bugs fixed.  Several portability improvements.
  + MSDOS: avoid date rollover problem
  + Borland C: support version 4
  + Borland and Microsoft C: enable HIGHLIGHTING
  + NetBSD: dodge ssize_t redefinition
  + SCO UNIX: use <ctype.h>
  + SunOS + Solaris: make charp effective
  + generic: Ensure screen is maintained during non-interactive processes,
    even if the user has typed ahead

- The xterm mousing interface has been completely revamped.
  Some small ancillary consequences of this are
  + A next-line (prev-line) landing in the middle of a Tab selects the Tab
    character (rather than the following one)
  + A yank-pop is no longer permitted to follow a copy-region.

Changes since version 4.14.6.

JOVE now works on many newer systems.  For example, it compiles
under Solaris 2.n (SYSDEFS=-DSYSVR4).

The uninstalled binary in the JOVE directory is jjove instead of xjove
(xjove is now something else).

The new command line flag -J inhibits the reading of the global
jove.rc file.  Similarly, -j inhibits ~/.joverc.

JOVE's auxiliary files are kept in two directories (actually, they can be
the same directory).  The sharedir holds the system jove.rc and cmds.doc,
the data used to implement the describe-command and describe-variable
commands; these files are meant to be machine-independent.  The libdir
holds portsrv and recover; these are compiled programs, and are

There are three ways JOVE uses to determine each of the directories, two
of them new.  If JOVE was invoked with -l dirname, dirname is taken as
the LibDir; otherwise, if the environment contains JOVELIB, its value is
taken as the LibDir; otherwise, the value of the make variable $(LIBDIR)
when JOVE was compiled is used as LibDir.  Similarly, -s dirname,
JOVESHARE, and $(SHAREDIR) specify ShareDir.  As a shortcut, -ls dirname
specifies both directories.  Now, a good way to test an uninstalled
version of JOVE is to say, within the JOVE directory,
	jjove -s doc -l . other_parameters

A new command "pushlibd" effectively does a pushd command with ShareDir as
the operand.  This is for use within startup files such as jove.rc.

The global startup file is now in doc/jove.rc (was doc/system.rc), so the
-s flag can find it as above.  It contains lots of goodies (you might not
want all of them), including an ability to call up additional TERMinal
specific startup files depending on the $TERM environment variable.
Among other things, these provide support for the many wacky keys that
terminal makers provide.  See doc/README.

The old make-keymap and bind-keymap-to-key commands are no longer needed.
Instead, bind-to-key can accept character strings of any length (they had
better not be a prefix of any other binding).  This enables, among other
things, binding commands to the function keys on Sun keyboards.  Buffer-
specific bindings are now supported (local-bind-* commands).

All system dependencies are now gathered together in the file sysdep.h, to
make it easier to select the bits of code which should or should not be
included for various flavors of UNIX.

The position of the mark is now indicated by underlining it (the position of
point is, of course, indicated by the cursor, so the extent of the region is
now easily seen).  The bad news is that, although this works well on
terminals, underlining is broken in some environments (notably SunView
and the versions of OpenWindows with SUNOS4.1.x and Solaris 2.0 -- Solaris
2.1+ is OK).  For the broken OpenWindows versions, you can include the
following in your .Xdefaults file
	term.boldStyle:				Offset_X_and_Y
	term.underlineStyle:			Same_as_Bold
The stock X11 terminfo entry for xterm was broken until X11R6 in a way that
will cause the screen to be scrambled when JOVE tries to use underlining.
The following fixes to the entry solve this problem and more:
	replace "blink=@," with "blink@,"
	replace "rs2=@" with "rs2@," [note the added comma!]
	add "kf1=\EOP," [if not already be present]
	delete "smul@,"	and "rmul@," [if present]
	add "smul=\E[4m, rmul=\E[m," [xterm does support underlining]

The portion of the buffer visible in the window is now indicated by
"uninverting" a part of the modeline in proportion.  This feature is really
intended for use with "xjove" (described next), and there is a variable
"scroll-bar" to enable it.

xjove is a complete front-end for JOVE which will be found in the directory
xjove (see the README there).  It enables setting of point and mark with the
mouse, cutting and pasting of text via the region, and scrolling by pointing
into the modeline.  It is written using the XView library (supplied with
Suns, or with the X-distribution from MIT); there is also a version for
Sunview known as jovetool.  See its man entry in doc/xjove.nr.

An alternative way of using the mouse is provided in the form of commands
designed to recognize the mouse events coded by Xterm.  These facilities
are not nearly as extensive or convenient as those provided via xjove or

Within SHELL windows, the TERM environment variable is now set to "dumb",
mainly to discourage running programs which might have depended on something
else.  Some shells (tcsh, for example) might prefer the emacs
terminal type;  JOVE also sets the INSIDE_JOVE variable, which can
be used to set things up for shells, as well as the proc-env-export,
and proc-env-unset commands for subshells and corresponding
iproc-env-export and iproc-env-unset commands for interactive processes.

By default, commands requiring a "y" or "n" response require a Return as
well.  When variable "one-key-confirmation" is set "on", a single
character "y" or "n" is expected.

Some features have been removed.  Marks always float, so the variable
"marks-should-float" is gone.  The IBMPC-specific commands scroll-*-page
are gone.

JOVE is now 8-bit clean (the old behavior can be retained by setting NCHARS
to 128 in sysdep.h, but no known system requires this setting).  In operating
systems with the necessary support (USE_CTYPE set in sysdep.h) it is
possible to set the environment variable LC_CTYPE (or the JOVE variable
lc-ctype) to a "locale" such as "iso_8859_1", whereupon characters with the
8th bit set sent from the keyboard (using the Alt Graph key, or the Compose
key, or the Meta key, or whatever the particular hardware provides) will be
displayed correctly, and will be treated as upper/lower case, etc in the
correct manner.  The default locale is "C", which reverts to 7-bit ASCII with
the top 128 characters being displayed in octal.

The format of the "jrec" file has changed.  This means that previous
versions of recover cannot deal with the files left by crashes of the new
JOVE, and vice versa.

Here is a list of reasons why your .joverc might no longer work.  JOVE
places diagnostics about the user and system .joverc files in the buffer
"RC errors".

- JOVE no longer ignores extra stuff on the end of binding commands.

- All keymap creation is implicit.  You no longer can or need to create
  new keymaps explicitly.

- auto-execute-command no longer magically supplies a numeric argument
  for its command.  If the command is intended to set a mode, you should
  supply the argument.  If you don't set the numeric argument, the mode
  will be flipped.  Here is an example from the system jove.rc:
	1 auto-execute-command c-mode .*\.[chy]$

- Within regular expressions, alternatives are separated by "\|".
  Previously, alternatives within braces were separated by ",".
  For example, "/tmp/\{Re,article,rnmail,pn\}" must be changed to

- auto-execute-command and auto-execute-macro both require explicit
  patterns.  Previously, the pattern would default to match every filename.

- Certain commands and variables have been eliminated or renamed:

	bind-keymap-to-key, make-keymap, process-bind-keymap-to-key --
		no longer needed
	unbind-key -- bind the "unbound" command instead
	marks-should-float -- they always do now
	physical-tabstop -- now picked up from termcap
	scroll-next-page, scroll-previous-page -- IBM PC only, and useless
	background-color => background-attribute -- IBM PC only
	foreground-color => foreground-attribute
	mode-line-color => mode-line-attribute

- On the IBM PC, the Delete key now generates the ASCII DEL character;
  Control-@ and Control-Space now generate the ASCII NUL character.

Known problems

In an interactive process buffer, JOVE sometimes fails to receive an
end-of-file through the pseudo-tty.  In this case, the process window
will not be considered done, even though the child and all its
ancestors are dead.  The only consequences are that the status
display continues to report that the process is not done and that
another process may not be started up in that buffer.  This only
happens on certain systems, and we think that they are at fault.

If a window-find command is issued while the current window's lines
are numbered, the numbering may become wrong temporarily.  We are
working on this bug.

JOVE can not handle lines longer than JBUFSIZ characters
(usually 4096, but 512 on some small systems).  Eliminating
this limit is not easy.  JBUFSIZ is 2^LG_JBUFSIZ, which can
be raised; JOVE keeps NBUF such buffers in memory and
reads/writes these from/to a temporary file, and lines may
not exceed a buffer, so making LG_JBUFSIZ larger increases
the max line length.  However, it increases memory
consumption, though that only matters on machines in the
sub-megabyte range.

JOVE can not handle NUL characters in the buffer.  In most cases,
they are discarded silently, another dubious feature.

JOVE does not handle Unicode (aka UTF-8), it silently ignores LANG,
locale etc.  Fixing this limitation is not easy.

Bug Reports and Maintenance.

Jonathan Payne no longer works on JOVE.

A group of JOVE maintainers supports the
github.com/jonmacs/jove releases and welcomes:

- help or success reports or issues with porting for additional systems

- bug reports (we may already have an explanation or fix)

- suggestions for and implementations of improvements or additional
  features (we do try to keep JOVE small)

See https://github.com/jonmacs/jove for JOVE updates.

A mailing list for discussions and mutual help amongst JOVE users exists
at jove-users _at_ freelists _DOT_ org


Jonathan's Own Version of Emacs (C89 Edition, for study and experiments)



Language:C 97.8%Language:Makefile 2.1%Language:Shell 0.1%