Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
arnoudbuzing committed Feb 13, 2018
1 parent fc1070a commit 056e5fa
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
24 changes: 24 additions & 0 deletions Prototypes/FrontEnd.wl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,30 @@ FrontEndExecute[
Global`MenuKey["/", Global`Modifiers -> {"Command"}]]}]]


QuickSearch[] := DynamicModule[{index, input = "", result = ConstantArray["",5], type},
index = SearchIndexObject["NotebookIndex"];
Column[{
InputField[Dynamic[input], String, ContinuousAction -> True],
Dynamic[
If[input =!= "",
result = TextSearch[index, input, MaxItems -> 5];
If[ result =!= $Failed,
result = result[All];
result = Map[
Function[
type = Part[FileNameSplit[#["ReferenceLocation"]], -2];
Row[{type, " ", Hyperlink[#["Title"], #["ReferenceLocation"]]}] ],
result
];
result = PadRight[result,5,""],
result = ConstantArray["",5]
];
Column[result]
]]
}]
]


BoxSyntaxQ[boxes_,form_:StandardForm] := Not[MatchQ[MakeExpression[boxes, form],_ErrorBox]]

(*
Expand Down
3 changes: 2 additions & 1 deletion Prototypes/PacletInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@
"Prototypes`Penultimate",
"Prototypes`Antepenultimate",
"Prototypes`ElapsedTime",
"Prototypes`CreateNotebookIndex"
"Prototypes`CreateNotebookIndex",
"Prototypes`QuickSearch"
},
Context -> {"Prototypes`"} }
}
Expand Down
2 changes: 1 addition & 1 deletion Prototypes/Prototypes.wl
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Antepenultimate::usage = "Antepenultimate[expr] gives Part[expr,-3]";
ElapsedTime::usage = "ElapsedTime[unit,expr] evaluates 'expr' and returns the elapsed time in the specified unit";

CreateNotebookIndex::usage = "CreateNotebookIndex[] creates a SearchIndexObject of all notebooks located in $InstallationDirectory";

QuickSearch::usage = "QuickSearch[] provides a quick interactive way to search all notebooks under $InstallationDirectory. You need to run CreateNotebookIndex[] once before using this function";
Begin["`Private`"];

(* general extensions *)
Expand Down

0 comments on commit 056e5fa

Please sign in to comment.