mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-06 02:30:42 -08:00
lisp eval for file and copy-buf
This commit is contained in:
parent
04e73eb80e
commit
777d81f6b6
2 changed files with 28 additions and 0 deletions
|
|
@ -194,6 +194,25 @@
|
||||||
(html-id (current-win app))
|
(html-id (current-win app))
|
||||||
(escape-string (copy-buf app))))))
|
(escape-string (copy-buf app))))))
|
||||||
|
|
||||||
|
(defun do-ide-lisp-eval-buf (obj)
|
||||||
|
(let* ((app (connection-data-item obj "app-data"))
|
||||||
|
(form (copy-buf app))
|
||||||
|
(result (eval (read-from-string form))))
|
||||||
|
(do-ide-file-new obj)
|
||||||
|
(js-execute obj (format nil "editor_~A.setValue('~A')"
|
||||||
|
(html-id (current-win app))
|
||||||
|
(escape-string result)))))
|
||||||
|
|
||||||
|
(defun do-ide-lisp-eval-file (obj)
|
||||||
|
(let* ((app (connection-data-item obj "app-data"))
|
||||||
|
(form (js-query obj (format nil "editor_~A.getValue()"
|
||||||
|
(html-id (current-win app)))))
|
||||||
|
(result (eval (read-from-string form))))
|
||||||
|
(do-ide-file-new obj)
|
||||||
|
(js-execute obj (format nil "editor_~A.setValue('~A')"
|
||||||
|
(html-id (current-win app))
|
||||||
|
(escape-string result)))))
|
||||||
|
|
||||||
(defun on-new-window (body)
|
(defun on-new-window (body)
|
||||||
(let ((app (make-instance 'app-data)))
|
(let ((app (make-instance 'app-data)))
|
||||||
(setf (connection-data-item body "app-data") app)
|
(setf (connection-data-item body "app-data") app)
|
||||||
|
|
@ -206,6 +225,8 @@
|
||||||
(set-on-click (attach-as-child body "ide-edit-copy") #'do-ide-edit-copy)
|
(set-on-click (attach-as-child body "ide-edit-copy") #'do-ide-edit-copy)
|
||||||
(set-on-click (attach-as-child body "ide-edit-cut") #'do-ide-edit-cut)
|
(set-on-click (attach-as-child body "ide-edit-cut") #'do-ide-edit-cut)
|
||||||
(set-on-click (attach-as-child body "ide-edit-paste") #'do-ide-edit-paste)
|
(set-on-click (attach-as-child body "ide-edit-paste") #'do-ide-edit-paste)
|
||||||
|
(set-on-click (attach-as-child body "ide-lisp-eval-buf") #'do-ide-lisp-eval-buf)
|
||||||
|
(set-on-click (attach-as-child body "ide-lisp-eval-file") #'do-ide-lisp-eval-file)
|
||||||
(set-on-click (attach-as-child body "ide-help-about") #'do-ide-help-about)
|
(set-on-click (attach-as-child body "ide-help-about") #'do-ide-help-about)
|
||||||
(run body)))
|
(run body)))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,13 @@
|
||||||
<span id="ide-edit-paste" class="w3-bar-item w3-button">Paste</span>
|
<span id="ide-edit-paste" class="w3-bar-item w3-button">Paste</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="w3-dropdown-hover">
|
||||||
|
<button class="w3-button">Lisp</button>
|
||||||
|
<div class="w3-dropdown-content w3-bar-block w3-card-4">
|
||||||
|
<span id="ide-lisp-eval-buf" class="w3-bar-item w3-button">Eval Copy Buffer</span>
|
||||||
|
<span id="ide-lisp-eval-file" class="w3-bar-item w3-button">Eval Current File</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="w3-dropdown-hover">
|
<div class="w3-dropdown-hover">
|
||||||
<button class="w3-button">Help</button>
|
<button class="w3-button">Help</button>
|
||||||
<div class="w3-dropdown-content w3-bar-block w3-card-4">
|
<div class="w3-dropdown-content w3-bar-block w3-card-4">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue