Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c3e97d9

Browse filesBrowse files
authored
Add clojure-directory-prefixes customisation (#596)
1 parent 33f267a commit c3e97d9
Copy full SHA for c3e97d9

File tree

2 files changed

+17
-1
lines changed
Filter options

2 files changed

+17
-1
lines changed

‎CHANGELOG.md

Copy file name to clipboardExpand all lines: CHANGELOG.md
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## master (unreleased)
44

5+
### New features
6+
7+
* Allow additional directories, beyond the default `clj[sc]`, to be correctly formulated by `clojure-expected-ns` via new `defcustom` entitled `clojure-directory-prefixes`
8+
59
## 5.13.0 (2021-05-05)
610

711
### New features

‎clojure-mode.el

Copy file name to clipboardExpand all lines: clojure-mode.el
+13-1Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,16 @@ Out-of-the box `clojure-mode' understands lein, boot, gradle,
196196
(and (listp value)
197197
(cl-every 'stringp value))))
198198

199+
(defcustom clojure-directory-prefixes
200+
'("\\`clj[scx]?\\.")
201+
"A list of directory prefixes used by `clojure-expected-ns'
202+
to formulate correct ns."
203+
:type '(repeat string)
204+
:package-version '(clojure-mode . "5.14.0")
205+
:safe (lambda (value)
206+
(and (listp value)
207+
(cl-every 'stringp value))))
208+
199209
(defcustom clojure-project-root-function #'clojure-project-root-path
200210
"Function to locate clojure project root directory."
201211
:type 'function
@@ -1761,7 +1771,9 @@ If PATH is nil, use the path to the file backing the current buffer."
17611771
(sans-file-sep (mapconcat 'identity (cdr (split-string sans-file-type "/")) "."))
17621772
(sans-underscores (replace-regexp-in-string "_" "-" sans-file-sep)))
17631773
;; Drop prefix from ns for projects with structure src/{clj,cljs,cljc}
1764-
(replace-regexp-in-string "\\`clj[scx]?\\." "" sans-underscores)))
1774+
(cl-reduce (lambda (a x) (replace-regexp-in-string x "" a))
1775+
clojure-directory-prefixes
1776+
:initial-value sans-underscores)))
17651777

17661778
(defun clojure-insert-ns-form-at-point ()
17671779
"Insert a namespace form at point."

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.