Skip to content

Commit 056e5fa

Browse files
committed
updates
1 parent fc1070a commit 056e5fa

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

Prototypes/FrontEnd.wl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,30 @@ FrontEndExecute[
2323
Global`MenuKey["/", Global`Modifiers -> {"Command"}]]}]]
2424

2525

26+
QuickSearch[] := DynamicModule[{index, input = "", result = ConstantArray["",5], type},
27+
index = SearchIndexObject["NotebookIndex"];
28+
Column[{
29+
InputField[Dynamic[input], String, ContinuousAction -> True],
30+
Dynamic[
31+
If[input =!= "",
32+
result = TextSearch[index, input, MaxItems -> 5];
33+
If[ result =!= $Failed,
34+
result = result[All];
35+
result = Map[
36+
Function[
37+
type = Part[FileNameSplit[#["ReferenceLocation"]], -2];
38+
Row[{type, " ", Hyperlink[#["Title"], #["ReferenceLocation"]]}] ],
39+
result
40+
];
41+
result = PadRight[result,5,""],
42+
result = ConstantArray["",5]
43+
];
44+
Column[result]
45+
]]
46+
}]
47+
]
48+
49+
2650
BoxSyntaxQ[boxes_,form_:StandardForm] := Not[MatchQ[MakeExpression[boxes, form],_ErrorBox]]
2751

2852
(*

Prototypes/PacletInfo.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@
7878
"Prototypes`Penultimate",
7979
"Prototypes`Antepenultimate",
8080
"Prototypes`ElapsedTime",
81-
"Prototypes`CreateNotebookIndex"
81+
"Prototypes`CreateNotebookIndex",
82+
"Prototypes`QuickSearch"
8283
},
8384
Context -> {"Prototypes`"} }
8485
}

Prototypes/Prototypes.wl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Antepenultimate::usage = "Antepenultimate[expr] gives Part[expr,-3]";
8989
ElapsedTime::usage = "ElapsedTime[unit,expr] evaluates 'expr' and returns the elapsed time in the specified unit";
9090

9191
CreateNotebookIndex::usage = "CreateNotebookIndex[] creates a SearchIndexObject of all notebooks located in $InstallationDirectory";
92-
92+
QuickSearch::usage = "QuickSearch[] provides a quick interactive way to search all notebooks under $InstallationDirectory. You need to run CreateNotebookIndex[] once before using this function";
9393
Begin["`Private`"];
9494

9595
(* general extensions *)

0 commit comments

Comments
 (0)