summaryrefslogtreecommitdiff
path: root/elisp/geiser-repl.el
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-12-05 10:58:56 +0000
committerjao <jao@gnu.org>2021-12-05 10:58:56 +0000
commitb4bd69d8c3d6dcc8b508579054eb7905923ef738 (patch)
tree3b9bdbc6603208e71cd54a18343ab1ce5d2868c6 /elisp/geiser-repl.el
parentfb11e7281c3b8acb43ac39d8a2769c29bb36f2a4 (diff)
downloadgeiser-b4bd69d8c3d6dcc8b508579054eb7905923ef738.tar.gz
geiser-b4bd69d8c3d6dcc8b508579054eb7905923ef738.tar.bz2
Refinement: geiser-repl-add-project-paths instead of a boolean flag
Diffstat (limited to 'elisp/geiser-repl.el')
-rw-r--r--elisp/geiser-repl.el27
1 files changed, 20 insertions, 7 deletions
diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el
index e74a187..4696ec8 100644
--- a/elisp/geiser-repl.el
+++ b/elisp/geiser-repl.el
@@ -18,6 +18,7 @@
(require 'geiser-syntax)
(require 'geiser-impl)
(require 'geiser-eval)
+(require 'geiser-compile)
(require 'geiser-connection)
(require 'geiser-menu)
(require 'geiser-image)
@@ -180,11 +181,20 @@ images popping up in the REPL.
See also `geiser-debug-auto-display-images-p'."
:type 'boolean)
-(geiser-custom--defcustom geiser-repl-add-project-path-p t
+(geiser-custom--defcustom geiser-repl-add-project-paths t
"Whether to automatically add current project's root to load path on startup.
-For this option to take effect,
-`geiser-repl-current-project-function' must be set appropriately."
- :type 'boolean)
+
+If set to `t' (the default), the directory returned by
+`geiser-repl-current-project-function' is added to the load path.
+
+If set to a list of sudirectories (e.g. (\".\" \"src\" \"tests\")),
+their full path (starting with the project's root, is added
+instead.
+
+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--defface repl-input
'comint-highlight-input geiser-repl "evaluated input highlighting")
@@ -517,9 +527,12 @@ module command as a string")
(geiser-repl--startup impl address)
(geiser-repl--autodoc-mode 1)
(geiser-company--setup geiser-repl-company-p)
- (when geiser-repl-add-project-path-p
- (when-let (root (funcall geiser-repl-current-project-function))
- (geiser-add-to-load-path (cdr root))))
+ (when geiser-repl-add-project-paths
+ (when-let (root (cdr (funcall geiser-repl-current-project-function)))
+ (dolist (p (cond ((eq t geiser-repl-add-project-paths) '("."))
+ ((listp geiser-repl-add-project-paths)
+ geiser-repl-add-project-paths)))
+ (geiser-add-to-load-path (expand-file-name p root)))))
(add-hook 'comint-output-filter-functions
'geiser-repl--output-filter
nil