mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-06 02:30:42 -08:00
allow eval to console
This commit is contained in:
parent
46cda1c223
commit
a9d0ce3c43
4 changed files with 36 additions and 11 deletions
|
|
@ -4,8 +4,10 @@
|
|||
(let ((app (connection-data-item obj "builder-app-data")))
|
||||
(if (console-win app)
|
||||
(window-focus (console-win app))
|
||||
(let* ((win (on-open-file obj :title "CLOG Builder Console")))
|
||||
(let* ((win (on-open-file obj :title "CLOG Builder Console"
|
||||
:editor-use-console-for-evals t)))
|
||||
(set-on-window-close win (lambda (obj)
|
||||
(declare (ignore obj))
|
||||
(setf (console-win app) nil)))
|
||||
(setf (console-win app) win)))))
|
||||
|
||||
|
|
@ -25,12 +27,13 @@ provide an interactive console.)"))
|
|||
(setf (win stream) (on-open-console (clog-obj stream))))
|
||||
(unless (ace stream)
|
||||
(setf (ace stream) (window-param (win stream))))
|
||||
(js-execute (ace stream) (format nil "~A.insert(String.fromCharCode(~A))"
|
||||
(clog-ace::js-ace (ace stream))
|
||||
(char-code character)))
|
||||
(js-execute (ace stream) (format nil "~A.renderer.scrollToLine(Number.POSITIVE_INFINITY)"
|
||||
(clog-ace::js-ace (ace stream)))))
|
||||
|
||||
(clog-ace::js-ace (ace stream))))
|
||||
(js-execute (ace stream) (format nil "~A.navigateFileEnd()"
|
||||
(clog-ace::js-ace (ace stream))))
|
||||
(js-execute (ace stream) (format nil "~A.insert(String.fromCharCode(~A),true)"
|
||||
(clog-ace::js-ace (ace stream))
|
||||
(char-code character))))
|
||||
|
||||
(defmethod trivial-gray-streams:stream-line-column ((stream console-out-stream))
|
||||
nil)
|
||||
|
|
@ -138,4 +141,3 @@ provide an interactive console.)"))
|
|||
(open-browser :url (format nil "http://127.0.0.1:~A/test" *clog-port*))
|
||||
(open-window (window (connection-body obj)) "/test")))
|
||||
(on-open-file obj :title-class "w3-yellow" :title "test eval" :text result)))
|
||||
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@
|
|||
(title-class *builder-title-class*)
|
||||
lisp-package
|
||||
regex
|
||||
(editor-use-console-for-evals *editor-use-console-for-evals*)
|
||||
maximized)
|
||||
"Open a new text editor"
|
||||
(let ((win (window-to-top-by-title obj open-file)))
|
||||
|
|
@ -429,21 +430,33 @@
|
|||
(when (> cp p) (return lf)))
|
||||
(when lf
|
||||
(let ((result (capture-eval lf
|
||||
:capture-console (not editor-use-console-for-evals)
|
||||
:capture-result (not editor-use-console-for-evals)
|
||||
:clog-obj (connection-body obj)
|
||||
:eval-in-package (text-value pac-line))))
|
||||
(on-open-file obj :title-class "w3-blue" :title "form eval" :text result)))))
|
||||
(if editor-use-console-for-evals
|
||||
(on-open-console obj)
|
||||
(on-open-file obj :title-class "w3-blue" :title "form eval" :text result))))))
|
||||
(eval-selection (obj)
|
||||
(let ((val (clog-ace:selected-text ace)))
|
||||
(unless (equal val "")
|
||||
(let ((result (capture-eval val :clog-obj obj
|
||||
:capture-console (not editor-use-console-for-evals)
|
||||
:capture-result (not editor-use-console-for-evals)
|
||||
:eval-in-package (text-value pac-line))))
|
||||
(on-open-file obj :title-class "w3-blue" :title "selection eval" :text result)))))
|
||||
(if editor-use-console-for-evals
|
||||
(on-open-console obj)
|
||||
(on-open-file obj :title-class "w3-blue" :title "selection eval" :text result))))))
|
||||
(eval-file (obj)
|
||||
(let ((val (text-value ace)))
|
||||
(unless (equal val "")
|
||||
(let ((result (capture-eval val :clog-obj obj
|
||||
:capture-console (not editor-use-console-for-evals)
|
||||
:capture-result (not editor-use-console-for-evals)
|
||||
:eval-in-package (text-value pac-line))))
|
||||
(on-open-file obj :title-class "w3-blue" :title "file eval" :text result))))))
|
||||
(if editor-use-console-for-evals
|
||||
(on-open-console obj)
|
||||
(on-open-file obj :title-class "w3-blue" :title "file eval" :text result)))))))
|
||||
(set-on-click btn-esel (lambda (obj)
|
||||
(eval-selection obj)))
|
||||
(set-on-click m-esel (lambda (obj)
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
(defparameter *open-external-panels-in-popup* nil)
|
||||
;; Open panels as popups by default
|
||||
(defparameter *open-panels-as-popups* nil)
|
||||
;; Use console for evals instead of capture
|
||||
(defparameter *editor-use-console-for-evals* nil)
|
||||
;; Use emacs instead of the source-editor when openning external
|
||||
(defparameter *open-external-with-emacs* nil)
|
||||
;; Best Light Theme for Lisp
|
||||
|
|
|
|||
10
tools/preferences.lisp.sample
vendored
10
tools/preferences.lisp.sample
vendored
|
|
@ -1,7 +1,7 @@
|
|||
(in-package :clog-tools)
|
||||
|
||||
;; Add directories to use custom directoires for storing projects
|
||||
;; (pushnew #P"path/to/dir/of/projects" ql:*local-project-directories* :test #'equalp)
|
||||
;; (pushnew #P"/path/of/projects" ql:*local-project-directories* :test #'equalp)
|
||||
|
||||
;; Preferences loaded on next call to clog-tools:clog-builder or [Eval All]
|
||||
|
||||
|
|
@ -9,10 +9,18 @@
|
|||
(setf *open-external* nil)
|
||||
;; Open files in browser popups instead of tabs if browser allows
|
||||
(setf *open-external-in-popup* nil)
|
||||
|
||||
;; CLOG Panels
|
||||
|
||||
;; Open panel editors in browser popus instead of tabs if browser allows
|
||||
(setf *open-external-panels-in-popup* nil)
|
||||
;; Open panels as popups by default
|
||||
(setf *open-panels-as-popups* nil)
|
||||
|
||||
;; CLOG Source Editor
|
||||
|
||||
;; Use console for evals instead of capture
|
||||
(setf *editor-use-console-for-evals* nil)
|
||||
;; Use emacs instead of the source-editor when opening external
|
||||
;; must start builder for slime in emacs
|
||||
(setf *open-external-with-emacs* nil)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue