@@ -4,8 +4,17 @@ const childProcess = require("child_process");
44const path = require ( "path" ) ;
55
66
7+ /**
8+ * Singleton class which manages the package's lifecycle.
9+ * @hideconstructor
10+ * @class
11+ */
712class EmacsLisp {
813
14+ /**
15+ * Register the package's commands with Atom.
16+ * @internal
17+ */
918 activate ( ) {
1019 const target = "atom-text-editor" ;
1120
@@ -29,12 +38,9 @@ class EmacsLisp{
2938 /**
3039 * Evaluate a string of Emacs Lisp code.
3140 *
32- * Returns a {Promise} that resolves to the stringified output.
33- *
34- * @public
3541 * @example eval("(+ 5 5)") -> "10"
3642 * @param {String } text
37- * @return {Promise }
43+ * @return {Promise } Resolves with collected output.
3844 */
3945 eval ( text ) {
4046 return new Promise ( ( resolve , reject ) => {
@@ -62,11 +68,9 @@ class EmacsLisp{
6268 /**
6369 * Run a Lisp file in Emacs.
6470 *
65- * Returns a {Promise} with the script's output, if any.
66- *
67- * @public
71+ * @example runFile("~/.emacs.d/lisp/script.el")
6872 * @param {String } file - Path to file
69- * @return {Promise }
73+ * @return {Promise } Resolves with the script's output, if any.
7074 */
7175 runFile ( file ) {
7276 return new Promise ( ( resolve , reject ) => {
@@ -92,7 +96,7 @@ class EmacsLisp{
9296 *
9397 * @param {String } text
9498 * @param {Boolean } error
95- * @private
99+ * @internal
96100 */
97101 showOutput ( text , error = false ) {
98102 const msg = "**Emacs:** " + text ;
@@ -106,30 +110,31 @@ class EmacsLisp{
106110 /**
107111 * Retrieve an editor's currently-selected text.
108112 *
109- * If nothing's selected, the scope enclosing the cursor's current
110- * position is selected and returned instead.
113+ * If nothing's selected, the scope enclosing the cursor's
114+ * current position is selected and returned instead.
111115 *
112116 * @param {TextEditor } ed - Defaults to current editor
113- * @private
117+ * @return {String }
118+ * @internal
114119 */
115120 getSelection ( ed ) {
116121 ed = ed || atom . workspace . getActiveTextEditor ( ) ;
117- if ( ! ed ) return ;
122+ if ( ! ed ) return "" ;
118123 let text = ed . getSelectedText ( ) ;
119124
120- /** If the user hasn't made a selection, make one for 'em */
125+ // If the user hasn't made a selection, make one for 'em
121126 if ( ! text ) {
122127 if ( atom . packages . activePackages [ "bracket-matcher" ] ) {
123128 atom . commands . dispatch ( ed . editorElement , "bracket-matcher:select-inside-brackets" ) ;
124129
125- /** Select containing brackets too */
130+ // Select containing brackets too
126131 let range = ed . getSelectedBufferRange ( ) ;
127132 -- range . start . column ;
128133 ++ range . end . column ;
129134 ed . setSelectedBufferRange ( range ) ;
130135 }
131136
132- /** Fallback if bracket-matcher isn't available */
137+ // Fallback if bracket-matcher isn't available
133138 else ed . selectWordsContainingCursors ( ) ;
134139
135140 text = ed . getSelectedText ( ) ;
0 commit comments