Skip to content

Commit 7493ed8

Browse files
arichiardibbatsov
authored andcommitted
Set inf-clojure-*-cmd :risky and :safe properties
It will be considered risky if the value is a string (indicating command line execution) and safe if a cons cell containing a valid endpoint.
1 parent c08d8bb commit 7493ed8

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

inf-clojure.el

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,16 @@ The following commands are available:
179179
(add-to-list 'completion-at-point-functions
180180
#'inf-clojure-completion-at-point))
181181

182+
(defun inf-clojure--endpoint-p (x)
183+
"Return non-nil if and only if X is a valid endpoint.
184+
185+
A valid endpoint consists of a host and port
186+
number (e.g. (\"localhost\" . 5555))."
187+
(and
188+
(listp x)
189+
(stringp (car x))
190+
(numberp (cdr x))))
191+
182192
(defcustom inf-clojure-lein-cmd "lein repl"
183193
"The command used to start a Clojure REPL for Leiningen projects.
184194
@@ -188,6 +198,8 @@ number (e.g. (\"localhost\" . 5555)). That's useful if you're
188198
often connecting to a remote REPL process."
189199
:type '(choice (string)
190200
(cons string integer))
201+
:risky #'stringp
202+
:safe #'inf-clojure--endpoint-p
191203
:package-version '(inf-clojure . "2.0.0"))
192204

193205
(define-obsolete-variable-alias 'inf-clojure-program 'inf-clojure-lein-cmd "2.0.0")
@@ -201,6 +213,8 @@ number (e.g. (\"localhost\" . 5555)). That's useful if you're
201213
often connecting to a remote REPL process."
202214
:type '(choice (string)
203215
(cons string integer))
216+
:risky #'stringp
217+
:safe #'inf-clojure--endpoint-p
204218
:package-version '(inf-clojure . "2.0.0"))
205219

206220
(defcustom inf-clojure-generic-cmd "lein repl"
@@ -212,6 +226,8 @@ number (e.g. (\"localhost\" . 5555)). That's useful if you're
212226
often connecting to a remote REPL process."
213227
:type '(choice (string)
214228
(cons string integer))
229+
:risky #'(stringp )
230+
:safe #'inf-clojure--endpoint-p
215231
:package-version '(inf-clojure . "2.0.0"))
216232

217233
(defvar-local inf-clojure-repl-type nil

0 commit comments

Comments
 (0)