├── .circleci └── config.yml ├── .codespellrc ├── .dir-locals.el ├── .gitattributes ├── .github ├── CONTRIBUTING.md ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── spell_checking.yml │ ├── stale.yml │ ├── test.yml │ └── unstale.yml ├── .gitignore ├── .markdownlint-cli2.yaml ├── .projectile ├── CHANGELOG.md ├── Eldev ├── LICENSE ├── Makefile ├── README.md ├── ROADMAP.md ├── cider-apropos.el ├── cider-browse-ns.el ├── cider-browse-spec.el ├── cider-cheatsheet.el ├── cider-classpath.el ├── cider-client.el ├── cider-clojuredocs.el ├── cider-common.el ├── cider-completion-context.el ├── cider-completion.el ├── cider-connection.el ├── cider-debug.el ├── cider-doc.el ├── cider-docstring.el ├── cider-eldoc.el ├── cider-eval.el ├── cider-find.el ├── cider-format.el ├── cider-inspector.el ├── cider-jar.el ├── cider-log.el ├── cider-macroexpansion.el ├── cider-mode.el ├── cider-ns.el ├── cider-overlays.el ├── cider-popup.el ├── cider-profile.el ├── cider-repl-history.el ├── cider-repl.el ├── cider-resolve.el ├── cider-scratch.el ├── cider-selector.el ├── cider-stacktrace.el ├── cider-test.el ├── cider-tracing.el ├── cider-util.el ├── cider-xref-backend.el ├── cider-xref.el ├── cider.el ├── codespell.txt ├── dev ├── deps.edn ├── docker-sample-project │ ├── .dir-locals.el │ ├── Dockerfile │ ├── Makefile │ ├── README.md │ ├── project.clj │ └── src │ │ ├── bar.clj │ │ └── foo.clj ├── generate_html_fragments.clj └── tramp-sample-project │ ├── Dockerfile │ ├── Makefile │ ├── README.md │ ├── project.clj │ └── src │ └── foo.clj ├── doc ├── antora.yml └── modules │ └── ROOT │ ├── assets │ └── images │ │ ├── cider-cheatsheet-select-1.png │ │ ├── cider-cheatsheet-select-2.png │ │ ├── cider-cheatsheet-select-3.png │ │ ├── cider-cheatsheet.png │ │ ├── cider-log-transient-mode.png │ │ ├── cider-log.png │ │ ├── cider-overview.png │ │ ├── cider-stacktrace-inspect.gif │ │ ├── cider-which-key.png │ │ ├── cider_architecture.png │ │ ├── cider_debugger.gif │ │ ├── cider_find_usages.gif │ │ ├── cider_see_also.gif │ │ ├── classpath_browser.png │ │ ├── code_completion.png │ │ ├── completion-annotations.png │ │ ├── dynamic_font_lock_off.png │ │ ├── dynamic_font_lock_on.png │ │ ├── eldoc.png │ │ ├── enlighten_disabled.png │ │ ├── enlighten_enabled.png │ │ ├── history_browser.png │ │ ├── menu_example.png │ │ ├── ns_browser.png │ │ ├── reader_conditionals.png │ │ ├── spec_browser.png │ │ ├── spec_browser_all.png │ │ ├── spec_browser_gen_example.png │ │ └── tracing.png │ ├── nav.adoc │ └── pages │ ├── about │ ├── changelog.adoc │ ├── compatibility.adoc │ ├── history.adoc │ ├── license.adoc │ ├── logo.adoc │ ├── release_policy.adoc │ ├── support.adoc │ └── team.adoc │ ├── additional_packages.adoc │ ├── additional_resources.adoc │ ├── basics │ ├── installation.adoc │ ├── middleware_setup.adoc │ └── up_and_running.adoc │ ├── caveats.adoc │ ├── cljs │ ├── configuration.adoc │ ├── figwheel.adoc │ ├── krell.adoc │ ├── other_repls.adoc │ ├── overview.adoc │ ├── shadow-cljs.adoc │ └── up_and_running.adoc │ ├── config │ ├── basic_config.adoc │ ├── eldoc.adoc │ ├── indentation.adoc │ ├── project_config.adoc │ └── syntax_highlighting.adoc │ ├── contributing.adoc │ ├── contributing │ ├── docs.adoc │ ├── funding.adoc │ └── hacking.adoc │ ├── debugging │ ├── debugger.adoc │ ├── enlighten.adoc │ ├── inspector.adoc │ ├── logging.adoc │ ├── macroexpansion.adoc │ ├── profiling.adoc │ └── tracing.adoc │ ├── faq.adoc │ ├── indent_spec.adoc │ ├── index.adoc │ ├── platforms │ ├── babashka.adoc │ ├── basilisp.adoc │ ├── clojureclr.adoc │ ├── nbb.adoc │ ├── other_platforms.adoc │ └── overview.adoc │ ├── repl │ ├── basic_usage.adoc │ ├── configuration.adoc │ ├── history.adoc │ └── keybindings.adoc │ ├── testing │ ├── running_tests.adoc │ ├── supported_libraries.adoc │ └── test_reports.adoc │ ├── troubleshooting.adoc │ └── usage │ ├── cider_mode.adoc │ ├── code_completion.adoc │ ├── code_evaluation.adoc │ ├── code_reloading.adoc │ ├── dealing_with_errors.adoc │ ├── interactive_programming.adoc │ ├── managing_connections.adoc │ ├── misc_features.adoc │ ├── pretty_printing.adoc │ └── working_with_documentation.adoc ├── logo ├── cider-logo-mug.svg ├── cider-logo-square.svg ├── cider-logo-w320.png ├── cider-logo-w480.png ├── cider-logo-w640.png ├── cider-logo-w960.png ├── cider-logo.ai ├── cider-logo.svg ├── favicon-152.png ├── favicon-16.png ├── favicon-32.png ├── favicon-64.png └── favicon.ico ├── nrepl-client.el ├── nrepl-dict.el ├── refcard ├── README.md ├── cider-refcard.pdf └── cider-refcard.tex └── test ├── cider-apropos-tests.el ├── cider-browse-ns-tests.el ├── cider-browse-spec-tests.el ├── cider-classpath-tests.el ├── cider-client-tests.el ├── cider-clojuredocs-tests.el ├── cider-common-tests.el ├── cider-completion-context-tests.el ├── cider-completion-tests.el ├── cider-connection-tests.el ├── cider-debug-tests.el ├── cider-doc-tests.el ├── cider-eldoc-tests.el ├── cider-error-parsing-tests.el ├── cider-eval-tests.el ├── cider-find-tests.el ├── cider-font-lock-tests.el ├── cider-inspector-tests.el ├── cider-interaction-tests.el ├── cider-jar-tests.el ├── cider-locals-tests.el ├── cider-log-tests.el ├── cider-ns-tests.el ├── cider-overlay-tests.el ├── cider-repl-tests.el ├── cider-selector-tests.el ├── cider-stacktrace-tests.el ├── cider-test-tests.el ├── cider-tests--no-auto.el ├── cider-tests.el ├── cider-util-tests.el ├── cider_ns_tests.clj ├── clojure-ts-mode ├── cider-connection-ts-tests.el ├── cider-find-ts-tests.el ├── cider-selector-ts-tests.el └── cider-util-ts-tests.el ├── integration ├── integration-test-utils.el └── integration-tests.el ├── nrepl-bencode-tests.el ├── nrepl-client-tests.el ├── nrepl-dict-tests.el ├── nrepl-server-mock.el └── utils ├── cider-connection-test-utils.el ├── cider-selector-test-utils.el └── nrepl-tests-utils.el /.codespellrc: -------------------------------------------------------------------------------- 1 | [codespell] 2 | skip = .git,.eldev,logo 3 | -------------------------------------------------------------------------------- /.dir-locals.el: -------------------------------------------------------------------------------- 1 | ;;; Directory Local Variables 2 | ;;; For more information see (info "(emacs) Directory Variables") 3 | 4 | ((emacs-lisp-mode 5 | (bug-reference-url-format . "https://github.com/clojure-emacs/cider/issues/%s") 6 | (bug-reference-bug-regexp . "#\\(?2:[[:digit:]]+\\)") 7 | (indent-tabs-mode . nil) 8 | (fill-column . 80) 9 | (sentence-end-double-space . t) 10 | (emacs-lisp-docstring-fill-column . 75) 11 | (checkdoc-symbol-words . ("top-level" "major-mode" "macroexpand-all" "print-level" "print-length")) 12 | (checkdoc-package-keywords-flag) 13 | (checkdoc-arguments-in-order-flag) 14 | (checkdoc-verb-check-experimental-flag) 15 | (elisp-lint-indent-specs . ((if-let* . 2) 16 | (when-let* . 1) 17 | (let* . defun) 18 | (nrepl-dbind-response . 2) 19 | (cider-save-marker . 1) 20 | (cider-propertize-region . 1) 21 | (cider-map-repls . 1) 22 | (cider--jack-in . 1) 23 | (cider--make-result-overlay . 1) 24 | ;; need better solution for indenting cl-flet bindings 25 | (insert-label . defun) ;; cl-flet 26 | (insert-align-label . defun) ;; cl-flet 27 | (insert-rect . defun) ;; cl-flet 28 | (cl-defun . 2) 29 | (with-parsed-tramp-file-name . 2) 30 | (thread-first . 0) 31 | (thread-last . 0) 32 | (transient-define-prefix . defmacro) 33 | (transient-define-suffix . defmacro))))) 34 | 35 | ;; To use the bug-reference stuff, do: 36 | ;; (add-hook 'text-mode-hook #'bug-reference-mode) 37 | ;; (add-hook 'prog-mode-hook #'bug-reference-prog-mode) 38 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | CHANGELOG.md merge=union 2 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | If you discover issues, have ideas for improvements or new features, 4 | please report them to the [issue tracker][1] of the repository or 5 | submit a pull request. Please, try to follow these guidelines when you 6 | do so. 7 | 8 | ## Issue reporting 9 | 10 | * Check that the issue has not already been reported. 11 | * Check that the issue has not already been fixed in the latest code 12 | (a.k.a. `master`). 13 | * Be clear, concise and precise in your description of the problem. 14 | * Open an issue with a descriptive title and a summary in grammatically correct, 15 | complete sentences. 16 | * Mention your Emacs version and operating system. 17 | * Mention the CIDER version info. You can use the REPL version info, which looks like that: 18 | 19 | ```el 20 | ;; CIDER 0.12.0snapshot (package: 20160331.421), nREPL 0.2.12 21 | ;; Clojure 1.8.0, Java 1.8.0_31 22 | ``` 23 | 24 | * Include any relevant code to the issue summary. 25 | 26 | ### Reporting bugs 27 | 28 | When reporting bugs it's a good idea to go through the [Troubleshooting section 29 | of the manual][7]. Adding information like the backtrace and the nREPL messages to 30 | the bug report makes it easier to track down bugs. Some steps to reproduce a bug 31 | reliably would also make a huge difference. 32 | 33 | ## Pull requests 34 | 35 | * Read the [Hacking on CIDER][8] manual section. 36 | * Read [how to properly contribute to open source projects on Github][2]. 37 | * Use a topic branch to easily amend a pull request later, if necessary. 38 | * Use the same coding conventions as the rest of the project. 39 | * Verify your Emacs Lisp code with `checkdoc` (C-c ? d). 40 | * Make sure that the unit tests are passing (`eldev test`). 41 | * Make sure that there are no lint warnings (`eldev lint`). 42 | * Write [good commit messages][3]. 43 | * Mention related tickets in the commit messages (e.g. `[Fix #N] Add command ...`). 44 | * Update the [changelog][6]. 45 | * [Squash related commits together][5]. 46 | * Open a [pull request][4] that relates to *only* one subject with a clear title 47 | and description in grammatically correct, complete sentences. 48 | 49 | [1]: https://github.com/clojure-emacs/cider/issues 50 | [2]: http://gun.io/blog/how-to-github-fork-branch-and-pull-request 51 | [3]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html 52 | [4]: https://help.github.com/articles/using-pull-requests 53 | [5]: http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html 54 | [6]: https://github.com/clojure-emacs/cider/blob/master/CHANGELOG.md 55 | [7]: http://cider.readthedocs.org/en/latest/troubleshooting/ 56 | [8]: https://cider.readthedocs.io/en/latest/hacking_on_cider/ 57 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: bbatsov 4 | patreon: bbatsov 5 | open_collective: cider 6 | custom: https://www.paypal.me/bbatsov 7 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug Report 3 | about: Report an issue with CIDER you've discovered. 4 | --- 5 | 6 | *Use the template below when reporting bugs. Please, make sure that 7 | you're running the latest stable CIDER and that the problem you're reporting 8 | hasn't been reported (and potentially fixed) already.* 9 | 10 | **Remove all of the placeholder text in your final report!** 11 | 12 | ## Expected behavior 13 | 14 | ## Actual behavior 15 | 16 | ## Steps to reproduce the problem 17 | 18 | *This is extremely important! Providing us with a reliable way to reproduce 19 | a problem will expedite its solution.* 20 | 21 | ## Environment & Version information 22 | 23 | ### CIDER version information 24 | 25 | *Include here the version string displayed when 26 | CIDER's REPL is launched. Here's an example:* 27 | 28 | ``` 29 | ;; CIDER 0.12.0snapshot (package: 20160331.421), nREPL 0.2.12 30 | ;; Clojure 1.8.0, Java 1.8.0_31 31 | ``` 32 | 33 | ### Lein / Clojure CLI version 34 | 35 | *E.g. Lein 2.6.1* 36 | 37 | ### Emacs version 38 | 39 | *E.g. 24.5* (use M-x emacs-version to check it if unsure) 40 | 41 | ### Operating system 42 | 43 | *E.g. Fedora 23, OS X 10.11 "El Capitan", Windows 10, etc* 44 | 45 | ### JDK distribution 46 | 47 | *The JDK distribution are you using (e.g. Oracle, Temurin, Corretto), and its version. (run `java -version` for obtaining this)* 48 | 49 | *Please note that you should be running a JDK, not a JRE.* 50 | 51 | *If you are using a JDK through Docker, please indicate the Docker image being used.* 52 | 53 | *Please note that especially on Linux, JDK sources may be absent by default and require a separate installation step.* 54 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature Request 3 | about: Suggest new CIDER features or improvements to existing features. 4 | --- 5 | 6 | **Is your feature request related to a problem? Please describe.** 7 | 8 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 9 | 10 | **Describe the solution you'd like** 11 | 12 | A clear and concise description of what you want to happen. 13 | 14 | **Describe alternatives you've considered** 15 | 16 | A clear and concise description of any alternative solutions or features you've considered. 17 | 18 | **Additional context** 19 | 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | **Replace this placeholder text with a summary of the changes in your PR. 2 | The more detailed you are, the better.** 3 | 4 | ----------------- 5 | 6 | Before submitting the PR make sure the following things have been done (and denote this 7 | by checking the relevant checkboxes): 8 | 9 | - [ ] The commits are consistent with our [contribution guidelines](../blob/master/.github/CONTRIBUTING.md) 10 | - [ ] You've added tests (if possible) to cover your change(s) 11 | - [ ] All tests are passing (`eldev test`) 12 | - [ ] All code passes the linter (`eldev lint`) which is based on [`elisp-lint`](https://github.com/gonewest818/elisp-lint) and includes 13 | - [byte-compilation](https://www.gnu.org/software/emacs/manual/html_node/elisp/Byte-Compilation.html), [`checkdoc`](https://www.gnu.org/software/emacs/manual/html_node/elisp/Tips.html), [check-declare](https://www.gnu.org/software/emacs/manual/html_node/elisp/Declaring-Functions.html), packaging metadata, indentation, and trailing whitespace checks. 14 | - [ ] You've updated the [changelog](../blob/master/CHANGELOG.md) (if adding/changing user-visible functionality) 15 | - [ ] You've updated the [user manual](../blob/master/doc) (if adding/changing user-visible functionality) 16 | 17 | Thanks! 18 | 19 | *If you're just starting out to hack on CIDER you might find this [section of its 20 | manual][1] extremely useful.* 21 | 22 | [1]: https://docs.cider.mx/cider/contributing/hacking.html 23 | -------------------------------------------------------------------------------- /.github/workflows/spell_checking.yml: -------------------------------------------------------------------------------- 1 | name: Spell Checking 2 | 3 | on: [pull_request] 4 | 5 | jobs: 6 | codespell: 7 | name: Check spelling with codespell 8 | runs-on: ubuntu-latest 9 | strategy: 10 | matrix: 11 | python-version: [3.8] 12 | steps: 13 | - uses: actions/checkout@v2 14 | - name: Set up Python ${{ matrix.python-version }} 15 | uses: actions/setup-python@v2 16 | with: 17 | python-version: ${{ matrix.python-version }} 18 | - name: Install dependencies 19 | run: | 20 | python -m pip install --upgrade pip 21 | pip install codespell 22 | if [ -f requirements.txt ]; then pip install -r requirements.txt; fi 23 | - name: Check spelling with codespell 24 | run: codespell --ignore-words=codespell.txt || exit 1 25 | misspell: 26 | name: Check spelling with misspell 27 | runs-on: ubuntu-latest 28 | steps: 29 | - uses: actions/checkout@v2 30 | - name: Install 31 | run: wget -O - -q https://git.io/misspell | sh -s -- -b . 32 | - name: Misspell 33 | run: ./misspell -error 34 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | name: Close inactive issues and pull requests 2 | on: 3 | schedule: 4 | - cron: "30 1 * * *" 5 | 6 | jobs: 7 | close-issues: 8 | runs-on: ubuntu-latest 9 | permissions: 10 | issues: write 11 | pull-requests: write 12 | steps: 13 | - uses: actions/stale@v9 14 | with: 15 | days-before-issue-stale: 30 16 | days-before-issue-close: 30 17 | stale-issue-label: "stale" 18 | exempt-all-milestones: true 19 | exempt-issue-labels: "bug, high priority, good first issue, pinned" 20 | stale-issue-message: >- 21 | This issue has been automatically marked as stale because it has not 22 | had any recent activity. It will be closed soon if no further 23 | activity occurs. Thank you for your contribution and understanding! 24 | close-issue-message: >- 25 | This issue been automatically closed due to lack of activity. Feel free to re-open it 26 | if you ever come back to it. 27 | days-before-pr-stale: 30 28 | days-before-pr-close: 30 29 | exempt-pr-labels: "high priority, good first issue, pinned" 30 | stale-pr-message: >- 31 | This pull request has been automatically marked as stale because it has not 32 | had any recent activity. It will be closed soon if no further 33 | activity occurs. Thank you for your contribution and understanding! 34 | close-pr-message: >- 35 | This issue been automatically closed due to lack of activity. Feel free to re-open it 36 | if you ever come back to it. 37 | repo-token: ${{ secrets.GITHUB_TOKEN }} 38 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | # This `on:` configuration avoids double-triggered jobs (one for `push`, one for `pull_request`). 4 | # Pull requests will still get jobs on every commit. 5 | # However you won't get jobs on branch pushes that lack an associated pull requests. 6 | # On the other hand, CircleCI jobs will still be triggered, which give a useful form of feedback. 7 | # Lastly, remember that we have a Makefile for local development - you are encouraged to use it before pushing commits. 8 | on: 9 | push: 10 | branches: 11 | - master 12 | pull_request: 13 | 14 | permissions: 15 | contents: read # to fetch code (actions/checkout) 16 | 17 | jobs: 18 | integration: 19 | # Run integration tests for all OSs and EMACS_VERSIONs. 20 | runs-on: ${{matrix.os}} 21 | 22 | strategy: 23 | matrix: 24 | # Test all Emacs versions on Ubuntu. 25 | os: [ubuntu-latest] 26 | # TODO: reenable snapshot once this is fixed https://app.circleci.com/pipelines/github/clojure-emacs/cider/2931/workflows/b7284759-c6d1-44dd-bbfc-e71709e3f62f/jobs/17699 27 | # emacs_version: ['27.2', '28.2', '29.3', '30.1', 'snapshot'] 28 | emacs_version: ['27.2', '28.2', '29.3', '30.1'] 29 | java_version: ['21'] 30 | include: 31 | # For other OSes, test only the latest stable Emacs version. 32 | - os: macos-latest # aarch64 33 | emacs_version: '30.1' 34 | java_version: '21' 35 | - os: macos-13 # x64 36 | emacs_version: '30.1' 37 | java_version: '21' 38 | - os: windows-latest 39 | emacs_version: '30.1' 40 | java_version: '21' 41 | 42 | steps: 43 | - name: Set up Emacs 44 | uses: jcs090218/setup-emacs@master 45 | with: 46 | version: ${{matrix.emacs_version}} 47 | 48 | - name: Install Eldev 49 | if: "!startsWith (matrix.os, 'windows')" 50 | run: curl -fsSL https://raw.github.com/doublep/eldev/master/webinstall/github-eldev | sh 51 | 52 | - name: Install Eldev on MS-Windows 53 | if: startsWith (matrix.os, 'windows') 54 | run: | 55 | # Remove expired DST Root CA X3 certificate. Workaround 56 | # for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=51038 57 | # bug on Emacs 27.2. 58 | gci cert:\LocalMachine\Root\DAC9024F54D8F6DF94935FB1732638CA6AD77C13 59 | gci cert:\LocalMachine\Root\DAC9024F54D8F6DF94935FB1732638CA6AD77C13 | Remove-Item 60 | 61 | curl.exe -fsSL https://raw.github.com/doublep/eldev/master/webinstall/github-eldev.bat | cmd /Q 62 | 63 | - name: Install deps.clj on MS-Windows 64 | if: startsWith (matrix.os, 'windows') 65 | run: | 66 | iwr -Uri https://raw.githubusercontent.com/borkdude/deps.clj/master/install.ps1 -outfile install_clojure.ps1 67 | .\install_clojure.ps1 68 | get-command deps.exe | split-path -parent | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append 69 | 70 | - name: Check out the source code 71 | uses: actions/checkout@v2 72 | 73 | - name: Prepare java 74 | uses: actions/setup-java@v3 75 | with: 76 | distribution: 'temurin' 77 | # shadow requires java 11 78 | java-version: ${{matrix.java_version}} 79 | 80 | - name: Install Clojure Tools 81 | # Use SHA until 82 | # https://github.com/DeLaGuardo/setup-clojure/issues/78 is 83 | # released 84 | uses: DeLaGuardo/setup-clojure@1376ded6747c79645e82c856f16375af5f5de307 85 | with: 86 | bb: '1.0.165' 87 | cli: '1.10.3.1013' 88 | lein: '2.9.10' 89 | 90 | - uses: actions/setup-node@v3 91 | with: 92 | node-version: 16 93 | - run: npm install shadow-cljs@2.20.13 -g 94 | - run: npm install nbb@1.1.152 -g 95 | 96 | - uses: actions/setup-python@v5 97 | with: 98 | python-version: '3.12' 99 | - run: | 100 | pip install basilisp==0.1.0b2 101 | 102 | - name: Test integration 103 | run: | 104 | # The tests occasionally fail on macos&win in what is seems to 105 | # be GH connectivity runner issues. We attempt to address this 106 | # problem by rerunning the tests more than once. 107 | eldev -p -dtTC test --test-type integration || eldev -p -dtTC test --test-type integration 108 | 109 | - name: Test clojure-ts-mode 110 | if: startsWith (matrix.emacs_version, '30') 111 | run: | 112 | eldev -p -dtTC test --test-type clojure-ts-mode || eldev -p -dtTC test --test-type clojure-ts-mode 113 | -------------------------------------------------------------------------------- /.github/workflows/unstale.yml: -------------------------------------------------------------------------------- 1 | name: Unmark issues and pull requests as stale on activity 2 | on: 3 | issue_comment: 4 | types: [created] 5 | 6 | # actions/stale does this automatically, but only once a day. 7 | # This immediately removes the label when the user creates a comment. 8 | jobs: 9 | remove-stale-label: 10 | if: (github.repository == 'clojure-emacs/cider') 11 | runs-on: ubuntu-latest 12 | permissions: 13 | issues: write 14 | pull-requests: write 15 | steps: 16 | - name: Remove stale label 17 | env: 18 | GH_TOKEN: ${{ github.token }} 19 | run: gh issue edit ${{ github.event.issue.number }} --remove-label "stale" -R ${{ github.repository }} 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *\#*\# 3 | *.\#* 4 | *.elc 5 | /.eldev 6 | /Eldev-local 7 | elpa* 8 | .depend 9 | TAGS 10 | .DS_STORE 11 | dist 12 | .vagrant/ 13 | cider-autoloads.el 14 | .dir-locals?.el 15 | cider-pkg.el 16 | cider-refcard.aux 17 | cider-refcard.log 18 | doc/auto/ 19 | test/*.edn 20 | -------------------------------------------------------------------------------- /.markdownlint-cli2.yaml: -------------------------------------------------------------------------------- 1 | config: 2 | default: true 3 | 4 | line-length: 5 | line_length: 100 6 | code_blocks: false 7 | tables: false 8 | 9 | no-duplicate-heading: 10 | allow_different_nesting: true 11 | 12 | no-inline-html: false 13 | 14 | first-line-heading: false 15 | -------------------------------------------------------------------------------- /.projectile: -------------------------------------------------------------------------------- 1 | /.cask 2 | /packages -------------------------------------------------------------------------------- /Eldev: -------------------------------------------------------------------------------- 1 | ; -*- mode: emacs-lisp; lexical-binding: t -*- 2 | 3 | (eldev-require-version "1.8.2") 4 | 5 | (eldev-use-package-archive 'gnu) 6 | 7 | ;; For compatibility; e.g. with MELPA Stable one test fails. 8 | (eldev-use-package-archive 'melpa-unstable) 9 | 10 | (eldev-use-plugin 'autoloads) 11 | 12 | (eldev-add-loading-roots 'test "test/utils") 13 | (eldev-add-extra-dependencies 'runtime '(:package logview :optional t)) 14 | (eldev-add-extra-dependencies 'runtime '(:package clojure-ts-mode :optional t)) 15 | 16 | ;; slightly increase the maximum (applies to checkdoc and the byte compiler alike) 17 | (setq byte-compile-docstring-max-column 100) 18 | 19 | ;; allow commas to indicate that the first sentence continues, which enables longer first sentences 20 | (setq checkdoc-permit-comma-termination-flag t) 21 | 22 | (defvar cider-test-type 'main) 23 | (setf eldev-standard-excludes `(:or ,eldev-standard-excludes 24 | ;; Avoid including files in test "projects". 25 | (eldev-pcase-exhaustive cider-test-type 26 | (`main "./test/*/") 27 | (`integration '("./test/" "!./test/integration")) 28 | (`clojure-ts-mode '("./test/*/" "!./test/clojure-ts-mode")) 29 | (`all '("./test/*/" "!./test/integration"))) 30 | "test/integration/projects" 31 | ;; This file is _supposed_ to be excluded 32 | ;; from automated testing. 33 | "test/cider-tests--no-auto.el")) 34 | 35 | (eldev-defoption cider-test-selection (type) 36 | "Select tests to run; type can be `main', `integration', `clojure-ts-mode' or `all'" 37 | :options (-T --test-type) 38 | :for-command test 39 | :value TYPE 40 | :default-value cider-test-type 41 | (unless (memq (intern type) '(main integration clojure-ts-mode all)) 42 | (signal 'eldev-wrong-option-usage `("unknown test type `%s'" ,type))) 43 | (setf cider-test-type (intern type))) 44 | 45 | (add-hook 'eldev-load-dependencies-hook 46 | (lambda (type additional-sets) 47 | (when (and (eq cider-test-type 'clojure-ts-mode) 48 | (member 'runtime additional-sets)) 49 | (message "Installing tree-sitter grammars") 50 | (require 'clojure-ts-mode) 51 | (clojure-ts--ensure-grammars)))) 52 | 53 | (add-hook 'eldev-test-hook 54 | (lambda () 55 | (eldev-verbose "Using cider tests of type `%s'" cider-test-type))) 56 | (add-hook 'eldev-executing-command-hook 57 | (lambda (command) 58 | (unless (eq command 'test) 59 | ;; So that e.g. byte-compilation works on all tests. 60 | (setf cider-test-type 'all)))) 61 | 62 | ;; CIDER cannot be compiled otherwise. 63 | (setf eldev-build-load-before-byte-compiling t) 64 | 65 | (setf eldev-lint-default '(elisp)) 66 | (with-eval-after-load 'elisp-lint 67 | ;; We will byte-compile with Eldev. 68 | (setf elisp-lint-ignored-validators '("package-lint" "fill-column" "byte-compile") 69 | enable-local-variables :safe)) 70 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: clean compile lint test-all test-integration test-unit 2 | .DEFAULT_GOAL := test 3 | 4 | # Per our CircleCI, linting/compiling assumes Emacs 28. 5 | # If you primarily use a different version, you can download Emacs 28 to a separate directory and set up: 6 | # export ELDEV_EMACS="$HOME/emacs28/Emacs.app/Contents/MacOS/Emacs" 7 | 8 | # Remove byte-compilation artifacts, which can alter the result of the test suite: 9 | clean: 10 | eldev clean 11 | 12 | # You can find a generic `eldev` installation script in https://github.com/emacs-eldev/eldev/blob/master/webinstall/eldev 13 | # (Don't use the one defined for CircleCI in your local machine) 14 | 15 | lint: clean 16 | eldev lint -c 17 | 18 | # Checks for byte-compilation warnings. 19 | compile: clean 20 | eldev -dtT compile --warnings-as-errors 21 | 22 | test-all: clean 23 | eldev -dtT -p test --test-type all 24 | 25 | test-integration: clean 26 | eldev -dtT -p test --test-type integration 27 | 28 | test-unit: clean 29 | eldev -dtT -p test 30 | 31 | test: lint test-unit compile 32 | -------------------------------------------------------------------------------- /cider-classpath.el: -------------------------------------------------------------------------------- 1 | ;;; cider-classpath.el --- Basic Java classpath browser -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright © 2014-2025 Bozhidar Batsov and CIDER contributors 4 | 5 | ;; This program is free software: you can redistribute it and/or modify 6 | ;; it under the terms of the GNU General Public License as published by 7 | ;; the Free Software Foundation, either version 3 of the License, or 8 | ;; (at your option) any later version. 9 | 10 | ;; This program is distributed in the hope that it will be useful, 11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ;; GNU General Public License for more details. 14 | 15 | ;; You should have received a copy of the GNU General Public License 16 | ;; along with this program. If not, see . 17 | 18 | ;; This file is not part of GNU Emacs. 19 | 20 | ;;; Commentary: 21 | 22 | ;; Basic Java classpath browser for CIDER. 23 | 24 | ;;; Code: 25 | 26 | (require 'cider-client) 27 | (require 'cider-popup) 28 | (require 'subr-x) 29 | 30 | (defvar cider-classpath-buffer "*cider-classpath*") 31 | 32 | (defvar cider-classpath-mode-map 33 | (let ((map (make-sparse-keymap))) 34 | (set-keymap-parent map cider-popup-buffer-mode-map) 35 | (define-key map (kbd "RET") #'cider-classpath-operate-on-point) 36 | (define-key map "n" #'next-line) 37 | (define-key map "p" #'previous-line) 38 | map)) 39 | 40 | (defvar cider-classpath-mouse-map 41 | (let ((map (make-sparse-keymap))) 42 | (define-key map [mouse-1] #'cider-classpath-handle-mouse) 43 | map)) 44 | 45 | (define-derived-mode cider-classpath-mode special-mode "classpath" 46 | "Major mode for browsing the entries in Java's classpath. 47 | 48 | \\{cider-classpath-mode-map}" 49 | (setq-local electric-indent-chars nil) 50 | (setq-local sesman-system 'CIDER) 51 | (when cider-special-mode-truncate-lines 52 | (setq-local truncate-lines t))) 53 | 54 | (defun cider-classpath-list (buffer items) 55 | "Populate BUFFER with ITEMS." 56 | (with-current-buffer buffer 57 | (cider-classpath-mode) 58 | (let ((inhibit-read-only t)) 59 | (erase-buffer) 60 | (dolist (item items) 61 | (insert item "\n")) 62 | (goto-char (point-min))))) 63 | 64 | (defun cider-classpath-properties (text) 65 | "Decorate TEXT with a clickable keymap and function face." 66 | (let ((face (cond 67 | ((not (file-exists-p text)) 'font-lock-warning-face) 68 | ((file-directory-p text) 'dired-directory) 69 | (t 'default)))) 70 | (propertize text 71 | 'font-lock-face face 72 | 'mouse-face 'highlight 73 | 'keymap cider-classpath-mouse-map))) 74 | 75 | (defun cider-classpath-operate-on-point () 76 | "Expand browser according to thing at current point." 77 | (interactive) 78 | (let* ((bol (line-beginning-position)) 79 | (eol (line-end-position)) 80 | (line (buffer-substring-no-properties bol eol))) 81 | (find-file-other-window line))) 82 | 83 | (defun cider-classpath-handle-mouse (_event) 84 | "Handle mouse click EVENT." 85 | (interactive "e") 86 | (cider-classpath-operate-on-point)) 87 | 88 | ;;;###autoload 89 | (defun cider-classpath () 90 | "List all classpath entries." 91 | (interactive) 92 | (cider-ensure-connected) 93 | (with-current-buffer (cider-popup-buffer cider-classpath-buffer 'select nil 'ancillary) 94 | (cider-classpath-list (current-buffer) 95 | (mapcar (lambda (name) 96 | (cider-classpath-properties name)) 97 | (cider-classpath-entries))))) 98 | 99 | ;;;###autoload 100 | (defun cider-open-classpath-entry () 101 | "Open a classpath entry." 102 | (interactive) 103 | (cider-ensure-connected) 104 | (when-let* ((entry (completing-read "Classpath entries: " (cider-classpath-entries)))) 105 | (find-file-other-window entry))) 106 | 107 | (provide 'cider-classpath) 108 | 109 | ;;; cider-classpath.el ends here 110 | -------------------------------------------------------------------------------- /cider-scratch.el: -------------------------------------------------------------------------------- 1 | ;;; cider-scratch.el --- *scratch* buffer for Clojure -*- lexical-binding: t -*- 2 | 3 | ;; Copyright © 2014-2025 Bozhidar Batsov and CIDER contributors 4 | ;; 5 | ;; Author: Tim King 6 | ;; Phil Hagelberg 7 | ;; Bozhidar Batsov 8 | ;; Artur Malabarba 9 | ;; Hugo Duncan 10 | ;; Steve Purcell 11 | 12 | ;; This program is free software: you can redistribute it and/or modify 13 | ;; it under the terms of the GNU General Public License as published by 14 | ;; the Free Software Foundation, either version 3 of the License, or 15 | ;; (at your option) any later version. 16 | 17 | ;; This program is distributed in the hope that it will be useful, 18 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | ;; GNU General Public License for more details. 21 | 22 | ;; You should have received a copy of the GNU General Public License 23 | ;; along with this program. If not, see . 24 | 25 | ;; This file is not part of GNU Emacs. 26 | 27 | ;;; Commentary: 28 | 29 | ;; Imitate Emacs's *scratch* buffer. 30 | 31 | ;;; Code: 32 | 33 | (require 'cider-eval) 34 | (require 'clojure-mode) 35 | (require 'easymenu) 36 | 37 | (defcustom cider-scratch-initial-message 38 | ";; This buffer is for Clojure experiments and evaluation.\n 39 | ;; Press C-j to evaluate the last expression.\n 40 | ;; You can also press C-u C-j to evaluate the expression and pretty-print its result.\n\n" 41 | "The initial message displayed in new scratch buffers." 42 | :type 'string 43 | :group 'cider 44 | :package-version '(cider . "0.18.0")) 45 | 46 | (defvar cider-clojure-interaction-mode-map 47 | (let ((map (make-sparse-keymap))) 48 | (set-keymap-parent map clojure-mode-map) 49 | (define-key map (kbd "C-j") #'cider-eval-print-last-sexp) 50 | (define-key map [remap paredit-newline] #'cider-eval-print-last-sexp) 51 | (define-key map [remap paredit-C-j] #'cider-eval-print-last-sexp) 52 | (easy-menu-define cider-clojure-interaction-mode-menu map 53 | "Menu for Clojure Interaction mode" 54 | '("Clojure Interaction" 55 | (["Eval and print last sexp" #'cider-eval-print-last-sexp] 56 | "--" 57 | ["Reset" #'cider-scratch-reset]))) 58 | map)) 59 | 60 | (defconst cider-scratch-buffer-name "*cider-scratch*") 61 | 62 | ;;;###autoload 63 | (defun cider-scratch () 64 | "Go to the scratch buffer named `cider-scratch-buffer-name'." 65 | (interactive) 66 | (pop-to-buffer (cider-scratch-find-or-create-buffer))) 67 | 68 | (defun cider-scratch-find-or-create-buffer () 69 | "Find or create the scratch buffer." 70 | (or (get-buffer cider-scratch-buffer-name) 71 | (cider-scratch--create-buffer))) 72 | 73 | (define-derived-mode cider-clojure-interaction-mode clojure-mode "Clojure Interaction" 74 | "Major mode for typing and evaluating Clojure forms. 75 | Like `clojure-mode' except that \\[cider-eval-print-last-sexp] evals the Lisp expression 76 | before point, and prints its value into the buffer, advancing point. 77 | 78 | \\{cider-clojure-interaction-mode-map}" 79 | (setq-local sesman-system 'CIDER)) 80 | 81 | (defun cider-scratch--insert-welcome-message () 82 | "Insert the welcome message for the scratch buffer." 83 | (insert cider-scratch-initial-message)) 84 | 85 | (defun cider-scratch--create-buffer () 86 | "Create a new scratch buffer." 87 | (with-current-buffer (get-buffer-create cider-scratch-buffer-name) 88 | (cider-clojure-interaction-mode) 89 | (cider-scratch--insert-welcome-message) 90 | (current-buffer))) 91 | 92 | (defun cider-scratch-reset () 93 | "Reset the current scratch buffer." 94 | (interactive) 95 | (erase-buffer) 96 | (cider-scratch--insert-welcome-message)) 97 | 98 | (provide 'cider-scratch) 99 | 100 | ;;; cider-scratch.el ends here 101 | -------------------------------------------------------------------------------- /cider-tracing.el: -------------------------------------------------------------------------------- 1 | ;;; cider-tracing.el --- Executing tracing functionality -*- lexical-binding: t -*- 2 | 3 | ;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors 4 | ;; 5 | ;; Author: Bozhidar Batsov 6 | ;; Artur Malabarba 7 | 8 | ;; This program is free software: you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;; This file is not part of GNU Emacs. 22 | 23 | ;;; Commentary: 24 | 25 | ;; A couple of commands for tracing the execution of functions. 26 | 27 | ;;; Code: 28 | 29 | (require 'cider-client) 30 | (require 'cider-common) ; for `cider-prompt-for-symbol-function' 31 | (require 'cider-util) ; for `cider-propertize' 32 | (require 'cider-connection) ; for `cider-map-repls' 33 | (require 'nrepl-dict) 34 | 35 | (defun cider-sync-request:toggle-trace-var (sym) 36 | "Toggle var tracing for SYM." 37 | (thread-first `("op" "toggle-trace-var" 38 | "ns" ,(cider-current-ns) 39 | "sym" ,sym) 40 | (cider-nrepl-send-sync-request))) 41 | 42 | (defun cider--toggle-trace-var (sym) 43 | "Toggle var tracing for SYM." 44 | (let* ((trace-response (cider-sync-request:toggle-trace-var sym)) 45 | (var-name (nrepl-dict-get trace-response "var-name")) 46 | (var-status (nrepl-dict-get trace-response "var-status"))) 47 | (pcase var-status 48 | ("not-found" (error "Var %s not found" (cider-propertize sym 'fn))) 49 | ("not-traceable" (error "Var %s can't be traced because it's not bound to a function" (cider-propertize var-name 'fn))) 50 | (_ (message "Var %s %s" (cider-propertize var-name 'fn) var-status))))) 51 | 52 | ;;;###autoload 53 | (defun cider-toggle-trace-var (arg) 54 | "Toggle var tracing. 55 | Prompts for the symbol to use, or uses the symbol at point, depending on 56 | the value of `cider-prompt-for-symbol'. With prefix arg ARG, does the 57 | opposite of what that option dictates." 58 | (interactive "P") 59 | (cider-ensure-op-supported "toggle-trace-var") 60 | (funcall (cider-prompt-for-symbol-function arg) 61 | "Toggle trace for var" 62 | #'cider--toggle-trace-var)) 63 | 64 | (defun cider-sync-request:toggle-trace-ns (ns) 65 | "Toggle namespace tracing for NS." 66 | (thread-first `("op" "toggle-trace-ns" 67 | "ns" ,ns) 68 | (cider-nrepl-send-sync-request))) 69 | 70 | ;;;###autoload 71 | (defun cider-toggle-trace-ns (query) 72 | "Toggle ns tracing. 73 | Defaults to the current ns. With prefix arg QUERY, prompts for a ns." 74 | (interactive "P") 75 | (cider-map-repls :clj-strict 76 | (lambda (conn) 77 | (with-current-buffer conn 78 | (cider-ensure-op-supported "toggle-trace-ns") 79 | (let ((ns (if query 80 | (completing-read "Toggle trace for ns: " 81 | (cider-sync-request:ns-list)) 82 | (cider-current-ns)))) 83 | (let* ((trace-response (cider-sync-request:toggle-trace-ns ns)) 84 | (ns-status (nrepl-dict-get trace-response "ns-status"))) 85 | (pcase ns-status 86 | ("not-found" (error "Namespace %s not found" (cider-propertize ns 'ns))) 87 | (_ (message "Namespace %s %s" (cider-propertize ns 'ns) ns-status))))))))) 88 | 89 | (provide 'cider-tracing) 90 | ;;; cider-tracing.el ends here 91 | -------------------------------------------------------------------------------- /codespell.txt: -------------------------------------------------------------------------------- 1 | debbugs 2 | edn 3 | eduction 4 | hist 5 | juxt 6 | nd 7 | unform 8 | -------------------------------------------------------------------------------- /dev/deps.edn: -------------------------------------------------------------------------------- 1 | ;; This file cannot live at CIDER's project root, because its presence can affect clojure-mode logic, making some tests fail. 2 | {:deps {cider/orchard {:mvn/version "RELEASE"}} 3 | :paths ["."] 4 | :aliases {:gen {:jvm-opts ["-Dclojure.main.report=stderr"] 5 | :main-opts ["-m" "generate-html-fragments"]}}} 6 | -------------------------------------------------------------------------------- /dev/docker-sample-project/.dir-locals.el: -------------------------------------------------------------------------------- 1 | ((nil . ((eval . (customize-set-variable 'cider-path-translations 2 | (list 3 | (cons "/src" (clojure-project-dir)) 4 | (cons "/root/.m2" (concat (getenv "HOME") "/.m2")))))))) 5 | -------------------------------------------------------------------------------- /dev/docker-sample-project/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM clojure:temurin-17-lein-bullseye 2 | ENV DEBIAN_FRONTEND=noninteractive 3 | ENV NREPL_PORT=7888 4 | WORKDIR /root/app 5 | COPY . /root/app 6 | RUN lein deps 7 | EXPOSE 7888 8 | RUN lein classpath 9 | CMD ["lein", "repl", ":headless", ":host", "0.0.0.0", ":port", "7888"] 10 | -------------------------------------------------------------------------------- /dev/docker-sample-project/Makefile: -------------------------------------------------------------------------------- 1 | build: 2 | DOCKER_BUILDKIT=0 docker build --no-cache -t cider-docker-dev . 3 | 4 | run: build 5 | docker run -v $$PWD/src:/app/src -p 7888:7888 cider-docker-dev 6 | -------------------------------------------------------------------------------- /dev/docker-sample-project/README.md: -------------------------------------------------------------------------------- 1 | This project spins up a Clojure project within a Docker image. 2 | 3 | The Docker image exposes an nREPL server. 4 | 5 | This way, for development purposes, we can exercise CIDER's Docker-related capabilities. 6 | 7 | To get started: 8 | 9 | * From a terminal tab, run `make run` to run the Docker image 10 | * Note that it has a volume mapping for `src`, so any local changes will be visible in the Docker image. 11 | * Also note that the root of this subproject has a .dir-locals.el setting up `cider-path-translations`. 12 | * `M-x cider-connect-clj`, choose localhost, 7888 13 | * `M-x cider-load-buffer` the foo.clj namespace. 14 | * From now on, you can `M-.` (jump to definition) recursively, starting from `clj-http.client`. 15 | -------------------------------------------------------------------------------- /dev/docker-sample-project/project.clj: -------------------------------------------------------------------------------- 1 | (defproject cider-docker-dev "0" 2 | :dependencies [[org.clojure/clojure "1.11.1"] 3 | [clj-http "3.12.3"]] 4 | :source-paths ["src"] 5 | :plugins [[cider/cider-nrepl "0.56.0"]]) 6 | -------------------------------------------------------------------------------- /dev/docker-sample-project/src/bar.clj: -------------------------------------------------------------------------------- 1 | (ns bar 2 | (:require [foo])) 3 | -------------------------------------------------------------------------------- /dev/docker-sample-project/src/foo.clj: -------------------------------------------------------------------------------- 1 | (ns foo 2 | (:require 3 | [clj-http.client :as client])) 4 | -------------------------------------------------------------------------------- /dev/generate_html_fragments.clj: -------------------------------------------------------------------------------- 1 | (ns generate-html-fragments 2 | "This script writes test/File.edn files, backing docstring-related Elisp tests." 3 | (:require 4 | [clojure.java.io :as io] 5 | [clojure.pprint :refer [pprint]] 6 | [orchard.java]) 7 | (:import 8 | (java.io File))) 9 | 10 | ;; Ensure that it is requireable - if Orchard internally falls back to other ns, this script won't work properly: 11 | (require 'orchard.java.parser-next) 12 | 13 | (defn -main [& _] 14 | (doseq [class-symbol [`Thread `String `Object `File 'java.util.Map] 15 | :let [{:keys [members] :as x} (orchard.java/source-info class-symbol) 16 | members (->> members vals (map vals) (reduce into)) 17 | all (conj members x) 18 | filename (str "../test" File/separator (-> class-symbol eval .getSimpleName) ".edn")]] 19 | (-> filename io/file .delete) 20 | (with-open [w (io/writer filename :append true)] 21 | (.write w "[") 22 | (doseq [{:keys [doc-fragments doc-first-sentence-fragments doc-block-tags-fragments] :as i} all 23 | :when (or (seq doc-fragments) 24 | (seq doc-first-sentence-fragments) 25 | (seq doc-block-tags-fragments))] 26 | (.write w (with-out-str 27 | (pprint (select-keys i [:doc-fragments 28 | :doc-first-sentence-fragments 29 | :doc-block-tags-fragments])))) 30 | (.write w "\n")) 31 | (.write w "]")) 32 | (println "Processed" (-> filename io/file str))) 33 | (shutdown-agents)) 34 | -------------------------------------------------------------------------------- /dev/tramp-sample-project/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM clojure:temurin-17-lein-bullseye 2 | ENV DEBIAN_FRONTEND=noninteractive 3 | ENV NREPL_PORT=7888 4 | 5 | RUN apt-get update \ 6 | && apt-get install -y openssh-server locales \ 7 | && mkdir /var/run/sshd 8 | 9 | RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \ 10 | locale-gen 11 | ENV LANG en_US.UTF-8 12 | ENV LANGUAGE en_US:en 13 | ENV LC_ALL en_US.UTF-8 14 | 15 | RUN locale-gen en_US.UTF-8 16 | RUN locale-gen en en_US en_US.UTF-8 17 | RUN dpkg-reconfigure locales 18 | 19 | RUN echo 'root:cider' | chpasswd 20 | 21 | RUN sed -i 's/^#* *PasswordAuthentication .*/PasswordAuthentication yes/' /etc/ssh/sshd_config 22 | RUN sed -i 's/^#* *PermitRootLogin .*/PermitRootLogin yes/' /etc/ssh/sshd_config 23 | RUN sed -i 's/^#* *ChallengeResponseAuthentication .*/ChallengeResponseAuthentication yes/' /etc/ssh/sshd_config 24 | 25 | # SSH login fix. Otherwise user is kicked off after login 26 | RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd 27 | 28 | EXPOSE 22 29 | 30 | CMD ["/usr/sbin/sshd", "-D"] 31 | 32 | WORKDIR /usr/src/app 33 | 34 | COPY . /usr/src/app 35 | 36 | RUN lein deps 37 | 38 | RUN echo "export JAVA_HOME=${JAVA_HOME}" >> /root/.bashrc 39 | RUN echo "export JAVA_CMD=${JAVA_HOME}/bin/java" >> /root/.bashrc 40 | RUN echo "export LEIN_HOME=${LEIN_HOME}" >> /root/.bashrc 41 | RUN echo "export LEIN_JAVA_CMD=${LEIN_JAVA_CMD}" >> /root/.bashrc 42 | RUN echo "export LEIN_JVM_OPTS=${LEIN_JVM_OPTS}" >> /root/.bashrc 43 | RUN echo "export LEIN_ROOT=${LEIN_ROOT}" >> /root/.bashrc 44 | RUN echo "export NREPL_PORT=${NREPL_PORT}" >> /root/.bashrc 45 | RUN echo "export PATH=${PATH}" >> /root/.bashrc 46 | -------------------------------------------------------------------------------- /dev/tramp-sample-project/Makefile: -------------------------------------------------------------------------------- 1 | build: 2 | DOCKER_BUILDKIT=0 docker build --no-cache -t cider-tramp-dev . 3 | 4 | run: build 5 | docker run -p 7888:7888 -p 8022:22 cider-tramp-dev 6 | 7 | ssh: 8 | ssh-keygen -R "[localhost]:8022" 9 | echo "Password is: cider" 10 | ssh root@localhost -p 8022 11 | -------------------------------------------------------------------------------- /dev/tramp-sample-project/README.md: -------------------------------------------------------------------------------- 1 | This project spins up a Clojure project within a Docker image. 2 | 3 | The Docker image exposes a SSH server. 4 | 5 | This way, for development purposes, we can SSH into it with TRAMP and exercise CIDER's TRAMP-related capabilities. 6 | 7 | ## Some ways to get started: 8 | 9 | ### `cider-jack-in` from a tramp buffer 10 | * `M-:` `(async-shell-command "make run")` to run the Docker image 11 | * `M-:` `(find-file "/sshx:root@localhost#8022:/usr/src/app/src/foo.clj")` 12 | * `M-x` `cider-jack-in` 13 | * Enter password: `cider` 14 | 15 | ### Manually create a remote repl and connect to it 16 | * In one terminal tab, run `make run` to run the Docker image 17 | * Once it's ready, from another tab, run `make ssh` and start a repl manually from there 18 | * The password is `cider` 19 | * `cd /usr/src/app; lein repl :headless :host 0.0.0.0 :port 7888` 20 | 21 | Now, from emacs you can `cider-connect` to localhost. 22 | 23 | * `M-:`, `(dired "/sshx:root@localhost#8022:/usr/src/app")` 24 | * `M-x cider-connect` (choose `localhost`, `7888`) 25 | 26 | NOTE: Do not visit `foo.clj` directly - do it from dired instead. 27 | -------------------------------------------------------------------------------- /dev/tramp-sample-project/project.clj: -------------------------------------------------------------------------------- 1 | (defproject cider-tramp-dev "0" 2 | :dependencies [[org.clojure/clojure "1.11.1"] 3 | [clj-http "3.12.3"]] 4 | :source-paths ["src"] 5 | :plugins [[cider/cider-nrepl "0.56.0"] 6 | [refactor-nrepl "3.9.0"]]) 7 | -------------------------------------------------------------------------------- /dev/tramp-sample-project/src/foo.clj: -------------------------------------------------------------------------------- 1 | (ns foo 2 | (:require 3 | [clj-http.client :as client])) 4 | -------------------------------------------------------------------------------- /doc/antora.yml: -------------------------------------------------------------------------------- 1 | name: cider 2 | title: CIDER 3 | # We always provide version without patch here (e.g. 1.1), 4 | # as patch versions should not appear in the docs. 5 | version: ~ 6 | nav: 7 | - modules/ROOT/nav.adoc 8 | -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/cider-cheatsheet-select-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/doc/modules/ROOT/assets/images/cider-cheatsheet-select-1.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/cider-cheatsheet-select-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/doc/modules/ROOT/assets/images/cider-cheatsheet-select-2.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/cider-cheatsheet-select-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/doc/modules/ROOT/assets/images/cider-cheatsheet-select-3.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/cider-cheatsheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/doc/modules/ROOT/assets/images/cider-cheatsheet.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/cider-log-transient-mode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/doc/modules/ROOT/assets/images/cider-log-transient-mode.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/cider-log.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/doc/modules/ROOT/assets/images/cider-log.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/cider-overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/doc/modules/ROOT/assets/images/cider-overview.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/cider-stacktrace-inspect.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/doc/modules/ROOT/assets/images/cider-stacktrace-inspect.gif -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/cider-which-key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/doc/modules/ROOT/assets/images/cider-which-key.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/cider_architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/doc/modules/ROOT/assets/images/cider_architecture.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/cider_debugger.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/doc/modules/ROOT/assets/images/cider_debugger.gif -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/cider_find_usages.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/doc/modules/ROOT/assets/images/cider_find_usages.gif -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/cider_see_also.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/doc/modules/ROOT/assets/images/cider_see_also.gif -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/classpath_browser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/doc/modules/ROOT/assets/images/classpath_browser.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/code_completion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/doc/modules/ROOT/assets/images/code_completion.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/completion-annotations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/doc/modules/ROOT/assets/images/completion-annotations.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/dynamic_font_lock_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/doc/modules/ROOT/assets/images/dynamic_font_lock_off.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/dynamic_font_lock_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/doc/modules/ROOT/assets/images/dynamic_font_lock_on.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/eldoc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/doc/modules/ROOT/assets/images/eldoc.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/enlighten_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/doc/modules/ROOT/assets/images/enlighten_disabled.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/enlighten_enabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/doc/modules/ROOT/assets/images/enlighten_enabled.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/history_browser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/doc/modules/ROOT/assets/images/history_browser.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/menu_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/doc/modules/ROOT/assets/images/menu_example.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/ns_browser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/doc/modules/ROOT/assets/images/ns_browser.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/reader_conditionals.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/doc/modules/ROOT/assets/images/reader_conditionals.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/spec_browser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/doc/modules/ROOT/assets/images/spec_browser.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/spec_browser_all.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/doc/modules/ROOT/assets/images/spec_browser_all.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/spec_browser_gen_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/doc/modules/ROOT/assets/images/spec_browser_gen_example.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/tracing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/doc/modules/ROOT/assets/images/tracing.png -------------------------------------------------------------------------------- /doc/modules/ROOT/nav.adoc: -------------------------------------------------------------------------------- 1 | * xref:index.adoc[Home] 2 | * Getting Started 3 | ** xref:basics/installation.adoc[Installation] 4 | ** xref:basics/up_and_running.adoc[Up and Running] 5 | ** xref:basics/middleware_setup.adoc[nREPL Middleware Setup] 6 | * ClojureScript Setup 7 | ** xref:cljs/overview.adoc[Overview] 8 | ** xref:cljs/up_and_running.adoc[Up and Running] 9 | ** xref:cljs/configuration.adoc[Configuration] 10 | ** xref:cljs/figwheel.adoc[Using Figwheel] 11 | ** xref:cljs/shadow-cljs.adoc[Using shadow-cljs] 12 | ** xref:cljs/other_repls.adoc[Using Other REPLs] 13 | * Alternative Platforms 14 | ** xref:platforms/overview.adoc[Overview] 15 | ** xref:platforms/babashka.adoc[Babashka] 16 | ** xref:platforms/nbb.adoc[Nbb] 17 | ** xref:platforms/basilisp.adoc[Basilisp] 18 | ** xref:platforms/other_platforms.adoc[Other Platforms] 19 | * Using CIDER 20 | ** xref:usage/interactive_programming.adoc[Interactive Programming] 21 | ** xref:usage/cider_mode.adoc[Using cider-mode] 22 | ** xref:usage/code_evaluation.adoc[Code Evaluation] 23 | ** xref:usage/code_completion.adoc[Code Completion] 24 | ** xref:usage/code_reloading.adoc[Code Reloading] 25 | ** xref:usage/pretty_printing.adoc[Pretty Printing] 26 | ** xref:usage/dealing_with_errors.adoc[Dealing with Errors] 27 | ** xref:usage/working_with_documentation.adoc[Working with Documentation] 28 | ** xref:usage/managing_connections.adoc[Managing Connections] 29 | ** xref:usage/misc_features.adoc[Misc Features] 30 | * Using the REPL 31 | ** xref:repl/basic_usage.adoc[Basic Usage] 32 | ** xref:repl/keybindings.adoc[Keybindings] 33 | ** xref:repl/configuration.adoc[Configuration] 34 | ** xref:repl/history.adoc[REPL History] 35 | * Testing 36 | ** xref:testing/running_tests.adoc[Running Tests] 37 | ** xref:testing/test_reports.adoc[Test Reports] 38 | ** xref:testing/supported_libraries.adoc[Supported Libraries] 39 | * Debugging 40 | ** xref:debugging/debugger.adoc[Debugger] 41 | ** xref:debugging/enlighten.adoc[Enlighten] 42 | ** xref:debugging/inspector.adoc[Inspector] 43 | ** xref:debugging/logging.adoc[Logging] 44 | ** xref:debugging/macroexpansion.adoc[Macroexpansion] 45 | ** xref:debugging/profiling.adoc[Profiling] 46 | ** xref:debugging/tracing.adoc[Tracing] 47 | * Configuration 48 | ** xref:config/basic_config.adoc[Basic Configuration] 49 | ** xref:config/syntax_highlighting.adoc[Syntax Highlighting] 50 | ** xref:config/indentation.adoc[Indentation] 51 | ** xref:config/eldoc.adoc[Eldoc] 52 | ** xref:config/project_config.adoc[Project-specific Configuration] 53 | * xref:indent_spec.adoc[Indentation Specification] 54 | * xref:caveats.adoc[Caveats] 55 | * xref:troubleshooting.adoc[Troubleshooting] 56 | * xref:faq.adoc[FAQ] 57 | * xref:additional_packages.adoc[Additional Packages] 58 | * xref:additional_resources.adoc[Additional Resources] 59 | * xref:contributing.adoc[Contributing] 60 | ** xref:contributing/docs.adoc[Documentation] 61 | ** xref:contributing/hacking.adoc[Hacking on CIDER] 62 | ** xref:contributing/funding.adoc[Funding] 63 | * About 64 | ** xref:about/history.adoc[History] 65 | ** xref:about/team.adoc[Team] 66 | ** xref:about/support.adoc[Support] 67 | ** xref:about/changelog.adoc[Changelog] 68 | ** xref:about/release_policy.adoc[Release Policy] 69 | ** xref:about/compatibility.adoc[Compatibility] 70 | ** xref:about/logo.adoc[Logo] 71 | ** xref:about/license.adoc[License] 72 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/about/changelog.adoc: -------------------------------------------------------------------------------- 1 | = Changelog 2 | 3 | An extensive changelog is available https://github.com/clojure-emacs/cider/blob/master/CHANGELOG.md[here]. 4 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/about/compatibility.adoc: -------------------------------------------------------------------------------- 1 | = Compatibility 2 | 3 | == Emacs 4 | 5 | CIDER supports Emacs 27.1+. More generally we try to support the last 3 major Emacs releases 6 | when that's feasible and doesn't add a lot of maintenance overhead. 7 | 8 | NOTE: We pay special attention to supporting whatever Emacs is bundled with the current stable Debian 9 | and RHEL GNU/Linux distributions. 10 | 11 | == nREPL 12 | 13 | CIDER supports nREPL 1.0+. 14 | 15 | NOTE: We pay special attention to supporting whatever nREPL is bundled with the current stable Leiningen release. 16 | 17 | == Java 18 | 19 | CIDER officially targets Java 8, 11, 17, 21, and the most recent 20 | non-LTS version. Generally speaking, we aim to support all Java releases that 21 | are currently officially supported by Oracle.footnote:[You can find more 22 | information about the supported Java releases 23 | https://www.oracle.com/java/technologies/java-se-support-roadmap.html[here].] 24 | 25 | NOTE: The requirements for Java are pretty much ``cider-nrepl``'s requirements. 26 | 27 | While CIDER can work with 28 | https://www.ibm.com/think/topics/jvm-vs-jre-vs-jdk[JRE], it is recommended to 29 | use the full JDK distribution. 30 | 31 | == Clojure 32 | 33 | CIDER targets Clojure 1.10+. As Clojure doesn't have the concept of supported releases 34 | we have to get a bit creative to determine the minimum version to target. 35 | 36 | The minimum required Clojure version is currently derived using data 37 | from the 38 | most recent https://clojure.org/news/2023/06/30/state-of-clojure-2023[State of Clojure] survey. 39 | In general we consider a Clojure release eligible for 40 | dropping once its usage drops below 5%, but we'd not drop support for 41 | any release just for the sake of doing it. We'd do it only if 42 | this would lessen the maintenance burden or open up the possibility for 43 | big CIDER improvements. 44 | 45 | == ClojureScript 46 | 47 | Currently we apply the same policy for Clojure and ClojureScript support. 48 | 49 | == Compatibility Matrix 50 | 51 | Below you can find the official compatibility matrix for CIDER. 52 | 53 | .Compatibility Matrix 54 | |=== 55 | | CIDER | Emacs | nREPL | cider-nrepl | Required JDK | Required Clojure 56 | 57 | | 1.1 58 | | 25.1 59 | | 0.6 60 | | 0.25 61 | | 8 62 | | 1.8 63 | 64 | | 1.9 65 | | 26.1 66 | | 1.0 67 | | 0.41 68 | | 8 69 | | 1.8 70 | 71 | | 1.13 72 | | 26.1 73 | | 1.0 74 | | 0.44 75 | | 8 76 | | 1.9 77 | 78 | | 1.17 79 | | 26.1 80 | | 1.0 81 | | 0.50 82 | | 8 83 | | 1.10 84 | 85 | | 1.18 86 | | 27.1 87 | | 1.0 88 | | 0.55 89 | | 8 90 | | 1.10 91 | 92 | |=== 93 | 94 | TIP: You can also check the requirements of a particular CIDER version by inspecting 95 | the values of some CIDER variables. For instance, the required `cider-nrepl` 96 | version is in `cider-required-middleware-version`, and so on. 97 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/about/history.adoc: -------------------------------------------------------------------------------- 1 | = History 2 | 3 | [quote] 4 | You don't know where you're going until you know where you've been. 5 | 6 | CIDER started its life as an effort to replace a hacked version of SLIME with 7 | a proper environment for Clojure development on Emacs. The work on it was 8 | fueled mostly by the advent of nREPL which was the first project that aimed to 9 | provide a common tool-agnostic foundation for Clojure development tools. 10 | 11 | The project was started in April 2012 by Phil Hagelberg (of Leiningen fame), 12 | who hacked a prototype of an nREPL client in Emacs Lisp on a flight to 13 | San Francisco. He got a bit stuck on the socket-based bencode 14 | functionality and dropped it after the flight, but not before pushing 15 | the code out and mentioning it on the http://groups.google.com/group/clojure/browse_thread/thread/2bd91de7dca55ca4[Clojure mailing list]. 16 | 17 | Fortunately Tim King picked it back up, and it quickly became a respectable competitor to SLIME. 18 | The project evolved at rapid pace and eventually superseded SLIME in August 2012.footnote:[https://technomancy.us/163] 19 | Unfortunately in early 2013 Tim ran out of time for `nrepl.el` and after a period of stagnation, eventually handed it over to Bozhidar, who has been the steward 20 | ever since. Bozhidar renamed `nrepl.el` to CIDER in version 0.3 to avoid the common case of confusion between 21 | the nREPL server and the `nrepl` package for Emacs.footnote:[https://github.com/clojure-emacs/cider/issues/375] 22 | 23 | Eventually CIDER became one of the most popular development environments in the Clojure community and it spawned many 24 | important projects like `cider-nrepl`, `cljs-tooling` and `orchard`, that were widely used by other development tools. 25 | Over the years a big ecosystem of packages grew around CIDER and nREPL. Today CIDER faces a lot of competition, but 26 | it's still evolving at a steady pace and it's still one of the more innovative Clojure development environments, 27 | that serves as inspiration for many others. 28 | 29 | == Notable Milestones 30 | 31 | * 17 Apr 2012 - Initial commit by Phil Hagelberg. 32 | * 24 Apr 2012 - Tim King picks up Phil's prototype. 33 | * 10 Jul 2012 - Tim releases version 0.1.0. 34 | * 21 Aug 2012 - Phil announces that `swank-clojure` is officially deprecated in favour of `nrepl.el`. 35 | * Autumn 2012 - Bozhidar starts contributing to `nrepl.el`. 36 | * Summer 2013 - Bozhidar takes over the maintenance of `nrepl.el`. 37 | * 08 Aug 2013 - First release (0.1.8) under Bozhidar's stewardship. 38 | * 28 Oct 2013 - Bozhidar renames `nrepl.el` to CIDER and releases version 0.3. 39 | * Winter 2013 - Work starts on `cider-nrepl` and ClojureScript support for CIDER. 40 | * 05 Aug 2014 - CIDER 0.7 leverages `cider-nrepl` for most of its functionality. 41 | * 16 Jun 2015 - CIDER 0.9 introduces its interactive debugger. 42 | * 03 Mar 2016 - CIDER 0.11 starts auto-injecting its dependencies on `cider-jack-in`. 43 | * 02 Sep 2018 - CIDER 0.18 introduces new connection management based on `sesman`. 44 | * Spring 2018 - Bozhidar assumes the maintenance of nREPL. 45 | * 04 May 2018 - Orchard 0.1 is released. 46 | * 19 Feb 2019 - CIDER 0.21 becomes the first editor to support nREPL 0.6 streamed values and improved pretty-printing. 47 | * 03 Aug 2020 - CIDER 0.26 adds support for new nREPL 0.8 ops like `lookup` and `completions`. 48 | * 28 Dec 2020 - CIDER 1.0 is released. 49 | 50 | To be continued... 51 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/about/license.adoc: -------------------------------------------------------------------------------- 1 | = License & Copyright 2 | :experimental: 3 | 4 | == Code License 5 | 6 | CIDER is distributed under the GNU General Public License, version 3, the same as Emacs. 7 | 8 | TIP: Type kbd:[C-h C-c] in Emacs to view it. 9 | 10 | `cider-nrepl` is distributed under the Eclipse Public License, the same as Clojure. 11 | 12 | == Documentation License 13 | 14 | All the original text is available under the Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0). 15 | 16 | All the original Emacs Lisp code is available under the terms of the GNU General Public License Version 3 or any later version. 17 | 18 | All the original Clojure code is available under the terms of the Eclipse Public License 1 or any later version. 19 | 20 | NOTE: Reach out to Bozhidar if you have any questions about licensing. 21 | 22 | == Copyright 23 | 24 | © 2012-2025 Bozhidar Batsov, Artur Malabarba, Tim King, Phil Hagelberg and CIDER contributors. 25 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/about/logo.adoc: -------------------------------------------------------------------------------- 1 | = Logo 2 | 3 | CIDER's logo was created by https://github.com/tapeinosyne[@tapeinosyne]. You can find 4 | the logo in various formats 5 | https://github.com/clojure-emacs/cider/tree/master/logo[here]. 6 | 7 | The logo is licensed under a 8 | http://creativecommons.org/licenses/by-nc/4.0/deed.en_GB[Creative Commons Attribution-NonCommercial 4.0 International License]. 9 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/about/release_policy.adoc: -------------------------------------------------------------------------------- 1 | = Release Policy 2 | 3 | We're following http://semver.org/[SemVer]. 4 | 5 | NOTE: Prior to CIDER 1.0, bumps of the minor (second) version number 6 | were considered major releases (e.g. 0.25 and 0.26 were major 7 | releases). 8 | 9 | The development cycle for the next major 10 | release starts immediately after the previous one has been 11 | shipped. Bugfix/point releases (if any) address only serious bugs and 12 | never contain new features or public API changes. 13 | 14 | Here are a few examples: 15 | 16 | * 1.1.0 - Feature release 17 | * 1.1.1 - Bug-fix release 18 | * 1.1.2 - Bug-fix release 19 | * 1.2.0 - Feature release 20 | 21 | CIDER and cider-nrepl are released independently, but follow the same release policy overall.footnote:[Keep in mind, though, that cider-nrepl has yet to make it to version 1.0] 22 | CIDER contains references to the cider-nrepl version it supports and would normally inject 23 | the newest cider-nrepl version possible. 24 | 25 | Commands that were made obsolete will be removed in the next major release. 26 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/about/support.adoc: -------------------------------------------------------------------------------- 1 | = Support 2 | 3 | CIDER currently has several official & unofficial support channels. 4 | For questions, suggestions and support refer to one of them. 5 | 6 | IMPORTANT: Please, don't 7 | use the support channels to report issues, as this makes them harder to track. 8 | 9 | The various support channels are listed below in the order of their importance from 10 | the perspective of the maintainers. 11 | 12 | == GitHub Discussions 13 | 14 | These days our primary discussion board is 15 | https://github.com/clojure-emacs/cider/discussions[here]. 16 | 17 | It's a great place to share ideas, help other CIDER users and just be up-to-date 18 | with interesting developments. 19 | 20 | == Slack 21 | 22 | We've got an official https://clojurians.slack.com/[Clojurians 23 | Slack] - `#cider`. The channel is very active and is a great way to 24 | get a handle on some of the maintainers and interact with other CIDER 25 | users. If you need an invite you can go http://clojurians.net/[here]. 26 | 27 | There's also another channel named `#emacs` for generic Emacs discussions. 28 | 29 | NOTE: Bozhidar Slack handle is `bozhidar`, instead of `bbatsov`. 30 | 31 | == StackOverflow 32 | 33 | We're also encouraging users to ask CIDER-related questions on StackOverflow. 34 | 35 | When doing so you should use the 36 | http://stackoverflow.com/questions/tagged/cider[cider] tag (ideally combined 37 | with the tags `emacs` and `clojure`). 38 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/about/team.adoc: -------------------------------------------------------------------------------- 1 | = Team 2 | 3 | == The Core Team 4 | 5 | The direction of the project is being stewarded by the CIDER core team. This 6 | group of long-term contributors manages releases, evaluates pull-requests, and 7 | does a lot of the groundwork on major new features. Here are the current members 8 | of the CIDER core team, listed in the order of joining it: 9 | 10 | * https://github.com/bbatsov[Bozhidar Batsov] (author & head maintainer) 11 | * https://github.com/alexander-yakushev[Oleksandr Yakushev] 12 | 13 | == CIDER Alumni 14 | 15 | In addition, we'd like to extend a special thanks the following retired CIDER 16 | core team members. Lovingly known as The Alumni: 17 | 18 | * https://github.com/kingtim[Tim King] (original author) 19 | * https://github.com/technomancy[Phil Hagelberg] 20 | * https://github.com/hugoduncan[Hugo Duncan] 21 | * https://github.com/purcell[Steve Purcell] 22 | * https://github.com/malabarba[Artur Malabarba] 23 | * https://github.com/jeffvalk[Jeff Valk] 24 | * https://github.com/vspinu[Vitalie Spinu] 25 | * https://github.com/cichli[Michael Griffiths] 26 | * https://github.com/expez[Lars Andersen] 27 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/additional_resources.adoc: -------------------------------------------------------------------------------- 1 | = Additional Resources 2 | 3 | Here we're collecting external resources on CIDER that are complementary to the 4 | user's manual. Please, keep in mind that as CIDER is constantly evolving, some 5 | of those resources might be out-of-date by the time you get to them. 6 | 7 | NOTE: Feel free to submit any useful CIDER resources that you've come across. 8 | 9 | == Quick reference 10 | 11 | A single-page quick reference PDF for CIDER commands is available 12 | https://github.com/clojure-emacs/cider/blob/master/refcard/cider-refcard.pdf[here]. This PDF can be created manually by running 13 | `pdflatex` on https://github.com/clojure-emacs/cider/blob/master/refcard/cider-refcard.tex[the CIDER refcard LaTeX file]. 14 | 15 | == Demos 16 | 17 | * https://www.youtube.com/watch?v=aYA4AAjLfT0[Deep Dive into CIDER] - an overview of CIDER's essential features 18 | * https://www.youtube.com/watch?v=O6g5C4jUCUc[Emacs & Clojure, A Lispy Love Affair] - an overview of all popular Emacs packages for Clojure development (including CIDER) 19 | * https://www.youtube.com/watch?v=IvTDzKVL58Y[Dark CIDER] - a talk featuring a demo of some less known features in CIDER (fast-forward to the 30th minute for the demo part) 20 | * https://cestlaz.github.io/post/using-emacs-63-clojurescript/[Using Emacs: ClojureScript] - an introduction to using CIDER for ClojureScript programming 21 | * https://www.youtube.com/playlist?list=PLdKXxqwRv6_y7rHHjbrK38E59t9ost3o3[Productive Emacs (CIDER)] - a bunch of short videos showcasing different aspects of CIDER 22 | * https://www.youtube.com/watch?v=mSRxiYNk3bY[Learning CIDER - 1 - Jacking into the REPL] 23 | * https://www.youtube.com/watch?v=efPPh2jUrkg[Clojure in Emacs from absolute zero] 24 | * https://www.youtube.com/watch?v=4ecC3jqHooc[Clojure Development Workflow with Spacemacs and CIDER] 25 | 26 | == Presentations 27 | 28 | * https://www.youtube.com/watch?v=4X-1fJm25Ww&list=PLZdCLR02grLoc322bYirANEso3mmzvCiI&index=6[The Evolution of the Emacs tooling for Clojure] - 29 | presented at Clojure/conj 2014; dedicated to the origin and the architecture 30 | of CIDER and related tooling 31 | * https://skillsmatter.com/skillscasts/7225-cider-the-journey-so-far-and-the-road-ahead[CIDER: The Journey so Far and the Road Ahead] - 32 | presented at ClojureX 2015; dedicated to CIDER 0.9 and 0.10 and the future of 33 | the project. 34 | * https://www.youtube.com/watch?v=3Q7APa2Htns&list=PLPgnbBCmP6ZMfHPJ4yMwuoLEZvEe5LVe8[A Few Pints of CIDER] - presented at Clojure Remote 2016; dedicated 35 | to CIDER 0.11; features a 10-minute live demo of some cool CIDER features. 36 | * https://www.youtube.com/watch?v=8wLwbpCxRf0&list=PLZdCLR02grLq4e8-1P2JNHBKUOLFTX3kb[CIDER: Inside the Brewery] - presented at Clojure/West 2016; 37 | dedicated to CIDER 0.12. 38 | 39 | == Podcasts 40 | 41 | * http://blog.cognitect.com/cognicast/080[Cognicast's episode on CIDER] 42 | * https://soundcloud.com/defn-771544745/36-a-long-glass-of-cider-with-bozhidar-batsov-aka-bbatsov[defn's episode on CIDER] 43 | * https://www.therepl.net/episodes/34/[The REPL's episode on CIDER and its Orchard] 44 | 45 | == Tutorials 46 | 47 | IMPORTANT: Keep in mind that third-party tutorials might be outdated by time you get to read them. 48 | 49 | * https://practicalli.github.io/spacemacs/[Clojure Development with Spacemacs] 50 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/basics/installation.adoc: -------------------------------------------------------------------------------- 1 | = Installation 2 | :experimental: 3 | 4 | The canonical way to install CIDER is via `package.el` (Emacs's built-in package 5 | manager). 6 | 7 | NOTE: You can install CIDER using other package managers as well, but this is 8 | outside the scope of this guide. 9 | 10 | == Prerequisites 11 | 12 | You'll need to have Emacs installed, preferably the latest stable 13 | release. If you're new to Emacs you might want to go through 14 | https://www.gnu.org/software/emacs/tour/index.html[the guided tour of Emacs] 15 | and the built-in tutorial (just press kbd:[C-h t]). 16 | 17 | CIDER officially supports Emacs 27.1+, Java 8+, and Clojure(Script) 1.10+. If 18 | you need to work with earlier versions, check 19 | xref:about/compatibility.adoc#compatibility-matrix[compatibility matrix]. 20 | 21 | You'll also need a recent version of your favorite build tool (Clojure CLI, 22 | Leiningen, or Gradle) to be able to start CIDER via `cider-jack-in`. Generally 23 | it's a good idea to use the latest stable versions. 24 | 25 | == Installation via package.el 26 | 27 | CIDER is available on all major `package.el` community 28 | maintained repos - 29 | https://elpa.nongnu.org[NonGNU ELPA], 30 | http://stable.melpa.org[MELPA Stable] 31 | and http://melpa.org[MELPA]. 32 | 33 | NOTE: NonGNU ELPA is one of Emacs's standard repositories and is enabled by 34 | default on Emacs 28+. You'll have to setup MELPA and MELPA Stable yourselves if 35 | you want to use them. 36 | 37 | You can install CIDER with the following command: 38 | 39 | kbd:[M-x package-install cider ] 40 | 41 | or by adding this bit of Emacs Lisp code to your Emacs initialization file 42 | (`.emacs` or `init.el`): 43 | 44 | [source,lisp] 45 | ---- 46 | (unless (package-installed-p 'cider) 47 | (package-install 'cider)) 48 | ---- 49 | 50 | If the installation doesn't work try refreshing the package list: 51 | 52 | kbd:[M-x package-refresh-contents ] 53 | 54 | It's important to note that MELPA packages are built automatically 55 | from the `master` branch, and that means you'll be right on the 56 | leading edge of development. This has upsides and downsides; you'll 57 | see new features first, but you might experience some bugs from 58 | time to time. Nevertheless, installing from MELPA is a reasonable way 59 | to obtain CIDER. The `master` branch is normally quite stable 60 | and serious regressions there are usually fixed quickly. 61 | 62 | TIP: If you don't want to (or can't) wait for MELPA to rebuild CIDER, 63 | you can easily build and install an up-to-date MELPA package locally yourself. Check out 64 | http://emacsredux.com/blog/2015/05/10/building-melpa-packages-locally/[this article] 65 | for details on the subject. 66 | 67 | If you have concerns about living on the leading edge of CIDER 68 | development, you can always pin CIDER to use NonGNU ELPA or MELPA Stable like this: 69 | 70 | [source,lisp] 71 | ---- 72 | ;; pin to NonGNU ELPA 73 | (add-to-list 'package-pinned-packages '(cider . "nongnu") t) 74 | 75 | ;; pin to MELPA Stable 76 | (add-to-list 'package-pinned-packages '(cider . "melpa-stable") t) 77 | ---- 78 | 79 | NOTE: CIDER has dependencies (e.g. `queue` & `seq`) that are only available in the 80 | https://elpa.gnu.org/[GNU ELPA repository]. It's the only package repository 81 | enabled by default in Emacs and you should not disable it! 82 | 83 | == Installation via use-package 84 | 85 | `use-package` can be used to install CIDER via the ``package.el``'s repositories 86 | https://elpa.nongnu.org[NonGNU ELPA], http://stable.melpa.org[MELPA Stable] and http://melpa.org[MELPA]. 87 | 88 | If you wanted to install the version of CIDER which is what is to be found in 89 | the `master` branch, declare the following in your Emacs initialization file 90 | (`.emacs` or `init.el`): 91 | 92 | [source,lisp] 93 | ---- 94 | (use-package cider 95 | :ensure t) 96 | ---- 97 | 98 | However, if you wanted to be a bit more conservative and only use the stable 99 | releases of CIDER, you'd declare the following: 100 | 101 | [source,lisp] 102 | ---- 103 | (use-package cider 104 | :ensure t 105 | :pin melpa-stable) 106 | ---- 107 | 108 | After placing one of the above s-expressions, evaluate it, for it to take effect 109 | by entering: kbd:[C-x C-e]. 110 | 111 | For further configuration options with `use-package`, consult the 112 | official https://github.com/jwiegley/use-package[use-package repository]. 113 | 114 | == Manual Installation 115 | 116 | Installing CIDER manually is discouraged unless you plan to work with CIDER's 117 | codebase. The manual installation is relatively involved as it requires manual 118 | installation of the dependencies. Check out the section 119 | xref:contributing/hacking.adoc[Hacking on CIDER] for more details. 120 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/basics/middleware_setup.adoc: -------------------------------------------------------------------------------- 1 | = nREPL Middleware Setup 2 | :experimental: 3 | 4 | NOTE: You can skip this section if you don't plan to use `cider-connect` or don't care 5 | about the advanced functionality that requires `cider-nrepl`. 6 | 7 | Much of CIDER's functionality depends on its own 8 | https://github.com/clojure-emacs/cider-nrepl[nREPL middleware]. `cider-jack-in` 9 | (kbd:[C-c C-x (C-)j (C-)j]) automatically injects this middleware and other 10 | dependencies as required. But if you prefer a standalone REPL, you will need to 11 | invoke `cider-connect` instead of `cider-jack-in` and manually add the 12 | dependencies to your Clojure project (explained in the following sections). 13 | 14 | == Setting Up a Standalone REPL 15 | 16 | === Using Leiningen 17 | 18 | Use the convenient plugin for defaults, either in your project's 19 | `project.clj` file or in the `:repl` profile in `~/.lein/profiles.clj`. 20 | 21 | [source,clojure] 22 | ---- 23 | :plugins [[cider/cider-nrepl "0.56.0"]] 24 | ---- 25 | 26 | A minimal `profiles.clj` for CIDER would be: 27 | 28 | [source,clojure] 29 | ---- 30 | {:repl {:plugins [[cider/cider-nrepl "0.56.0"]]}} 31 | ---- 32 | 33 | WARNING: Be careful not to place this in the `:user` profile, as this way CIDER's 34 | middleware will always get loaded, causing `lein` to start slower. You really 35 | need it just for `lein repl` and this is what the `:repl` profile is for. 36 | 37 | === Using tools.deps 38 | 39 | You can add the following aliases to your deps.edn in order to launch 40 | a standalone Clojure(Script) nREPL server with CIDER middleware from 41 | the commandline with something like `clj -A:cider-clj`. Then from emacs 42 | run `cider-connect` or `cider-connect-cljs`. 43 | 44 | [source,clojure] 45 | ---- 46 | :cider-clj {:extra-deps {cider/cider-nrepl {:mvn/version "0.56.0"}} 47 | :main-opts ["-m" "nrepl.cmdline" "--middleware" "[cider.nrepl/cider-middleware]"]} 48 | 49 | :cider-cljs {:extra-deps {org.clojure/clojurescript {:mvn/version "1.10.339"} 50 | cider/cider-nrepl {:mvn/version "0.56.0"} 51 | cider/piggieback {:mvn/version "0.6.0"}} 52 | :main-opts ["-m" "nrepl.cmdline" "--middleware" 53 | "[cider.nrepl/cider-middleware,cider.piggieback/wrap-cljs-repl]"]} 54 | ---- 55 | 56 | NOTE: the suggested ClojureScript setup is apt for e.g. library development, but not for frontend development. 57 | For those cases, you may want to check out our xref:cljs/shadow-cljs.adoc#using-cider-connect-cljs[shadow-cljs] 58 | or xref:cljs/figwheel.adoc#clojure-cli-setup[figwheel] setups instead. 59 | 60 | === Using Gradle 61 | 62 | NOTE: Make sure you're using https://github.com/clojurephant/clojurephant[Clojurephant] 0.4.0 or newer. 63 | 64 | .build.gradle 65 | [source, groovy] 66 | ---- 67 | dependencies { 68 | devImplementation 'nrepl:nrepl:1.3.1' 69 | devImplementation 'cider:cider-nrepl:0.56.0' 70 | } 71 | 72 | tasks.named('clojureRepl') { 73 | middleware = ['cider.nrepl/cider-middleware'] 74 | } 75 | ---- 76 | 77 | You can then launch the nREPL server from the command line via: `./gradlew clojureRepl`. 78 | 79 | For more information, see the https://clojurephant.dev[Clojurephant docs]. 80 | 81 | === Using Maven 82 | 83 | NOTE: This section is currently a stub. Contributions welcome! 84 | 85 | == Using Embedded nREPL Server 86 | 87 | If you're embedding nREPL in your application, you'll have to start the 88 | server with CIDER's own nREPL handler. 89 | 90 | [source,clojure] 91 | ---- 92 | (ns my-app 93 | (:require [nrepl.server :as nrepl-server] 94 | [cider.nrepl :refer (cider-nrepl-handler)])) 95 | 96 | (defn -main 97 | [] 98 | (nrepl-server/start-server :port 7888 :handler cider-nrepl-handler)) 99 | ---- 100 | 101 | It goes without saying that your project should depend on `cider-nrepl`. 102 | 103 | NOTE: CIDER and cider-nrepl projects are co-developed, but are not released in a 104 | lock-step — they have differing versions. Usually, any recent version of 105 | cider-nrepl should be (mostly) compatible with a recent version of CIDER. You 106 | can check the required version of cider-nrepl for your version of CIDER by 107 | looking at `cider-required-middleware-version`. See also the 108 | xref:about/compatibility.adoc#compatibility-matrix[compatibility 109 | matrix]. 110 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/caveats.adoc: -------------------------------------------------------------------------------- 1 | = Caveats 2 | :experimental: 3 | 4 | CIDER is certainly not perfect and has some limitations that everyone 5 | should be aware of. 6 | 7 | == ClojureScript limitations 8 | 9 | Currently, the following features are not supported for ClojureScript 10 | development: 11 | 12 | * Reloading 13 | * Running tests 14 | * Tracing 15 | * Debugging (check out https://github.com/clojure-emacs/cider/issues/1416[this ticket] dedicated to porting the debugger to ClojureScript) 16 | * Enlighten 17 | 18 | There is currently no support for both Clojure and ClojureScript evaluation in 19 | the same nREPL session. If Piggieback is active, code evaluation and all 20 | features will assume ClojureScript. 21 | 22 | == Microsoft Windows 23 | 24 | === Line separators 25 | 26 | On Microsoft Windows the JVM default line separator string is `\r\n` 27 | which can appear in Emacs as `+^M+` characters at the end of lines 28 | printed out by the JVM. One option is to set the 29 | `buffer-display-table` to not show these characters as detailed 30 | http://stackoverflow.com/questions/10098925/m-character-showing-in-clojure-slime-repl/11787550#11787550[here] 31 | (changing `slime-repl-mode-hook` to 32 | `cider-repl-mode-hook`). Alternatively, setting the system property 33 | `line.separator` to `\n` at JVM startup will stop the carriage return 34 | from being printed and will fix output in all cider buffers. To do so 35 | add `"-Dline.separator=\"\n\""` to `:jvm-opts` in 36 | `~/.lein/profiles.clj`. 37 | 38 | === Definition lookup in jar files 39 | 40 | In order for source lookup commands to work with `.jar` files you'll need to 41 | install either http://www.7-zip.org/[7zip] or `pkunzip` and add its 42 | installation folder to Emacs's `exec-path`. Here's an example: 43 | 44 | [source,lisp] 45 | ---- 46 | (add-to-list 'exec-path "C:/Program Files/7-Zip") 47 | ---- 48 | 49 | == powershell.el 50 | 51 | The powershell inferior shell mode truncates CIDER's REPL output when 52 | loaded. As a workaround remove 53 | 54 | [source,lisp] 55 | ---- 56 | (require 'powershell) 57 | ---- 58 | 59 | from your Emacs config. 60 | 61 | == ClojureCLR Support 62 | 63 | CIDER currently has very basic support ClojureCLR (via Arcadia's nREPL server). The reasons for this are the following: 64 | 65 | * nREPL itself runs only on the JVM (because it leverages Java APIs 66 | internally). There's an 67 | https://github.com/clojure/clr.tools.nrepl[nREPL port for ClojureCLR], but 68 | it's not actively maintained and it doesn't behave like the Clojure nREPL. 69 | * `cider-nrepl` uses a lot of Java code internally itself. 70 | 71 | Those issues are not insurmountable, but are beyond the scope of our current roadmap. 72 | If someone would like to tackle them, we'd be happy to provide assistance. 73 | 74 | == Injecting dependencies and Leiningen pedantic: abort mode 75 | 76 | Because injection currently creates an override of the nREPL dependency that 77 | Leingingen also pulls in starting up the REPL will fail if `:pedantic? :abort` 78 | is set. There are several ways to address this: 79 | 80 | * Remove the `:pedantic? :abort` setting. 81 | * Switch off injecting the dependencies with setting `cider-inject-dependencies-at-jack-in` to `nil` and 82 | provide the dependencies by editing your `~/.lein/profiles.clj` as described in 83 | the xref:basics/middleware_setup.adoc#setting-up-a-standalone-repl[standalone REPL] section. 84 | * Adjust the value of `cider-injected-nrepl-version` to the same nREPL version as the 85 | one that's bundled with Leiningen. 86 | 87 | == clojure-ts-mode integration 88 | 89 | NOTE: `clojure-ts-mode` support was introduced in CIDER 1.14. 90 | 91 | CIDER has basic support for working with 92 | https://github.com/clojure-emacs/clojure-ts-mode[clojure-ts-mode] buffers, but it still depends on 93 | https://github.com/clojure-emacs/clojure-mode[clojure-mode] for certain functionality, like 94 | extracting information about Clojure code out of the buffer. We hope to make `clojure-ts-mode` capable 95 | of providing CIDER with all the functionality it needs to interact with Clojure buffers, but that 96 | will take some time. 97 | 98 | Additionally, some features like 99 | xref:config/indentation.adoc#dynamic-indentation[`cider-dynamic-indentation`] 100 | and xref:config/syntax_highlighting.adoc#dynamic-syntax-highlighting[`cider-font-lock-dynamically`] 101 | are not supported by `clojure-ts-mode`. 102 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/cljs/configuration.adoc: -------------------------------------------------------------------------------- 1 | = Configuration 2 | 3 | In this section we'll briefly examine some common configuration 4 | options related to ClojureScript. Configuration that is specific 5 | to a particular REPL (e.g. `shadow-cljs`) is covered separately 6 | in the individual REPL setup sections. 7 | 8 | == Modifying the ClojureScript jack-in dependencies 9 | 10 | Out-of-the-box, CIDER injects a single dependency into ClojureScript REPLs - namely `piggieback`. 11 | If you'd like to inject more deps you'll have to modify the `cider-jack-in-cljs-dependencies` 12 | variable. Here's an example: 13 | 14 | [source,lisp] 15 | ---- 16 | ;; let's add Weasel on jack-in 17 | (cider-add-to-alist 'cider-jack-in-cljs-dependencies "weasel/weasel" "0.7.1") 18 | ---- 19 | 20 | IMPORTANT: Always use the fully qualified `group/artifact` (e.g. `re-frame/re-frame`) in these dependencies, since only Leiningen supports the bare `re-frame` syntax. 21 | 22 | Typically, modifying this variable is not needed, as ClojureScript dependencies are declared 23 | explicitly in your project configuration most of the time. 24 | 25 | NOTE: Modifying this variable will affect all ClojureScript REPL types. 26 | 27 | == Setting a Default ClojureScript REPL Type 28 | 29 | If you frequently use the same ClojureScript REPL, you can set 30 | `cider-default-cljs-repl` and CIDER will skip the prompt and use this 31 | instead. For example, the following will make Node.js the default: 32 | 33 | [source,lisp] 34 | ---- 35 | (setq cider-default-cljs-repl 'node) 36 | ---- 37 | 38 | == Defining Custom ClojureScript REPL Types 39 | 40 | All supported ClojureScript REPLs are stored in 41 | `cider-cljs-repl-types`. If you need to extend it, you should use 42 | `cider-register-cljs-repl-type` in your Emacs configuration. 43 | 44 | [source,lisp] 45 | ---- 46 | (cider-register-cljs-repl-type 'super-cljs "(do (...))" optional-requirements-function) 47 | ---- 48 | 49 | NOTE: If you're registering a self-hosted (native) ClojureScript REPL (e.g. `scittle`), the "upgrade" form should be `nil`. 50 | 51 | You can also modify the known ClojureScript REPLs on a per-project basis using 52 | `.dir-locals.el`: 53 | 54 | [source,lisp] 55 | ---- 56 | ;; replace the list of REPL types and set some default 57 | ((nil 58 | (cider-default-cljs-repl . super-cljs) 59 | (cider-cljs-repl-types . ((super-cljs "(do (foo) (bar))"))))) 60 | ---- 61 | 62 | [source,lisp] 63 | ---- 64 | ;; modify the list of known REPLs and set some default 65 | ((nil 66 | (eval . (cider-register-cljs-repl-type 'super-cljs "(do (foo) (bar))")) 67 | (cider-default-cljs-repl . super-cljs))) 68 | ---- 69 | 70 | For one-off REPLs you can also use the custom REPL init form like this: 71 | 72 | [source,lisp] 73 | ---- 74 | ;; modify the list of known REPLs and set some default 75 | ((nil 76 | (cider-custom-cljs-repl-init-form . "(do (foo) (bar))" 77 | (cider-default-cljs-repl . custom))) 78 | ---- 79 | 80 | If you already have a Clojure REPL running and want to add a 81 | ClojureScript REPL, you can invoke 82 | `cider-jack-in-sibling-clojurescript` to add it. 83 | 84 | == Enhanced Completion 85 | 86 | By default CIDER will enrich the ClojureScript completion results using 87 | the https://github.com/rksm/clj-suitable[suitable] library. If case you run 88 | into any `suitable`-related issues you can disable the enhanced completion like this: 89 | 90 | [source,lisp] 91 | ---- 92 | (setq cider-enhanced-cljs-completion-p nil) 93 | ---- 94 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/cljs/krell.adoc: -------------------------------------------------------------------------------- 1 | = Using Krell 2 | :experimental: 3 | 4 | https://github.com/vouch-opensource/krell[Krell] is the newest 5 | ClojureScript React Native REPL. In this section we'll discuss how to 6 | set it up and use it together with CIDER. 7 | 8 | == Installing Krell 9 | 10 | To use Krell, specify it as a dependency in your `deps.edn` as per 11 | https://github.com/vouch-opensource/krell/wiki/Reagent-Tutorial[Krell's own wiki]. 12 | 13 | == Starting a Krell REPL 14 | 15 | === Using cider-jack-in-cljs 16 | 17 | Provided you've configured your project correctly, you can simply use 18 | `cider-jack-in-cljs`: 19 | 20 | * Press kbd:[C-c C-x j s] (or do `M-x cider-jack-in-cljs`) 21 | * When prompted for the ClojureScript REPL type to start, select `krell` 22 | 23 | This will automatically start the REPL server and connect to it. 24 | 25 | You can get rid of the prompts for the REPL type and the target build 26 | by creating a `.dir-locals.el` file with the following contents in the 27 | root of your project. 28 | 29 | [source,clojure] 30 | ---- 31 | ((nil . ((cider-default-cljs-repl . krell)))) 32 | ---- 33 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/cljs/other_repls.adoc: -------------------------------------------------------------------------------- 1 | = Using Other ClojureScript REPLs 2 | :experimental: 3 | 4 | While these days most people are using `figwheel` and `shadow-cljs`, 5 | CIDER supports other ClojureScript REPLs as well. 6 | This section of the user manual is dedicated to them. 7 | 8 | == Node.js REPL 9 | 10 | IMPORTANT: Make sure `node.js` is installed and that the `node` binary 11 | is on Emacs's `exec-path`. 12 | 13 | ClojureScript's Node.js REPL is really simple to setup, as it doesn't 14 | require you to fiddle with your project's dependencies. All you need to do is: 15 | 16 | . Open some file in your project. 17 | . Type kbd:[M-x] `cider-jack-in-cljs` kbd:[RET]. 18 | . Choose the `node` option when prompted about the ClojureScript REPL type you want 19 | to use. 20 | 21 | == Weasel 22 | 23 | Using https://github.com/nrepl/weasel[Weasel], you can have a browser-connected REPL. 24 | 25 | . Add `[weasel "0.7.1"]` to your project's `:dependencies`. 26 | . Type kbd:[M-x] `cider-jack-in-cljs` kbd:[RET] and choose 27 | the `Weasel` option when prompted about the ClojureScript REPL type you want 28 | to use. 29 | . Add this to your ClojureScript code: 30 | + 31 | [source,clojure] 32 | ---- 33 | (ns my.cljs.core 34 | (:require [weasel.repl :as repl])) 35 | (repl/connect "ws://localhost:9001") 36 | ---- 37 | + 38 | . Once connected you can start evaluating code in the REPL and you'll see the results in your 39 | browser. 40 | + 41 | cljs.user> (js/alert "Hello world!") 42 | 43 | Provided that a Piggieback-enabled ClojureScript environment is active in your 44 | REPL session, code loading and evaluation will work seamlessly regardless of the 45 | presence of the `cider-nrepl` middleware. If the middleware is present then most 46 | other features of CIDER will also be enabled (including code completion, 47 | documentation lookup, the namespace browser, and macroexpansion). 48 | 49 | TIP: For more information on Weasel you should consult its https://github.com/nrepl/weasel/blob/master/README.md[documentation]. 50 | 51 | == nbb (node.js babashka) 52 | 53 | CIDER has built-in support for `nbb`. You can either jack in to an nbb project with `M-x clojure-jack-in-cljs`. 54 | 55 | or start its bundled nREPL server: 56 | 57 | $ nbb nrepl-server 58 | 59 | and connect to it afterwards using `M-x cider-connect-cljs`. 60 | 61 | See the xref:platforms/nbb.adoc[dedicated page] for more details. 62 | 63 | == Other Self-hosted REPLs 64 | 65 | For all other self-hosted REPLs you can follow the instructions xref:platforms/other_platforms.adoc[here]. This will work fine with any well-behaved nREPL implementation, like those of: 66 | 67 | * https://github.com/babashka/nbb[nbb] 68 | * https://github.com/babashka/scittle[scittle] 69 | * https://github.com/BetterThanTomorrow/joyride[joyride] 70 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/config/eldoc.adoc: -------------------------------------------------------------------------------- 1 | = ElDoc 2 | 3 | Eldoc is a buffer-local minor mode that helps with looking up Lisp 4 | documentation. When it is enabled, the echo area displays some useful 5 | information whenever there is a Lisp function or variable at point; 6 | for a function, it shows the argument list, and for a variable it 7 | shows the first line of the variable's documentation string. 8 | 9 | CIDER provides a Clojure backend for ElDoc that works out-of-the box, as 10 | long as `eldoc-mode` is enabled. 11 | 12 | image::eldoc.png[Eldoc] 13 | 14 | == Enabling ElDoc 15 | 16 | `global-eldoc-mode` is enabled by default in Emacs 25.1, so you don't really have 17 | to do anything to enable it. 18 | 19 | It will work in both source and REPL buffers. 20 | 21 | == Configuring ElDoc 22 | 23 | === Displaying ElDoc for the Symbol at Point 24 | 25 | Typically you'd see the eldoc for the containing function/macro/special form (with 26 | respect to your cursor's position). 27 | 28 | CIDER also would show the eldoc for the symbol at point. So in `+(map inc ...)+` 29 | when the cursor is over `inc` its eldoc would be displayed. You can turn off this 30 | behavior by: 31 | 32 | [source,lisp] 33 | ---- 34 | (setq cider-eldoc-display-for-symbol-at-point nil) 35 | ---- 36 | 37 | === Dealing with Long ElDoc 38 | 39 | CIDER respects the value of `eldoc-echo-area-use-multiline-p` when 40 | displaying documentation in the minibuffer. You can customize this variable to change 41 | its behavior. 42 | 43 | |=== 44 | | eldoc-echo-area-use-multiline-p | Behavior 45 | 46 | | `t` 47 | | Never attempt to truncate messages. Complete symbol name and function arglist or variable documentation will be displayed even if echo area must be resized to fit. 48 | 49 | | `nil` 50 | | Messages are always truncated to fit in a single line of display in the echo area. 51 | 52 | | `truncate-sym-name-if-fit` or anything non-nil 53 | | Symbol name may be truncated if it will enable the function arglist or documentation string to fit on a single line. Otherwise, behavior is just like `t` case. 54 | |=== 55 | 56 | === Context-dependent ElDoc 57 | 58 | CIDER will try to add expected function arguments based on the current context 59 | (for example for the `datomic.api/q` function where it will show the expected 60 | inputs of the query at point), if the variable `cider-eldoc-display-context-dependent-info` 61 | is non-nil: 62 | 63 | [source,lisp] 64 | ---- 65 | (setq cider-eldoc-display-context-dependent-info t) 66 | ---- 67 | 68 | === Disable CIDER's ElDoc Function 69 | 70 | If you're using CIDER alongside `clojure-lsp` you might prefer to use `clojure-lsp` for ElDoc. This means you'll have to remove CIDER's ElDoc function from the list of registered ElDoc functions: 71 | 72 | [source,lisp] 73 | ---- 74 | (remove-hook 'eldoc-documentation-functions #'cider-eldoc) 75 | ---- 76 | 77 | TIP: If you're dealing with a lot of packages providing some ElDoc integration 78 | it's a good idea to learn about 79 | https://www.masteringemacs.org/article/seamlessly-merge-multiple-documentation-sources-eldoc[merging 80 | multiple documentation sources with ElDoc]. In brief - Emacs 28 added support 81 | for multiple documentation backends. Now you can read error messages from your 82 | linter or compiler *and* see code documentation at the same time. Cool stuff! 83 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/config/syntax_highlighting.adoc: -------------------------------------------------------------------------------- 1 | = Syntax highlighting 2 | 3 | `clojure-mode` provides basic syntax highlighting for Clojure(Script) code, but 4 | CIDER builds upon this in several ways. The biggest limitation of `clojure-mode` 5 | is that the syntax highlighting there is based on the usage of regular expressions 6 | to figure out what's the syntactic category of the various identifiers (e.g. constants, 7 | macros, types, etc). CIDER, however, has access to all the data about identifiers from 8 | code that has already been loaded into nREPL, so it can provide a richer and more accurate 9 | syntax highlighting. We call this functionality "dynamic syntax highlighting" (as opposed to 10 | the somewhat static syntax highlighting you'd get from `clojure-mode`). 11 | 12 | == Dynamic syntax highlighting 13 | 14 | NOTE: The Emacs term for "syntax highlighting" is "font-locking". That's why 15 | all configuration variables that have something to do with syntax highlighting have 16 | "font-locking" in their names. 17 | 18 | CIDER can syntax highlight symbols that are known to be defined. By default, 19 | this is done from symbols from the `clojure.core` and `cljs.core` namespaces, as 20 | well as macros from any namespace. If you'd like CIDER to also colorize usages 21 | of functions and variables from any namespace, do: 22 | 23 | [source,lisp] 24 | ---- 25 | (setq cider-font-lock-dynamically '(macro core function var)) 26 | ---- 27 | 28 | Here's how code looks without dynamic syntax highlighting. 29 | 30 | image::dynamic_font_lock_off.png[Dynamic Font-lock Off] 31 | 32 | And here's how the code looks when it's turned on. 33 | 34 | image::dynamic_font_lock_on.png[Dynamic Font-lock On] 35 | 36 | You can refer to the `cider-font-lock-dynamically` Elisp documentation for further details. 37 | 38 | == Syntax highlighting for reader conditionals 39 | 40 | By default CIDER will apply font-locking to unused reader conditional 41 | expressions depending on the buffer's CIDER connection type. 42 | 43 | image::reader_conditionals.png[Reader Conditionals] 44 | 45 | You can disable this behavior by adjusting `cider-font-lock-reader-conditionals`: 46 | 47 | [source,lisp] 48 | ---- 49 | (setq cider-font-lock-reader-conditionals nil) 50 | ---- 51 | 52 | == Customizing CIDER faces 53 | 54 | CIDER defines a few custom faces that you might want to adjust (although normally your color theme 55 | should take care of them): 56 | 57 | * `cider-deprecated-face` - used for syntax highlighting deprecated vars 58 | * `cider-instrumented-face` - used for syntax highlighting instrumented for debugging vars 59 | * `cider-traced-face` - used for syntax highlighting traced and profiled vars 60 | * `cider-reader-conditional-face` - used for syntax highlighting inactive reader conditional branches 61 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/contributing.adoc: -------------------------------------------------------------------------------- 1 | = Contributing 2 | 3 | == Issues 4 | 5 | Report issues and suggest features and improvements on the 6 | https://github.com/clojure-emacs/cider/issues[GitHub issue tracker]. Don't ask 7 | questions on the issue tracker - use the xref:about/support.adoc[support channels] instead. 8 | 9 | If you want to file a bug, please provide all the necessary info listed in 10 | our issue reporting template (it's loaded automatically when you create a 11 | new GitHub issue). 12 | 13 | It's usually a good idea to try to reproduce (obscure) bugs in isolation. You 14 | can do this by cloning CIDER's GitHub repo and running `make run-cider` inside 15 | it. This will bring up Emacs with only the latest version of CIDER loaded. By 16 | starting fresh, with the latest code, we can ensure that the problem at hand 17 | isn't already fixed or caused by interactions with other packages. 18 | 19 | == Patches 20 | 21 | Patches in any form are always welcome! GitHub pull requests are even better! :-) 22 | 23 | If your changes do not require a REPL, consider submitting to https://github.com/clojure-emacs/clojure-mode[clojure-mode] instead. 24 | 25 | Before submitting a patch or a pull request make sure all tests are 26 | passing and that your patch is in line with the https://github.com/clojure-emacs/cider/blob/master/.github/CONTRIBUTING.md[contribution 27 | guidelines]. 28 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/contributing/docs.adoc: -------------------------------------------------------------------------------- 1 | = Documentation 2 | 3 | Good documentation is just as important as good code.footnote:[If not even more important.] 4 | CIDER is a pretty complex project with numerous features and the user manual is one 5 | of the primary ways to discover those. Please, consider improving and extending it. 6 | 7 | == Overview 8 | 9 | The manual is generated from the AsciiDoc files in the https://github.com/clojure-emacs/cider/tree/master/doc[doc] folder of CIDER's GitHub repo and is published to https://docs.cider.mx. 10 | https://antora.org[Antora] is used to convert the AsciiDoc source into HTML. 11 | Antora's filesystem layout is described https://docs.antora.org/antora/3.1/component-structure/[here]. 12 | 13 | == Installing Antora 14 | 15 | NOTE: The instructions here assume you already have (the right version of) node.js installed. 16 | 17 | Installing the Antora is super simple: 18 | 19 | [source] 20 | ---- 21 | $ npm install 22 | ---- 23 | 24 | Check out https://docs.antora.org/antora/3.1/install/install-antora/[the detailed installation instructions] 25 | if you run into any problems. 26 | 27 | == Editing the Docs 28 | 29 | If you want to make changes to the manual's page structure you'll have to edit 30 | https://github.com/clojure-emacs/cider/blob/master/doc/modules/ROOT/nav.adoc[nav.adoc]. 31 | 32 | == Building the Docs Site 33 | 34 | To make changes to the manual you simply have to change the files under `doc`. 35 | 36 | You can build the documentation locally from the https://github.com/clojure-emacs/docs.cider.mx[docs.cider.mx] repo. 37 | 38 | [source,shell] 39 | ---- 40 | $ git clone https://github.com/clojure-emacs/docs.cider.mx 41 | $ cd docs.cider.mx 42 | $ make build 43 | ---- 44 | 45 | To check the generated site you can simply open `build/site/index.html` in your favourite browser. 46 | 47 | == Deploying the Docs Site 48 | 49 | NOTE: The manual will be regenerated manually periodically by CIDER's Core Team. 50 | 51 | We're currently publishing the user manual to GitHub Pages. 52 | The deployment is handled by a GitHub Actions workflow that builds and deploys the 53 | documentation every time something is changed in the documentation site's repository. 54 | It can also be triggered manually if needed. 55 | 56 | == Updating the Playbook 57 | 58 | IMPORTANT: Don't forget to update the manual's version metadata when cutting CIDER releases. 59 | It lives in `doc/antora.yml`. 60 | 61 | When cutting new releases you'll have to updated `antora-playbook.yml` to mention 62 | their relevant tags from which the documentation needs to be build. Here's how this 63 | looks for one of the projects: 64 | 65 | [source] 66 | ---- 67 | - url: https://github.com/clojure-emacs/cider.git 68 | branches: master 69 | tags: ['v1.7.0', 'v1.8.0'] 70 | start_path: docs 71 | ---- 72 | 73 | TIP: You need to add one such block for each new CIDER module you're adding to the docs site. 74 | 75 | == Troubleshooting 76 | 77 | The most common mistake that people make is to forget to update the version of an Antora docs module 78 | after cutting a release. This will result in an error saying you've got the same version in two branches (e.g. `master` 79 | and `v1.0`). Fixing this is pretty simple - just update the version to `master` in `antora.yml`. 80 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/contributing/funding.adoc: -------------------------------------------------------------------------------- 1 | = Funding 2 | 3 | While CIDER is free software and will always be, the project would benefit immensely from some funding. 4 | Raising a monthly budget of a couple of thousand dollars would make it possible to pay people to work on 5 | certain complex features, fund other development related stuff (e.g. hardware, conference trips) and so on. 6 | Raising a monthly budget of over $5000 would open the possibility of someone working full-time on the project 7 | which would speed up the pace of development significantly. 8 | 9 | == Funding Channels 10 | 11 | We welcome both individual and corporate sponsors! We also offer a wide array of funding channels to account 12 | for your preferences (although currently https://opencollective.com/cider[Open Collective] is our preferred funding platform). 13 | 14 | If you're working in a company that's making significant use of CIDER we'd appreciate it if you suggest to your company 15 | to become a CIDER sponsor. 16 | 17 | You can support the development of CIDER, https://github.com/clojure-emacs/clojure-mode[clojure-mode] and https://github.com/clojure-emacs/inf-clojure[inf-clojure] via: 18 | 19 | * https://opencollective.com/cider[Open Collective] 20 | * https://github.com/sponsors/bbatsov[GitHub Sponsors] 21 | * https://www.patreon.com/bbatsov[Patreon] 22 | * https://www.paypal.me/bbatsov[PayPal] 23 | 24 | === Open Collective 25 | 26 | People and companies supporting our collective will be featured on CIDER's README. 27 | 28 | * https://opencollective.com/cider#backer[Become a backer] (for individuals) 29 | * https://opencollective.com/cider#sponsor[Become a sponsor] (for companies) 30 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/debugging/enlighten.adoc: -------------------------------------------------------------------------------- 1 | = Enlighten 2 | :experimental: 3 | 4 | Enlighten Mode displays the value of locals in realtime, as your code 5 | runs. This feature is somewhat similar to a feature in the Light Table 6 | editor. 7 | 8 | To turn it on, issue kbd:[M-x] `cider-enlighten-mode`. Then, 9 | evaluate your functions one at a time using kbd:[C-M-x] or 10 | kbd:[C-x C-e]. Note that kbd:[C-c C-k] won't work. 11 | 12 | That's it! Once your code executes, the regular old buffer on the left will turn 13 | into the brilliant show of lights on the right. 14 | 15 | |=== 16 | | Enlighten Mode Disabled | Enlighten Mode Enabled 17 | 18 | | image:enlighten_disabled.png[Disabled] 19 | | image:enlighten_enabled.png[Enabled] 20 | |=== 21 | 22 | To stop displaying the locals you'll have to disable `cider-enlighten-mode` 23 | and reevaluate the definitions you had instrumented previously. 24 | 25 | You can also trigger this on specific functions (without having to turn on the 26 | minor mode) by writing `#light` before the `(def` and re-evaluating 27 | it. 28 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/debugging/macroexpansion.adoc: -------------------------------------------------------------------------------- 1 | = Macroexpansion 2 | :experimental: 3 | 4 | Typing kbd:[C-c C-m] after some form in a source buffer or the 5 | REPL will show you the macro expansion of the form in a new 6 | buffer. You'll have access to additional keybindings in the macro 7 | expansion buffer (which is internally using 8 | `cider-macroexpansion-mode`): 9 | 10 | |=== 11 | | Keyboard shortcut | Description 12 | 13 | | kbd:[m] 14 | | Invoke `macroexpand-1` on the form at point and replace the original form with its expansion. If invoked with a prefix argument, `macroexpand` is used instead of `macroexpand-1`. 15 | 16 | | kbd:[a] 17 | | Invoke `clojure.walk/macroexpand-all` on the form at point and replace the original form with its expansion. 18 | 19 | | kbd:[g] 20 | | The prior macro expansion is performed again and the current contents of the macro expansion buffer are replaced with the new expansion. 21 | 22 | | kbd:[C-/] + 23 | kbd:[u] 24 | | Undo the last in-place expansion performed in the macroexpansion buffer. 25 | |=== 26 | 27 | == Configuration 28 | 29 | The option `cider-macroexpansion-display-namespaces` controls whether to display 30 | namespaces in the macroexpansion buffer. It can be set to one of the following: 31 | 32 | * `qualified` - Vars are fully-qualified in the expansion. 33 | * `none`- Vars are displayed without namespace qualification. 34 | * `tidy`(default) - Vars that are :refer-ed or defined in the current namespace 35 | are displayed with their simple name, non-referred vars from other namespaces 36 | are referred using the alias for that namespace (if defined), other vars are 37 | displayed fully qualified. 38 | 39 | The option `cider-macroexpansion-print-metadata` controls whether to print the var metadata 40 | in the macroexpansion buffer. It's set to `nil` by default. 41 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/debugging/profiling.adoc: -------------------------------------------------------------------------------- 1 | = Profiling 2 | 3 | CIDER has a simple built-in profiler that can you to quickly measure the running 4 | time of individual functions. It is similar to wrapping your functions with 5 | `time` macro, except it records every timing and displays a summarized result. 6 | 7 | NOTE: Profiling is different from benchmarking. Benchmarking more accurately 8 | tells you how long the code executes. If you need accurate timing results, use a 9 | serious benchmarking library like 10 | https://github.com/hugoduncan/criterium[Criterium]. If you need to understand 11 | where most of the time is spent, use a serious profiler like 12 | https://github.com/clojure-goes-fast/clj-async-profiler[clj-async-profiler]. 13 | 14 | NOTE: The profiler doesn't support ClojureScript. 15 | 16 | == Usage 17 | 18 | To start using CIDER profiler, choose the vars you want to profile and invoke 19 | `M-x cider-profile-toggle` (kbd:[C-c C-= t]). By defaults it operates on the 20 | symbol at point, but will prompt for a var if there's nothing under the point. 21 | You can also mark all functions in the namespace for profiling via 22 | `cider-profile-ns-toggle` (kbd:[C-c C-= n]). 23 | 24 | Then, evaluate some code making use of those vars and their invocations will be 25 | automatically profiled. 26 | 27 | You can display a report of the collected profiling data with `M-x 28 | cider-profile-summary` (kbd:[C-c C-= s]). 29 | 30 | == Understanding the Report Format 31 | 32 | Profiling reports are rendered by xref:debugging/inspector.adoc[CIDER 33 | inspector]. A typical profiling report looks like this: 34 | 35 | .... 36 | | # | :name | :n | :mean | :std | :sum | :min | :max | :med | :samples | 37 | |---+-----------------+------+--------+---------+--------+--------+--------+--------+------------| 38 | | 0 | #'sample-ns/bar | 1000 | 3 us | ±14 us | 3 ms | 791 ns | 384 us | 2 us | [791 ...] | 39 | | 1 | #'sample-ns/baz | 1000 | 307 ns | ±710 ns | 307 us | 84 ns | 22 us | 250 ns | [84 ...] | 40 | | 2 | #'sample-ns/foo | 1000 | 7 us | ±18 us | 7 ms | 3 us | 495 us | 5 us | [2584 ...] | 41 | | 3 | #'sample-ns/qux | 1000 | 8 us | ±20 us | 8 ms | 3 us | 543 us | 5 us | [3125 ...] | 42 | .... 43 | 44 | Let's demystify all the column names: 45 | 46 | * `:n`: Number of samples. 47 | * `:mean`: Average time spent in fn. 48 | * `:std`: Standard deviation. 49 | * `:sum`: Aggregate time spent in fn. 50 | * `:min`: Minimal recorded time for fn. 51 | * `:min`: Maximal recorded time for fn. 52 | * `:med`: Median i.e. fiftieth percentile. 53 | * `:samples`: A list of all timing samples. You can click it to see the full list in the inspector. 54 | 55 | == Keybindings 56 | 57 | |=== 58 | | Command | Keyboard shortcut | Description 59 | 60 | | `cider-profile-toggle` 61 | | kbd:[C-c C-= t] 62 | | Toggle profiling for var. Defaults to the var at point. 63 | 64 | | `cider-profile-ns-toggle` 65 | | kbd:[C-c C-= n] 66 | | Toggle profiling for the current ns. 67 | 68 | | `cider-profile-summary` 69 | | kbd:[C-c C-= s] 70 | | Display the profiling summary for all vars. 71 | 72 | | `cider-profile-clear` 73 | | kbd:[C-c C-= c] 74 | | Clear profiling data. 75 | |=== 76 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/debugging/tracing.adoc: -------------------------------------------------------------------------------- 1 | = Tracing Function Execution 2 | :experimental: 3 | 4 | You can trace the arguments supplied, to and the result values produced 5 | by functions using kbd:[C-c M-t v]. CIDER will prompt you for the 6 | name of the function you want to trace, defaulting to the previous 7 | top-level definition. 8 | 9 | image::tracing.png[Tracing] 10 | 11 | Invoking kbd:[C-c M-t v] again for the same function will result 12 | in the function being untraced. 13 | 14 | You can also use kbd:[C-c M-t n] to toggle tracing on and off for 15 | an entire namespace. 16 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/platforms/babashka.adoc: -------------------------------------------------------------------------------- 1 | = Babashka 2 | 3 | == Overview 4 | 5 | Babashka is highly compatible with Clojure, so it works with CIDER out of the box. 6 | 7 | == Usage 8 | 9 | All you need to do 10 | is start its bundled nREPL server: 11 | 12 | $ bb --nrepl-server 13 | 14 | And connect to it afterwards using kbd:[C-c C-x c j] (`cider-connect-clj`). 15 | 16 | Babashka's nREPL server supports all core nREPL operations, plus code completion, so you'll get all of 17 | CIDER's basic functionality with it. 18 | 19 | NOTE: Depending on your CIDER version you might get some warnings about missing Clojure/nREPL versions. You can safely 20 | ignore those. 21 | 22 | Starting with CIDER 1.2, `cider-jack-in-clj` works with Babashka projects that are using `bb.edn`. 23 | 24 | == Differences with Clojure 25 | 26 | There are a few differences between Babashka and Clojure that you should keep in mind: 27 | 28 | * Built-in vars (e.g. `clojure.core/map`) don't have definition location metadata. In practice this means you can't 29 | navigate to their definitions in CIDER. 30 | * The `javadoc` (`clojure.java.javadoc/javadoc`) REPL utility function is not currently available in Babashka. 31 | 32 | == Additional Resources 33 | 34 | * https://github.com/borkdude/babashka/blob/master/doc/repl.md#nrepl[Babashka's nREPL Documentation] 35 | * https://github.com/babashka/babashka.nrepl[babashka.nrepl] 36 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/platforms/basilisp.adoc: -------------------------------------------------------------------------------- 1 | = Basilisp Integration with CIDER 2 | https://github.com/basilisp-lang/basilisp[basilisp] 3 | 4 | NOTE: Basilisp support was added in CIDER 1.14. 5 | 6 | == Overview 7 | 8 | Basilisp aims to enable writing Clojure programs on Python with full interoperability. It is highly compatible with Clojure. 9 | 10 | To install Basilisp, run: 11 | 12 | $ pip install basilisp 13 | 14 | == Usage 15 | 16 | There are several ways to connect to Basilisp. 17 | 18 | === jack-in 19 | 20 | kbd:[M-x cider-jack-in] and kbd:[M-5 M-x cider-jack-in-universal] 21 | 22 | If you have created a `basilisp.edn` project file at your root of your project tree, you can jack in to the project with `M-x cider-jack-in`. The `basilisp.edn` is similar to `deps.edn` for clojure-cli projects. It can be left empty just to mark the root of your project. 23 | 24 | If you don't have or want a basilisp project file, you can use universal jack in with a numerical argument of 5: 25 | 26 | - kbd:[M-5 M-x cider-jack-in-universal], or 27 | - kbd:[M-5 C-c C-x j u], from within a file in clojure-mode 28 | 29 | NOTE: an alternative to kbd:[M-5] is kbd:[C-u 5] 30 | 31 | You can also bind the universal jack-in to Basilisp to a function to use as a shortcut, for example: 32 | 33 | [source,lisp] 34 | ---- 35 | (global-set-key (kbd "") (lambda () 36 | (interactive) 37 | (cider-jack-in-universal 5))) 38 | ---- 39 | 40 | === connect 41 | 42 | kbd:[M-x cider-connect] 43 | 44 | You can start its bundled nREPL server: 45 | 46 | $ basilisp nrepl-server 47 | 48 | and connect to it afterward using `M-x cider-connect`. 49 | 50 | To see available options, type `basilisp nrepl-server -h` in a shell prompt. 51 | 52 | == Configuration 53 | 54 | The jack-in command can be configured with the following defcustoms: 55 | 56 | === `cider-basilisp-command` 57 | 58 | (default is `basilisp`) 59 | 60 | If Basilisp is installed in a virtual environment, update this to the full path of the `basilisp` executable within that virtual environment. 61 | 62 | === `cider-basilisp-parameters` 63 | 64 | (default is `nrepl-server`) 65 | 66 | === Customization 67 | 68 | There at few ways to setup (custom) variables in Emacs 69 | 70 | ==== 1. https://www.gnu.org/software/emacs/manual/html_node/emacs/Easy-Customization.html[Examining and Setting Variables] 71 | 72 | - kbd:[C-h v cider-basilisp-command], and 73 | - kbd:[C-h v cider-basilisp-parameters] 74 | 75 | ==== 2. https://www.gnu.org/software/emacs/manual/html_node/emacs/Directory-Variables.html[Per-Diretory Local Variables] 76 | 77 | Uses `.dir-locals.el` to setup per mode variables. This file is typically stored at the root of the project. 78 | 79 | For example, to set the path to the basilisp executable within a virtual environment 80 | 81 | - kbd:[M-x add-dir-local-variable] 82 | - Mode or subdirectory: `clojure-mode` 83 | - Add directory-local variable: `cider-basilisp-command` 84 | - Add `cider-basilisp-command` with value: `"c:/dev/venvs/312/Scripts/basilisp"` 85 | 86 | This should result to updating or creating a `.dir-local.el` file like below 87 | 88 | [source,lisp] 89 | ---- 90 | ;;; Directory Local Variables -*- no-byte-compile: t -*- 91 | ;;; For more information see (info "(emacs) Directory Variables") 92 | 93 | ((clojure-mode . ((cider-basilisp-command . "c:/dev/venvs/312/Scripts/basilisp")))) 94 | ---- 95 | 96 | ==== 3. https://www.gnu.org/software/emacs/manual/html_node/emacs/Specifying-File-Variables.html[Specifying File Variables] 97 | 98 | It is best to put this in the top of your project's `basilisp.edn` file, and always jack-in from there. 99 | 100 | For example, setting `cider-basilisp-command` to start basilisp from within a virtual environment: 101 | 102 | - kbd:[M-x add-dir-local-variable] 103 | - Add file-local variable: `cider-basilisp-command` 104 | - Add cider-basilisp-command with value: `"c:/dev/venvs/312/Scripts/basilisp"` 105 | 106 | This will result in the following in `basilisp.edn` 107 | 108 | [source,clojure] 109 | ---- 110 | ;; Local Variables: 111 | ;; cider-basilisp-command: "c:/dev/venvs/312/Scripts/basilisp" 112 | ;; End: 113 | {} 114 | ---- 115 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/platforms/clojureclr.adoc: -------------------------------------------------------------------------------- 1 | = ClojureCLR 2 | 3 | == Current Status 4 | 5 | ClojureCLR on CIDER is not great due to the lack of a fully-functional nREPL 6 | server for ClojureCLR. There are currently two options: 7 | 8 | - https://github.com/clojure/clr.tools.nrepl[clr.tools.nrepl]: A direct (but incomplete) port of the reference Clojure nREPL server. 9 | - https://github.com/arcadia-unity/Arcadia/blob/master/Editor/NRepl.cs[Arcadia's nREPL]: A basic, but working nREPL implementation in C#. 10 | 11 | If you need to use CIDER with ClojureCLR today Arcadia's nREPL is your only usable option. That being said - `clr.tools.nrepl` is a much 12 | more sophisticated project and ideally we should get it over to the finish line. 13 | 14 | == Usage 15 | 16 | NOTE: Contributions welcome! 17 | 18 | As `cider-jack-in` doesn't support ClojureCLR projects out-of-the-box currently, you'll need to start an nREPL server externally and 19 | connect to it with `cider-connect`. 20 | 21 | == Plans 22 | 23 | In an ideal world we'll achieve the following objectives: 24 | 25 | - out-of-the-box ClojureCLR support with `cider-jack-in` 26 | - feature parity between Clojure's nREPL implementation and `clr.tools.nrepl` (the project can use some help) 27 | - adapting `cider-nrepl` for ClojureCLR (some of its codebase is JVM-specific) 28 | 29 | Given that Bozhidar's knowledge of CLR and time are limited, it'd be great if we manage to find some volunteers to help with the 30 | work that's needed in this direction. In particular it'd be amazing to complete `clr.tools.nrepl`, as the project needs relatively 31 | little work to be fully usable. 32 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/platforms/nbb.adoc: -------------------------------------------------------------------------------- 1 | = https://github.com/babashka/nbb[nbb] 2 | 3 | == Overview 4 | 5 | Nbb's main goal is to make it easy to get started with ad hoc ClojureScript scripting on Node.js. 6 | 7 | It is highly compatible with ClojureScript, so it works with CIDER out of the box. 8 | 9 | == Usage 10 | 11 | You can either jack in to an nbb project with `M-x clojure-jack-in-cljs`. 12 | 13 | or start its bundled nREPL server: 14 | 15 | $ nbb nrepl-server 16 | 17 | and connect to it afterwards using `M-x cider-connect-cljs`. 18 | 19 | NOTE: `cider-jack-in-cljs` works with nbb projects that are using `nbb.edn`. 20 | 21 | == Configuration 22 | 23 | The jack-in command can be configured via several defcustoms: 24 | 25 | * `cider-nbb-command` (by default `nbb`) 26 | * `cider-nbb-parameters` (by default `nrepl-server`) 27 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/platforms/other_platforms.adoc: -------------------------------------------------------------------------------- 1 | = Other Platforms 2 | 3 | == Overview 4 | 5 | Here "other platforms" essentially means any (Clojure) platforms that hasn't 6 | been mentioned specifically earlier in a dedicated section of the documentation. 7 | 8 | As noted earlier in the documentation, down the road CIDER might support non-Clojure 9 | platforms as well. As things stand today, however, that's not particularly high on our 10 | list of priorities. 11 | 12 | == Usage 13 | 14 | As of CIDER 1.6, the default CIDER connection command `cider-connect-clj` is 15 | capable of connecting to any nREPL server that implements the core nREPL 16 | protocol interface. So, all you need to do is the following: 17 | 18 | * Start an nREPL server (the project's README usually has a section 19 | on starting a nREPL server). 20 | * kbd:[M-x `cider-connect-clj` ] 21 | 22 | And that's it! You'll get every feature that's implemented by the nREPL server 23 | you're using. 24 | 25 | == Supported Platform 26 | 27 | Here's an incomplete list of Clojure platforms that you can use as described above. 28 | 29 | * https://github.com/babashka/nbb[nbb] 30 | * https://github.com/babashka/scittle[scittle] 31 | * https://github.com/BetterThanTomorrow/joyride[joyride] 32 | 33 | NOTE: For `nbb` you can alternatively connect via `cider-connect-cljs`, see xref:platforms/nbb.adoc[nbb]. 34 | 35 | == Limitations & Caveats 36 | 37 | * Everything will be treated as a Clojure connection, regardless of the underlying platform. 38 | * Errors will be displayed only as overlays. (The default CIDER error buffer is not implemented currently). 39 | * The amount of functionality you'll get will be dependent on how well the nREPL server you're using implements the core nREPL protocol. 40 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/platforms/overview.adoc: -------------------------------------------------------------------------------- 1 | = Overview 2 | 3 | NOTE: This section is work in progress. 4 | 5 | While CIDER was created to serve as a Clojure(Script) programming environment, due to the flexibility of the nREPL 6 | protocol it can actually be used with other programming languages/platforms as well. 7 | 8 | == Challenges 9 | 10 | The biggest problem with supporting multiple programming languages are the assumptions that CIDER has that it's being 11 | used together with Clojure. In practice this translates to CIDER evaluating Clojure code in some cases to power its 12 | functionality. One simple example here would be switching the REPL's namespace - CIDER simply evals `in-ns` behind the curtains to achieve this. 13 | 14 | You also have to keep in mind that much of the advanced functionality (e.g. everything related to debugging) is not part 15 | of the core nREPL protocol and is provided by the `cider-nrepl` middleware. Other platforms will need to provide 16 | compatible implementation of that functionality, so that CIDER would work with. 17 | 18 | Another problem is that some of the functionality is specific to Clojure and doesn't make much sense in other languages, but that's 19 | something that functionality can be simply ignored when non-applicable. There's also some coupling with `clojure-mode`, but that's 20 | not that hard to overcome. Some examples here would be the REPL (which uses `clojure-mode` syntax table and indentation rules), 21 | the logic for finding the current namespace (which uses `clojure-find-ns`), and so on. All such instances will need to be replaced 22 | eventually with more generic versions that dispatch on the type of the nREPL connection (e.g. Clojure, Racket, Fennel, etc). 23 | 24 | == Current Status 25 | 26 | Right now CIDER the supports to some extent the following: 27 | 28 | * xref:platforms/babashka.adoc[Babashka] 29 | * xref:platforms/nbb.adoc[nbb] 30 | * xref:platforms/clojureclr.adoc[ClojureCLR] 31 | * xref:platforms/other_platforms.adoc[scittle, joyride & friends] 32 | * xref:platforms/basilisp.adoc[Basilisp] 33 | 34 | All of them are derived from Clojure, so supporting them didn't really require much work. 35 | 36 | == Future Plans 37 | 38 | While not a very high priority, making CIDER usable with any nREPL server is certainly on the project's roadmap. 39 | https://github.com/clojure-emacs/cider/issues/2848[Here] you can find a discussion about the changes needed to 40 | get CIDER to work with Fennel, plus a couple of commits that illustrate them. 41 | 42 | Any help on that front would greatly appreciated! 43 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/repl/basic_usage.adoc: -------------------------------------------------------------------------------- 1 | = Basic Usage 2 | :experimental: 3 | 4 | CIDER comes with a powerful REPL that complements the interactive 5 | development functionality in `cider-mode`. Using the CIDER REPL you 6 | can experiment with your running program, test functions, or just 7 | explore a new library you're interested in using. The CIDER REPL offers a number of advanced features: 8 | 9 | * code completion 10 | * font-locking (the same as in `clojure-mode`) 11 | * quick access to many CIDER commands (e.g. definition and documentation lookup, tracing, etc) 12 | * pretty-printing of evaluation results 13 | * inline display of images 14 | * persistent REPL history 15 | * powerful REPL history browser 16 | * eldoc support 17 | * highly customizable REPL prompt 18 | 19 | == Interacting with the REPL 20 | 21 | Interacting with CIDER's REPL is pretty simple - most of the time 22 | you'd just write expressions there and press kbd:[RET] to 23 | evaluate them. 24 | 25 | But the REPL is a bit more powerful than that and it allows you to do some things that might not be available in 26 | other Clojure REPLs. Some examples of such things would be: 27 | 28 | * You can close an incomplete expression with kbd:[C-RET] 29 | * You can enter a multi-line expression by pressing kbd:[C-j] at the end of each line 30 | * You can quickly jump to the definition of a symbol (kbd:[.]) or to its documentation (kbd:[C-c C-d d]) 31 | * You can clear the output of the last expression with kbd:[C-c C-o] 32 | * You can clear the REPL buffer with kbd:[C-u C-c C-o] 33 | * You can jump between your source buffers and the REPL with kbd:[C-c C-z] 34 | * You can jump between your Clojure and ClojureScript REPLs with kbd:[C-c M-o] 35 | 36 | On top of this the REPL is extremely configurable and you can tweak almost every aspect of it. 37 | 38 | == Interrupting Evaluations 39 | 40 | If you accidentally try to evaluate something that's going to take a lot of time (if it finishes at all), you 41 | can interrupt the rogue evaluation operation by pressing kbd:[C-c C-c]. 42 | 43 | TIP: Note that this is different from the keybinding for interrupting evaluations in source buffers, 44 | namely kbd:[C-c C-b]. 45 | 46 | == Quitting a REPL 47 | 48 | When you're done with a REPL you can dispose of it with kbd:[C-c C-q]. 49 | 50 | TIP: Avoid killing REPL buffers with kbd:[C-c C-k]. This will forgo 51 | some of the operations needed to properly dispose of a REPL buffer. 52 | 53 | == Loading REPL Utility Functions 54 | 55 | Normally Clojure REPLs load the following code in the first REPL that you start: 56 | 57 | [source,clojure] 58 | ---- 59 | (clojure.core/apply clojure.core/require clojure.main/repl-requires) 60 | ---- 61 | 62 | CIDER does this as well, but goes one step further and actually allows you 63 | to control what code to evaluate when a REPL is being initialized via 64 | the variable `cider-repl-init-code`. 65 | 66 | This initialization code is auto-loaded only in the first REPL namespace 67 | (normally `user`), but you can easily invoke it in any namespace using the REPL 68 | shortcut `require-repl-utils`. The functionality is also accessible via 69 | CIDER's menu ("REPL -> Require REPL utils"). 70 | 71 | TIP: You'll rarely need the REPL utility functions when using CIDER, as it 72 | provides many Emacs commands that behave similarly (e.g. instead of doing 73 | something like `(doc str)` you'd probably use the `cider-doc` (kbd:[C-c C-d C-d]) command). 74 | 75 | == Known Limitations 76 | 77 | Performance can degrade when the REPL buffer grows very large. This is 78 | especially true if either `cider-repl-use-clojure-font-lock` or 79 | `nrepl-log-messages` are enabled. 80 | 81 | Very long lines are guaranteed to bring Emacs to a crawl, so using a value of 82 | `cider-print-fn` that wraps lines beyond a certain width (i.e. any of the 83 | built-in options except for `pr`) is advised. 84 | 85 | TIP: You can use `cider-repl-clear-output` to 86 | either clear the result of the previous evaluation, or with a prefix argument 87 | clear the entire REPL buffer. You can also set `cider-repl-buffer-size-limit` 88 | which will enable trimming the buffer automatically after each evaluation. This 89 | trimming can also be invoked manually with `cider-repl-trim-buffer`. 90 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/repl/keybindings.adoc: -------------------------------------------------------------------------------- 1 | = REPL Keybindings 2 | :experimental: 3 | 4 | Here's a list of the keybindings that are available in CIDER's REPL: 5 | 6 | |=== 7 | | Keyboard shortcut | Description 8 | 9 | | kbd:[RET] 10 | | Evaluate the current input in Clojure if it is complete. If incomplete, open a new line and indent. If the current input is a blank string (containing only whitespace including newlines) then clear the input without evaluating and print a fresh prompt. If invoked with a prefix argument, then the input is evaluated without checking for completeness. 11 | 12 | | kbd:[C-RET] 13 | | Close any unmatched parentheses and then evaluate the current input in Clojure. 14 | 15 | | kbd:[C-j] 16 | | Open a new line and indent. 17 | 18 | | kbd:[C-c C-o] 19 | | Remove the output of the previous evaluation from the REPL buffer. With a prefix argument it will clear the entire REPL buffer, leaving only a prompt. 20 | 21 | | kbd:[C-c M-o] 22 | | Switch between the Clojure and ClojureScript REPLs for the current project. 23 | 24 | | kbd:[C-c C-u] 25 | | Kill all text from the prompt to the current point. 26 | 27 | | kbd:[C-c C-b] + 28 | kbd:[C-c C-c] 29 | | Interrupt any pending evaluations. 30 | 31 | | kbd:[C-up] + 32 | kbd:[C-down] 33 | | Go to to previous/next input in history. 34 | 35 | | kbd:[M-p] + 36 | kbd:[M-n] 37 | | Search the previous/next item in history using the current input as search pattern. If kbd:[M-p/M-n] is typed two times in a row, the second invocation uses the same search pattern (even if the current input has changed). 38 | 39 | | kbd:[M-s] + 40 | kbd:[M-r] 41 | | Search forward/reverse through command history with regex. 42 | 43 | | kbd:[C-c C-n] + 44 | kbd:[C-c C-p] 45 | | Move between the current and previous prompts in the REPL buffer. Pressing kbd:[RET] on a line with old input copies that line to the newest prompt. 46 | 47 | | kbd:[TAB] 48 | | Complete symbol at point. 49 | 50 | | kbd:[C-c C-d d] + 51 | kbd:[C-c C-d C-d] 52 | | Display doc string for the symbol at point. If invoked with a prefix argument, or no symbol is found at point, prompt for a symbol 53 | 54 | | kbd:[C-c C-d j] + 55 | kbd:[C-c C-d C-j] 56 | | Display JavaDoc (in your default browser) for the symbol at point. If invoked with a prefix argument, or no symbol is found at point, prompt for a symbol. 57 | 58 | | kbd:[C-c C-d c] + 59 | kbd:[C-c C-d C-c] 60 | | Lookup symbol in ClojureDocs. 61 | 62 | | kbd:[C-c C-d a] + 63 | kbd:[C-c C-d C-a] 64 | | Apropos search for functions/vars. 65 | 66 | | kbd:[C-c C-d f] + 67 | kbd:[C-c C-d C-f] 68 | | Apropos search for documentation. 69 | 70 | | kbd:[C-c C-z] 71 | | Switch to the previous Clojure buffer. This complements kbd:[C-c C-z] used in `cider-mode`. 72 | 73 | | kbd:[C-c M-i] 74 | | Inspect expression. Will act on expression at point if present. 75 | 76 | | kbd:[C-c M-n] 77 | | Select a namespace and switch to it. 78 | 79 | | kbd:[C-c C-.] 80 | | Jump to some namespace on the classpath. 81 | 82 | | kbd:[C-c M-t v] 83 | | Toggle var tracing. 84 | 85 | | kbd:[C-c M-t n] 86 | | Toggle namespace tracing. 87 | 88 | | kbd:[C-c C-t t] + 89 | kbd:[C-c C-t C-t] 90 | | Run test at point. 91 | 92 | | kbd:[C-c C-t a] + 93 | kbd:[C-c C-t C-a] 94 | | Re-run the last test you ran. 95 | 96 | | kbd:[C-c C-t n] + 97 | kbd:[C-c C-t C-n] 98 | | Run tests for current namespace. 99 | 100 | | kbd:[C-c C-t l] + 101 | kbd:[C-c C-t C-l] 102 | | Run tests for all loaded namespaces. 103 | 104 | | kbd:[C-c C-t p] + 105 | kbd:[C-c C-t C-p] 106 | | Run tests for all project namespaces. This loads all namespaces of the project. 107 | 108 | | kbd:[C-c C-t r] + 109 | kbd:[C-c C-t C-r] 110 | | Re-run failed and erring tests. 111 | 112 | | kbd:[C-c C-t b] + 113 | kbd:[C-c C-t C-b] 114 | | Show the test report buffer. 115 | 116 | | kbd:[C-c C-q] 117 | | Quit the current nREPL connection. With a prefix argument it will quit all connections. 118 | |=== 119 | 120 | TIP: There's no need to memorize this list. In any REPL buffer you'll have a `REPL` 121 | menu available, which lists the most important commands and their 122 | keybindings. You can also invoke `C-h f RET cider-repl-mode` to get a list of the 123 | keybindings for `cider-repl-mode`. 124 | 125 | == REPL Shortcuts 126 | 127 | In the REPL you can also use "shortcut commands" by pressing `,` at the 128 | beginning of a REPL line. You'll be presented with a list of commands you can 129 | quickly run (like quitting, displaying some info, clearing the REPL, etc). The 130 | character used to trigger the shortcuts is configurable via 131 | `cider-repl-shortcut-dispatch-char`. Here's how you can change it to `;`: 132 | 133 | [source,lisp] 134 | ---- 135 | (setq cider-repl-shortcut-dispatch-char ?\;) 136 | ---- 137 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/testing/supported_libraries.adoc: -------------------------------------------------------------------------------- 1 | = Using cider-test with Alternative Test Libraries 2 | 3 | The `clojure.test` machinery is designed to be pluggable. Any test 4 | library can integrate with it and leverage the `cider-test` 5 | ecosystem. 6 | 7 | As a test framework author, supporting the built-in `clojure.test` machinery 8 | (and hence `cider-test`) is pretty straightforward: 9 | 10 | . Add `:test` metadata to the vars corresponding to the test 11 | functions. The `clojure-test` machinery uses this metadata to 12 | find tests. 13 | . Implement the `clojure.test/report` multimethod to capture the test results. 14 | 15 | For example, https://github.com/clojure/test.check[test.check] was designed independently of `clojure.test` 16 | but integrates with it. Because of this, `cider-test` handles 17 | `defspec` just like `deftest`. `test.check` just adds compatibility in this 18 | https://github.com/clojure/test.check/blob/24f74b83f1c7a032f98efdcc1db9d74b3a6a794d/src/main/clojure/clojure/test/check/clojure_test.cljc[namespace]. 19 | 20 | == Supported Libraries 21 | 22 | * https://github.com/clojure/test.check[test.check] 23 | * https://github.com/clojure-expectations/expectations[clojure-expectations] added 24 | support for `clojure.test` in version 2.2 and should also work with CIDER. 25 | * https://github.com/jimpil/fudje[fudje] 26 | 27 | == Midje Support 28 | 29 | NOTE: Emidje is a third-party extension that's not bundled with CIDER. 30 | 31 | https://github.com/nubank/emidje[Emidje] is a test runner, report 32 | viewer and formatting tool for 33 | https://github.com/marick/Midje[Midje] within Emacs. 34 | 35 | Emidje extends CIDER to provide support for Midje tests in a similar 36 | fashion as `cider-test.el` does for clojure.test tests. In fact, most of 37 | Emidje's functionalities were strongly inspired by `cider-test.el` 38 | features. 39 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/testing/test_reports.adoc: -------------------------------------------------------------------------------- 1 | = Interacting with Test Result Reports 2 | :experimental: 3 | 4 | Should tests fail then CIDER displays a test result report in the 5 | `+*cider-test-report*+` buffer. This buffer uses `cider-test-report-mode`, 6 | which makes it easy to review any failures that might have occurred 7 | and jump directly to the definition of failing tests. 8 | 9 | Calling test commands again will update the test report. 10 | 11 | TIP: You can also xref:testing/running_tests.adoc#display-test-report-on-success[configure test reports to be displayed on success]. 12 | 13 | |=== 14 | | Keyboard shortcut | Command name | Description 15 | 16 | | kbd:[g] 17 | | `cider-test-run-test` 18 | | Run test at point. 19 | 20 | | kbd:[n] 21 | | `cider-test-run-ns-tests` 22 | | Run tests for current namespace. 23 | 24 | | kbd:[s] 25 | | `cider-test-run-ns-tests-with-filters` 26 | | Run tests for current namespace with selector filter. 27 | 28 | | kbd:[l] 29 | | `cider-test-run-loaded-tests` 30 | | Run tests for all loaded namespaces. 31 | 32 | | kbd:[p] 33 | | `cider-test-run-project-tests` 34 | | Run tests for all project namespaces. This loads the additional namespaces. 35 | 36 | | kbd:[f] 37 | | `cider-test-rerun-failed-tests` 38 | | Re-run test failures/errors. 39 | 40 | | kbd:[M-p] 41 | | `cider-test-previous-result` 42 | | Move point to previous test. 43 | 44 | | kbd:[M-n] 45 | | `cider-test-next-result` 46 | | Move point to next test. 47 | 48 | | kbd:[t] or kbd:[M-.] or kbd:click 49 | | `cider-test-jump` 50 | | Jump to test definition. 51 | 52 | | kbd:[d] 53 | | `cider-test-ediff` 54 | | Display diff of actual vs expected. 55 | 56 | | kbd:[e] 57 | | `cider-test-stacktrace` 58 | | Display test error cause and stacktrace info. 59 | |=== 60 | 61 | Most key bindings are defined in `cider-test-report-mode-map`, while the `click` behavior is defined in `cider-test-var-keymap`. 62 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/usage/interactive_programming.adoc: -------------------------------------------------------------------------------- 1 | = Interactive Programming 2 | :experimental: 3 | 4 | == Overview 5 | 6 | Traditional programming languages and development environments often 7 | use a http://wiki.c2.com/?EditCompileLinkRun[Edit, Compile, Run 8 | Cycle]. In this environment, 9 | the programmer modifies the code, compiles it, and then runs it to see 10 | if it does what she wants. The program is then terminated, and the 11 | programmer goes back to editing the program further. This cycle is 12 | repeated over and over until the program behavior conforms to what the 13 | programmer desires. While modern IDEs have optimized this process to 14 | be quick and relatively painless, it's still a slow way to work. 15 | 16 | Clojure and CIDER offer a better way to work called _interactive 17 | programming_. Indeed, this idea is at the very heart of CIDER. 18 | 19 | Using CIDER's interactive programming environment, a programmer works 20 | in a very dynamic and incremental manner. Instead of repeatedly 21 | editing, compiling, and restarting an application, the programmer 22 | starts the application once and then adds and updates individual 23 | Clojure definitions as the program continues to run. Using the CIDER 24 | REPL, the programmer can access the value of different definitions and 25 | invoke program functions with test data, immediately seeing the 26 | result. This methodology is far more efficient than the typical Edit, 27 | Compile, and Run Cycle because the program continues to run and keeps 28 | its state intact while the programmer interacts with it. Indeed, some 29 | Clojure programmers have been known to keep a CIDER session running 30 | for weeks or even months as they continue to write code. 31 | 32 | == Implementation 33 | 34 | CIDER's interactive programming environment is partially implemented 35 | using an Emacs minor mode called `cider-mode`. `cider-mode` 36 | complements `clojure-mode` and allows you to evaluate Clojure code 37 | from your source file buffers and send it directly to your running 38 | program through the CIDER REPL. Using the functions offered by 39 | `cider-mode` will improve your productivity and make you a more 40 | efficient Clojure programmer. 41 | 42 | == Demos 43 | 44 | [quote, Clorpheus] 45 | ____ 46 | Unfortunately, no one can be told what interactive programming is. You have 47 | to see it for yourself. 48 | ____ 49 | 50 | The above description might sound a bit too "meta", so probably checking out 51 | some demos illustrating the interactive programming workflow will help you 52 | understand the key concepts better. Here are a few ideas: 53 | 54 | * https://www.youtube.com/watch?v=aYA4AAjLfT0[Deep Dive into CIDER] - an overview of CIDER's essential features 55 | * https://www.youtube.com/watch?v=O6g5C4jUCUc[Emacs & Clojure, A Lispy Love Affair] - an overview of all popular Emacs packages for Clojure development (including CIDER) 56 | * https://www.youtube.com/watch?v=4ecC3jqHooc[Clojure Development Workflow with Spacemacs and CIDER] 57 | 58 | NOTE: As CIDER is evolving rapidly, some of the information in those videos would likely be outdated by the time you get to watch them. Still, 59 | the core ideas of interactive programming are immutable, so whatever differences you come to observe and experience will likely be superficial. 60 | 61 | You can find more CIDER demos on the xref:additional_resources.adoc["Additional Resources"] page. 62 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/usage/pretty_printing.adoc: -------------------------------------------------------------------------------- 1 | = Pretty-printing 2 | 3 | == Configuring a printing function 4 | 5 | NOTE: CIDER relies on nREPL's own value printing mechanism. Refer to 6 | https://nrepl.org/nrepl/usage/misc.html#pretty_printing[nREPL's documentation] 7 | for details. 8 | 9 | You can configure the function used by CIDER for pretty-printing evaluation 10 | results and other data using the option `cider-print-fn`, which can take the 11 | following possible values: 12 | 13 | * `nil` to defer to nREPL to choose the printing function. This will use the 14 | bound value of `+nrepl.middleware.print/*print-fn*+`, which defaults to the 15 | equivalent of `clojure.core/pr`. 16 | * `pr` to use the equivalent of `clojure.core/pr`. 17 | * `pprint` to use the built-in `clojure.pprint/pprint` (this is the default). 18 | * `fipp` to use the https://github.com/brandonbloom/fipp[Fast Idiomatic 19 | Pretty-Printer]. This is approximately 5-10x faster than `clojure.core/pprint`. 20 | * `puget` to use https://github.com/greglook/puget[Puget], which provides 21 | https://github.com/greglook/puget#canonical-representation[canonical serialization] 22 | of data on top of fipp, but at a slight performance cost. 23 | * `zprint` to use https://github.com/kkinnear/zprint[zprint], a fast and 24 | flexible alternative to the libraries mentioned above. 25 | 26 | IMPORTANT: For `fipp`, `puget`, and `zprint` printers to work, you need to add a 27 | respective dependency in your project explicitly. 28 | 29 | Alternatively, `cider-print-fn` can be set to the namespace-qualified name of a 30 | Clojure var whose function takes three arguments: the object to print, the 31 | `java.io.PrintWriter` to print on, and a (possibly nil) map of options. 32 | 33 | [source,lisp] 34 | ---- 35 | (setq cider-print-fn "user/my-pprint") 36 | ---- 37 | 38 | Here's one example: 39 | 40 | [source,clojure] 41 | ---- 42 | (ns cider.pprint 43 | (:require 44 | [clojure.pprint :as pp])) 45 | 46 | (defn pprint 47 | "A simple wrapper around `clojure.pprint/write`. 48 | 49 | Its signature is compatible with the expectations of nREPL's wrap-print 50 | middleware." 51 | [value writer options] 52 | (apply pp/write value (mapcat identity (assoc options :stream writer)))) 53 | ---- 54 | 55 | == Limiting printed output 56 | 57 | You can set `cider-print-quota` to limit the number of bytes that will be 58 | returned by any printing operation. This defaults to one megabyte, and can be 59 | set to `nil` if no limit is desired. Note well that if no quota is set some 60 | printing operations may never terminate -- you can still use `cider-interrupt` to 61 | halt them. 62 | 63 | Your configured printing function might also support limiting the length and 64 | depth of printed objects -- either using `+clojure.core/*print-length*+` and 65 | `+clojure.core/*print-level*+` or in the provided <>. 66 | 67 | == Print options 68 | 69 | You can pass an options map to the print function by setting `cider-print-options`. Here's an example: 70 | 71 | [source,lisp] 72 | ---- 73 | (setq cider-print-options '(("length" 50) ("right-margin" 70))) 74 | ---- 75 | 76 | NOTE: Each print engine has its own configuration options, so you'll have to be sure to set `cider-print-options` accordingly. 77 | 78 | Here's a table describing the differences in the names for the most common print 79 | options supported by every print engine. 80 | 81 | |=== 82 | | `clojure.core/pr` | `clojure.pprint` | Fipp & Puget | zprint 83 | 84 | | `+clojure.core/*print-length*+` 85 | | `length` 86 | | `print-length` 87 | | `max-length` 88 | 89 | | `+clojure.core/*print-level*+` 90 | | `level` 91 | | `print-level` 92 | | `max-depth` 93 | 94 | | `+clojure.pprint/*print-right-margin*+` 95 | | `right-margin` 96 | | `width` 97 | | `width` 98 | |=== 99 | 100 | Not all printing engines use (or default to) the dynamic variables in all cases, 101 | so setting them at the REPL may or may not have the intended effect. See the 102 | respective documentation of each engine: 103 | 104 | * `clojure.core/pr`: https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/+*print-dup*+ 105 | * `clojure.pprint`: https://clojuredocs.org/clojure.pprint/write 106 | * Fipp: https://github.com/brandonbloom/fipp/#printer-usage 107 | * Puget: https://github.com/greglook/puget#usage 108 | * zprint: https://github.com/kkinnear/zprint/#what-is-configurable 109 | 110 | == Width of printed output 111 | 112 | If you're using one of the printing engines provided with CIDER, the value of 113 | `fill-column` will be used for the relevant width option in the <>. You can override this by hardcoding the relevant option in 115 | `cider-print-options`. 116 | -------------------------------------------------------------------------------- /logo/cider-logo-mug.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | ]> 6 | 8 | 12 | 13 | 14 | 17 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /logo/cider-logo-square.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | ]> 6 | 8 | 9 | 12 | 15 | 18 | 21 | 24 | 27 | 28 | 29 | 30 | 32 | 34 | 35 | 36 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /logo/cider-logo-w320.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/logo/cider-logo-w320.png -------------------------------------------------------------------------------- /logo/cider-logo-w480.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/logo/cider-logo-w480.png -------------------------------------------------------------------------------- /logo/cider-logo-w640.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/logo/cider-logo-w640.png -------------------------------------------------------------------------------- /logo/cider-logo-w960.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/logo/cider-logo-w960.png -------------------------------------------------------------------------------- /logo/cider-logo.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/logo/cider-logo.ai -------------------------------------------------------------------------------- /logo/cider-logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | ]> 6 | 8 | 9 | 12 | 15 | 18 | 21 | 24 | 27 | 28 | 29 | 30 | 32 | 34 | 35 | 36 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /logo/favicon-152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/logo/favicon-152.png -------------------------------------------------------------------------------- /logo/favicon-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/logo/favicon-16.png -------------------------------------------------------------------------------- /logo/favicon-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/logo/favicon-32.png -------------------------------------------------------------------------------- /logo/favicon-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/logo/favicon-64.png -------------------------------------------------------------------------------- /logo/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/logo/favicon.ico -------------------------------------------------------------------------------- /refcard/README.md: -------------------------------------------------------------------------------- 1 | # CIDER Quick Reference 2 | 3 | CIDER's quick reference is a single-page pdf containing the essential commands one needs to know 4 | to use CIDER effectively. You're encouraged to print it, laminate it and keep it on your desk. 5 | 6 | If you want to make changes to it you should first edit `cider-refcard.tex` and then run the following command 7 | to regenerate the pdf file: 8 | 9 | $ pdflatex cider-refcard.tex 10 | 11 | Note that you might have to install `pdflatex` first. You can find instructions for all major operating 12 | systems [here](https://www.latex-project.org/get/). 13 | -------------------------------------------------------------------------------- /refcard/cider-refcard.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clojure-emacs/cider/9b002c0b311a180afd2f11d3de60ef0d6dbdb9bb/refcard/cider-refcard.pdf -------------------------------------------------------------------------------- /refcard/cider-refcard.tex: -------------------------------------------------------------------------------- 1 | \documentclass[a4paper,10pt]{article} 2 | \usepackage[margin=1cm]{geometry} 3 | \pagestyle{empty} 4 | 5 | \usepackage{textcomp} 6 | \usepackage{multicol} 7 | \usepackage{menukeys} 8 | \usepackage{enumitem} 9 | \usepackage{xcolor} 10 | \usepackage{xpatch} 11 | \usepackage{xparse} 12 | \usepackage{calc} 13 | \usepackage{tcolorbox} 14 | 15 | \colorlet{faded}{lightgray} 16 | \colorlet{namespace}{black} 17 | \def\alternateitem\item[#1]{\item[#1]\color{faded}} 18 | \NewDocumentCommand\ns{g}{\IfValueTF{#1}{\gdef\currentnamespace{#1}\currentnamespace}{\textcolor{namespace}{\currentnamespace}}} 19 | \renewcommand\section[1]{\bigskip\par\textbf{\large#1}\medskip} 20 | \renewcommand\subsection[1]{\medskip\par\textbf{#1}\medskip} 21 | \newcommand\meta[1]{\textlangle\textit{#1}\textrangle} 22 | \newcommand\keyify[1]{\keys{\ttfamily#1}} 23 | \newlist{keylist}{description}{1} 24 | \setlist[keylist]{ 25 | labelindent = 2ex, 26 | itemsep = -1ex, 27 | font = \keyify, 28 | before = \let\&\alternateitem 29 | \xpretocmd{\item}{\color{black}}{}{} 30 | \ttfamily 31 | } 32 | 33 | \setlength\parindent{0em} 34 | \setlength\parsep{0ex} 35 | \renewcommand\baselinestretch{1.2} 36 | 37 | \begin{document} 38 | \begin{center} 39 | \Huge 40 | CIDER Quick-Reference Card 41 | \par\bigskip 42 | \end{center} 43 | 44 | \begin{center} 45 | \begin{tcolorbox}[title=Getting Help in Emacs, center title, fonttitle=\Large\bfseries] 46 | \begin{keylist}[labelindent=4ex,before=,labelwidth=\widthof{\keyify{\meta{prefix} 47 | C-h}}] 48 | \item[C-h k \meta{key}] describe function bound to \meta{key} 49 | \item[C-h b] list the current key-bindings for the focus buffer 50 | \item[C-h m] describe mode 51 | \item[C-h l] show the keys you have pressed 52 | \item[\meta{prefix} C-h] show all key-bindings beginning with 53 | \meta{prefix} 54 | \end{keylist} 55 | \end{tcolorbox} 56 | \end{center} 57 | \bigskip 58 | 59 | \setlength{\columnsep}{1cm} 60 | 61 | \begin{multicols}{2} 62 | 63 | \section{Programming} 64 | \subsection{Completion} 65 | 66 | \begin{keylist}[labelwidth=\widthof{\keyify{C-c C-c}}] 67 | \item[M-TAB] complete-symbol 68 | \end{keylist} 69 | 70 | \subsection{Navigation} 71 | \begin{keylist}[labelwidth=\widthof{\keyify{C-c M-.}}] 72 | \item[M-,] cider-pop-back 73 | \item[M-.] cider-find-var 74 | \item[C-c M-.] cider-find-resource 75 | \item[C-c M-s] cider-selector 76 | \end{keylist} 77 | 78 | \subsection{Evaluation} 79 | \begin{keylist}[labelwidth=\widthof{\keyify{C-c RET}}] 80 | \item[C-c C-k] cider-load-buffer 81 | \item[C-c C-l] cider-load-file 82 | \item[C-c C-M-l] cider-load-all-files 83 | \item[C-c C-v] cider-eval-commands-map 84 | \item[C-c C-n] cider-eval-ns-form 85 | \item[C-x C-e] \ns{cider-eval-last-sexp} 86 | \item[C-c C-w] \ns -and-replace 87 | \item[C-c M-e] \ns -to-repl 88 | \item[C-M-x] cider-eval-defun-at-point 89 | \&\item[C-c C-c] cider-eval-defun-at-point 90 | \item[C-c C-p] \ns{cider-pprint-eval}-last-sexp 91 | \item[C-c C-f] \ns -at-point 92 | \item[C-c M-:] cider-read-and-eval 93 | \item[C-c M-i] cider-inspect 94 | \item[C-c RET] \ns{cider-macroexpand}-1 95 | \item[C-c M-m] \ns -all 96 | \end{keylist} 97 | 98 | \columnbreak 99 | 100 | \section{Debugging \& Testing} 101 | \begin{keylist}[labelwidth=\widthof{\keyify{C-c C-d C-a}}] 102 | \item[C-u C-M-x] cider-eval-defun-at-point 103 | \item[C-c M-t v] \ns{cider-toggle-trace}-var 104 | \item[C-c M-t n] \ns -ns 105 | \item[C-c C-t t] \ns{cider-test}-run-test 106 | \item[C-c C-t n] \ns -run-ns-tests 107 | \item[C-c C-t l] \ns -run-loaded-tests 108 | \item[C-c C-t p] \ns -run-project-tests 109 | \item[C-c C-t r] \ns -rerun-tests 110 | \item[C-c C-t b] \ns -show-report 111 | \end{keylist} 112 | 113 | \section{Documentation} 114 | \begin{keylist}[labelwidth=\widthof{\keyify{C-c C-d C-a}}] 115 | \item[C-c C-d d] cider-doc 116 | \item[C-c C-d j] cider-javadoc 117 | \item[C-c C-d a] \ns{cider-apropos} 118 | \item[C-c C-d f] \ns -documentation 119 | \item[C-c C-d c] \ns{cider-clojuredocs} 120 | \item[C-c C-d w] \ns -web 121 | \end{keylist} 122 | 123 | \section{REPL control} 124 | \begin{keylist}[labelwidth=\widthof{\keyify{C-c M-c}}] 125 | \item[C-c M-p] cider-insert-last-sexp-in-repl 126 | \item[C-c C-z] cider-switch-to-repl-buffer 127 | \item[C-c M-o] cider-find-and-clear-repl-buffer 128 | \item[C-c M-d] cider-describe-connection 129 | \item[C-c M-n M-n] cider-repl-set-ns 130 | \item[C-c C-b] cider-interrupt 131 | \item[C-c M-n M-r] cider-ns-refresh 132 | \item[C-c C-q] cider-quit 133 | \end{keylist} 134 | \end{multicols} 135 | \end{document} 136 | -------------------------------------------------------------------------------- /test/cider-apropos-tests.el: -------------------------------------------------------------------------------- 1 | ;;; cider-apropos-tests.el -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright © 2012-2025 Tim King, Bozhidar Batsov 4 | 5 | ;; Author: Tim King 6 | ;; Bozhidar Batsov 7 | ;; Artur Malabarba 8 | 9 | ;; This file is NOT part of GNU Emacs. 10 | 11 | ;; This program is free software: you can redistribute it and/or 12 | ;; modify it under the terms of the GNU General Public License as 13 | ;; published by the Free Software Foundation, either version 3 of the 14 | ;; License, or (at your option) any later version. 15 | ;; 16 | ;; This program is distributed in the hope that it will be useful, but 17 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | ;; General Public License for more details. 20 | ;; 21 | ;; You should have received a copy of the GNU General Public License 22 | ;; along with this program. If not, see `http://www.gnu.org/licenses/'. 23 | 24 | ;;; Commentary: 25 | 26 | ;; This file is part of CIDER 27 | 28 | ;;; Code: 29 | 30 | (require 'buttercup) 31 | (require 'cider-apropos) 32 | 33 | ;; Please, for each `describe', ensure there's an `it' block, so that its execution is visible in CI. 34 | 35 | (describe "cider-apropos" 36 | (it "raises user-error when cider is not connected." 37 | (spy-on 'cider-connected-p :and-return-value nil) 38 | (expect (cider-apropos "test") :to-throw 'user-error)) 39 | 40 | (it "raises user-error when the `apropos' op is not supported." 41 | (spy-on 'cider-ensure-op-supported :and-return-value nil) 42 | (expect (cider-apropos "test") :to-throw 'user-error))) 43 | 44 | (describe "cider-apropos-documentation" 45 | (it "raises user-error when cider is not connected." 46 | (spy-on 'cider-connected-p :and-return-value nil) 47 | (expect (cider-apropos-documentation) :to-throw 'user-error)) 48 | 49 | (it "raises user-error when the `apropos' op is not supported." 50 | (spy-on 'cider-ensure-op-supported :and-return-value nil) 51 | (expect (cider-apropos-documentation) :to-throw 'user-error))) 52 | -------------------------------------------------------------------------------- /test/cider-browse-ns-tests.el: -------------------------------------------------------------------------------- 1 | ;;; cider-browse-ns-tests.el -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright © 2012-2025 Tim King, Bozhidar Batsov 4 | 5 | ;; Author: Tim King 6 | ;; Bozhidar Batsov 7 | ;; Artur Malabarba 8 | 9 | ;; This file is NOT part of GNU Emacs. 10 | 11 | ;; This program is free software: you can redistribute it and/or 12 | ;; modify it under the terms of the GNU General Public License as 13 | ;; published by the Free Software Foundation, either version 3 of the 14 | ;; License, or (at your option) any later version. 15 | ;; 16 | ;; This program is distributed in the hope that it will be useful, but 17 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | ;; General Public License for more details. 20 | ;; 21 | ;; You should have received a copy of the GNU General Public License 22 | ;; along with this program. If not, see `http://www.gnu.org/licenses/'. 23 | 24 | ;;; Commentary: 25 | 26 | ;; This file is part of CIDER 27 | 28 | ;;; Code: 29 | 30 | (require 'buttercup) 31 | (require 'cider-browse-ns) 32 | 33 | ;; Please, for each `describe', ensure there's an `it' block, so that its execution is visible in CI. 34 | 35 | (describe "cider-browse-ns--text-face" 36 | (it "identifies a function" 37 | (expect (cider-browse-ns--text-face '(dict "arglists" "fn arg list")) 38 | :to-equal 'font-lock-function-name-face)) 39 | 40 | (it "identifies a macro" 41 | (expect (cider-browse-ns--text-face '(dict "arglists" "fn arg list" "macro" "true")) 42 | :to-equal 'font-lock-keyword-face)) 43 | 44 | (it "identifies a variable" 45 | (expect (cider-browse-ns--text-face '(dict)) 46 | :to-equal 'font-lock-variable-name-face))) 47 | 48 | (describe "cider-browse-ns" 49 | :var (cider-browse-ns-buffer) 50 | (it "lists out all forms of a namespace with correct font-locks" 51 | (spy-on 'cider-sync-request:ns-vars-with-meta :and-return-value 52 | '(dict "blank?" 53 | (dict "arglists" "fn arg list" 54 | "doc" "\"True if s is nil, empty, or contains only whitespace.\""))) 55 | (spy-on 'cider-sync-request:private-ns-vars-with-meta :and-return-value '(dict)) 56 | 57 | (with-temp-buffer 58 | (setq cider-browse-ns-buffer (buffer-name (current-buffer))) 59 | (cider-browse-ns "clojure.string") 60 | (search-forward "clojure") 61 | (expect (get-text-property (point) 'face) :to-equal 'font-lock-type-face) 62 | (search-forward "blank") 63 | (expect (get-text-property (point) 'font-lock-face) :to-equal 'font-lock-function-name-face) 64 | (search-forward "True") 65 | (expect (get-text-property (point) 'font-lock-face) :to-equal 'font-lock-doc-face) 66 | ;; filter out the functions and ensure that blank? doesn't show up 67 | (cider-browse-ns-toggle-hide-function) 68 | (goto-char (point-min)) 69 | (expect (not (search-forward "blank" nil t)))))) 70 | 71 | (describe "cider-browse-ns--first-doc-line" 72 | (it "returns Not documented if the doc string is missing" 73 | (expect (cider-browse-ns--first-doc-line nil) 74 | :to-equal "Not documented.")) 75 | 76 | (it "returns the first line of the doc string" 77 | (expect (cider-browse-ns--first-doc-line "True if s is nil, empty, or contains only whitespace.") 78 | :to-equal "True if s is nil, empty, or contains only whitespace.")) 79 | 80 | (it "returns the first sentence of the doc string if the first line contains multiple sentences" 81 | (expect (cider-browse-ns--first-doc-line "First sentence. Second sentence.") 82 | :to-equal "First sentence. ")) 83 | 84 | (it "returns the first line of the doc string if the first sentence spans multiple lines" 85 | (expect (cider-browse-ns--first-doc-line "True if s is nil, empty, or\n contains only whitespace.") 86 | :to-equal "True if s is nil, empty, or..."))) 87 | -------------------------------------------------------------------------------- /test/cider-browse-spec-tests.el: -------------------------------------------------------------------------------- 1 | ;;; cider-browse-spec-tests.el -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright © 2012-2025 r0man, Bozhidar Batsov 4 | 5 | ;; Author: r0man 6 | ;; Bozhidar Batsov 7 | 8 | ;; This file is NOT part of GNU Emacs. 9 | 10 | ;; This program is free software: you can redistribute it and/or 11 | ;; modify it under the terms of the GNU General Public License as 12 | ;; published by the Free Software Foundation, either version 3 of the 13 | ;; License, or (at your option) any later version. 14 | ;; 15 | ;; This program is distributed in the hope that it will be useful, but 16 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 17 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | ;; General Public License for more details. 19 | ;; 20 | ;; You should have received a copy of the GNU General Public License 21 | ;; along with this program. If not, see `http://www.gnu.org/licenses/'. 22 | 23 | ;;; Commentary: 24 | 25 | ;; This file is part of CIDER 26 | 27 | ;;; Code: 28 | 29 | (require 'buttercup) 30 | (require 'cider-browse-spec) 31 | 32 | ;; Please, for each `describe', ensure there's an `it' block, so that its execution is visible in CI. 33 | 34 | (defvar cider-browse-spec-tests--schema-vector-response 35 | '("clojure.alpha.spec/schema" 36 | (":example.customer/id" ":example.customer/name")) 37 | "The NREPL response for a s/schema vector spec.") 38 | 39 | (defvar cider-browse-spec-tests--schema-map-response 40 | '("clojure.alpha.spec/schema" 41 | ((dict ":id" ":example.customer/id" 42 | ":name" ":example.customer/name"))) 43 | "The NREPL response for a s/schema map spec.") 44 | 45 | (defvar cider-browse-spec-tests--company-addr-response 46 | '("clojure.alpha.spec/union" ":test/addr" 47 | (":test/company" ":test/suite")) 48 | "The NREPL response for the :user/company-addr spec.") 49 | 50 | (defvar cider-browse-spec-tests--movie-times-user-response 51 | '("clojure.alpha.spec/select" ":test/user" 52 | (":test/id" ":test/addr" 53 | (dict ":test/addr" 54 | (":test/zip")))) 55 | "The NREPL response for the :user/movie-times-user spec.") 56 | 57 | (defun cider-browse-spec-tests--setup-spec-form (spec-form) 58 | "Setup the mocks to test rendering of SPEC-FORM." 59 | (spy-on 'sesman-current-session :and-return-value t) 60 | (spy-on 'cider-nrepl-op-supported-p :and-return-value t) 61 | (spy-on 'cider-connected-p :and-return-value nil) 62 | (spy-on 'cider--get-symbol-indent :and-return-value nil) 63 | (spy-on 'cider-sync-request:spec-form :and-return-value spec-form)) 64 | 65 | (describe "cider-browse-spec--browse" 66 | (it "raises user-error when cider is not connected." 67 | (spy-on 'sesman-current-session :and-return-value nil) 68 | (expect (cider-browse-spec--browse ":example/customer") :to-throw 'user-error)) 69 | 70 | (it "raises user-error when the `spec-form' op is not supported." 71 | (spy-on 'sesman-current-session :and-return-value t) 72 | (spy-on 'cider-nrepl-op-supported-p :and-return-value nil) 73 | (expect (cider-browse-spec--browse ":example/customer") :to-throw 'user-error)) 74 | 75 | (it "renders a s/schema map form" 76 | (cider-browse-spec-tests--setup-spec-form cider-browse-spec-tests--schema-map-response) 77 | (expect (cider-browse-spec--browse ":example/customer"))) 78 | 79 | (it "renders a s/schema vector form" 80 | (cider-browse-spec-tests--setup-spec-form cider-browse-spec-tests--schema-vector-response) 81 | (expect (cider-browse-spec--browse ":example/customer"))) 82 | 83 | (it "renders a s/select form" 84 | (cider-browse-spec-tests--setup-spec-form cider-browse-spec-tests--movie-times-user-response) 85 | (expect (cider-browse-spec--browse ":user/movie-times-user"))) 86 | 87 | (it "renders a s/union form" 88 | (cider-browse-spec-tests--setup-spec-form cider-browse-spec-tests--company-addr-response) 89 | (expect (cider-browse-spec--browse ":user/company-addr")))) 90 | -------------------------------------------------------------------------------- /test/cider-classpath-tests.el: -------------------------------------------------------------------------------- 1 | ;;; cider-classpath-tests.el -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright © 2012-2025 Tim King, Bozhidar Batsov 4 | 5 | ;; Author: Tim King 6 | ;; Bozhidar Batsov 7 | ;; Artur Malabarba 8 | 9 | ;; This file is NOT part of GNU Emacs. 10 | 11 | ;; This program is free software: you can redistribute it and/or 12 | ;; modify it under the terms of the GNU General Public License as 13 | ;; published by the Free Software Foundation, either version 3 of the 14 | ;; License, or (at your option) any later version. 15 | ;; 16 | ;; This program is distributed in the hope that it will be useful, but 17 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | ;; General Public License for more details. 20 | ;; 21 | ;; You should have received a copy of the GNU General Public License 22 | ;; along with this program. If not, see `http://www.gnu.org/licenses/'. 23 | 24 | ;;; Commentary: 25 | 26 | ;; This file is part of CIDER 27 | 28 | ;;; Code: 29 | 30 | (require 'buttercup) 31 | (require 'cider-classpath) 32 | 33 | ;; Please, for each `describe', ensure there's an `it' block, so that its execution is visible in CI. 34 | 35 | (describe "cider-classpath" 36 | (it "raises user-error when cider is not connected." 37 | (spy-on 'cider-connected-p :and-return-value nil) 38 | (expect (cider-classpath) :to-throw 'user-error)) 39 | 40 | (it "raises user-error when the `classpath' op is not supported." 41 | (spy-on 'cider-ensure-op-supported :and-return-value nil) 42 | (expect (cider-classpath) :to-throw 'user-error))) 43 | 44 | (describe "cider-open-classpath-entry" 45 | (it "raises user-error when cider is not connected." 46 | (spy-on 'cider-connected-p :and-return-value nil) 47 | (expect (cider-open-classpath-entry) :to-throw 'user-error)) 48 | 49 | (it "raises user-error when the `classpath' op is not supported." 50 | (spy-on 'cider-ensure-op-supported :and-return-value nil) 51 | (expect (cider-open-classpath-entry) :to-throw 'user-error))) 52 | -------------------------------------------------------------------------------- /test/cider-clojuredocs-tests.el: -------------------------------------------------------------------------------- 1 | ;;; cider-clojuredocs-tests.el -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright © 2012-2025 Tim King, Bozhidar Batsov 4 | 5 | ;; Author: Tim King 6 | ;; Bozhidar Batsov 7 | ;; Artur Malabarba 8 | 9 | ;; This file is NOT part of GNU Emacs. 10 | 11 | ;; This program is free software: you can redistribute it and/or 12 | ;; modify it under the terms of the GNU General Public License as 13 | ;; published by the Free Software Foundation, either version 3 of the 14 | ;; License, or (at your option) any later version. 15 | ;; 16 | ;; This program is distributed in the hope that it will be useful, but 17 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | ;; General Public License for more details. 20 | ;; 21 | ;; You should have received a copy of the GNU General Public License 22 | ;; along with this program. If not, see `http://www.gnu.org/licenses/'. 23 | 24 | ;;; Commentary: 25 | 26 | ;; This file is part of CIDER 27 | 28 | ;;; Code: 29 | 30 | (require 'buttercup) 31 | (require 'cider-clojuredocs) 32 | 33 | ;; Please, for each `describe', ensure there's an `it' block, so that its execution is visible in CI. 34 | 35 | ;;; clojuredocs tests 36 | 37 | (describe "cider-clojuredocs-replace-special" 38 | (it "converts the input to a clojuredocs friendly format" 39 | (expect (cider-clojuredocs-replace-special "isa?") :to-equal "isa_q") 40 | (expect (cider-clojuredocs-replace-special "really-isa?") :to-equal "really-isa_q") 41 | (expect (cider-clojuredocs-replace-special "..") :to-equal "_..") 42 | (expect (cider-clojuredocs-replace-special ".") :to-equal "_.") 43 | (expect (cider-clojuredocs-replace-special "/") :to-equal "fs") 44 | )) 45 | 46 | (describe "cider-clojuredocs-url" 47 | (it "creates a clojuredocs search URL" 48 | (expect (cider-clojuredocs-url "even?" "clojure.core") :to-equal "https://clojuredocs.org/clojure.core/even_q") 49 | (expect (cider-clojuredocs-url nil "clojure.core") :to-equal nil) 50 | (expect (cider-clojuredocs-url "even?" nil) :to-equal nil))) 51 | -------------------------------------------------------------------------------- /test/cider-completion-context-tests.el: -------------------------------------------------------------------------------- 1 | ;;; cider-completion-context-tests.el -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright © 2012-2025 Bozhidar Batsov 4 | 5 | ;; Author: Bozhidar Batsov 6 | 7 | ;; This file is NOT part of GNU Emacs. 8 | 9 | ;; This program is free software: you can redistribute it and/or 10 | ;; modify it under the terms of the GNU General Public License as 11 | ;; published by the Free Software Foundation, either version 3 of the 12 | ;; License, or (at your option) any later version. 13 | ;; 14 | ;; This program is distributed in the hope that it will be useful, but 15 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | ;; General Public License for more details. 18 | ;; 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see `http://www.gnu.org/licenses/'. 21 | 22 | ;;; Commentary: 23 | 24 | ;; This file is part of CIDER 25 | 26 | ;;; Code: 27 | 28 | (require 'buttercup) 29 | (require 'cider-completion-context) 30 | 31 | ;; Please, for each `describe', ensure there's an `it' block, so that its execution is visible in CI. 32 | 33 | (describe "cider-completion-get-context" 34 | 35 | (describe "when POINT is not at the end of the symbol" 36 | (describe "within a vanilla clojure buffer" 37 | (it "Returns different things depending on the :info param" 38 | (with-clojure-buffer "(ns foo) 39 | 40 | (|.foo \"\")" 41 | (expect (cider-completion-get-context) :to-equal "(__prefix__.foo \"\")") 42 | (expect (cider-completion-get-context :info) :to-equal "(__prefix__ \"\")")))) 43 | 44 | (describe "within a repl" 45 | (it "Returns different things depending on the :info param" 46 | (with-clojure-buffer "user> (.foo|bar \"\")" 47 | (expect (cider-completion-get-context) :to-equal "(__prefix__bar \"\")") 48 | (expect (cider-completion-get-info-context-at-point) :to-equal "(__prefix__ \"\")"))))) 49 | 50 | (it "Returns the same context when invoked twice at the same place" 51 | (with-clojure-buffer "(ns foo) 52 | 53 | (.foo| \"\")" 54 | (expect (cider-completion-get-context) :to-equal "(__prefix__ \"\")") 55 | (expect (cider-completion-get-context) :to-equal "(__prefix__ \"\")")))) 56 | -------------------------------------------------------------------------------- /test/cider-completion-tests.el: -------------------------------------------------------------------------------- 1 | ;;; cider-completion-tests.el -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright © 2012-2025 Bozhidar Batsov 4 | 5 | ;; Author: Bozhidar Batsov 6 | 7 | ;; This file is NOT part of GNU Emacs. 8 | 9 | ;; This program is free software: you can redistribute it and/or 10 | ;; modify it under the terms of the GNU General Public License as 11 | ;; published by the Free Software Foundation, either version 3 of the 12 | ;; License, or (at your option) any later version. 13 | ;; 14 | ;; This program is distributed in the hope that it will be useful, but 15 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | ;; General Public License for more details. 18 | ;; 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see `http://www.gnu.org/licenses/'. 21 | 22 | ;;; Commentary: 23 | 24 | ;; This file is part of CIDER 25 | 26 | ;;; Code: 27 | 28 | (require 'buttercup) 29 | (require 'cider-completion) 30 | 31 | ;; Please, for each `describe', ensure there's an `it' block, so that its execution is visible in CI. 32 | 33 | (describe "cider-enable-flex-completion" 34 | (when (>= emacs-major-version 27) 35 | (cl-assert (not (member 'flex (assq 'styles (assq 'cider completion-category-overrides))))) 36 | (let ((old-value completion-category-overrides)) 37 | (unwind-protect 38 | (progn 39 | (it "adds `flex' and `basic' as a fallback" 40 | (let ((expected-category-overrides '((cider (styles flex basic))))) 41 | (cider-enable-flex-completion) 42 | (expect (member 'flex (assq 'styles (assq 'cider completion-category-overrides))) 43 | :to-be-truthy) 44 | (expect (member 'basic (assq 'styles (assq 'cider completion-category-overrides))) 45 | :to-be-truthy) 46 | (expect completion-category-overrides :to-equal expected-category-overrides))) 47 | 48 | (it "doesn't add `cycle'" 49 | (expect (assq 'cycle (assq 'cider completion-category-overrides)) 50 | :to-be nil)) 51 | 52 | (it "adds just `flex' if there is another style present" 53 | (setq completion-category-overrides '((cider (styles partial-completion)))) 54 | (cider-enable-flex-completion) 55 | (expect (member 'flex (assq 'styles (assq 'cider completion-category-overrides))) 56 | :to-be-truthy) 57 | (expect (member 'partial-completion (assq 'styles (assq 'cider completion-category-overrides))) 58 | :to-be-truthy) 59 | (expect (member 'basic (assq 'styles (assq 'cider completion-category-overrides))) 60 | :to-be nil)) 61 | 62 | (it "doesn't re-add `flex' if already present, preserving `cycle' as well" 63 | (let ((with-flex-and-cycle '((cider (styles basic flex) 64 | (cycle t))))) 65 | (setq completion-category-overrides with-flex-and-cycle) 66 | (cider-enable-flex-completion) 67 | (expect completion-category-overrides 68 | :to-equal with-flex-and-cycle)))) 69 | (setq completion-category-overrides old-value))))) 70 | -------------------------------------------------------------------------------- /test/cider-doc-tests.el: -------------------------------------------------------------------------------- 1 | ;;; cider-doc-tests.el -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright © 2023-2025 Bozhidar Batsov 4 | 5 | ;; Author: Bozhidar Batsov 6 | 7 | ;; This file is NOT part of GNU Emacs. 8 | 9 | ;; This program is free software: you can redistribute it and/or 10 | ;; modify it under the terms of the GNU General Public License as 11 | ;; published by the Free Software Foundation, either version 3 of the 12 | ;; License, or (at your option) any later version. 13 | ;; 14 | ;; This program is distributed in the hope that it will be useful, but 15 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | ;; General Public License for more details. 18 | ;; 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see `http://www.gnu.org/licenses/'. 21 | 22 | ;;; Commentary: 23 | 24 | ;; This file is part of CIDER 25 | 26 | ;;; Code: 27 | 28 | (require 'buttercup) 29 | (require 'cider-doc) 30 | 31 | ;; Please, for each `describe', ensure there's an `it' block, so that its execution is visible in CI. 32 | 33 | (describe "cider--abbreviate-file-protocol" 34 | (it "Removes the file or jar part" 35 | (expect (cider--abbreviate-file-protocol "file:foo.clj") 36 | :to-equal 37 | "foo.clj") 38 | (expect (cider--abbreviate-file-protocol "jar:file:/root/.m2/org/clojure/clojure/1.10.3/clojure-1.10.3.jar!/clojure/core.clj") 39 | :to-equal 40 | "clojure/core.clj") 41 | (expect (cider--abbreviate-file-protocol "zip:file:/root/.m2/org/clojure/clojure/1.10.3/clojure-1.10.3.jar!/clojure/core.clj") 42 | :to-equal 43 | "clojure/core.clj") 44 | (expect (format-spec "*cider-repl %s(%r:%S)*" 45 | (list '(115 . "ClojureProjects/PPL:localhost:36453") 46 | '(104 . "localhost") 47 | '(72 . "") 48 | '(112 . 36453) 49 | '(106 . "PPL") 50 | '(74 . "ClojureProjects/PPL") 51 | '(114 . clj) 52 | '(83 . ""))) 53 | :to-equal 54 | "*cider-repl ClojureProjects/PPL:localhost:36453(clj:)*"))) 55 | -------------------------------------------------------------------------------- /test/cider-eval-tests.el: -------------------------------------------------------------------------------- 1 | ;;; cider-eval-tests.el -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright © 2012-2025 Arne Brasseur 4 | 5 | ;; Author: Arne Brasseur 6 | 7 | ;; This file is NOT part of GNU Emacs. 8 | 9 | ;; This program is free software: you can redistribute it and/or 10 | ;; modify it under the terms of the GNU General Public License as 11 | ;; published by the Free Software Foundation, either version 3 of the 12 | ;; License, or (at your option) any later version. 13 | ;; 14 | ;; This program is distributed in the hope that it will be useful, but 15 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | ;; General Public License for more details. 18 | ;; 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see `http://www.gnu.org/licenses/'. 21 | 22 | ;;; Commentary: 23 | 24 | ;; This file is part of CIDER 25 | 26 | ;;; Code: 27 | 28 | (require 'buttercup) 29 | (require 'cider-eval) 30 | 31 | ;; Please, for each `describe', ensure there's an `it' block, so that its execution is visible in CI. 32 | 33 | (describe "cider-extract-error-info" 34 | (it "Matches Clojure compilation exceptions" 35 | (expect (cider-extract-error-info cider-compilation-regexp "Syntax error compiling clojure.core/let at (src/haystack/analyzer.clj:18:1).\n[1] - failed: even-number-of-forms? at: [:bindings] spec: :clojure.core.specs.alpha/bindings\n") 36 | :to-equal '("src/haystack/analyzer.clj" 18 1 cider-error-highlight-face "Syntax error compiling clojure.core/let at (src/haystack/analyzer.clj:18:1).\n[1] - failed: even-number-of-forms? at: [:bindings] spec: :clojure.core.specs.alpha/bindings\n")) 37 | (expect (cider-extract-error-info cider-compilation-regexp "Syntax error macroexpanding clojure.core/let at (src/haystack/analyzer.clj:18:1).\n[1] - failed: even-number-of-forms? at: [:bindings] spec: :clojure.core.specs.alpha/bindings\n") 38 | :to-equal '("src/haystack/analyzer.clj" 18 1 cider-error-highlight-face "Syntax error macroexpanding clojure.core/let at (src/haystack/analyzer.clj:18:1).\n[1] - failed: even-number-of-forms? at: [:bindings] spec: :clojure.core.specs.alpha/bindings\n")) 39 | (expect (cider-extract-error-info cider-compilation-regexp "Syntax error reading source at (/Users/vemv/haystack/src/haystack/parser.cljc:13:0).") 40 | :to-equal '("/Users/vemv/haystack/src/haystack/parser.cljc" 13 0 cider-error-highlight-face "Syntax error reading source at (/Users/vemv/haystack/src/haystack/parser.cljc:13:0).")) 41 | (expect (cider-extract-error-info cider-compilation-regexp "Syntax error FOOING clojure.core/let at (src/haystack/analyzer.clj:18:1).\n[1] - failed: even-number-of-forms? at: [:bindings] spec: :clojure.core.specs.alpha/bindings\n") 42 | :to-equal nil))) 43 | -------------------------------------------------------------------------------- /test/cider-find-tests.el: -------------------------------------------------------------------------------- 1 | ;;; cider-find-tests.el -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright © 2012-2025 Bozhidar Batsov 4 | 5 | ;; Author: Bozhidar Batsov 6 | 7 | ;; This file is NOT part of GNU Emacs. 8 | 9 | ;; This program is free software: you can redistribute it and/or 10 | ;; modify it under the terms of the GNU General Public License as 11 | ;; published by the Free Software Foundation, either version 3 of the 12 | ;; License, or (at your option) any later version. 13 | ;; 14 | ;; This program is distributed in the hope that it will be useful, but 15 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | ;; General Public License for more details. 18 | ;; 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see `http://www.gnu.org/licenses/'. 21 | 22 | ;;; Commentary: 23 | 24 | ;; This file is part of CIDER 25 | 26 | ;;; Code: 27 | 28 | (require 'buttercup) 29 | (require 'cider-find) 30 | 31 | ;; Please, for each `describe', ensure there's an `it' block, so that its execution is visible in CI. 32 | 33 | (describe "cider-find-ns" 34 | (it "raises a user error if cider is not connected" 35 | (spy-on 'cider-connected-p :and-return-value nil) 36 | (expect (cider-find-ns) :to-throw 'user-error)) 37 | (it "raises a user error if the op is not supported" 38 | (spy-on 'cider-nrepl-op-supported-p :and-return-value nil) 39 | (expect (cider-find-ns) :to-throw 'user-error))) 40 | 41 | (describe "cider--find-keyword-loc" 42 | (it "finds the given keyword, discarding false positives" 43 | (with-clojure-buffer "(ns some.ns) 44 | ;; ::foo 45 | \"::foo\" 46 | #_::foo 47 | ::foobar 48 | \" 49 | ::foo 50 | \" 51 | ::foo 52 | more 53 | stuff" 54 | (let* ((sample-buffer (current-buffer))) 55 | (spy-on 'cider-ensure-connected :and-return-value t) 56 | (spy-on 'cider-sync-request:ns-path :and-call-fake (lambda (kw-ns _) 57 | kw-ns)) 58 | (spy-on 'cider-resolve-alias :and-call-fake (lambda (_ns ns-qualifier) 59 | ns-qualifier)) 60 | (spy-on 'cider-find-file :and-call-fake (lambda (kw-ns) 61 | (when (equal kw-ns "some.ns") 62 | sample-buffer))) 63 | 64 | (nrepl-dbind-response (cider--find-keyword-loc "::some.ns/foo") (dest dest-point) 65 | (expect dest-point :to-equal 63) 66 | (with-current-buffer dest 67 | (goto-char dest-point) 68 | ;; important - ensure that we're looking at ::foo and not ::foobar: 69 | (expect (cider-symbol-at-point 'look-back) :to-equal "::foo"))) 70 | 71 | (nrepl-dbind-response (cider--find-keyword-loc "::foo") (dest dest-point) 72 | (expect dest-point :to-equal 63) 73 | (with-current-buffer dest 74 | (goto-char dest-point) 75 | ;; important - ensure that we're looking at ::foo and not ::foobar: 76 | (expect (cider-symbol-at-point 'look-back) :to-equal "::foo"))) 77 | 78 | (nrepl-dbind-response (cider--find-keyword-loc ":some.ns/foo") (dest dest-point) 79 | (expect dest-point :to-equal 63) 80 | (with-current-buffer dest 81 | (goto-char dest-point) 82 | ;; important - ensure that we're looking at ::foo and not ::foobar: 83 | (expect (cider-symbol-at-point 'look-back) :to-equal "::foo"))) 84 | 85 | (nrepl-dbind-response (cider--find-keyword-loc "::some.ns/bar") (dest dest-point) 86 | (expect dest-point :to-equal nil)) 87 | 88 | (nrepl-dbind-response (cider--find-keyword-loc ":some.ns/bar") (dest dest-point) 89 | (expect dest-point :to-equal nil)) 90 | 91 | (expect (cider--find-keyword-loc ":foo") :to-throw 'user-error) 92 | 93 | (nrepl-dbind-response (cider--find-keyword-loc ":unrelated/foo") (dest dest-point) 94 | (expect dest-point :to-equal nil)) 95 | 96 | (nrepl-dbind-response (cider--find-keyword-loc "::unrelated/foo") (dest dest-point) 97 | (expect dest-point :to-equal nil)))))) 98 | -------------------------------------------------------------------------------- /test/cider-jar-tests.el: -------------------------------------------------------------------------------- 1 | ;;; cider-jar-tests.el -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright © 2012-2025 Arne Brasseur 4 | 5 | ;; Author: Arne Brasseur 6 | 7 | ;; This file is NOT part of GNU Emacs. 8 | 9 | ;; This program is free software: you can redistribute it and/or 10 | ;; modify it under the terms of the GNU General Public License as 11 | ;; published by the Free Software Foundation, either version 3 of the 12 | ;; License, or (at your option) any later version. 13 | ;; 14 | ;; This program is distributed in the hope that it will be useful, but 15 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | ;; General Public License for more details. 18 | ;; 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see `http://www.gnu.org/licenses/'. 21 | 22 | ;;; Commentary: 23 | 24 | ;; This file is part of CIDER 25 | 26 | ;;; Code: 27 | 28 | (require 'buttercup) 29 | (require 'cider-jar) 30 | (require 'map) 31 | 32 | ;; Please, for each `describe', ensure there's an `it' block, so that its execution is visible in CI. 33 | 34 | (describe "cider-jar--cider-nrepl-clojars-url" 35 | (it "Builds a Clojars url" 36 | (expect (cider-jar-clojars-url "cider" "cider-nrepl" "0.1.2") 37 | :to-equal 38 | "https://repo.clojars.org/cider/cider-nrepl/0.1.2/cider-nrepl-0.1.2.jar"))) 39 | 40 | (describe "cider-jar-ensure-cider-nrepl-jar" 41 | (it "Builds a path" 42 | (expect (cider-jar-find-or-fetch "cider" "cider-nrepl" "0.20.0") 43 | :to-match 44 | (rx "cider-cache/repo.clojars.org/cider/cider-nrepl/0.20.0/cider-nrepl-0.20.0.jar")))) 45 | 46 | (describe "cider-jar-contents" 47 | (it "Has reasonable contents" 48 | (expect 49 | (cider-jar-contents (cider-jar-find-or-fetch "cider" "cider-nrepl" "0.20.0")) 50 | :to-contain 51 | "cider/nrepl.clj"))) 52 | 53 | (describe "cider-jar-contents-cached" 54 | (it "Has reasonable contents" 55 | (expect 56 | (map-elt (cider-jar-contents-cached (cider-jar-find-or-fetch "cider" "cider-nrepl" "0.20.0")) 57 | "cider/nrepl.clj") 58 | :to-be t))) 59 | 60 | (describe "cider-jar-contains" 61 | (it "Returns t if and only if a given file is contained" 62 | (expect 63 | (cider-jar-contains-p (cider-jar-find-or-fetch "cider" "cider-nrepl" "0.20.0") 64 | "cider/nrepl.clj") 65 | :to-be t) 66 | (expect 67 | (cider-jar-contains-p (cider-jar-find-or-fetch "cider" "cider-nrepl" "0.20.0") 68 | "foo/bar.clj") 69 | :to-be nil))) 70 | 71 | (describe "cider-jar-retrieve-resource" 72 | (it "Correctly extracts and slurps the given file" 73 | (expect 74 | (cider-jar-retrieve-resource (cider-jar-find-or-fetch "cider" "cider-nrepl" "0.20.0") 75 | "data_readers.clj") 76 | :to-equal 77 | "{dbg cider.nrepl.middleware.debug/debug-reader 78 | break cider.nrepl.middleware.debug/breakpoint-reader 79 | light cider.nrepl.middleware.enlighten/light-reader} 80 | "))) 81 | -------------------------------------------------------------------------------- /test/cider-log-tests.el: -------------------------------------------------------------------------------- 1 | ;;; cider-log-tests.el -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright © 2023-2025 Bozhidar Batsov and CIDER contributors 4 | 5 | ;; Author: r0man 6 | 7 | ;; This file is NOT part of GNU Emacs. 8 | 9 | ;; This program is free software: you can redistribute it and/or 10 | ;; modify it under the terms of the GNU General Public License as 11 | ;; published by the Free Software Foundation, either version 3 of the 12 | ;; License, or (at your option) any later version. 13 | ;; 14 | ;; This program is distributed in the hope that it will be useful, but 15 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | ;; General Public License for more details. 18 | ;; 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see `http://www.gnu.org/licenses/'. 21 | 22 | ;;; Commentary: 23 | 24 | ;; This file is part of CIDER 25 | 26 | ;;; Code: 27 | 28 | (require 'buttercup) 29 | (require 'cider-log) 30 | 31 | ;; Please, for each `describe', ensure there's an `it' block, so that its execution is visible in CI. 32 | 33 | (describe "cider-log" 34 | (let ((framework (nrepl-dict "id" "jul" "name" "Java Util Logging")) 35 | (appender (nrepl-dict "id" "cider-log"))) 36 | 37 | (it "raises user-error when cider is not connected." 38 | (spy-on 'cider-connected-p :and-return-value nil) 39 | (expect (cider-log framework appender) :to-throw 'user-error)) 40 | 41 | (it "doesn't add an appender when initialized." 42 | (let ((cider-log--initialized-once-p t)) 43 | (spy-on 'cider-sync-request:log-frameworks :and-return-value (list framework)) 44 | (spy-on 'transient-setup) 45 | (cider-log framework appender) 46 | (expect 'transient-setup :to-have-been-called-with 'cider-log))) 47 | 48 | (it "does add an appender when not initialized." 49 | (let ((cider-log--initialized-once-p nil)) 50 | (spy-on 'cider-sync-request:log-frameworks :and-return-value (list framework)) 51 | (spy-on 'cider-sync-request:log-add-appender :and-return-value appender) 52 | (spy-on 'transient-setup) 53 | (cider-log framework appender) 54 | (expect 'transient-setup :to-have-been-called-with 'cider-log))))) 55 | -------------------------------------------------------------------------------- /test/cider-selector-tests.el: -------------------------------------------------------------------------------- 1 | ;;; cider-selector-tests.el -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright © 2012-2025 Tim King, Bozhidar Batsov 4 | 5 | ;; Author: Tim King 6 | ;; Bozhidar Batsov 7 | ;; Artur Malabarba 8 | 9 | ;; This file is NOT part of GNU Emacs. 10 | 11 | ;; This program is free software: you can redistribute it and/or 12 | ;; modify it under the terms of the GNU General Public License as 13 | ;; published by the Free Software Foundation, either version 3 of the 14 | ;; License, or (at your option) any later version. 15 | ;; 16 | ;; This program is distributed in the hope that it will be useful, but 17 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | ;; General Public License for more details. 20 | ;; 21 | ;; You should have received a copy of the GNU General Public License 22 | ;; along with this program. If not, see `http://www.gnu.org/licenses/'. 23 | 24 | ;;; Commentary: 25 | 26 | ;; This file is part of CIDER 27 | 28 | ;;; Code: 29 | 30 | (require 'buttercup) 31 | (require 'cider-selector) 32 | (require 'cider-selector-test-utils "test/utils/cider-selector-test-utils") 33 | (require 'cider-connection-test-utils "test/utils/cider-connection-test-utils") 34 | 35 | ;; Please, for each `describe', ensure there's an `it' block, so that its execution is visible in CI. 36 | 37 | ;; selector 38 | 39 | (describe "cider-selector-method-c" 40 | (it "switches to most recently visited clojure-mode buffer" 41 | (cider-test-selector-method ?c 'clojure-mode "*testfile*.clj"))) 42 | 43 | (describe "cider-selector-method-e" 44 | (it "switches to most recently visited emacs-lisp-mode buffer" 45 | (kill-buffer "*scratch*") 46 | (cider-test-selector-method ?e 'emacs-lisp-mode "*testfile*.el"))) 47 | 48 | (describe "cider-selector-method-r" 49 | :var (cider-current-repl) 50 | (it "switches to current REPL buffer" 51 | (spy-on 'cider-current-repl :and-return-value "*cider-repl xyz*") 52 | (cider-test-selector-method ?r 'cider-repl-mode "*cider-repl xyz*"))) 53 | 54 | ;; FIXME: should work but doesn't with a nonsense error 55 | ;; (describe "cider-selector-method-m" 56 | ;; (it "switches to current connection's *nrepl-messages* buffer" 57 | ;; (let ((buf (get-buffer-create "*nrepl-messages some-id*"))) 58 | ;; (with-repl-buffer "a-session" 'clj _ 59 | ;; (setq-local nrepl-messages-buffer buf) 60 | ;; (message "%S" (nrepl-messages-buffer (cider-current-repl))) 61 | ;; (cider-test-selector-method ?m nil "*nrepl-messages some-id*"))))) 62 | 63 | (describe "cider-selector-method-x" 64 | (it "switches to *cider-error* buffer" 65 | (cider-test-selector-method ?x 'cider-stacktrace-mode "*cider-error*"))) 66 | 67 | (describe "cider-selector-method-d" 68 | (it "switches to *cider-doc* buffer" 69 | (cider-test-selector-method ?d 'cider-stacktrace-mode "*cider-doc*"))) 70 | 71 | (describe "cider-selector-method-s" 72 | :var (cider-scratch-find-or-create-buffer) 73 | (it "switches to *cider-scratch* buffer" 74 | (spy-on 'cider-scratch-find-or-create-buffer :and-return-value "*cider-scratch*") 75 | (cider-test-selector-method ?s 'cider-docview-mode "*cider-scratch*"))) 76 | -------------------------------------------------------------------------------- /test/cider-test-tests.el: -------------------------------------------------------------------------------- 1 | ;;; cider-test-tests.el -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright © 2023-2025 Bozhidar Batsov 4 | 5 | ;; Author: Bozhidar Batsov 6 | 7 | ;; This file is NOT part of GNU Emacs. 8 | 9 | ;; This program is free software: you can redistribute it and/or 10 | ;; modify it under the terms of the GNU General Public License as 11 | ;; published by the Free Software Foundation, either version 3 of the 12 | ;; License, or (at your option) any later version. 13 | ;; 14 | ;; This program is distributed in the hope that it will be useful, but 15 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | ;; General Public License for more details. 18 | ;; 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see `http://www.gnu.org/licenses/'. 21 | 22 | ;;; Commentary: 23 | 24 | ;; This file is part of CIDER 25 | 26 | ;;; Code: 27 | 28 | (require 'buttercup) 29 | (require 'cider-test) 30 | 31 | ;; Please, for each `describe', ensure there's an `it' block, so that its execution is visible in CI. 32 | 33 | (describe "cider-test--string-contains-newline" 34 | (it "Returns `t' only for escaped newlines" 35 | (expect (cider-test--string-contains-newline "n") 36 | :to-equal 37 | nil) 38 | (expect (cider-test--string-contains-newline "Hello\nWorld") 39 | :to-equal 40 | nil) 41 | (expect (cider-test--string-contains-newline "Hello\\nWorld") 42 | :to-equal 43 | t))) 44 | -------------------------------------------------------------------------------- /test/cider-tests--no-auto.el: -------------------------------------------------------------------------------- 1 | ;;; cider-tests--no-auto.el --- Non-automated tests -*- lexical-binding: t -*- 2 | 3 | ;; Copyright © 2014-2025 Jeff Valk, Bozhidar Batsov and CIDER contributors 4 | 5 | ;; Author: Jeff Valk 6 | 7 | ;; This program is free software: you can redistribute it and/or modify 8 | ;; it under the terms of the GNU General Public License as published by 9 | ;; the Free Software Foundation, either version 3 of the License, or 10 | ;; (at your option) any later version. 11 | 12 | ;; This program is distributed in the hope that it will be useful, 13 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | ;; GNU General Public License for more details. 16 | 17 | ;; You should have received a copy of the GNU General Public License 18 | ;; along with this program. If not, see . 19 | 20 | ;; This file is not part of GNU Emacs. 21 | 22 | ;;; Commentary: 23 | 24 | ;; This file contains tests for CIDER that require an active nREPL connection 25 | ;; with `cider-nrepl' middleware, and can't currently be included in automated 26 | ;; CI builds. 27 | 28 | ;; To run these tests: 29 | ;; All tests: M-x buttercup-run-at-point 30 | ;; 31 | ;;; Code: 32 | 33 | (require 'buttercup) 34 | (require 'cider) 35 | (require 'subr-x) 36 | 37 | ;; Please, for each `describe', ensure there's an `it' block, so that its execution is visible in CI. 38 | 39 | ;;; Docs 40 | ;; Presenting docs erroneously would cause an ugly scene. 41 | 42 | (defun cider-test-doc (sym &optional dump) 43 | "Compare `cider-doc' output for SYM to the canonical `clojure.repl/doc'. 44 | Prior to compare, Added/Deprecated info is removed from the former, and the 45 | leading line of all dashes and trailing nil (when no doc is present) are removed 46 | from the latter. Remaining content is compared for string equality." 47 | (let ((repl-doc (with-temp-buffer 48 | (let ((form (format "(clojure.repl/doc %s)" sym))) 49 | (insert (nrepl-dict-get (cider-nrepl-send-sync-request form) 50 | "out")) 51 | (goto-char (point-min)) 52 | (while (re-search-forward "^ nil\n" nil t) 53 | (replace-match "")) 54 | (goto-line 2) 55 | (buffer-substring (point) (point-max))))) 56 | (cider-doc (if-let* ((doc-buffer (cider-doc-buffer-for sym))) 57 | (with-current-buffer doc-buffer 58 | (let ((inhibit-read-only t)) 59 | (goto-char (point-min)) 60 | (while (re-search-forward 61 | "^\\(Added\\|Deprecated\\).*\n" nil t) 62 | (replace-match "")) 63 | (prog1 64 | (buffer-string) 65 | (kill-buffer)))) 66 | ""))) 67 | (when dump 68 | (message "== clojure.repl/doc ==\n%s" repl-doc) 69 | (message "== cider-doc ==\n%s" cider-doc)) 70 | (string= cider-doc repl-doc))) 71 | 72 | (defun cider-test-all-docs () 73 | "Verify docs for all special forms and every public var in `clojure/core'." 74 | (let ((syms (read 75 | (cider-nrepl-sync-request:eval 76 | "(->> (merge @#'clojure.repl/special-doc-map 77 | (->> (ns-map 'clojure.core) 78 | (filter (every-pred 79 | (comp var? val) 80 | (complement (comp :private meta val)))))) 81 | (keys) 82 | (remove '#{.}))" ; emacs lisp chokes on the dot symbol 83 | )))) 84 | (let (untested diffs) 85 | (dolist (sym syms) 86 | (let ((name (cond ((symbolp sym) (symbol-name sym)) 87 | ((listp sym) (symbol-name (cadr sym)))))) 88 | (if name 89 | (unless (cider-test-doc name) 90 | (setq diffs (cons sym diffs))) 91 | (setq untested (cons sym untested))))) 92 | (when untested 93 | (message "Could not test: %s" untested)) 94 | (when diffs 95 | (message "Mismatched: %s" diffs)) 96 | (concatenate 'list untested diffs)))) 97 | 98 | (describe "cider-test-all-docs" 99 | (it "returns nil if `cider-doc' output matches with the `clojure.repl/doc'" 100 | (expect (cider-test-all-docs) :to-equal nil))) 101 | -------------------------------------------------------------------------------- /test/cider_ns_tests.clj: -------------------------------------------------------------------------------- 1 | (ns cider-ns-tests 2 | "Supports cider-ns-tests.el") 3 | -------------------------------------------------------------------------------- /test/clojure-ts-mode/cider-connection-ts-tests.el: -------------------------------------------------------------------------------- 1 | ;;; cider-connection-ts-tests.el -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright © 2012-2023 Tim King, Bozhidar Batsov 4 | 5 | ;; Author: Tim King 6 | ;; Bozhidar Batsov 7 | ;; Artur Malabarba 8 | 9 | ;; This file is NOT part of GNU Emacs. 10 | 11 | ;; This program is free software: you can redistribute it and/or 12 | ;; modify it under the terms of the GNU General Public License as 13 | ;; published by the Free Software Foundation, either version 3 of the 14 | ;; License, or (at your option) any later version. 15 | ;; 16 | ;; This program is distributed in the hope that it will be useful, but 17 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | ;; General Public License for more details. 20 | ;; 21 | ;; You should have received a copy of the GNU General Public License 22 | ;; along with this program. If not, see `http://www.gnu.org/licenses/'. 23 | 24 | ;;; Commentary: 25 | 26 | ;; This file is part of CIDER 27 | 28 | ;;; Code: 29 | 30 | (require 'buttercup) 31 | (require 'clojure-ts-mode) 32 | (require 'cider-connection) 33 | 34 | (describe "Enable cider-minor mode on clojure-ts-mode buffers" 35 | (setq clojure-ts-mode-hook nil) 36 | (with-temp-buffer 37 | (clojure-ts-mode) 38 | (it "should enable cider-mode in the clojure-ts-mode buffer" 39 | (cider-enable-on-existing-clojure-buffers) 40 | (expect local-minor-modes :to-contain 'cider-mode) 41 | (expect clojure-ts-mode-hook :to-contain #'cider-mode)) 42 | (it "should disable cider-mode in the clojure-ts-mode-buffer" 43 | (cider-disable-on-existing-clojure-buffers) 44 | (expect local-minor-modes :not :to-contain 'cider-mode)))) 45 | 46 | (describe "cider-repl-type-for-buffers" 47 | (it "correctly detects corresponding repl type based on clojure-ts-* major mode" 48 | (with-temp-buffer 49 | (clojure-ts-mode) 50 | (expect (cider-repl-type-for-buffer) :to-be 'clj)) 51 | (with-temp-buffer 52 | (clojure-ts-clojurescript-mode) 53 | (expect (cider-repl-type-for-buffer) :to-be 'cljs)) 54 | (with-temp-buffer 55 | (clojure-ts-clojurec-mode) 56 | (expect (cider-repl-type-for-buffer) :to-be 'multi)))) 57 | 58 | (provide 'cider-connection-ts-tests) 59 | -------------------------------------------------------------------------------- /test/clojure-ts-mode/cider-find-ts-tests.el: -------------------------------------------------------------------------------- 1 | ;;; cider-find-ts-tests.el --- -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2025 Roman Rudakov 4 | 5 | ;; Author: Roman Rudakov 6 | 7 | ;; This program is free software; you can redistribute it and/or modify 8 | ;; it under the terms of the GNU General Public License as published by 9 | ;; the Free Software Foundation, either version 3 of the License, or 10 | ;; (at your option) any later version. 11 | 12 | ;; This program is distributed in the hope that it will be useful, 13 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | ;; GNU General Public License for more details. 16 | 17 | ;; You should have received a copy of the GNU General Public License 18 | ;; along with this program. If not, see . 19 | 20 | ;;; Commentary: 21 | 22 | ;; This is part of CIDER 23 | 24 | ;;; Code: 25 | 26 | (require 'buttercup) 27 | (require 'cider-find) 28 | 29 | (describe "cider--find-keyword-loc (TreeSitter)" 30 | (it "finds the given keyword, discarding false positives" 31 | (with-clojure-ts-buffer "(ns some.ns) 32 | ;; ::foo 33 | \"::foo\" 34 | #_::foo 35 | ::foobar 36 | \" 37 | ::foo 38 | \" 39 | ::foo 40 | more 41 | stuff" 42 | (let* ((sample-buffer (current-buffer))) 43 | (spy-on 'cider-ensure-connected :and-return-value t) 44 | (spy-on 'cider-sync-request:ns-path :and-call-fake (lambda (kw-ns _) 45 | kw-ns)) 46 | (spy-on 'cider-resolve-alias :and-call-fake (lambda (_ns ns-qualifier) 47 | ns-qualifier)) 48 | (spy-on 'cider-find-file :and-call-fake (lambda (kw-ns) 49 | (when (equal kw-ns "some.ns") 50 | sample-buffer))) 51 | 52 | (nrepl-dbind-response (cider--find-keyword-loc "::some.ns/foo") (dest dest-point) 53 | (expect dest-point :to-equal 63) 54 | (with-current-buffer dest 55 | (goto-char dest-point) 56 | ;; important - ensure that we're looking at ::foo and not ::foobar: 57 | (expect (cider-symbol-at-point 'look-back) :to-equal "::foo"))) 58 | 59 | (nrepl-dbind-response (cider--find-keyword-loc "::foo") (dest dest-point) 60 | (expect dest-point :to-equal 63) 61 | (with-current-buffer dest 62 | (goto-char dest-point) 63 | ;; important - ensure that we're looking at ::foo and not ::foobar: 64 | (expect (cider-symbol-at-point 'look-back) :to-equal "::foo"))) 65 | 66 | (nrepl-dbind-response (cider--find-keyword-loc ":some.ns/foo") (dest dest-point) 67 | (expect dest-point :to-equal 63) 68 | (with-current-buffer dest 69 | (goto-char dest-point) 70 | ;; important - ensure that we're looking at ::foo and not ::foobar: 71 | (expect (cider-symbol-at-point 'look-back) :to-equal "::foo"))) 72 | 73 | (nrepl-dbind-response (cider--find-keyword-loc "::some.ns/bar") (dest dest-point) 74 | (expect dest-point :to-equal nil)) 75 | 76 | (nrepl-dbind-response (cider--find-keyword-loc ":some.ns/bar") (dest dest-point) 77 | (expect dest-point :to-equal nil)) 78 | 79 | (expect (cider--find-keyword-loc ":foo") :to-throw 'user-error) 80 | 81 | (nrepl-dbind-response (cider--find-keyword-loc ":unrelated/foo") (dest dest-point) 82 | (expect dest-point :to-equal nil)) 83 | 84 | (nrepl-dbind-response (cider--find-keyword-loc "::unrelated/foo") (dest dest-point) 85 | (expect dest-point :to-equal nil)))))) 86 | 87 | (provide 'cider-find-ts-tests) 88 | ;;; cider-find-ts-tests.el ends here 89 | -------------------------------------------------------------------------------- /test/clojure-ts-mode/cider-selector-ts-tests.el: -------------------------------------------------------------------------------- 1 | ;;; cider-selector-ts-tests.el -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright © 2012-2023 Tim King, Bozhidar Batsov 4 | 5 | ;; Author: Tim King 6 | ;; Bozhidar Batsov 7 | ;; Artur Malabarba 8 | 9 | ;; This file is NOT part of GNU Emacs. 10 | 11 | ;; This program is free software: you can redistribute it and/or 12 | ;; modify it under the terms of the GNU General Public License as 13 | ;; published by the Free Software Foundation, either version 3 of the 14 | ;; License, or (at your option) any later version. 15 | ;; 16 | ;; This program is distributed in the hope that it will be useful, but 17 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | ;; General Public License for more details. 20 | ;; 21 | ;; You should have received a copy of the GNU General Public License 22 | ;; along with this program. If not, see `http://www.gnu.org/licenses/'. 23 | 24 | ;;; Commentary: 25 | 26 | ;; This file is part of CIDER 27 | 28 | ;;; Code: 29 | 30 | (require 'buttercup) 31 | (require 'clojure-ts-mode) 32 | (require 'cider-selector-test-utils "test/cider-selector-tests") 33 | 34 | (describe "cider-selector-method-c" 35 | (it "switches to most recently visited clojure-ts-mode buffer" 36 | (cider-test-selector-method ?c 'clojure-ts-mode "*treesitter-test*.clj"))) 37 | 38 | (provide 'cider-selector-ts-tests) 39 | -------------------------------------------------------------------------------- /test/clojure-ts-mode/cider-util-ts-tests.el: -------------------------------------------------------------------------------- 1 | ;;; cider-util-ts-tests.el -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright © 2012-2023 Tim King, Bozhidar Batsov 4 | 5 | ;; Author: Tim King 6 | ;; Bozhidar Batsov 7 | ;; Artur Malabarba 8 | 9 | ;; This file is NOT part of GNU Emacs. 10 | 11 | ;; This program is free software: you can redistribute it and/or 12 | ;; modify it under the terms of the GNU General Public License as 13 | ;; published by the Free Software Foundation, either version 3 of the 14 | ;; License, or (at your option) any later version. 15 | ;; 16 | ;; This program is distributed in the hope that it will be useful, but 17 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | ;; General Public License for more details. 20 | ;; 21 | ;; You should have received a copy of the GNU General Public License 22 | ;; along with this program. If not, see `http://www.gnu.org/licenses/'. 23 | 24 | 25 | ;;; Commentary: 26 | 27 | ;; This file is part of CIDER 28 | 29 | ;;; Code: 30 | 31 | (require 'buttercup) 32 | (require 'clojure-ts-mode) 33 | (require 'cider-util) 34 | 35 | (defun with-clojure-ts-buffer--go-to-point () 36 | (when (search-forward "|" nil 'noerror) 37 | (delete-char -1))) 38 | 39 | (defmacro with-clojure-ts-buffer (contents &rest body) 40 | "Execute BODY in a clojure-ts-mode buffer with CONTENTS 41 | 42 | CONTENTS is a string containing an optional character `|' indicating the 43 | cursor position. If not present, the cursor is placed at the end of the 44 | buffer." 45 | (declare (indent 1)) 46 | `(with-temp-buffer 47 | (delay-mode-hooks (clojure-ts-mode)) 48 | (insert ,contents) 49 | (goto-char (point-min)) 50 | (with-clojure-ts-buffer--go-to-point) 51 | ,@body)) 52 | 53 | (describe "clojure-ts-mode activation" 54 | (it "test suite installs the tree-sitter-clojure grammar" 55 | (with-temp-buffer 56 | (clojure-ts-mode) 57 | (expect (treesit-ready-p 'clojure))))) 58 | 59 | (describe "major-mode-predicates" 60 | (with-temp-buffer 61 | (it "matches clojure-ts-mode" 62 | (clojure-ts-mode) 63 | (expect (cider-clojure-major-mode-p) :to-be-truthy) 64 | (expect (cider-clojurescript-major-mode-p) :not :to-be-truthy) 65 | (expect (cider-clojurec-major-mode-p) :not :to-be-truthy)) 66 | (it "matches clojure-ts-clojurescript-mode" 67 | (clojure-ts-clojurescript-mode) 68 | (expect (cider-clojure-major-mode-p) :to-be-truthy) 69 | (expect (cider-clojurescript-major-mode-p) :to-be-truthy) 70 | (expect (cider-clojurec-major-mode-p) :not :to-be-truthy)) 71 | (it "matches clojure-ts-clojurec-mode" 72 | (clojure-ts-clojurec-mode) 73 | (expect (cider-clojure-major-mode-p) :to-be-truthy) 74 | (expect (cider-clojurescript-major-mode-p) :not :to-be-truthy) 75 | (expect (cider-clojurec-major-mode-p) :to-be-truthy)))) 76 | 77 | (describe "cider-keyword-at-p" 78 | (it "returns `t' if in keyword" 79 | (with-clojure-ts-buffer ":he|llo" 80 | (expect (cider-keyword-at-point-p) :to-be-truthy) 81 | (expect (cider-keyword-at-point-p (point)) :to-be-truthy)) 82 | (with-clojure-ts-buffer "::he|llo" 83 | (expect (cider-keyword-at-point-p) :to-be-truthy) 84 | (expect (cider-keyword-at-point-p (point)) :to-be-truthy)) 85 | (with-clojure-ts-buffer ":some.names|pace/hello" 86 | (expect (cider-keyword-at-point-p) :to-be-truthy) 87 | (expect (cider-keyword-at-point-p (point)) :to-be-truthy))) 88 | (it "returns `nil' if not in keyword" 89 | (with-clojure-ts-buffer ":hello \"|World\"" 90 | (expect (cider-keyword-at-point-p) :not :to-be-truthy) 91 | (expect (cider-keyword-at-point-p (point)) :not :to-be-truthy)))) 92 | 93 | (provide 'cider-ts-util-tests) 94 | -------------------------------------------------------------------------------- /test/utils/cider-connection-test-utils.el: -------------------------------------------------------------------------------- 1 | ;;; cider-connection-test-utils.el -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright © 2012-2025 Tim King, Bozhidar Batsov 4 | 5 | ;; Author: Tim King 6 | ;; Bozhidar Batsov 7 | ;; Artur Malabarba 8 | 9 | ;; This file is NOT part of GNU Emacs. 10 | 11 | ;; This program is free software: you can redistribute it and/or 12 | ;; modify it under the terms of the GNU General Public License as 13 | ;; published by the Free Software Foundation, either version 3 of the 14 | ;; License, or (at your option) any later version. 15 | ;; 16 | ;; This program is distributed in the hope that it will be useful, but 17 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | ;; General Public License for more details. 20 | ;; 21 | ;; You should have received a copy of the GNU General Public License 22 | ;; along with this program. If not, see `http://www.gnu.org/licenses/'. 23 | 24 | ;;; Commentary: 25 | 26 | ;; This file is part of CIDER 27 | 28 | ;;; Code: 29 | 30 | (require 'cider) 31 | (require 'cider-client) 32 | 33 | (defmacro with-repl-buffer (ses-name type symbol &rest body) 34 | "Run BODY in a temp buffer, with the given repl TYPE. 35 | SES-NAME is Sesman's session. SYMBOL is locally let-bound to the 36 | current buffer." 37 | (declare (indent 3) 38 | (debug (sexp sexp &rest form))) 39 | `(with-temp-buffer 40 | (setq major-mode 'cider-repl-mode) 41 | (setq cider-repl-type ,type) 42 | (setq sesman-system 'CIDER) 43 | (sesman-add-object 'CIDER ,ses-name (current-buffer) t) 44 | ;; `with-current-buffer' doesn't bump the buffer up the list. 45 | (switch-to-buffer (current-buffer)) 46 | (rename-buffer (format "*%s:%s:%s*(%s)" 47 | ,ses-name ,(symbol-name symbol) ,type (random 10000)) 48 | t) 49 | (let ((,symbol (current-buffer))) 50 | ,@body 51 | (sesman-remove-object 'CIDER ,ses-name (current-buffer) t 'no-error)))) 52 | 53 | (defmacro cider-test-with-buffers (buffer-names &rest body) 54 | (let ((create (lambda (b) (list b `(generate-new-buffer " *temp*"))))) 55 | `(let (,@(mapcar create buffer-names)) 56 | ,@body 57 | (mapc 'kill-buffer (list ,@buffer-names))))) 58 | 59 | (provide 'cider-connection-test-utils) 60 | -------------------------------------------------------------------------------- /test/utils/cider-selector-test-utils.el: -------------------------------------------------------------------------------- 1 | ;;; cider-selector-test-utils.el -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright © 2012-2023 Tim King, Bozhidar Batsov 4 | 5 | ;; Author: Tim King 6 | ;; Bozhidar Batsov 7 | ;; Artur Malabarba 8 | 9 | ;; This file is NOT part of GNU Emacs. 10 | 11 | ;; This program is free software: you can redistribute it and/or 12 | ;; modify it under the terms of the GNU General Public License as 13 | ;; published by the Free Software Foundation, either version 3 of the 14 | ;; License, or (at your option) any later version. 15 | ;; 16 | ;; This program is distributed in the hope that it will be useful, but 17 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | ;; General Public License for more details. 20 | ;; 21 | ;; You should have received a copy of the GNU General Public License 22 | ;; along with this program. If not, see `http://www.gnu.org/licenses/'. 23 | 24 | ;;; Commentary: 25 | 26 | ;; This file is part of CIDER 27 | 28 | ;;; Code: 29 | 30 | (require 'buttercup) 31 | (require 'cider-selector) 32 | 33 | (defun cider-invoke-selector-method-by-key (ch) 34 | (let ((method (cl-find ch cider-selector-methods :key #'car))) 35 | (funcall (cl-third method)))) 36 | 37 | (defun cider-test-selector-method (method buffer-mode buffer-name) 38 | (with-temp-buffer 39 | (rename-buffer buffer-name) 40 | (setq major-mode buffer-mode) 41 | (let ((expected-buffer (current-buffer))) 42 | ;; switch to another buffer 43 | (with-temp-buffer 44 | (cider-invoke-selector-method-by-key method) 45 | (expect (current-buffer) :to-equal expected-buffer))))) 46 | 47 | (provide 'cider-selector-test-utils) 48 | 49 | ;;; clojure-selector-test-utilss.el ends here 50 | --------------------------------------------------------------------------------