Function
Shell.Editor.Custom
val addConnectDialog: (string * string * string list) -> unitSyntax:
addConnectDialog (name, dialog-name, commands) -> ()
()
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"
"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"
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 %
.