From 956ec5ff543e9a0fcb3b3ceb339bb1e21c39719e Mon Sep 17 00:00:00 2001 From: jao Date: Fri, 12 Aug 2022 16:01:37 +0100 Subject: geiser-repl: new variables startup-hook and startup-forms See discussion in issue #48. --- elisp/geiser-repl.el | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'elisp/geiser-repl.el') diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el index 3ce191f..897a17b 100644 --- a/elisp/geiser-repl.el +++ b/elisp/geiser-repl.el @@ -1,4 +1,4 @@ -;;; geiser-repl.el --- Geiser's REPL +;;; geiser-repl.el --- Geiser's REPL -*- lexical-binding: t; -*- ;; Copyright (C) 2009-2013, 2015-2016, 2018-2022 Jose Antonio Ortega Ruiz @@ -206,6 +206,20 @@ This variable is a good candidate for .dir-locals.el. This option has no effect if no project root is found." :type '(choice boolean (list string))) +(geiser-custom--defcustom geiser-repl-startup-hook nil + "Functions run right after a REPL has started and is fully set up. + +See also `geiser-repl-startup-forms'." + :type 'hook) + +(geiser-custom--defcustom geiser-repl-startup-forms nil + "List scheme forms, as strings, sent to a REPL on start-up. + +This variable is a good candidate for .dir-locals.el. + +See also `geiser-repl-startup-hook'." + :type '(repeat string)) + (geiser-custom--defface repl-input 'comint-highlight-input geiser-repl "evaluated input highlighting") @@ -563,6 +577,10 @@ will be set up using `geiser-connect-local' when a REPL is started.") t) (set-process-query-on-exit-flag (get-buffer-process (current-buffer)) geiser-repl-query-on-kill-p) + (dolist (f geiser-repl-startup-forms) + (geiser-log--info "Evaluating startup form %s..." f) + (geiser-eval--send/wait `(:eval (:scm ,f)))) + (run-hooks geiser-repl-startup-hook) (message "%s up and running!" (geiser-repl--repl-name impl)))) (defvar-local geiser-repl--connection-buffer nil) -- cgit v1.2.3