Index   File selector   File menu   Other menus

Command lines and the Edith Pro server

Command lines and the Edith Pro server

Most frequently, you will probably be starting Edith Pro/X11 simply by issuing a command like edith file from an xterm window. Everything you type following edith we will call the command line.

An Edith command line typically consists of a number of file names, optionally followed by a specification of a position within the file. Binary files can be opened by prefixing -b to the file name. To open a file or URL into a browser window, prefix -l to the name of the file or location.

A number of alternative ways of starting Edith is provided through a set of small programs (shell scripts): edivisual, edimore and ediman, whose purpose is to emulate more closely the interfaces of a number of conventional UNIX tools.

SYNOPSIS

edith [-name rsrc-name] [-display displayname] [-iconic] [-nofork] [ { file | -bbinary-file | -llocation } ... ]

edivisual file [+line-no]

edimore [file...]

ediman [section] name

OPTIONS

The following options can be put anywhere between the list of files.

-display, -iconic, -name
Equivalent to the standard X options
-cfile
Open file and do not return until its window is open; if used more than once on the same command line, only the first occurrence is interpreted.
-wfile
As -c, but wait for the user to finish editing the file and close its window. This corresponds to the way a standard Unix editor like vi, that doesn't run in the background, works.
-nofork
Don't use the client/server protocol; the use of this option is discouraged.

EXAMPLES

edith /home/wanda/.Xdefaults +35,-12
will open .Xdefaults in Wanda's home directory, mark the 35th line from the top of the file, the 12th line from the bottom of the file, and move to line 35.
edith .cshrc +/setenv/
will open the file .cshrc, and jump to the first occurrence of the word setenv in that file.
edith main.c:330
A colon has the same effect as a plus sign (but is immediately appended to the file name).
edith 'main.c:?draw_border?'
Opens file main.c and jumps to the last occurrence of draw_border in that file.
edith -ba.out
Opens file a.out into a binary editing window.
edith -lhttp://www.zfc.nl/
Opens a URL, in this case the ZFC home page.

Sequences like -c-lfile and -w-bfile are allowed.

These command lines can also be typed in Edith's file selector.

CLIENTS, SERVERS AND FORKS

The first time the Edith program is run on your X workstation or terminal, it will respond with a message like
   Starting Edith Pro server on display :0.
Even though the command will return as soon as one Edith window has been opened, the editor will continue to run on your display. On any subsequent times you call the Edith program, instead of starting another copy of the program, the newly run copy will consider itself a client, send a message to the copy that is already running (the server), and then exit.

This ensures that all Edith windows on an X display behave coherently; e.g. the panels for changing colours and fonts will apply to all active editor windows. It also helps to avoid editing the same file twice in different windows.

If you want to use Edith as a standard editor, you will want other applications to run it, like a mailer program. These programs usually call an editor and assume it will not terminate before the user finished editing the file. Therefore Edith provides the command line option -wfile, which will cause the program to wait until the window for the file following -w is closed. Meanwhile, other files can be edited as usual.

Use the special shell script edivisual for installing Edith as a default editor; it is equivalent in synopsis to the vi editor, and in fact, if the DISPLAY variable is not set, e.g. because you are working from a telnet or modem connection, it will run vi instead, or whatever editor is pointed to by the environment variable EDITOR. edivisual makes use of the -w option. Another shell script called edimore is the counterpart of more, or whatever pages is pointed to by the PAGER variable; it makes use of the command line option -c which before exiting merely checks that the Edith server has loaded the file. ediman corresponds to man; edigrep to fgrep.

If you are sharing an X display between more than one user, you may have problems with file permissions, as the Edith server is started by user 1, and subsequent edith calls by user 2 will be sent to the server started by user 1, which does not have full permissions for user 2's files. There are two solutions to this problem. The first is to give each user's copy of Edith a different resource name. To do this, put the following lines in the different user's .cshrc (or similar) files:

/home/user1/.cshrc:
alias edith 'edith -name edithUser1'
/home/user2/.cshrc:
alias edith 'edith -name edithUser2'

A more rigorous, discouraged approach is to disable the client-server protocol by specifying the command line option -nofork.


Index   File selector   File menu   Other menus