next: Remove shell demo.

master
Pierre Neidhardt 2019-09-10 17:16:19 +02:00
parent a209a2db5b
commit 8d38b82d56
1 changed files with 0 additions and 48 deletions

View File

@ -108,51 +108,3 @@
(with-result (url (buffer-get-url))
(uiop:run-program (list "mpv" url))))
(define-key "C-M-c v" 'play-video-in-current-page)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-mode shell-mode ()
"A basic shell prompt."
((keymap-schemes
:initform
(let ((map (make-keymap)))
(define-key :keymap map
"c" 'run-shell-command
"k" 'clear-shell)
(list :emacs map
:vi-normal map)))))
(define-parenscript clear-shell-output ()
(setf (ps:chain document body inner-h-t-m-l) ""))
(define-command clear-shell (shell-mode)
"Clear the output in the shell buffer."
(rpc-buffer-evaluate-javascript
*interface* (active-buffer *interface*)
(clear-shell-output)))
(define-parenscript append-output (output)
(setf (ps:chain document body inner-h-t-m-l)
(ps:chain document body inner-h-t-m-l
(concat (ps:lisp
(format nil "<pre><code>~a</code></pre><br/>" output))))))
(define-command run-shell-command (shell-mode)
"Run a shell command."
(with-result
(input (read-from-minibuffer
(minibuffer *interface*)
:input-prompt "Run in shell:"))
(rpc-buffer-evaluate-javascript
*interface* (active-buffer *interface*)
(append-output
:output
(uiop:run-program input :force-shell t :output :string)))))
(define-command shell ()
"Open a shell buffer."
(set-active-buffer *interface*
(make-buffer :name "*shell*"
:default-modes (cons 'shell-mode
(get-default 'buffer 'default-modes)))))
(define-key "C-x s" #'shell)