mark parameter

Use the mark parameter to query, set, or remove a named or unnamed mark.  A mark is a label that has been assigned to a contiguous portion of the document.  As the document is edited, the mark's location is maintained such that it stays with the text that it started on.

There are two types of marks, element marks and character marks.  Element marks have no column positions and refer only to complete elements.  Character marks have column positions and can refer to partial elements.  You can also specify whether a mark should be a sticky mark or not.  A sticky mark will expand if text is added immediately before or immediately after the mark.

 

Availability

query command
set command

 

Scope

The current view.

 

Syntax

query mark.[name | #id]
set mark.[name | #id] { clear
                      | [ sticky ] element [ element1 [ element2 ] ]
                      | [ sticky ] [ element1 [ column1 [ element2 [ column2 ] ] ] ]
                      } 

 

Parameters

name Use the name parameter to specify a new name or the name of an existing mark.  Names may contain any characters but spaces, and may not start with the # character.
id Use the id parameter to specify the id of an existing mark.  The id is a positive integer value which uniquely identifies a mark.
clear Use the clear parameter to remove the specified mark.
[ sticky ] element
[ element1 [ element2 ] ]
Specify the optional sticky parameter if you want this mark to expand if elements are added right after or right before the mark.  Use the element parameter to indicate that the mark should be created (or recreated) as an element mark.  Element marks refer only to complete elements.
Specify the optional parameters element1 and element2 to indicate the range of the element mark.  element1 and element2 must be positive integers and refer to element ordinal numbers.  If you do not specify element2, the mark is created with element1 as both the start and end of the mark.  If you do not specify element1 or element2, the mark is created with the current element as both the start and end of the mark.
[ sticky ]
[ element1 [ column1
[ element2 [ column2 ] ] ] ]
Specify the optional sticky parameter if you want this mark to expand if text is added immediately before or immediately after the mark.  If you do not specify any parameters, a character mark is created.  A character mark has a starting element with a starting column and ending element with an ending column.  By default the character mark is created with both its starting point and ending point at the current cursor position. 
If you only specify element1, the mark starts and ends at column 1 of the specified element.  If you only specify element1 and column1, the element starts and ends at the specified position.  If you only specify element1, column1, and element2, the mark starts at column1 of element1 and ends at column 1 of element2.

 

Description

If you do not specify a mark name or a mark id and you do not specify the clear option, you will create an unnamed mark.  You will only be able to refer to this unnamed mark by its id.  You may determine the mark's id by issuing "query markId." (notice the trailing period).  "query markId." will return the id of the last mark created.  If you do not specify a mark name or a mark id and you do specify the clear option, you will remove the last mark created.

 

Examples

query mark.test
set mark.test element 5 10
set mark.test sticky 1 1 1 1
set mark.test clear 

Related reference
locate command
query command
set command
headerMark parameter
markExcluded parameter
markExcludedHeader parameter
markHighlight parameter
markId parameter
markIncluded parameter
markProtect parameter
markStyle parameter
findMark action
findQuickMark action
nameMark action
setQuickMark action