diff --git a/README.org b/README.org index 7db1963..b5e4236 100644 --- a/README.org +++ b/README.org @@ -151,6 +151,12 @@ Syntax highlighting is currently off by default. To enable it, install ;; (setf *pygmentize-options* (list "-s" "-l" "lisp")) #+end_src +You can also switch it on and off from the REPL: + +#+BEGIN_SRC lisp +(setf sbcli:*syntax-highlighting* t) +#+end_src + # update the TOC with toc-org diff --git a/repl.lisp b/repl.lisp index 2691103..4c072ab 100755 --- a/repl.lisp +++ b/repl.lisp @@ -9,7 +9,8 @@ (defpackage :sbcli (:use :common-lisp :cffi :trivial-package-local-nicknames) (:export sbcli help what *repl-version* *repl-name* *prompt* *prompt2* *ret* *config-file* - *hist-file* *special* *last-result*)) + *hist-file* *special* *last-result* + *syntax-highlighting* *pygmentize* *pygmentize-options*)) (in-package :sbcli) diff --git a/utils.lisp b/utils.lisp index ff1c8aa..742e23c 100644 --- a/utils.lisp +++ b/utils.lisp @@ -32,11 +32,11 @@ bar:qux (which:which "pygmentize")))) (when pygmentize (with-input-from-string (s str) - (let ((proc (sb-ext:run-program pygmentize - *pygmentize-options* - :input s - :output :stream))) - (read-line (sb-ext:process-output proc) nil ""))))) + (let ((proc (uiop:launch-program (alexandria:flatten + (list pygmentize *pygmentize-options*)) + :input s + :output :stream))) + (read-line (uiop:process-info-output proc) nil ""))))) str)) (defun syntax-hl ()