REPL: highlighting sb-ext -> uiop

This commit is contained in:
vindarel 2020-10-28 12:50:39 +01:00
parent f75e29f4c2
commit fa79625d50
3 changed files with 13 additions and 6 deletions

View file

@ -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

View file

@ -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)

View file

@ -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 ()