src/Pure/PIDE/sendback.ML
author wenzelm
Wed, 28 Nov 2012 16:07:17 +0100
changeset 50253 41fd9f68614b
parent 50215 97959912840a
permissions -rw-r--r--
clarified new identifier syntax: exclude \<^isup>, include subscripted prime (to allow imitating full identifier here);
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50163
c62ce309dc26 more abstract Sendback operations, with explicit id/exec_id properties;
wenzelm
parents:
diff changeset
     1
(*  Title:      Pure/PIDE/sendback.ML
c62ce309dc26 more abstract Sendback operations, with explicit id/exec_id properties;
wenzelm
parents:
diff changeset
     2
    Author:     Makarius
c62ce309dc26 more abstract Sendback operations, with explicit id/exec_id properties;
wenzelm
parents:
diff changeset
     3
c62ce309dc26 more abstract Sendback operations, with explicit id/exec_id properties;
wenzelm
parents:
diff changeset
     4
Clickable "sendback" areas within the source text (see also
c62ce309dc26 more abstract Sendback operations, with explicit id/exec_id properties;
wenzelm
parents:
diff changeset
     5
Tools/jEdit/src/sendback.scala).
c62ce309dc26 more abstract Sendback operations, with explicit id/exec_id properties;
wenzelm
parents:
diff changeset
     6
*)
c62ce309dc26 more abstract Sendback operations, with explicit id/exec_id properties;
wenzelm
parents:
diff changeset
     7
c62ce309dc26 more abstract Sendback operations, with explicit id/exec_id properties;
wenzelm
parents:
diff changeset
     8
signature SENDBACK =
c62ce309dc26 more abstract Sendback operations, with explicit id/exec_id properties;
wenzelm
parents:
diff changeset
     9
sig
50215
97959912840a more general sendback properties;
wenzelm
parents: 50212
diff changeset
    10
  val make_markup: {implicit: bool, properties: Properties.T} -> Markup.T
50212
4fb06c22c5ec tuned signature;
wenzelm
parents: 50201
diff changeset
    11
  val markup_implicit: string -> string
50163
c62ce309dc26 more abstract Sendback operations, with explicit id/exec_id properties;
wenzelm
parents:
diff changeset
    12
  val markup: string -> string
c62ce309dc26 more abstract Sendback operations, with explicit id/exec_id properties;
wenzelm
parents:
diff changeset
    13
end;
c62ce309dc26 more abstract Sendback operations, with explicit id/exec_id properties;
wenzelm
parents:
diff changeset
    14
c62ce309dc26 more abstract Sendback operations, with explicit id/exec_id properties;
wenzelm
parents:
diff changeset
    15
structure Sendback: SENDBACK =
c62ce309dc26 more abstract Sendback operations, with explicit id/exec_id properties;
wenzelm
parents:
diff changeset
    16
struct
c62ce309dc26 more abstract Sendback operations, with explicit id/exec_id properties;
wenzelm
parents:
diff changeset
    17
50215
97959912840a more general sendback properties;
wenzelm
parents: 50212
diff changeset
    18
fun make_markup {implicit, properties} =
97959912840a more general sendback properties;
wenzelm
parents: 50212
diff changeset
    19
  Markup.sendback
97959912840a more general sendback properties;
wenzelm
parents: 50212
diff changeset
    20
  |> not implicit ? (fn markup =>
97959912840a more general sendback properties;
wenzelm
parents: 50212
diff changeset
    21
      let
97959912840a more general sendback properties;
wenzelm
parents: 50212
diff changeset
    22
        val props =
97959912840a more general sendback properties;
wenzelm
parents: 50212
diff changeset
    23
          (case Position.get_id (Position.thread_data ()) of
97959912840a more general sendback properties;
wenzelm
parents: 50212
diff changeset
    24
            SOME id => [(Markup.idN, id)]
97959912840a more general sendback properties;
wenzelm
parents: 50212
diff changeset
    25
          | NONE => []);
97959912840a more general sendback properties;
wenzelm
parents: 50212
diff changeset
    26
      in Markup.properties props markup end)
97959912840a more general sendback properties;
wenzelm
parents: 50212
diff changeset
    27
  |> Markup.properties properties;
50163
c62ce309dc26 more abstract Sendback operations, with explicit id/exec_id properties;
wenzelm
parents:
diff changeset
    28
50215
97959912840a more general sendback properties;
wenzelm
parents: 50212
diff changeset
    29
fun markup_implicit s = Markup.markup (make_markup {implicit = true, properties = []}) s;
97959912840a more general sendback properties;
wenzelm
parents: 50212
diff changeset
    30
fun markup s = Markup.markup (make_markup {implicit = false, properties = []}) s;
50164
77668b522ffe some support for implicit senback, meaning that it uses the caret position instead of explicit command exec_id;
wenzelm
parents: 50163
diff changeset
    31
50163
c62ce309dc26 more abstract Sendback operations, with explicit id/exec_id properties;
wenzelm
parents:
diff changeset
    32
end;
c62ce309dc26 more abstract Sendback operations, with explicit id/exec_id properties;
wenzelm
parents:
diff changeset
    33