The [mark] command.

Introduction

The mark command lets you manipulate the marks in a document window.
The window can be specified by the -w option. If this option is not present, the command applies to the currently active document window.
There are two kinds of marks: In all the commands below, the temporary marks are specified with the -temp option. If this option is not specified, the commands apply to the user marks.

Synopsis

The formal syntax of the [mark] command is:
mark subcommand ?options?
The possible subcommands are described below. Depending on the subcommand, some options may be specified.

The [add] subcommand

This subcommand creates a new mark. The complete syntax is:
    mark add ?-w win? ?-temp? ?--? ?name disp? ?start? ?end?
If there is already a mark with the same name, it is replaced by the new one. The disp argument is the character position of the start of the first line to be displayed, while start and end bracket the text to be selected. If start and end are not specified, they are equal to disp by default; if only end is unspecified, it is equal to start.
When the command is used without any arguments (except possibly the -w option), a sheet window is displayed and the user is asked to enter the name of a new mark created at the current position. In this form, the command is asynchronous and should not be used in a Tcl script.
The -- argument indicates the end of the options.

The [clear] subcommand

This subcommand lets you clear the marks list of a given document. The complete syntax is:
    mark clear ?-w win? ?-temp?

The [count] subcommand

This subcommand returns the number of marks currently defined. The complete syntax is:
    mark count ?-w win? ?-temp?

The [goto] subcommand

This subcommand lets you jump to the specified mark. The complete syntax is:
    mark goto ?-w win? ?-temp? ?--? ?name?
When the command is used without any arguments (except possibly the -w option), a sheet window is displayed and the user is asked to enter the name of a target mark. In this form, the command is asynchronous and should not be used in a Tcl script.
The -- argument indicates the end of the options.

The [list] subcommand

This subcommand returns a list of currently defined marks. The complete syntax is:
    mark list ?-w win? ?-temp? ?-n?
Marks are returned in the order in which they were created with the [mark add] command. The -n option means that only mark names are returned, without the associated positions. Otherwise, the command returns a list of sublists: each sublist contains the name of a mark and its three associated positions (disp, start, end as explained with the [mark add] command).

The [pos] subcommand

This subcommand returns the positions associated with the specified mark. The complete syntax is:
    mark pos ?-w win? ?-temp? ?--? name
There are three positions (disp, start, end) which have the same meaning as with the [mark add] command.
The -- argument indicates the end of the options.

The [remove] subcommand

This subcommand removes a mark. The complete syntax is:
    mark remove ?-w win? ?-temp? ?--? ?name?
If there is no mark with the specified name, nothing happens.
When the command is used without any arguments (except possibly the -w option), a sheet window is displayed and the user is asked to enter the name of a mark to remove. In this form, the command is asynchronous and should not be used in a Tcl script.
The -- argument indicates the end of the options.

Examples



Last updated 2021-02-25 12:58:19