src/Pure/Tools/jedit.ML
changeset 63681 d2448471ffba
parent 63680 6e1e8b5abbfa
child 66670 e5188cb1c3d8
equal deleted inserted replaced
63680:6e1e8b5abbfa 63681:d2448471ffba
    51     Lazy.force jedit_actions);
    51     Lazy.force jedit_actions);
    52 
    52 
    53 in
    53 in
    54 
    54 
    55 fun check_action (name, pos) =
    55 fun check_action (name, pos) =
    56   if member (op =) (Lazy.force all_actions) name then name
    56   if member (op =) (Lazy.force all_actions) name then
       
    57     let
       
    58       val ((bg1, bg2), en) =
       
    59         YXML.output_markup_elem
       
    60           (Active.make_markup Markup.jedit_actionN {implicit = false, properties = []});
       
    61       val msg = "Invoke " ^ bg1 ^ name ^ bg2 ^ name ^ en ^ " jEdit action";
       
    62     in writeln (msg ^ Position.here pos); name end
    57   else
    63   else
    58     let
    64     let
    59       val completion =
    65       val completion =
    60         Completion.make (name, pos)
    66         Completion.make (name, pos)
    61           (fn completed =>
    67           (fn completed =>
    64             |> sort_strings
    70             |> sort_strings
    65             |> map (fn a => (a, ("action", a))));
    71             |> map (fn a => (a, ("action", a))));
    66       val report = Markup.markup_report (Completion.reported_text completion);
    72       val report = Markup.markup_report (Completion.reported_text completion);
    67     in error ("Bad jEdit action " ^ quote name ^ Position.here pos ^ report) end
    73     in error ("Bad jEdit action " ^ quote name ^ Position.here pos ^ report) end
    68 
    74 
       
    75 val _ =
       
    76   Theory.setup
       
    77     (Thy_Output.antiquotation @{binding action} (Scan.lift (Parse.position Parse.embedded))
       
    78       (fn {context = ctxt, ...} => fn (name, pos) =>
       
    79        (if Context_Position.is_reported ctxt pos then ignore (check_action (name, pos)) else ();
       
    80         Thy_Output.verbatim_text ctxt name)));
       
    81 
    69 end;
    82 end;
    70 
    83 
    71 end;
    84 end;