summaryrefslogtreecommitdiff
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
parentfb11e7281c3b8acb43ac39d8a2769c29bb36f2a4 (diff)
downloadgeiser-b4bd69d8c3d6dcc8b508579054eb7905923ef738.tar.gz
geiser-b4bd69d8c3d6dcc8b508579054eb7905923ef738.tar.bz2
Refinement: geiser-repl-add-project-paths instead of a boolean flag
-rw-r--r--elisp/geiser-compile.el2
-rw-r--r--elisp/geiser-repl.el27
-rw-r--r--news.org4
3 files changed, 23 insertions, 10 deletions
diff --git a/elisp/geiser-compile.el b/elisp/geiser-compile.el
index a938107..1c2a1de 100644
--- a/elisp/geiser-compile.el
+++ b/elisp/geiser-compile.el
@@ -83,7 +83,7 @@ add, defaulting to the current buffer's directory."
(interactive "DDirectory to add: ")
(let* ((c `(:eval (:ge add-to-load-path ,(expand-file-name path))))
(r (geiser-eval--send/result c)))
- (message "%s" (if r "Added" "Failed!"))))
+ (message "%s%s added to load path" path (if r "" "couldn't be"))))
(provide 'geiser-compile)
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
diff --git a/news.org b/news.org
index 959e411..87c7041 100644
--- a/news.org
+++ b/news.org
@@ -1,6 +1,6 @@
* Version 0.20 (unreleased)
- - New option to add current project's root to load path,
- ~geiser-repl-add-project-path-p~.
+ - New option to add current project's root to load path or any of
+ its subdirectories, ~geiser-repl-add-project-paths~.
- Defaulting ~geiser-repl-current-project-function~ to ~project-current~
in emacsen having it available.
* Version 0.19 (December, 2021)