summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Whatson <whatson@gmail.com>2020-06-19 23:32:45 +1000
committerjao <jao@gnu.org>2020-07-06 20:12:33 +0000
commit8cba6b5ea04c9a4c8473944aa1d0a6be78e78c66 (patch)
treed0d5a12c2440133db8cba8a0634654c2756744b5
parent210068c7d552c35b958f0647bbb5bfa3cb8e4726 (diff)
downloadgeiser-8cba6b5ea04c9a4c8473944aa1d0a6be78e78c66.tar.gz
geiser-8cba6b5ea04c9a4c8473944aa1d0a6be78e78c66.tar.bz2
Improve project function selection, make ignore default
-rw-r--r--elisp/geiser-repl.el22
1 files changed, 9 insertions, 13 deletions
diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el
index 17dfd45..ac328b3 100644
--- a/elisp/geiser-repl.el
+++ b/elisp/geiser-repl.el
@@ -46,11 +46,13 @@ symbol (e.g., `guile', `chicken', etc.)."
:group 'geiser-repl)
(geiser-custom--defcustom geiser-repl-current-project-function
- 'geiser-repl-current-project
+ 'ignore
"Function used to determine the current project.
The function is called from both source and REPL buffers, and
should return a value which uniquely identifies the project."
- :type '(choice (function-item geiser-repl-current-project)
+ :type '(choice (function-item :doc "Ignore projects" ignore)
+ (function-item :doc "Use Project.el" project-current)
+ (function-item :doc "Use Projectile" projectile-project-root)
(function :tag "Other function"))
:group 'geiser-repl)
@@ -294,7 +296,7 @@ module command as a string")
(when (buffer-live-p repl)
(with-current-buffer repl
(when (and (eq geiser-impl--implementation impl)
- (eq geiser-repl--project proj))
+ (equal geiser-repl--project proj))
(throw 'repl repl))))))))
(defun geiser-repl--set-up-repl (impl)
@@ -317,20 +319,14 @@ module command as a string")
(defsubst geiser-repl--buffer-name (impl)
(funcall geiser-repl-buffer-name-function impl))
+(defsubst geiser-repl--current-project ()
+ (or (funcall geiser-repl-current-project-function)
+ 'no-project))
+
(defun geiser-repl-buffer-name (impl)
"Return default name of the REPL buffer for implementation IMPL."
(format "* %s *" (geiser-repl--repl-name impl)))
-(defsubst geiser-repl--current-project ()
- (funcall geiser-repl-current-project-function))
-
-(defun geiser-repl-current-project ()
- "Return the current project for REPL association."
- (cond ((bound-and-true-p projectile-mode)
- (projectile-project-root))
- ((require 'project nil 'noerror)
- (project-current))))
-
(defun geiser-repl--switch-to-buffer (buffer)
(unless (eq buffer (current-buffer))
(let ((pop-up-windows geiser-repl-window-allow-split))