Skip to content

Commit 08cc7d8

Browse files
authored
added doc strings to popup menu functions and lem-process:run-process
* added doc strings to popup menu functions * added documentation for lem-process:run-process * updated formatting * fixed typo
1 parent 58b33b1 commit 08cc7d8

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

extensions/process/process.lisp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,25 @@
2525
:reader process-output-callback-type)))
2626

2727
(defun run-process (command &key name output-callback output-callback-type directory)
28+
"Runs an external program as a separate thread.
29+
- `command`: can simply be a string naming the command to run. If you need to
30+
pass arguments to the command, then `command` must be a list of strings. Each string will be its own
31+
arg. These args are not parsed by a shell, so you cannot combine tokens, such as a flag and its value.
32+
33+
for example, `find ~ -iname \"lem\"` would be represented as
34+
'(\"find\" \"~\" \"-iname\" \"\\\"lem\\\"\")
35+
36+
- `name`: You can supply a detailed name. The command name is used by default.
37+
38+
- `output-callback`: if `output-callback-type` is `:process-input`, then `output-callback`
39+
must be a function with the lambda list `(process string)`. Otherwise, it must only take
40+
a single argument (string). This is called whenever the process sends input to its stdout.
41+
The process output can also be retrieved by `lem-process:get-process-output-string`.
42+
43+
- `output-callback-type`: If set to `:process-input`, `output-callback` takes `(process string)`.
44+
otherwise, it takes `(string)`
45+
46+
- `directory`: Specifies where to look for `command`. if not specified, PATH is used."
2847
(setf command (uiop:ensure-list command))
2948
(let ((buffer-stream (make-string-output-stream)))
3049
(let* ((pointer (async-process:create-process command :nonblock nil :directory directory))

src/ext/popup-menu.lisp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
(make-line-overlay point focus-attribute))
3636

3737
(defun update-focus-overlay (popup-menu point)
38-
+ "Refresh the focus highlight so it tracks POINT in POPUP-MENU.
39-
+Deletes any previous overlay, clears stray overlays, and creates a new
40-
+focus overlay unless POINT is on the header line."
38+
"Refresh the focus highlight so it tracks POINT in POPUP-MENU.
39+
Deletes any previous overlay, clears stray overlays, and creates a new
40+
focus overlay unless POINT is on the header line."
4141
(alexandria:when-let ((focus-overlay (popup-menu-focus-overlay popup-menu)))
4242
(delete-overlay focus-overlay))
4343
(clear-overlays (popup-menu-buffer popup-menu))
@@ -49,6 +49,8 @@
4949
(:method (print-spec point)))
5050

5151
(defgeneric apply-print-spec (print-spec point item)
52+
(:documentation "Applies the function `print-spec` to an `item` at `point`. Typically this
53+
will get the string representation of `item` and insert it at `point` (the default method implemented below)")
5254
(:method ((print-spec function) point item)
5355
(let ((string (funcall print-spec item)))
5456
(insert-string point string))))

src/popup.lisp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@
3838
print-spec
3939
style
4040
max-display-items)
41+
"Creates a popup-menu at the cursor position and displays it. Used for things
42+
such as completions.
43+
44+
- `items`: is a list of anything, but print-spec must be able to turn it into a string.
45+
- `action-callback`: function taking an item (from `items`) as a parameter. It is run once an item is selected.
46+
- `print-spec`: A function taking an `item` as a paremeter and returns it's string representation.
47+
- `style`: No Documentation
48+
- `max-display-items`: integer limiting the number of items that can be displayed at once."
4149
(declare (ignore action-callback print-spec style max-display-items))
4250
(apply #'lem-if:display-popup-menu (implementation)
4351
items

0 commit comments

Comments
 (0)