emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/inf-clojure 5d76920 176/313: Introduce inf-clojure-project


From: ELPA Syncer
Subject: [nongnu] elpa/inf-clojure 5d76920 176/313: Introduce inf-clojure-project-type defcustom
Date: Wed, 11 Aug 2021 10:00:11 -0400 (EDT)

branch: elpa/inf-clojure
commit 5d769201765fee21f7fa826db1655244a0361f97
Author: Andrea Richiardi <a.richiardi.work@gmail.com>
Commit: Bozhidar Batsov <bozhidar.batsov@gmail.com>

    Introduce inf-clojure-project-type defcustom
    
    This patch adds a defcustom, inf-clojure-project-type, so that when it is
    not-nil we skip the project detection and choose which inf-clojure-*-cmd 
will
    be used.  This is very useful for projects that don't have standard layouts.
---
 CHANGELOG.md   |  4 ++++
 README.md      |  3 +++
 inf-clojure.el | 17 +++++++++++++----
 3 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index b5b34d7..698edb0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,10 @@
 * [#93](https://github.com/clojure-emacs/inf-clojure/pull/93): Slow response 
from inf-clojure (completions, arglists, ...).
 * [#101](https://github.com/clojure-emacs/inf-clojure/pull/101): 
`inf-clojure-set-ns` hangs Emacs.
 
+### New Features
+
+* [#114](https://github.com/clojure-emacs/inf-clojure/pull/114): Introduce 
`inf-clojure-project-type` defcustom.
+
 ## 2.0.1 (2017-05-18)
 
 ### Bugs Fixed
diff --git a/README.md b/README.md
index 8f527d1..c3963cb 100644
--- a/README.md
+++ b/README.md
@@ -74,6 +74,9 @@ interacting with it.
 `inf-clojure` has several custom variables which control the command
 used to start a REPL for particular project type - `inf-clojure-lein-cmd`,
 `inf-clojure-boot-cmd` and `inf-clojure-generic-cmd`.
+The `inf-clojure-project-type` can force a particular project type, skipping
+the project detection, which can be useful for projects that don't have
+standard layouts.
 
 By default all those variables are set to strings (e.g. `lein repl`).
 However, it is possible to use a cons pair like `("localhost" . 5555)`
diff --git a/inf-clojure.el b/inf-clojure.el
index 27b4f03..ecfde28 100644
--- a/inf-clojure.el
+++ b/inf-clojure.el
@@ -189,6 +189,14 @@ number (e.g. (\"localhost\" . 5555))."
    (stringp (car x))
    (numberp (cdr x))))
 
+(defcustom inf-clojure-project-type nil
+  "Defines the project type.
+
+If this is `nil`, the project will be automatically detected."
+  :type 'string
+  :safe #'stringp
+  :package-version '(inf-clojure . "2.1.0"))
+
 (defcustom inf-clojure-lein-cmd "lein repl"
   "The command used to start a Clojure REPL for Leiningen projects.
 
@@ -511,10 +519,11 @@ Fallback to `default-directory.' if not within a project."
 
 (defun inf-clojure-project-type ()
   "Determine the type, either leiningen or boot of the current project."
-  (let ((default-directory (inf-clojure-project-root)))
-    (cond ((file-exists-p "project.clj") "lein")
-          ((file-exists-p "build.boot") "boot")
-          (t nil))))
+  (or inf-clojure-project-type
+      (let ((default-directory (inf-clojure-project-root)))
+        (cond ((file-exists-p "project.clj") "lein")
+              ((file-exists-p "build.boot") "boot")
+              (t "generic")))))
 
 (defun inf-clojure-cmd (project-type)
   "Determine the command `inf-clojure' needs to invoke for the PROJECT-TYPE."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]