shell-maker
is a convenience wrapper around comint mode.
For related packages, see:
- dall-e-shell: An Emacs shell for OpenAI’s DALL-E.
- chatgpt-shell: An Emacs shell for OpenAI’s ChatGPT.
A basic shell implementation looks as follows:
(require 'map)
(require 'shell-maker)
(defvar greeter-shell--config
(make-shell-maker-config
:name "Greeter"
:execute-command
(lambda (command shell)
(funcall (map-elt shell :write-output)
(format "Hello \"%s\"." command))
(funcall (map-elt shell :finish-output) t))))
(defun greeter-shell ()
"Start a Greeter shell."
(interactive)
(shell-maker-start greeter-shell--config))
Invoke shell
’s :write-output as many times as needed to stream responses.
(require 'map)
(require 'shell-maker)
(defvar greeter-shell--config
(make-shell-maker-config
:name "Greeter"
:execute-command
(lambda (command shell)
(mapc (lambda (char)
(sit-for 0.008)
(funcall (map-elt shell :write-output)
(format "%c" char)))
(format "Hello \"%s\". Nice to see you again!
It's been %d days since I last saw you."
command (random 30)))
(funcall (map-elt shell :finish-output) t))))
(defun greeter-shell ()
"Start a Greeter shell."
(interactive)
(shell-maker-start greeter-shell--config))
👉 Find my work useful? Support this work via GitHub Sponsors or buy my iOS apps.
- Blog (xenodium.com)
- Blog (lmno.lol/alvaro)
- Plain Org (iOS)
- Flat Habits (iOS)
- Scratch (iOS)
- macosrec (macOS)
- Fresh Eyes (macOS)
- dwim-shell-command (Emacs)
- company-org-block (Emacs)
- org-block-capf (Emacs)
- ob-swiftui (Emacs)
- chatgpt-shell (Emacs)
- ready-player (Emacs)
- sqlite-mode-extras
- ob-chatgpt-shell (Emacs)
- dall-e-shell (Emacs)
- ob-dall-e-shell (Emacs)
- shell-maker (Emacs)