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 +++++++++++++++++++- news.org | 6 ++++++ 2 files changed, 25 insertions(+), 1 deletion(-) 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) diff --git a/news.org b/news.org index 9343de5..74ca564 100644 --- a/news.org +++ b/news.org @@ -1,3 +1,9 @@ +* Version 0.25 (unreleased) + + - Fix: support for .dir-locals.el in REPL buffers + - New customizable variables: geiser-repl-startup-hook and + geiser-repl-startup-forms. + * Version 0.24 (May, 2022) - Support for #{...}# extended symbol syntax -- cgit v1.2.3