Skip to content

Commit

Permalink
Use Eldev
Browse files Browse the repository at this point in the history
  • Loading branch information
doublep authored and bbatsov committed Jul 18, 2020
1 parent 2a0f25b commit 3d8552a
Show file tree
Hide file tree
Showing 12 changed files with 80 additions and 153 deletions.
17 changes: 12 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,22 @@ commands:
setup:
steps:
- checkout
- run: make elpa-key
- run: make elpa
- run: emacs --version
- run:
name: Install Eldev
command: curl -fsSL https://raw.github.com/doublep/eldev/master/webinstall/circle-eldev > x.sh && source ./x.sh
test:
steps:
- run: make test
- run:
name: Run regression tests
command: eldev -dtT -p test
lint:
steps:
- run: make lint
- run:
name: Run Elisp-lint
command: eldev lint
- run:
name: Byte-compile `.el' files
command: eldev -dtT compile --warnings-as-errors

jobs:
test-emacs-25:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
*\#*\#
*.\#*
*.elc
.cask
/.eldev
/Eldev-local
elpa*
.depend
TAGS
Expand Down
11 changes: 0 additions & 11 deletions Cask

This file was deleted.

27 changes: 27 additions & 0 deletions Eldev
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
; -*- mode: emacs-lisp; lexical-binding: t; no-byte-compile: t -*-

(eldev-require-version "0.6")

(eldev-use-package-archive 'gnu)
;; For compatibility; e.g. with MELPA Stable one test fails.
(eldev-use-package-archive 'melpa-unstable)

(eldev-use-plugin 'autoloads)

(eldev-add-loading-roots 'test "test/utils")

;; Otherwise `cider-test.el' will be considered a test file.
(setf eldev-test-fileset "./test/")
;; This file is _supposed_ to be excluded from automated testing. Since Eldev
;; uses everything inside `test/' subdirectory, tell it to leave this file alone
;; explicitly.
(setf eldev-standard-excludes `(:or ,eldev-standard-excludes "test/cider-tests--no-auto.el"))

;; CIDER cannot be compiled otherwise.
(setf eldev-build-load-before-byte-compiling t)

(setf eldev-lint-default '(elisp))
(with-eval-after-load 'elisp-lint
;; We will byte-compile with Eldev.
(setf elisp-lint-ignored-validators '("package-lint" "fill-column" "byte-compile")
enable-local-variables :safe))
111 changes: 0 additions & 111 deletions Makefile

This file was deleted.

1 change: 0 additions & 1 deletion cider-connection.el
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,6 @@ REPL defaults to the current REPL."
"Map active on REPL objects in sesman browser.")

(cl-defmethod sesman-session-info ((_system (eql CIDER)) session)
(interactive "P")
(list :objects (cdr session)
:map cider-sesman-browser-map))

Expand Down
48 changes: 30 additions & 18 deletions doc/modules/ROOT/pages/contributing/hacking.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,42 @@ Alternatively you can simply load CIDER in your Emacs straight from its source
repo (you'll have to manually install all the packages CIDER depends on
in advance).

Additionally you will have to generate and require the
https://www.gnu.org/software/emacs/manual/html_node/elisp/Autoload.html[autoloads],
otherwise you'll keep getting errors about missing commands. That's done
automatically when installing via `package.el` but you'll have to do it
manually in this case:
CIDER uses https://github.com/doublep/eldev[Eldev] for development, so
you should install the tool first.

The easiest and "purest" way to run CIDER is to execute:

[source,shell]
----
make autoloads # generates cider-autoloads.el
eldev emacs
----

Then:
This will start a separate Emacs process with CIDER and its
dependencies available, but _without_ your normal packages installed.
However, you can use `Eldev-local` to add some packages with
`(eldev-add-extra-dependencies 'emacs ...)` forms. See Eldev
documentation for details.

Alternatively, if you want to load CIDER from source code in the Emacs
you use for editing:

. Generate autoloads file (that's done automatically when installing
via `package.el` but you'll have to do it manually in this case):
+
[source,shell]
----
eldev build :autoloads
----

. Add to your `.emacs`:
+
[source,lisp]
----
;; load CIDER from its source code
(add-to-list 'load-path "~/projects/cider")
(load "cider-autoloads" t t)
----

If you want to compile *and* generate autoloads, just run `make`.

=== Changing the code

It's perfectly fine to load CIDER from `package.el` and then to start making
Expand Down Expand Up @@ -70,22 +84,20 @@ all the details.

If you prefer running all tests outside Emacs that's also an option.

Install https://github.com/cask/cask[cask] if you haven't
already, then:

$ cd /path/to/cider
$ cask

Run all tests with:

$ make test
$ eldev test

NOTE: Tests may not run correctly inside Emacs' `shell-mode` buffers. Running
them in a terminal is recommended.

You can also check for compliance with a variety of coding standards in batch mode (including docstrings and byte-compilation warnings):
You can also check for compliance with a variety of coding standards in batch mode (including docstrings):

$ eldev lint

To check for byte-compilation warnings you can just compile the project with Eldev:

$ make lint
$ eldev compile

==== Running the tests in CircleCI

Expand Down
6 changes: 3 additions & 3 deletions test/cider-connection-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@

;; follows type arguments
(expect (cider-current-repl 'clj) :to-equal bb1)
(message "%S" (seq-take (buffer-list) 10))
;(message "%S" (seq-take (buffer-list) 10))
(expect (cider-current-repl 'cljs) :to-equal bb2)

;; follows file type
Expand Down Expand Up @@ -211,7 +211,7 @@
(expect (cider-current-repl) :to-equal bb2))

(switch-to-buffer b2)
(message "%S" (sesman-sessions 'CIDER))
;(message "%S" (sesman-sessions 'CIDER))
(with-temp-buffer
(expect (cider-current-repl) :to-equal b2))
(with-temp-buffer
Expand Down Expand Up @@ -323,7 +323,7 @@
(sesman-register 'CIDER session)
(expect (cider-repls) :to-equal (list a b))
(cider--close-connection b)
(message "%S" sesman-links-alist)
;(message "%S" sesman-links-alist)
(expect (buffer-live-p b) :not :to-be-truthy)
(expect (cider-repls) :to-equal (list a))
(sesman-unregister 'CIDER session))))))
Expand Down
2 changes: 1 addition & 1 deletion test/cider-debug-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
(expect (looking-back (rx "[]")) :to-be-truthy)
(goto-char (point-min))
(cider--debug-move-point '(4 ":b"))
(message "%S" (point))
;(message "%S" (point))
(expect (thing-at-point 'symbol) :to-equal "2")))

(it "handles the syntax quote"
Expand Down
2 changes: 1 addition & 1 deletion test/cider-interaction-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
(with-temp-buffer
(clojure-mode)
(setq buffer-file-name (make-temp-name "tmp.clj"))
(expect (cider-load-buffer) :not :to-throw))))))
(expect (let ((inhibit-message t)) (cider-load-buffer)) :not :to-throw))))))

(describe "cider-interactive-eval"
(it "works as expected in empty Clojure buffers"
Expand Down
2 changes: 1 addition & 1 deletion test/cider-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

(describe "customize-menu"
(it "opens without error"
(customize-group 'cider)))
(let ((inhibit-message t)) (customize-group 'cider))))

(describe "cider-figwheel-main-init-form"
;; whitespace checks sprinkled amongst other tests
Expand Down
3 changes: 3 additions & 0 deletions test/nrepl-bencode-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@ If object is incomplete, return a decoded path."
:var (nrepl--toString-dicts nrepl--toString-strings)

(it "decodes the structures"
(unless (byte-code-function-p (symbol-function 'nrepl--bdecode-message))
(buttercup-skip "[this test fails if source code is not byte-compiled]"))

(setq nrepl--toString-dicts '((dict "id" "29" "session" "9bde8b1f-aefc-4883-aa7c-9c3fa4692ac2" "value"
(dict "candidates"
(dict "clojure.lang.Compiler" (dict "arglists-str" "([this])" "argtypes" nil "class" "clojure.lang.Compiler" "file" nil "javadoc" "clojure/lang/Compiler.html#toString()" "member" "toString" "modifiers" "#{:public}" "returns" "java.lang.String" "throws" nil)
Expand Down

0 comments on commit 3d8552a

Please # to comment.