Next Previous Up Top Contents Index

4.8 Editor support: The Editor structure

addConnectDialog

Function

Structure

Shell.Editor.Custom

Type

val addConnectDialog: (string * string * string list) -> unit

Syntax:

addConnectDialog (name, dialog-name, commands) -> ()

Arguments

name
A name to be associated with a dialog.

dialog-name
A dialog name.

commands
A list of editing commands.

Values

()

Description

Associates the name name with the editor connect-dialog dialog-name and with a list of editing commands commands. The value of dialog-name can be either "Emacs" for Emacs or "DDE" for DDE.

"Emacs"
UNIX only. Used for connecting GNU-Emacs-style editors via a sockets mechanism. Despite being called "Emacs", this socket-based dialog provides a general way to talk to editors. However, only a few editors can accept commands in this way.

If the ordinary Emacs server behavior does not quite meet your needs, you could change specify a different dialog string. To use this method you must still set up a copy of Emacs to be a server, using the procedure described in Chapter 1 of the MLWorks User's Guide.

"DDE"
Windows only. Uses the "execute string" form of Dynamic Data Exchange to allow editors to be controlled remotely.

Example

The connect dialog for an Emacs server could be defined by:

let
 val find_file = "(find-file \"%f\")"
 val goto_line = "(goto-line %sl)"
 val fwd_char  = "(forward-char %sc)"
 val highlight = "(mlworks-highlight %sl %sc %el %ec)"
 val raise_win = "(raise-this-window)"
 val full_dialog  = [find_file, goto_line, fwd_char,
           highlight, raise_win]
in
 Shell.Editor.Custom.addConnectDialog("My Emacs",
                  "Emacs",
                  full_dialog)
end

The Windows editor PFE could be defined by:

let
 val DDE_service = "PFE32"
 val DDE_topic   = "Editor"
 val file_open   = "[FileOpen(\"%f\")]"
 val file_visit  = "[FileVisit(\"%f\")]"
 val goto_line   = "[EditGotoLine(%sl,0)]"
 val fwd_char    = "[CaretRight(%sc,0)]"
 val highlight   =
      "[EditGotoLine(%el,1)][CaretRight(%ec,1)]"
 val edit_dialog = [file_open, goto_line, fwd_char,
          highlight]
 val DDE_dialog  =
        DDE_service :: DDE_topic :: edit_dialog
in
 Shell.Editor.Custom.addConnectDialog("PFE32",
                  "DDE",
                  DDE_dialog)
end

Connect dialog strings can use the following codes:

%f

A filename.

%l and %sl

Starting line number.

%c and %sc

Starting character number.

%el

Ending line number.

%ec

Ending character number.

Use %% for the literal %.


MLWorks Reference Manual version 2.0 - 29 Jul 1998

Next Previous Up Top Contents Index

Generated with Harlequin WebMaker