From 4544bffbe94c4536678f072eecec7be5a0924660 Mon Sep 17 00:00:00 2001 From: mattwparas Date: Sun, 20 Aug 2023 09:34:07 -0700 Subject: [PATCH] extra stuff --- STEEL.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/STEEL.md b/STEEL.md index ebef4c811..480ead18f 100644 --- a/STEEL.md +++ b/STEEL.md @@ -70,6 +70,22 @@ to be used as typed commands. For example: ;; Adds the current file to git (define (git-add cx) (shell cx "git" "add" "%")) + + +;; Functions to assist with the above + +(define (editor-get-doc-if-exists editor doc-id) + (if (editor-doc-exists? editor doc-id) (editor->get-document editor doc-id) #f)) + +(define (current-path cx) + (let* ([editor (cx-editor! cx)] + [focus (editor-focus editor)] + [focus-doc-id (editor->doc-id editor focus)] + [document (editor-get-doc-if-exists editor focus-doc-id)]) + + (if document (Document-path document) #f))) + + ```