From 4134224802fe7868bd8139e529aeba1bfbcb1a85 Mon Sep 17 00:00:00 2001 From: chaos Date: Sat, 3 Dec 2022 13:49:08 +0000 Subject: [PATCH 1/2] Nbb support --- CHANGELOG.md | 1 + clojure-mode.el | 8 ++++++-- test/clojure-mode-util-test.el | 10 ++++++++++ test/utils/test-helper.el | 10 ++++++++++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f267c99..34ce38bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Changes +* [#641](https://github.com/clojure-emacs/clojure-mode/issues/641) Recognize nbb projects (identified by the presence of `nbb.edn`). * [#629](https://github.com/clojure-emacs/clojure-mode/pull/629): Set `add-log-current-defun-function` to new function `clojure-current-defun-name` (this is used by `which-function-mode` and `easy-kill`). ### Bugs fixed diff --git a/clojure-mode.el b/clojure-mode.el index 0ed97f1f..89d90309 100644 --- a/clojure-mode.el +++ b/clojure-mode.el @@ -189,10 +189,11 @@ For example, \[ is allowed in :db/id[:db.part/user]." "deps.edn" ; Clojure CLI (a.k.a. tools.deps) "shadow-cljs.edn" ; shadow-cljs "bb.edn" ; babashka + "nbb.edn" ; nbb ) "A list of files, which identify a Clojure project's root. Out-of-the box `clojure-mode' understands lein, boot, gradle, - shadow-cljs, tools.deps and babashka." + shadow-cljs, tools.deps, babashka and nbb." :type '(repeat string) :package-version '(clojure-mode . "5.0.0") :safe (lambda (value) @@ -3219,7 +3220,10 @@ With universal argument \\[universal-argument], act on the \"top-level\" form." ;; boot build scripts are Clojure source files (add-to-list 'auto-mode-alist '("\\(?:build\\|profile\\)\\.boot\\'" . clojure-mode)) ;; babashka scripts are Clojure source files - (add-to-list 'interpreter-mode-alist '("bb" . clojure-mode))) + ;; nbb scripts are ClojureScript source files + (add-to-list 'interpreter-mode-alist + '("bb" . clojure-mode) + '("nbb" . clojurescript-mode))) (provide 'clojure-mode) diff --git a/test/clojure-mode-util-test.el b/test/clojure-mode-util-test.el index 95931d9d..bf17d02a 100644 --- a/test/clojure-mode-util-test.el +++ b/test/clojure-mode-util-test.el @@ -39,6 +39,16 @@ (clj-file-ns "my-project.my-ns.my-file") (clojure-cache-project nil)) + (describe "clojure-project-root-path" + (it "nbb subdir" + (with-temp-dir temp-dir + (let* ((bb-edn (expand-file-name "nbb.edn" temp-dir)) + (bb-edn-src (expand-file-name "src" temp-dir))) + (write-region "{}" nil bb-edn) + (make-directory bb-edn-src) + (expect (clojure-project-dir bb-edn-src) + :to-equal (file-name-as-directory temp-dir)))))) + (describe "clojure-project-relative-path" (cl-letf (((symbol-function 'clojure-project-dir) (lambda () project-dir))) (expect (string= (clojure-project-relative-path clj-file-path) diff --git a/test/utils/test-helper.el b/test/utils/test-helper.el index fd3db309..c8dfed86 100644 --- a/test/utils/test-helper.el +++ b/test/utils/test-helper.el @@ -96,5 +96,15 @@ DESCRIPTION is a string with the description of the spec." (expect (point) :to-equal expected-cursor-pos))))) +;; https://emacs.stackexchange.com/a/55031 +(defmacro with-temp-dir (temp-dir &rest body) + "Create a temporary directory and bind its to TEMP-DIR while evaluating BODY. +Removes the temp directory at the end of evaluation." + `(let ((,temp-dir (make-temp-file "" t))) + (unwind-protect + (progn + ,@body) + (delete-directory ,temp-dir t)))) + (provide 'test-helper) ;;; test-helper.el ends here From ce2f6d078698ad4d4a99fd4a12c6efeaade6a352 Mon Sep 17 00:00:00 2001 From: ikappaki Date: Sat, 3 Dec 2022 14:14:23 +0000 Subject: [PATCH 2/2] Add emacs-28 in test matrix --- .circleci/config.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8c7fbd07..def610ed 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -33,6 +33,12 @@ jobs: entrypoint: bash <<: *default-steps + test-emacs-28: + docker: + - image: silex/emacs:28-ci-cask + entrypoint: bash + <<: *default-steps + test-emacs-master: docker: - image: silex/emacs:master-ci-cask @@ -46,4 +52,5 @@ workflows: - test-emacs-25 - test-emacs-26 - test-emacs-27 + - test-emacs-28 - test-emacs-master