Rebol Programming/editor

From Wikibooks, open books for an open world
Jump to navigation Jump to search

USAGE:[edit | edit source]

EDITOR file /app app-word 

DESCRIPTION:[edit | edit source]

(undocumented)

EDITOR is a function value.

ARGUMENTS[edit | edit source]

  • file -- (Type: any)

REFINEMENTS[edit | edit source]

  • /app
    • app-word -- (Type: any)

SOURCE CODE[edit | edit source]

editor: func [file /app app-word /local tmp][
    either link? [
        if block? ctx-edit [
            ctx-edit: context either all [
                value? 'fileset-files? 
                tmp: fileset-files? 'desktop 
                find tmp %desktop/edit.r 
                tmp: load/header link-root/desktop/edit.r
            ] [next tmp] [ctx-edit]
        ] 
        either app [ctx-edit/view-file/app file app-word] [ctx-edit/view-file file]
    ] [
        either exists? tmp: view-root/desktop/scripts/edit.r [do/args tmp file] [
            if block? ctx-edit [ctx-edit: context ctx-edit] 
            ctx-edit/view-file file
        ]
    ]
]