Extremely basic mode

This commit is contained in:
BirDt_ 2026-07-11 09:50:03 +08:00
commit ebb30679b8
3 changed files with 83 additions and 0 deletions

74
geiser-lips.el Normal file
View file

@ -0,0 +1,74 @@
;;; geiser-lips.el --- Interop between geiser and LIPS -*- lexical-binding: t -*-
;; This file is not part of GNU Emacs
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;; Code:
(require 'geiser-eval)
(require 'geiser)
(defgroup geiser-lips nil
"Customisations for geiser-lips."
:group 'geiser)
(defcustom geiser-lips-binary "lips"
"The path to the Lips interpreter binary."
:type 'string)
(defcustom geiser-lips-args '()
"Arguments to pass to the Lips interpreter."
:type '(list string))
(defun geiser-lips--parameters ()
"Return all args for the Lips interpreter."
geiser-lips-args)
(defun geiser-lips--exit-cmd ()
"Return the exit command."
"(exit)")
(defun geiser-lips--startup (remote)
"Startup function, potentially for REMOTE."
#t)
(defconst geiser-lips--prompt-rx "^")
(defconst geiser-lips--unsupported-procs
'("macroexpand" "completions" "module-completions" "find-file" "symbol-location"
"module-location" "symbol-documentation" "module-exports" "autodoc" "callers"
"callees" "generic-methods")
"All currently unsupported procedures.")
(defun geiser-lips--geiser-proc (proc &rest args)
"Send a string to the REPL to execute PROC with ARGS."
(let ((format (mapconcat #'identity args " ")))
(format "(eval '(geiser:%s %s))" proc args)))
(define-geiser-implementation lips
(binary geiser-lips-binary)
(arglist geiser-lips--parameters)
(exit-command geiser-lips--exit-cmd)
(repl-startup geiser-lips--startup)
(prompt-regexp geiser-lips--prompt-rx)
(unsupported-procedures geiser-lips--unsupported-procs)
(marshall-procedure geiser-lips--geiser-proc))
(provide 'geiser-lips)
;;; geiser-lips.el ends here