From 8cba6b5ea04c9a4c8473944aa1d0a6be78e78c66 Mon Sep 17 00:00:00 2001 From: Andrew Whatson Date: Fri, 19 Jun 2020 23:32:45 +1000 Subject: Improve project function selection, make ignore default --- elisp/geiser-repl.el | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'elisp') 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)) -- cgit v1.2.3