├── .projectile ├── legacy-manual ├── configuration.md ├── using_the_repl.md ├── favicon.ico ├── cider-refcard.pdf ├── images │ ├── eldoc.png │ ├── tracing.png │ ├── ns_browser.png │ ├── menu_example.png │ ├── spec_browser.png │ ├── cider-overview.png │ ├── cider-which-key.png │ ├── cider_debugger.gif │ ├── cider_see_also.gif │ ├── code_completion.png │ ├── history_browser.png │ ├── spec_browser_all.png │ ├── cider_architecture.png │ ├── classpath_browser.png │ ├── enlighten_disabled.png │ ├── enlighten_enabled.png │ ├── dynamic_font_lock_off.png │ ├── dynamic_font_lock_on.png │ ├── reader_conditionals.png │ ├── completion-annotations.png │ └── spec_browser_gen_example.png ├── about │ ├── changelog.md │ ├── logo.md │ ├── license.md │ ├── team.md │ ├── release_policy.md │ ├── support.md │ └── contributing.md ├── css │ └── extra.css ├── configuration │ ├── indentation.md │ ├── syntax_highlighting.md │ ├── misc.md │ └── eldoc.md ├── additional_resources.md ├── repl │ ├── basic_usage.md │ └── keybindings.md ├── caveats.md ├── code_completion.md ├── pretty_printing.md ├── cider-refcard.tex ├── additional_packages.md └── index.md ├── .gitattributes ├── logo ├── favicon.ico ├── cider-logo.ai ├── favicon-152.png ├── favicon-16.png ├── favicon-32.png ├── favicon-64.png ├── cider-logo-w320.png ├── cider-logo-w480.png ├── cider-logo-w640.png ├── cider-logo-w960.png ├── cider-logo-mug.svg ├── cider-logo.svg └── cider-logo-square.svg ├── doc ├── antora.yml └── modules │ └── ROOT │ ├── assets │ └── images │ │ ├── eldoc.png │ │ ├── tracing.png │ │ ├── ns_browser.png │ │ ├── menu_example.png │ │ ├── spec_browser.png │ │ ├── cider-overview.png │ │ ├── cider-which-key.png │ │ ├── cider_debugger.gif │ │ ├── cider_see_also.gif │ │ ├── code_completion.png │ │ ├── history_browser.png │ │ ├── spec_browser_all.png │ │ ├── cider_architecture.png │ │ ├── classpath_browser.png │ │ ├── enlighten_disabled.png │ │ ├── enlighten_enabled.png │ │ ├── dynamic_font_lock_off.png │ │ ├── dynamic_font_lock_on.png │ │ ├── reader_conditionals.png │ │ ├── completion-annotations.png │ │ └── spec_browser_gen_example.png │ ├── pages │ ├── about │ │ ├── changelog.adoc │ │ ├── license.adoc │ │ ├── logo.adoc │ │ ├── team.adoc │ │ ├── release_policy.adoc │ │ ├── support.adoc │ │ └── history.adoc │ ├── debugging │ │ ├── tracing.adoc │ │ ├── enlighten.adoc │ │ └── misc.adoc │ ├── testing │ │ ├── test_reports.adoc │ │ └── supported_libraries.adoc │ ├── contributing.adoc │ ├── contributing │ │ ├── funding.adoc │ │ └── docs.adoc │ ├── config │ │ ├── syntax_highlighting.adoc │ │ ├── misc.adoc │ │ ├── eldoc.adoc │ │ └── indentation.adoc │ ├── additional_resources.adoc │ ├── usage │ │ ├── interactive_programming.adoc │ │ ├── code_completion.adoc │ │ └── pretty_printing.adoc │ ├── repl │ │ ├── basic_usage.adoc │ │ └── keybindings.adoc │ ├── caveats.adoc │ ├── basics │ │ ├── middleware_setup.adoc │ │ └── installation.adoc │ └── index.adoc │ └── nav.adoc ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── PULL_REQUEST_TEMPLATE.md ├── stale.yml └── CONTRIBUTING.md ├── Vagrantfile ├── Cask ├── .gitignore ├── .circleci └── config.yml ├── test ├── cider-ns-tests.el ├── cider-find-tests.el ├── cider-apropos-tests.el ├── cider-classpath-tests.el ├── cider-clojuredocs-tests.el ├── utils │ └── cider-connection-test-utils.el ├── cider-overlay-tests.el ├── cider-common-tests.el ├── cider-browse-ns-tests.el ├── cider-selector-tests.el ├── nrepl-client-tests.el ├── cider-tests--no-auto.el └── cider-interaction-tests.el ├── .dir-locals.el ├── mkdocs.yml ├── cider-compat.el ├── Makefile ├── cider-tracing.el ├── ROADMAP.md ├── cider-scratch.el ├── cider-classpath.el └── cider-clojuredocs.el /.projectile: -------------------------------------------------------------------------------- 1 | /.cask 2 | /packages -------------------------------------------------------------------------------- /legacy-manual/configuration.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /legacy-manual/using_the_repl.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | CHANGELOG.md merge=union 2 | -------------------------------------------------------------------------------- /logo/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/logo/favicon.ico -------------------------------------------------------------------------------- /logo/cider-logo.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/logo/cider-logo.ai -------------------------------------------------------------------------------- /logo/favicon-152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/logo/favicon-152.png -------------------------------------------------------------------------------- /logo/favicon-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/logo/favicon-16.png -------------------------------------------------------------------------------- /logo/favicon-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/logo/favicon-32.png -------------------------------------------------------------------------------- /logo/favicon-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/logo/favicon-64.png -------------------------------------------------------------------------------- /legacy-manual/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/legacy-manual/favicon.ico -------------------------------------------------------------------------------- /logo/cider-logo-w320.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/logo/cider-logo-w320.png -------------------------------------------------------------------------------- /logo/cider-logo-w480.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/logo/cider-logo-w480.png -------------------------------------------------------------------------------- /logo/cider-logo-w640.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/logo/cider-logo-w640.png -------------------------------------------------------------------------------- /logo/cider-logo-w960.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/logo/cider-logo-w960.png -------------------------------------------------------------------------------- /doc/antora.yml: -------------------------------------------------------------------------------- 1 | name: cider 2 | title: CIDER 3 | version: master 4 | nav: 5 | - modules/ROOT/nav.adoc 6 | -------------------------------------------------------------------------------- /legacy-manual/cider-refcard.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/legacy-manual/cider-refcard.pdf -------------------------------------------------------------------------------- /legacy-manual/images/eldoc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/legacy-manual/images/eldoc.png -------------------------------------------------------------------------------- /legacy-manual/images/tracing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/legacy-manual/images/tracing.png -------------------------------------------------------------------------------- /legacy-manual/images/ns_browser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/legacy-manual/images/ns_browser.png -------------------------------------------------------------------------------- /legacy-manual/images/menu_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/legacy-manual/images/menu_example.png -------------------------------------------------------------------------------- /legacy-manual/images/spec_browser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/legacy-manual/images/spec_browser.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/eldoc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/doc/modules/ROOT/assets/images/eldoc.png -------------------------------------------------------------------------------- /legacy-manual/images/cider-overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/legacy-manual/images/cider-overview.png -------------------------------------------------------------------------------- /legacy-manual/images/cider-which-key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/legacy-manual/images/cider-which-key.png -------------------------------------------------------------------------------- /legacy-manual/images/cider_debugger.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/legacy-manual/images/cider_debugger.gif -------------------------------------------------------------------------------- /legacy-manual/images/cider_see_also.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/legacy-manual/images/cider_see_also.gif -------------------------------------------------------------------------------- /legacy-manual/images/code_completion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/legacy-manual/images/code_completion.png -------------------------------------------------------------------------------- /legacy-manual/images/history_browser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/legacy-manual/images/history_browser.png -------------------------------------------------------------------------------- /legacy-manual/images/spec_browser_all.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/legacy-manual/images/spec_browser_all.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/tracing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/doc/modules/ROOT/assets/images/tracing.png -------------------------------------------------------------------------------- /legacy-manual/images/cider_architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/legacy-manual/images/cider_architecture.png -------------------------------------------------------------------------------- /legacy-manual/images/classpath_browser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/legacy-manual/images/classpath_browser.png -------------------------------------------------------------------------------- /legacy-manual/images/enlighten_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/legacy-manual/images/enlighten_disabled.png -------------------------------------------------------------------------------- /legacy-manual/images/enlighten_enabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/legacy-manual/images/enlighten_enabled.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/ns_browser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/doc/modules/ROOT/assets/images/ns_browser.png -------------------------------------------------------------------------------- /legacy-manual/images/dynamic_font_lock_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/legacy-manual/images/dynamic_font_lock_off.png -------------------------------------------------------------------------------- /legacy-manual/images/dynamic_font_lock_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/legacy-manual/images/dynamic_font_lock_on.png -------------------------------------------------------------------------------- /legacy-manual/images/reader_conditionals.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/legacy-manual/images/reader_conditionals.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/menu_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/doc/modules/ROOT/assets/images/menu_example.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/spec_browser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/doc/modules/ROOT/assets/images/spec_browser.png -------------------------------------------------------------------------------- /legacy-manual/images/completion-annotations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/legacy-manual/images/completion-annotations.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/cider-overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/doc/modules/ROOT/assets/images/cider-overview.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/cider-which-key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/doc/modules/ROOT/assets/images/cider-which-key.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/cider_debugger.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/doc/modules/ROOT/assets/images/cider_debugger.gif -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/cider_see_also.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/doc/modules/ROOT/assets/images/cider_see_also.gif -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/code_completion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/doc/modules/ROOT/assets/images/code_completion.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/history_browser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/doc/modules/ROOT/assets/images/history_browser.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/spec_browser_all.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/doc/modules/ROOT/assets/images/spec_browser_all.png -------------------------------------------------------------------------------- /legacy-manual/images/spec_browser_gen_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/legacy-manual/images/spec_browser_gen_example.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/cider_architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/doc/modules/ROOT/assets/images/cider_architecture.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/classpath_browser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/doc/modules/ROOT/assets/images/classpath_browser.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/enlighten_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/doc/modules/ROOT/assets/images/enlighten_disabled.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/enlighten_enabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/doc/modules/ROOT/assets/images/enlighten_enabled.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/dynamic_font_lock_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/doc/modules/ROOT/assets/images/dynamic_font_lock_off.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/dynamic_font_lock_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/doc/modules/ROOT/assets/images/dynamic_font_lock_on.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/reader_conditionals.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/doc/modules/ROOT/assets/images/reader_conditionals.png -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/completion-annotations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/doc/modules/ROOT/assets/images/completion-annotations.png -------------------------------------------------------------------------------- /legacy-manual/about/changelog.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | An extensive changelog is available [here](https://github.com/clojure-emacs/cider/blob/master/CHANGELOG.md). 4 | -------------------------------------------------------------------------------- /doc/modules/ROOT/assets/images/spec_browser_gen_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magnars/cider/master/doc/modules/ROOT/assets/images/spec_browser_gen_example.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | Vagrant::Config.run do |config| 5 | config.vm.box = "ubuntu/trusty64" 6 | 7 | config.vm.provision :shell, :path => "vagrant/provision.sh" 8 | end 9 | -------------------------------------------------------------------------------- /Cask: -------------------------------------------------------------------------------- 1 | (source gnu) 2 | (source melpa) 3 | 4 | (package-file "cider.el") 5 | 6 | (files "*.el" (:exclude ".dir-locals.el")) 7 | 8 | (development 9 | (depends-on "elisp-lint") 10 | (depends-on "buttercup") 11 | (depends-on "markdown-mode")) 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *\#*\# 3 | *.\#* 4 | *.elc 5 | .cask 6 | elpa* 7 | .depend 8 | TAGS 9 | .DS_STORE 10 | dist 11 | .vagrant/ 12 | cider-autoloads.el 13 | .dir-locals?.el 14 | cider-pkg.el 15 | cider-refcard.aux 16 | cider-refcard.log 17 | doc/auto/ 18 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/about/license.adoc: -------------------------------------------------------------------------------- 1 | = License 2 | :experimental: 3 | 4 | CIDER is distributed under the GNU General Public License, version 3, the same as Emacs. 5 | 6 | TIP: Type kbd:[C-h C-c] in Emacs to view it. 7 | 8 | `cider-nrepl` is distributed under the Eclipse Public License, the same as Clojure. 9 | -------------------------------------------------------------------------------- /legacy-manual/about/logo.md: -------------------------------------------------------------------------------- 1 | # Logo 2 | 3 | CIDER's logo was created by [@tapeinosyne](https://github.com/tapeinosyne). You can find 4 | the logo in various formats 5 | [here](https://github.com/clojure-emacs/cider/tree/master/logo). 6 | 7 | The logo is licensed under a 8 | [Creative Commons Attribution-NonCommercial 4.0 International License](http://creativecommons.org/licenses/by-nc/4.0/deed.en_GB). 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /legacy-manual/css/extra.css: -------------------------------------------------------------------------------- 1 | /* By default kbd doesn't stand out very much. Let's fix this! */ 2 | kbd { 3 | padding: 3px 5px; 4 | border: solid 1px #ccc; 5 | background-color: #fcfcfc; 6 | border-radius: 3px; 7 | box-shadow: inset 0 -1px 0 #bbb; 8 | display: inline-block; 9 | } 10 | 11 | /* The default font-size for code blocks is 75% which makes code 12 | hard to read. */ 13 | code { 14 | font-size: 90%; 15 | } 16 | -------------------------------------------------------------------------------- /legacy-manual/about/license.md: -------------------------------------------------------------------------------- 1 | # License 2 | 3 | Copyright (C) 2012-2016 Tim King, Phil Hagelberg, Bozhidar Batsov, Artur Malabarba and 4 | [contributors](https://github.com/clojure-emacs/cider/contributors). 5 | 6 | CIDER is distributed under the GNU General Public License, version 3, the same as Emacs. 7 | Type C-h C-c in Emacs to view it. 8 | 9 | `cider-nrepl` is distributed under the Eclipse Public License, the same as Clojure. 10 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /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 manage releases, evaluate pull-requests, and 7 | does a lot of the groundwork on major new features. 8 | 9 | * https://github.com/bbatsov[Bozhidar Batsov] (author & head maintainer) 10 | * https://github.com/vspinu[Vitalie Spinu] 11 | * https://github.com/cichli[Michael Griffiths] 12 | * https://github.com/expez[Lars Andersen] 13 | 14 | == CIDER Alumni 15 | 16 | In addition, we'd like to extend a special thanks the following retired CIDER 17 | core team members. Lovingly known as The Alumni: 18 | 19 | * https://github.com/kingtim[Tim King] (original author) 20 | * https://github.com/technomancy[Phil Hagelberg] 21 | * https://github.com/hugoduncan[Hugo Duncan] 22 | * https://github.com/purcell[Steve Purcell] 23 | * https://github.com/malabarba[Artur Malabarba] 24 | * https://github.com/jeffvalk[Jeff Valk] 25 | -------------------------------------------------------------------------------- /legacy-manual/about/team.md: -------------------------------------------------------------------------------- 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 manage releases, evaluate pull-requests, and 7 | does a lot of the groundwork on major new features. 8 | 9 | * [Bozhidar Batsov](https://github.com/bbatsov) (author & head maintainer) 10 | * [Vitalie Spinu](https://github.com/vspinu) 11 | * [Michael Griffiths](https://github.com/cichli) 12 | * [Lars Andersen](https://github.com/expez) 13 | 14 | ## CIDER Alumni 15 | 16 | In addition, we'd like to extend a special thanks the following retired CIDER 17 | core team members. Lovingly known as The Alumni: 18 | 19 | * [Tim King](https://github.com/kingtim) (original author) 20 | * [Phil Hagelberg](https://github.com/technomancy) 21 | * [Hugo Duncan](https://github.com/hugoduncan) 22 | * [Steve Purcell](https://github.com/purcell) 23 | * [Artur Malabarba](https://github.com/malabarba) 24 | * [Jeff Valk](https://github.com/jeffvalk) 25 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /legacy-manual/about/release_policy.md: -------------------------------------------------------------------------------- 1 | # Release Policy 2 | 3 | We're following [SemVer](http://semver.org/) (as much as one can be 4 | following it when the major version is 0). At this point bumps of the 5 | minor (second) version number are considered major releases and always 6 | include new features or significant changes to existing features. API 7 | compatibility between major releases is not a (big) concern (although we try 8 | to break the API rarely and only for a good reason). 9 | 10 | The development cycle for the next major 11 | release starts immediately after the previous one has been 12 | shipped. Bugfix/point releases (if any) address only serious bugs and 13 | never contain new features. 14 | 15 | Here are a few examples: 16 | 17 | * 0.5.0 - Feature release 18 | * 0.5.1 - Bug-fix release 19 | * 0.5.2 - Bug-fix release 20 | * 0.6.0 - Feature release 21 | 22 | CIDER and cider-nrepl are released independently, but follow the same release policy overall. 23 | CIDER contains references to the cider-nrepl version it supports and would normally inject 24 | the newest cider-nrepl version possible. 25 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/about/release_policy.adoc: -------------------------------------------------------------------------------- 1 | = Release Policy 2 | 3 | We're following http://semver.org/[SemVer] (as much as one can be 4 | following it when the major version is 0). At this point bumps of the 5 | minor (second) version number are considered major releases and always 6 | include new features or significant changes to existing features. API 7 | compatibility between major releases is not a (big) concern (although we try 8 | to break the API rarely and only for a good reason). 9 | 10 | The development cycle for the next major 11 | release starts immediately after the previous one has been 12 | shipped. Bugfix/point releases (if any) address only serious bugs and 13 | never contain new features. 14 | 15 | Here are a few examples: 16 | 17 | * 0.5.0 - Feature release 18 | * 0.5.1 - Bug-fix release 19 | * 0.5.2 - Bug-fix release 20 | * 0.6.0 - Feature release 21 | 22 | CIDER and cider-nrepl are released independently, but follow the same release policy overall. 23 | CIDER contains references to the cider-nrepl version it supports and would normally inject 24 | the newest cider-nrepl version possible. 25 | -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2.1 2 | 3 | # Default actions to perform on each Emacs version 4 | commands: 5 | setup: 6 | steps: 7 | - checkout 8 | - run: make elpa 9 | - run: emacs --version 10 | test: 11 | steps: 12 | - run: make test 13 | lint: 14 | steps: 15 | - run: make lint 16 | 17 | jobs: 18 | test-emacs-25: 19 | docker: 20 | - image: silex/emacs:25-dev 21 | entrypoint: bash 22 | steps: 23 | - setup 24 | - test 25 | 26 | test-emacs-26: 27 | docker: 28 | - image: silex/emacs:26-dev 29 | entrypoint: bash 30 | steps: 31 | - setup 32 | - test 33 | 34 | test-emacs-master: 35 | docker: 36 | - image: silex/emacs:master-dev 37 | entrypoint: bash 38 | steps: 39 | - setup 40 | - test 41 | 42 | test-lint: 43 | docker: 44 | - image: silex/emacs:26-dev 45 | steps: 46 | - setup 47 | - lint 48 | 49 | workflows: 50 | version: 2 51 | ci-test-matrix: 52 | jobs: 53 | - test-emacs-25 54 | - test-emacs-26 55 | - test-emacs-master 56 | - test-lint 57 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/testing/test_reports.adoc: -------------------------------------------------------------------------------- 1 | = Interacting with Test Result Reports 2 | :experimental: 3 | 4 | After running your tests, 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 | |=== 10 | | Keyboard shortcut | Description 11 | 12 | | kbd:[g] 13 | | Run test at point. 14 | 15 | | kbd:[n] 16 | | Run tests for current namespace. 17 | 18 | | kbd:[s] 19 | | Run tests for current namespace with selector filter. 20 | 21 | | kbd:[l] 22 | | Run tests for all loaded namespaces. 23 | 24 | | kbd:[p] 25 | | Run tests for all project namespaces. This loads the additional namespaces. 26 | 27 | | kbd:[f] 28 | | Re-run test failures/errors. 29 | 30 | | kbd:[M-p] 31 | | Move point to previous test. 32 | 33 | | kbd:[M-n] 34 | | Move point to next test. 35 | 36 | | kbd:[t] or kbd:[M-.] 37 | | Jump to test definition. 38 | 39 | | kbd:[d] 40 | | Display diff of actual vs expected. 41 | 42 | | kbd:[e] 43 | | Display test error cause and stacktrace info. 44 | |=== 45 | -------------------------------------------------------------------------------- /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: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 | Before submitting a patch or a pull request make sure all tests are 24 | passing and that your patch is in line with the https://github.com/clojure-emacs/cider/blob/master/.github/CONTRIBUTING.md[contribution 25 | guidelines]. 26 | -------------------------------------------------------------------------------- /test/cider-ns-tests.el: -------------------------------------------------------------------------------- 1 | ;;; cider-ns-tests.el 2 | 3 | ;; Copyright © 2019 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-ns) 30 | 31 | (describe "cider-ns-refresh" 32 | (it "raises a user error if cider is not connected" 33 | (spy-on 'cider-connected-p :and-return-value nil) 34 | (expect (cider-ns-refresh) :to-throw 'user-error))) 35 | -------------------------------------------------------------------------------- /.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/Boot version 34 | 35 | *E.g. Lein 2.6.1* (skip this when you didn't start the nREPL server 36 | using Lein or Boot) 37 | 38 | ### Emacs version 39 | 40 | *E.g. 24.5* (use M-x emacs-version to check it if unsure) 41 | 42 | ### Operating system 43 | 44 | *E.g. Fedora 23, OS X 10.11 "El Capitan", Windows 10, etc* 45 | -------------------------------------------------------------------------------- /legacy-manual/configuration/indentation.md: -------------------------------------------------------------------------------- 1 | # Indentation 2 | 3 | ## Dynamic Indentation 4 | 5 | It is common for macros to require special indentation mechanisms. This is most 6 | common in macros that start with `do`, `def`, or `with-`. CIDER has some 7 | heuristics to detect these macros, but it also lets you explicitly specify how 8 | a macro should be indented. 9 | 10 | Here's a simple example of how someone would specify the indent spec for a macro 11 | they've written (using an example in core): 12 | 13 | ```clojure 14 | (defmacro with-in-str 15 | "[DOCSTRING]" 16 | {:style/indent 1} 17 | [s & body] 18 | ...cut for brevity...) 19 | ``` 20 | 21 | And here's a more complex one: 22 | 23 | ```clojure 24 | (defmacro letfn 25 | "[DOCSTRING]" 26 | {:style/indent [1 [[:defn]] :form]} 27 | [fnspecs & body] 28 | ...cut for brevity...) 29 | ``` 30 | 31 | Don't worry if this looks intimidating. For most macros the indent spec should 32 | be either just a number, or one of the keywords `:defn` or `:form`. A full 33 | description of the spec is provided in the 34 | [indent spec section of the manual](indent_spec.md). 35 | 36 | If you *don't* want to use this feature, you can disable it by setting 37 | `cider-dynamic-indentation` to `nil` in your Emacs init file. 38 | 39 | ```el 40 | (setq cider-dynamic-indentation nil) 41 | ``` 42 | -------------------------------------------------------------------------------- /test/cider-find-tests.el: -------------------------------------------------------------------------------- 1 | ;;; cider-find-tests.el 2 | 3 | ;; Copyright © 2012-2019 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 | (describe "cider-find-ns" 32 | (it "raises a user error if cider is not connected" 33 | (spy-on 'cider-connected-p :and-return-value nil) 34 | (expect (cider-find-ns) :to-throw 'user-error)) 35 | (it "raises a user error if the op is not supported" 36 | (spy-on 'cider-nrepl-op-supported-p :and-return-value nil) 37 | (expect (cider-find-ns) :to-throw 'user-error))) 38 | -------------------------------------------------------------------------------- /.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](../.github/CONTRIBUTING.md) 10 | - [ ] You've added tests (if possible) to cover your change(s) 11 | - [ ] All tests are passing (`make test`) 12 | - [ ] All code passes the linter (`make 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 | -------------------------------------------------------------------------------- /logo/cider-logo-mug.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | ]> 6 | 8 | 12 | 13 | 14 | 17 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /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 | https://opencollective.com/cider[Open Collective], 19 | https://salt.bountysource.com/teams/cider[Salt], 20 | https://www.patreon.com/bbatsov[Patreon] and 21 | https://www.paypal.me/bbatsov[PayPal]. 22 | 23 | === Open Collective 24 | 25 | * https://opencollective.com/cider#backer[Become a backer] (for individuals) 26 | * https://opencollective.com/cider#sponsor[Become a sponsor] (for companies) 27 | -------------------------------------------------------------------------------- /legacy-manual/about/support.md: -------------------------------------------------------------------------------- 1 | # Support 2 | 3 | CIDER currently has several official & unofficial support channels. 4 | 5 | For questions, suggestions and support refer to one of them. Please, don't 6 | use the support channels to report issues, as this makes them harder to track. 7 | 8 | ## Mailing list 9 | 10 | The [official mailing list](https://groups.google.com/forum/#!forum/cider-emacs) is 11 | hosted at Google Groups. It's a low-traffic list, so don't be too hesitant to subscribe. 12 | 13 | ## Freenode 14 | 15 | We've got an unofficial Freenode channel - `#clojure-emacs`. It's not actively 16 | monitored by the CIDER maintainers themselves, but still you can get support 17 | from other CIDER users there. 18 | 19 | ## Slack 20 | 21 | We've got an official [Clojurians Slack](https://clojurians.slack.com/) - 22 | `#cider`. This is usually be best way to get a handle on some of the maintainers 23 | and interact with other CIDER users. The channel is very active! If you need an invite 24 | you can go [here](http://clojurians.net/). 25 | 26 | There's also another channel named `#emacs` for generic Emacs discussions. 27 | 28 | ## Stackoverflow 29 | 30 | We're also encouraging users to ask CIDER-related questions on StackOverflow. 31 | 32 | When doing so you should use the 33 | [cider](http://stackoverflow.com/questions/tagged/cider) tag (ideally combined 34 | with the tags `emacs` and `clojure`). 35 | 36 | ## Bountysource 37 | 38 | If you're willing to pay for some feature to be implemented you can use 39 | [Bountysource](https://www.bountysource.com/teams/cider/issues) to place a 40 | bounty for the work you want to be done. 41 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/about/support.adoc: -------------------------------------------------------------------------------- 1 | = Support 2 | 3 | CIDER currently has several official & unofficial support channels. 4 | 5 | For questions, suggestions and support refer to one of them. Please, don't 6 | use the support channels to report issues, as this makes them harder to track. 7 | 8 | == Mailing list 9 | 10 | The https://groups.google.com/forum/#!forum/cider-emacs[official mailing list] is 11 | hosted at Google Groups. It's a low-traffic list, so don't be too hesitant to subscribe. 12 | 13 | == Freenode 14 | 15 | We've got an unofficial Freenode channel - `#clojure-emacs`. It's not actively 16 | monitored by the CIDER maintainers themselves, but still you can get support 17 | from other CIDER users there. 18 | 19 | == Slack 20 | 21 | We've got an official https://clojurians.slack.com/[Clojurians Slack] - 22 | `#cider`. This is usually be best way to get a handle on some of the maintainers 23 | and interact with other CIDER users. The channel is very active! If you need an invite 24 | you can go http://clojurians.net/[here]. 25 | 26 | There's also another channel named `#emacs` for generic Emacs discussions. 27 | 28 | == Stackoverflow 29 | 30 | We're also encouraging users to ask CIDER-related questions on StackOverflow. 31 | 32 | When doing so you should use the 33 | http://stackoverflow.com/questions/tagged/cider[cider] tag (ideally combined 34 | with the tags `emacs` and `clojure`). 35 | 36 | == Bountysource 37 | 38 | If you're willing to pay for some feature to be implemented you can use 39 | https://www.bountysource.com/teams/cider/issues[Bountysource] to place a 40 | bounty for the work you want to be done. 41 | -------------------------------------------------------------------------------- /legacy-manual/configuration/syntax_highlighting.md: -------------------------------------------------------------------------------- 1 | # Syntax highlighting 2 | 3 | ## Dynamic syntax highlighting 4 | 5 | CIDER can syntax highlight symbols that are known to be defined. By default, 6 | this is done on symbols from the `clojure.core` namespace, as well as macros 7 | from any namespace. If you'd like CIDER to also colorize usages of functions 8 | and variables from any namespace, do: 9 | 10 | ```el 11 | (setq cider-font-lock-dynamically '(macro core function var)) 12 | ``` 13 | 14 | Here's how code looks without dynamic syntax highlighting. 15 | 16 | ![Dynamic Font-lock Off](../images/dynamic_font_lock_off.png) 17 | 18 | And here's how to the code looks when it's turned on. 19 | 20 | ![Dynamic Font-lock On](../images/dynamic_font_lock_on.png) 21 | 22 | ## Syntax highlighting for reader conditionals 23 | 24 | By default CIDER will apply font-locking to unused reader conditional 25 | expressions depending on the buffer CIDER connection type. 26 | 27 | ![Reader Conditionals](../images/reader_conditionals.png) 28 | 29 | You can disable this behavior by adjusting `cider-font-lock-reader-conditionals`: 30 | 31 | ```el 32 | (setq cider-font-lock-reader-conditionals nil) 33 | ``` 34 | 35 | ## Customizing CIDER faces 36 | 37 | CIDER defines a few custom faces that you might want to adjust (although normally your color theme 38 | should take care of them): 39 | 40 | * `cider-deprecated-face` - used for syntax highlighting deprecated vars 41 | * `cider-instrumented-face` - used for syntax highlighting instrumented for debugging vars 42 | * `cider-traced-face` - used for syntax highlighting traced vars 43 | * `cider-reader-conditional-face` - used for syntax highlighting inactive reader conditional branches 44 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/config/syntax_highlighting.adoc: -------------------------------------------------------------------------------- 1 | = Syntax highlighting 2 | 3 | == Dynamic syntax highlighting 4 | 5 | CIDER can syntax highlight symbols that are known to be defined. By default, 6 | this is done on symbols from the `clojure.core` namespace, as well as macros 7 | from any namespace. If you'd like CIDER to also colorize usages of functions 8 | and variables from any namespace, do: 9 | 10 | [source,lisp] 11 | ---- 12 | (setq cider-font-lock-dynamically '(macro core function var)) 13 | ---- 14 | 15 | Here's how code looks without dynamic syntax highlighting. 16 | 17 | image::dynamic_font_lock_off.png[Dynamic Font-lock Off] 18 | 19 | And here's how to the code looks when it's turned on. 20 | 21 | image::dynamic_font_lock_on.png[Dynamic Font-lock On] 22 | 23 | == Syntax highlighting for reader conditionals 24 | 25 | By default CIDER will apply font-locking to unused reader conditional 26 | expressions depending on the buffer CIDER connection type. 27 | 28 | image::reader_conditionals.png[Reader Conditionals] 29 | 30 | You can disable this behavior by adjusting `cider-font-lock-reader-conditionals`: 31 | 32 | [source,lisp] 33 | ---- 34 | (setq cider-font-lock-reader-conditionals nil) 35 | ---- 36 | 37 | == Customizing CIDER faces 38 | 39 | CIDER defines a few custom faces that you might want to adjust (although normally your color theme 40 | should take care of them): 41 | 42 | * `cider-deprecated-face` - used for syntax highlighting deprecated vars 43 | * `cider-instrumented-face` - used for syntax highlighting instrumented for debugging vars 44 | * `cider-traced-face` - used for syntax highlighting traced vars 45 | * `cider-reader-conditional-face` - used for syntax highlighting inactive reader conditional branches 46 | -------------------------------------------------------------------------------- /legacy-manual/configuration/misc.md: -------------------------------------------------------------------------------- 1 | # Miscellaneous Configuration 2 | 3 | ## Overlays 4 | 5 | When you evaluate code in Clojure files, the result is displayed in the buffer 6 | itself, in an overlay right after the evaluated code. If you want this overlay 7 | to be font-locked (syntax-highlighted) like Clojure code, set the following 8 | variable. 9 | 10 | ```el 11 | (setq cider-overlays-use-font-lock t) 12 | ``` 13 | 14 | You can disable overlays entirely (and display results in the echo-area at the 15 | bottom) with the `cider-use-overlays` variable. 16 | 17 | ```el 18 | (setq cider-use-overlays nil) 19 | ``` 20 | 21 | ## Minibuffer completion 22 | 23 | Out-of-the box CIDER uses the standard `completing-read` Emacs mechanism. While 24 | it's not fancy it certainly gets the job done (just press TAB). There 25 | are, however, ways to improve upon the standard completion if you wish to. 26 | 27 | ### icomplete 28 | 29 | `icomplete` is bundled with Emacs and enhances the default minibuffer completion: 30 | 31 | ```el 32 | (require 'icomplete) 33 | ``` 34 | 35 | You can learn more about `icomplete` 36 | [here](https://www.gnu.org/software/emacs/manual/html_node/emacs/Icomplete.html). 37 | 38 | ### ido 39 | 40 | `ido` is also bundled with Emacs and offers more features than `icomplete`. 41 | If you are using `ido`, be sure to use both `ido-everywhere` 42 | and [`ido-completing-read+`](https://github.com/DarwinAwardWinner/ido-completing-read-plus). 43 | You might also want to install [`ido-flex`](https://github.com/lewang/flx). 44 | 45 | ### ivy (recommended) 46 | 47 | If you're fine with installing a third-party package for enhanced minibuffer 48 | completion you can't go wrong with the modern and versatile 49 | [ivy](http://oremacs.com/2015/04/16/ivy-mode/). 50 | -------------------------------------------------------------------------------- /legacy-manual/additional_resources.md: -------------------------------------------------------------------------------- 1 | # Additional Resources 2 | 3 | ## Quick reference 4 | 5 | A single-page quick reference PDF for CIDER commands is available 6 | [here](cider-refcard.pdf). This PDF can be created manually by running 7 | `pdflatex` on [the CIDER refcard LaTeX file](cider-refcard.tex). 8 | 9 | ## Demos 10 | 11 | * [Deep Dive into CIDER](https://www.youtube.com/watch?v=aYA4AAjLfT0) - an overview of CIDER's essential features 12 | * [Emacs & Clojure, A Lispy Love Affair](https://www.youtube.com/watch?v=O6g5C4jUCUc) - an overview of all popular Emacs packages for Clojure development (including CIDER) 13 | 14 | ## Presentations 15 | 16 | * [The Evolution of the Emacs tooling for Clojure](https://www.youtube.com/watch?v=4X-1fJm25Ww&list=PLZdCLR02grLoc322bYirANEso3mmzvCiI&index=6) - 17 | presented at Clojure/conj 2014; dedicated to the origin and the architecture 18 | of CIDER and related tooling 19 | * [CIDER: The Journey so Far and the Road Ahead](https://skillsmatter.com/skillscasts/7225-cider-the-journey-so-far-and-the-road-ahead) - 20 | presented at ClojureX 2015; dedicated to CIDER 0.9 and 0.10 and the future of 21 | the project. 22 | * [A Few Pints of CIDER](https://www.youtube.com/watch?v=3Q7APa2Htns&list=PLPgnbBCmP6ZMfHPJ4yMwuoLEZvEe5LVe8) - presented at Clojure Remote 2016; dedicated 23 | to CIDER 0.11; features a 10-minute live demo of some cool CIDER features. 24 | * [CIDER: Inside the Brewery](https://www.youtube.com/watch?v=8wLwbpCxRf0&list=PLZdCLR02grLq4e8-1P2JNHBKUOLFTX3kb) - presented at Clojure/West 2016; 25 | dedicated to CIDER 0.12. 26 | 27 | ## Podcasts 28 | 29 | * [Cognicast's episode on CIDER](http://blog.cognitect.com/cognicast/080) 30 | * [defn's episode on CIDER](https://soundcloud.com/defn-771544745/36-a-long-glass-of-cider-with-bozhidar-batsov-aka-bbatsov) 31 | -------------------------------------------------------------------------------- /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 | * [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 functionalities were strongly inspired on `cider-test.el` 38 | features. 39 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/config/misc.adoc: -------------------------------------------------------------------------------- 1 | = Miscellaneous Configuration 2 | :experimental: 3 | 4 | == Overlays 5 | 6 | When you evaluate code in Clojure files, the result is displayed in the buffer 7 | itself, in an overlay right after the evaluated code. If you want this overlay 8 | to be font-locked (syntax-highlighted) like Clojure code, set the following 9 | variable. 10 | 11 | [source,lisp] 12 | ---- 13 | (setq cider-overlays-use-font-lock t) 14 | ---- 15 | 16 | You can disable overlays entirely (and display results in the echo-area at the 17 | bottom) with the `cider-use-overlays` variable. 18 | 19 | [source,lisp] 20 | ---- 21 | (setq cider-use-overlays nil) 22 | ---- 23 | 24 | == Minibuffer completion 25 | 26 | Out-of-the box CIDER uses the standard `completing-read` Emacs mechanism. While 27 | it's not fancy it certainly gets the job done (just press kbd:[TAB]). There 28 | are, however, ways to improve upon the standard completion if you wish to. 29 | 30 | === icomplete 31 | 32 | `icomplete` is bundled with Emacs and enhances the default minibuffer completion: 33 | 34 | [source,lisp] 35 | ---- 36 | (require 'icomplete) 37 | ---- 38 | 39 | You can learn more about `icomplete` 40 | https://www.gnu.org/software/emacs/manual/html_node/emacs/Icomplete.html[here]. 41 | 42 | === ido 43 | 44 | `ido` is also bundled with Emacs and offers more features than `icomplete`. 45 | If you are using `ido`, be sure to use both `ido-everywhere` 46 | and https://github.com/DarwinAwardWinner/ido-completing-read-plus[`ido-completing-read+`]. 47 | You might also want to install https://github.com/lewang/flx[`ido-flex`]. 48 | 49 | === ivy (recommended) 50 | 51 | If you're fine with installing a third-party package for enhanced minibuffer 52 | completion you can't go wrong with the modern and versatile 53 | http://oremacs.com/2015/04/16/ivy-mode/[ivy]. 54 | -------------------------------------------------------------------------------- /.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 . 1) 31 | (thread-last . 1))))) 32 | 33 | ;; To use the bug-reference stuff, do: 34 | ;; (add-hook 'text-mode-hook #'bug-reference-mode) 35 | ;; (add-hook 'prog-mode-hook #'bug-reference-prog-mode) 36 | -------------------------------------------------------------------------------- /mkdocs.yml: -------------------------------------------------------------------------------- 1 | site_name: "CIDER: The Clojure Interactive Development Environment that Rocks" 2 | repo_url: https://github.com/clojure-emacs/cider 3 | edit_uri: edit/master/doc/ 4 | site_favicon: favicon.ico 5 | copyright: "Copyright © 2016-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors" 6 | docs_dir: legacy-manual 7 | pages: 8 | - Home: index.md 9 | - Installation: installation.md 10 | - Up and Running: up_and_running.md 11 | - ClojureScript: clojurescript.md 12 | - Interactive Programming: interactive_programming.md 13 | - Using the REPL: 14 | - Basic Usage: repl/basic_usage.md 15 | - Keybindings: repl/keybindings.md 16 | - Configuration: repl/configuration.md 17 | - REPL History: repl/history_browser.md 18 | - Managing Connections: managing_connections.md 19 | - Code Completion: code_completion.md 20 | - Pretty Printing: pretty_printing.md 21 | - Navigating Stacktraces: navigating_stacktraces.md 22 | - Running Tests: running_tests.md 23 | - Debugging: debugging.md 24 | - Miscellaneous Features: miscellaneous_features.md 25 | - Configuration: 26 | - Basic Configuration: configuration/basic_configuration.md 27 | - Syntax Highlighting: configuration/syntax_highlighting.md 28 | - Indentation: configuration/indentation.md 29 | - ElDoc: configuration/eldoc.md 30 | - Misc: configuration/misc.md 31 | - Indentation Specification: indent_spec.md 32 | - Additional Packages: additional_packages.md 33 | - Caveats: caveats.md 34 | - Troubleshooting: troubleshooting.md 35 | - FAQ: faq.md 36 | - Additional Resources: additional_resources.md 37 | - Hacking on CIDER: hacking_on_cider.md 38 | - About: 39 | - Team: about/team.md 40 | - Support: about/support.md 41 | - Contributing: about/contributing.md 42 | - Release Policy: about/release_policy.md 43 | - Changelog: about/changelog.md 44 | - Logo: about/logo.md 45 | - License: about/license.md 46 | extra_css: 47 | - css/extra.css 48 | markdown_extensions: 49 | - admonition 50 | theme: readthedocs 51 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/additional_resources.adoc: -------------------------------------------------------------------------------- 1 | = Additional Resources 2 | 3 | == Quick reference 4 | 5 | A single-page quick reference PDF for CIDER commands is available 6 | link:cider-refcard.pdf[here]. This PDF can be created manually by running 7 | `pdflatex` on link:cider-refcard.tex[the CIDER refcard LaTeX file]. 8 | 9 | == Demos 10 | 11 | * https://www.youtube.com/watch?v=aYA4AAjLfT0[Deep Dive into CIDER] - an overview of CIDER's essential features 12 | * 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) 13 | 14 | == Presentations 15 | 16 | * https://www.youtube.com/watch?v=4X-1fJm25Ww&list=PLZdCLR02grLoc322bYirANEso3mmzvCiI&index=6[The Evolution of the Emacs tooling for Clojure] - 17 | presented at Clojure/conj 2014; dedicated to the origin and the architecture 18 | of CIDER and related tooling 19 | * https://skillsmatter.com/skillscasts/7225-cider-the-journey-so-far-and-the-road-ahead[CIDER: The Journey so Far and the Road Ahead] - 20 | presented at ClojureX 2015; dedicated to CIDER 0.9 and 0.10 and the future of 21 | the project. 22 | * https://www.youtube.com/watch?v=3Q7APa2Htns&list=PLPgnbBCmP6ZMfHPJ4yMwuoLEZvEe5LVe8[A Few Pints of CIDER] - presented at Clojure Remote 2016; dedicated 23 | to CIDER 0.11; features a 10-minute live demo of some cool CIDER features. 24 | * https://www.youtube.com/watch?v=8wLwbpCxRf0&list=PLZdCLR02grLq4e8-1P2JNHBKUOLFTX3kb[CIDER: Inside the Brewery] - presented at Clojure/West 2016; 25 | dedicated to CIDER 0.12. 26 | 27 | == Podcasts 28 | 29 | * http://blog.cognitect.com/cognicast/080[Cognicast's episode on CIDER] 30 | * https://soundcloud.com/defn-771544745/36-a-long-glass-of-cider-with-bozhidar-batsov-aka-bbatsov[defn's episode on CIDER] 31 | 32 | == Tutorials 33 | 34 | IMPORTANT: Keep in mind that third-party tutorials might be outdated by time you get to read them. 35 | 36 | * https://practicalli.github.io/spacemacs/[Clojure Development with Spacemacs] 37 | -------------------------------------------------------------------------------- /test/cider-apropos-tests.el: -------------------------------------------------------------------------------- 1 | ;;; cider-apropos-tests.el 2 | 3 | ;; Copyright © 2012-2019 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 | (describe "cider-apropos" 34 | (it "raises user-error when cider is not connected." 35 | (spy-on 'cider-connected-p :and-return-value nil) 36 | (expect (cider-apropos "test") :to-throw 'user-error)) 37 | 38 | (it "raises user-error when the `apropos' op is not supported." 39 | (spy-on 'cider-ensure-op-supported :and-return-value nil) 40 | (expect (cider-apropos "test") :to-throw 'user-error))) 41 | 42 | (describe "cider-apropos-documentation" 43 | (it "raises user-error when cider is not connected." 44 | (spy-on 'cider-connected-p :and-return-value nil) 45 | (expect (cider-apropos-documentation) :to-throw 'user-error)) 46 | 47 | (it "raises user-error when the `apropos' op is not supported." 48 | (spy-on 'cider-ensure-op-supported :and-return-value nil) 49 | (expect (cider-apropos-documentation) :to-throw 'user-error))) 50 | -------------------------------------------------------------------------------- /test/cider-classpath-tests.el: -------------------------------------------------------------------------------- 1 | ;;; cider-classpath-tests.el 2 | 3 | ;; Copyright © 2012-2019 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 | (describe "cider-classpath" 34 | (it "raises user-error when cider is not connected." 35 | (spy-on 'cider-connected-p :and-return-value nil) 36 | (expect (cider-classpath) :to-throw 'user-error)) 37 | 38 | (it "raises user-error when the `classpath' op is not supported." 39 | (spy-on 'cider-ensure-op-supported :and-return-value nil) 40 | (expect (cider-classpath) :to-throw 'user-error))) 41 | 42 | (describe "cider-open-classpath-entry" 43 | (it "raises user-error when cider is not connected." 44 | (spy-on 'cider-connected-p :and-return-value nil) 45 | (expect (cider-open-classpath-entry) :to-throw 'user-error)) 46 | 47 | (it "raises user-error when the `classpath' op is not supported." 48 | (spy-on 'cider-ensure-op-supported :and-return-value nil) 49 | (expect (cider-open-classpath-entry) :to-throw 'user-error))) 50 | -------------------------------------------------------------------------------- /test/cider-clojuredocs-tests.el: -------------------------------------------------------------------------------- 1 | ;;; cider-clojuredocs-tests.el 2 | 3 | ;; Copyright © 2012-2019 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 | ;;; clojuredocs tests 34 | 35 | (describe "cider-clojuredocs-replace-special" 36 | (it "converts the input to a clojuredocs friendly format" 37 | (expect (cider-clojuredocs-replace-special "isa?") :to-equal "isa_q") 38 | (expect (cider-clojuredocs-replace-special "really-isa?") :to-equal "really-isa_q") 39 | (expect (cider-clojuredocs-replace-special "..") :to-equal "_..") 40 | (expect (cider-clojuredocs-replace-special ".") :to-equal "_.") 41 | (expect (cider-clojuredocs-replace-special "/") :to-equal "fs") 42 | )) 43 | 44 | (describe "cider-clojuredocs-url" 45 | (it "creates a clojuredocs search URL" 46 | (expect (cider-clojuredocs-url "even?" "clojure.core") :to-equal "https://clojuredocs.org/clojure.core/even_q") 47 | (expect (cider-clojuredocs-url nil "clojure.core") :to-equal nil) 48 | (expect (cider-clojuredocs-url "even?" nil) :to-equal nil))) 49 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/debugging/misc.adoc: -------------------------------------------------------------------------------- 1 | = Misc Debugging Tools 2 | :experimental: 3 | 4 | == Expanding Macros 5 | 6 | Typing kbd:[C-c C-m] after some form in a source buffer or the 7 | REPL will show you the macro expansion of the form in a new 8 | buffer. You'll have access to additional keybindings in the macro 9 | expansion buffer (which is internally using 10 | `cider-macroexpansion-mode`): 11 | 12 | |=== 13 | | Keyboard shortcut | Description 14 | 15 | | kbd:[m] 16 | | 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`. 17 | 18 | | kbd:[a] 19 | | Invoke `clojure.walk/macroexpand-all` on the form at point and replace the original form with its expansion. 20 | 21 | | kbd:[g] 22 | | The prior macro expansion is performed again and the current contents of the macro expansion buffer are replaced with the new expansion. 23 | 24 | | kbd:[C-/] + 25 | kbd:[u] 26 | | Undo the last in-place expansion performed in the macroexpansion buffer. 27 | |=== 28 | 29 | == Inspecting Values 30 | 31 | Typing kbd:[C-c M-i] after some form in a source buffer or the 32 | REPL will show you the structure for the result of the form in a new 33 | buffer. You can also use kbd:[C-u C-c M-i] to inspect the result 34 | of the current top-level form and kbd:[C-u C-u C-c M-i] to read 35 | an expression from the minibuffer and inspect its result. You'll have 36 | access to additional keybindings in the inspector buffer (which is 37 | internally using `cider-inspector-mode`): 38 | 39 | |=== 40 | | Keyboard shortcut | Description 41 | 42 | | kbd:[Tab] or kbd:[Shift-Tab] 43 | | Navigate inspectable sub-objects 44 | 45 | | kbd:[Return] 46 | | Inspect sub-objects 47 | 48 | | kbd:[l] 49 | | Pop to the parent object 50 | 51 | | kbd:[g] 52 | | Refresh the inspector (e.g. if viewing an atom/ref/agent) 53 | 54 | | kbd:[SPC] 55 | | Jump to next page in paginated view 56 | 57 | | kbd:[M-SPC] 58 | | Jump to previous page in paginated view 59 | 60 | | kbd:[s] 61 | | Set a new page size in paginated view 62 | |=== 63 | -------------------------------------------------------------------------------- /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 defintions 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 | CIDER's interactive programming environment is partially implemented 33 | using an Emacs minor mode called `cider-mode`. `cider-mode` 34 | complements `clojure-mode` and allows you to evaluate Clojure code 35 | from your source file buffers and send it directly to your running 36 | program through the CIDER REPL. Using the functions offered by 37 | `cider-mode` will improve your productivity and make you a more 38 | efficient Clojure programmer. 39 | -------------------------------------------------------------------------------- /legacy-manual/configuration/eldoc.md: -------------------------------------------------------------------------------- 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 | ![Eldoc](../images/eldoc.png) 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 in both source and REPL buffers. 20 | 21 | ## Configuring ElDoc 22 | 23 | * CIDER also would show the eldoc for the symbol at point. So in `(map inc ...)` 24 | when the cursor is over `inc` its eldoc would be displayed. You can turn off this 25 | behaviour by: 26 | 27 | ```el 28 | (setq cider-eldoc-display-for-symbol-at-point nil) 29 | ``` 30 | 31 | * CIDER respects the value of `eldoc-echo-area-use-multiline-p` when 32 | displaying documentation in the minibuffer. You can customize this variable to change 33 | its behaviour. 34 | 35 | | eldoc-echo-area-use-multiline-p | Behaviour | 36 | | ------------- | ------------- | 37 | | `t` | 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.| 38 | | `nil` | Messages are always truncated to fit in a single line of display in the echo area. | 39 | | `truncate-sym-name-if-fit` or anything non-nil | 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. | 40 | 41 | * CIDER will try to add expected function arguments based on the current context 42 | (for example for the `datomic.api/q` function where it will show the expected 43 | inputs of the query at point), if the variable `cider-eldoc-display-context-dependent-info` 44 | is non-nil: 45 | 46 | ```el 47 | (setq cider-eldoc-display-context-dependent-info t) 48 | ``` 49 | -------------------------------------------------------------------------------- /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 link: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 | link:https://antora.org[Antora] is used to convert the manual into HTML. 11 | The filesystem layout is described at https://docs.antora.org/antora/2.0/component-structure/ 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 i -g @antora/cli@2.0 @antora/site-generator-default@2.0 22 | ---- 23 | 24 | Check out https://docs.antora.org/antora/2.0/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 | link:https://github.com/clojure-emacs/cider/blob/master/doc/modules/ROOT/nav.adoc[nav.adoc]. 31 | 32 | == Building the 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 link:https://github.com/clojure-emacs/cider-site[cider-site] repo. 37 | 38 | [source,shell] 39 | ---- 40 | $ cd cider-site 41 | $ antora site.yml 42 | ---- 43 | 44 | == Deploying the Site 45 | 46 | NOTE: The manual will be regenerated manually periodically by CIDER's Core Team. 47 | 48 | The deployment process is simply pushing the generated HTML to GitHub. Simple as that. 49 | 50 | IMPORTANT: Don't forget to update the manual's version metadata when cutting CIDER releases. 51 | It lives in `docs/antora.yml`. 52 | 53 | Down the road we plan to automate the process and deploy automatically changes to the manual. 54 | Ideally this should be done by our CI. 55 | -------------------------------------------------------------------------------- /cider-compat.el: -------------------------------------------------------------------------------- 1 | ;;; cider-compat.el --- Functions from newer Emacs versions for compatibility -*- lexical-binding: t -*- 2 | 3 | ;; Copyright © 2012-2013 Tim King, Phil Hagelberg, Bozhidar Batsov 4 | ;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors 5 | ;; 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 | ;; Everything here was copied from subr-x for compatibility with 25 | ;; Emacs 25.1. 26 | 27 | ;;; Code: 28 | 29 | (eval-and-compile 30 | 31 | (unless (fboundp 'if-let*) 32 | (defmacro if-let* (bindings then &rest else) 33 | "Process BINDINGS and if all values are non-nil eval THEN, else ELSE. 34 | Argument BINDINGS is a list of tuples whose car is a symbol to be 35 | bound and (optionally) used in THEN, and its cadr is a sexp to be 36 | evalled to set symbol's value." 37 | (declare (indent 2) 38 | (debug ([&or (&rest (symbolp form)) (symbolp form)] form body))) 39 | `(let* ,(internal--build-bindings bindings) 40 | (if ,(car (internal--listify (car (last bindings)))) 41 | ,then 42 | ,@else)))) 43 | 44 | (unless (fboundp 'when-let*) 45 | (defmacro when-let* (bindings &rest body) 46 | "Process BINDINGS and if all values are non-nil eval BODY. 47 | Argument BINDINGS is a list of tuples whose car is a symbol to be 48 | bound and (optionally) used in BODY, and its cadr is a sexp to be 49 | evalled to set symbol's value." 50 | (declare (indent 1) (debug if-let*)) 51 | `(if-let* ,bindings ,(macroexp-progn body))))) 52 | 53 | (provide 'cider-compat) 54 | ;;; cider-compat.el ends here 55 | -------------------------------------------------------------------------------- /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 | ** xref:basics/clojurescript.adoc[ClojureScript] 7 | * Using CIDER 8 | ** xref:usage/interactive_programming.adoc[Interactive Programming] 9 | ** xref:usage/cider_mode.adoc[Using cider-mode] 10 | ** xref:usage/managing_connections.adoc[Managing Connections] 11 | ** xref:usage/code_completion.adoc[Code Completion] 12 | ** xref:usage/pretty_printing.adoc[Pretty Printing] 13 | ** xref:usage/navigating_stacktraces.adoc[Navigating Stacktraces] 14 | ** xref:usage/misc_features.adoc[Misc Features] 15 | * Testing 16 | ** xref:testing/running_tests.adoc[Running Tests] 17 | ** xref:testing/test_reports.adoc[Test Reports] 18 | ** xref:testing/supported_libraries.adoc[Supported Libraries] 19 | * Debugging 20 | ** xref:debugging/tracing.adoc[Tracing] 21 | ** xref:debugging/enlighten.adoc[Enlighten] 22 | ** xref:debugging/debugger.adoc[Debugger] 23 | ** xref:debugging/misc.adoc[Misc] 24 | * Configuration 25 | ** xref:config/basic_config.adoc[Basic Configuration] 26 | ** xref:config/syntax_highlighting.adoc[Syntax Highlighting] 27 | ** xref:config/indentation.adoc[Indentation] 28 | ** xref:config/eldoc.adoc[Eldoc] 29 | ** xref:config/misc.adoc[Misc] 30 | * xref:indent_spec.adoc[Indentation Specification] 31 | * Using the REPL 32 | ** xref:repl/basic_usage.adoc[Basic Usage] 33 | ** xref:repl/keybindings.adoc[Keybindings] 34 | ** xref:repl/configuration.adoc[Configuration] 35 | ** xref:repl/history.adoc[REPL History] 36 | * xref:caveats.adoc[Caveats] 37 | * xref:troubleshooting.adoc[Troubleshooting] 38 | * xref:faq.adoc[FAQ] 39 | * xref:additional_packages.adoc[Additional Packages] 40 | * xref:additional_resources.adoc[Additional Resources] 41 | * xref:contributing.adoc[Contributing] 42 | ** xref:contributing/docs.adoc[Documentation] 43 | ** xref:contributing/hacking.adoc[Hacking on CIDER] 44 | ** xref:contributing/funding.adoc[Funding] 45 | * About 46 | ** xref:about/history.adoc[History] 47 | ** xref:about/team.adoc[Team] 48 | ** xref:about/support.adoc[Support] 49 | ** xref:about/changelog.adoc[Changelog] 50 | ** xref:about/release_policy.adoc[Release Policy] 51 | ** xref:about/logo.adoc[Logo] 52 | ** xref:about/license.adoc[License] 53 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Configuration for probot-stale - https://github.com/probot/stale 2 | 3 | # Number of days of inactivity before an Issue or Pull Request becomes stale 4 | daysUntilStale: 90 5 | 6 | # Number of days of inactivity before an Issue or Pull Request with the stale label is closed. 7 | # Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale. 8 | daysUntilClose: 30 9 | 10 | # Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled) 11 | onlyLabels: [] 12 | 13 | # Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable 14 | exemptLabels: 15 | - "high priority" 16 | - "good first issue" 17 | - "pinned" 18 | 19 | # Set to true to ignore issues in a project (defaults to false) 20 | exemptProjects: false 21 | 22 | # Set to true to ignore issues in a milestone (defaults to false) 23 | exemptMilestones: true 24 | 25 | # Set to true to ignore issues with an assignee (defaults to false) 26 | exemptAssignees: true 27 | 28 | # Label to use when marking as stale 29 | staleLabel: stale 30 | 31 | # Comment to post when marking as stale. Set to `false` to disable 32 | markComment: > 33 | This issue has been automatically marked as stale because it has not had 34 | recent activity. It will be closed if no further activity occurs. Thank you 35 | for your contribution and understanding! 36 | 37 | # Comment to post when removing the stale label. 38 | # unmarkComment: > 39 | # Your comment here. 40 | 41 | # Comment to post when closing a stale Issue or Pull Request. 42 | closeComment: > 43 | This issues been automatically closed due to lack of activity. Feel free to re-open it 44 | if you ever come back to it. 45 | 46 | # Limit the number of actions per hour, from 1-30. Default is 30 47 | limitPerRun: 30 48 | 49 | # Limit to only `issues` or `pulls` 50 | # only: issues 51 | 52 | # Optionally, specify configuration settings that are specific to just 'issues' or 'pulls': 53 | # pulls: 54 | # daysUntilStale: 30 55 | # markComment: > 56 | # This pull request has been automatically marked as stale because it has not had 57 | # recent activity. It will be closed if no further activity occurs. Thank you 58 | # for your contributions. 59 | 60 | # issues: 61 | # exemptLabels: 62 | # - confirmed 63 | -------------------------------------------------------------------------------- /test/utils/cider-connection-test-utils.el: -------------------------------------------------------------------------------- 1 | ;;; cider-connection-test-utils.el 2 | 3 | ;; Copyright © 2012-2019 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)) t) 48 | (let ((,symbol (current-buffer))) 49 | ,@body 50 | (sesman-remove-object 'CIDER ,ses-name (current-buffer) t 'no-error)))) 51 | 52 | (defmacro cider-test-with-buffers (buffer-names &rest body) 53 | (let ((create (lambda (b) (list b `(generate-new-buffer " *temp*"))))) 54 | `(let (,@(mapcar create buffer-names)) 55 | ,@body 56 | (mapc 'kill-buffer (list ,@buffer-names))))) 57 | 58 | (provide 'cider-connection-test-utils) 59 | -------------------------------------------------------------------------------- /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 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 | behaviour 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 behaviour. 42 | 43 | |=== 44 | | eldoc-echo-area-use-multiline-p | Behaviour 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 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | export EMACS ?= emacs 2 | EMACSFLAGS = -L . 3 | CASK = cask 4 | VERSION = $(shell git describe --tags --abbrev=0 | sed 's/^v//') 5 | PKG = cider 6 | 7 | ELS_ALL = $(wildcard *.el) 8 | ELS = $(filter-out $(PKG)-autoloads.el,$(ELS_ALL)) 9 | OBJECTS = $(ELS:.el=.elc) 10 | 11 | .PHONY: elpa build version test lint clean elpaclean autoloads run-$(PKG) 12 | 13 | all: build 14 | 15 | .depend: $(ELS) 16 | @echo Compute dependencies 17 | @rm -f .depend 18 | @for f in $(ELS); do \ 19 | sed -n "s/(require '\(\(cider\|nrepl\)-.*\)).*$$/$${f}c: \1.elc/p" $$f >> .depend;\ 20 | done 21 | 22 | -include .depend 23 | 24 | elpa-$(EMACS): 25 | $(CASK) install 26 | $(CASK) update 27 | touch $@ 28 | 29 | elpa: elpa-$(EMACS) 30 | 31 | autoloads: $(PKG)-autoloads.el 32 | 33 | $(PKG)-autoloads.el: $(ELS) 34 | @printf "Generating $@\n" 35 | @printf "%s" "$$LOADDEFS_TMPL" > $@ 36 | @$(CASK) exec $(EMACS) -Q --batch -l autoload.el --eval "(progn\ 37 | (fset 'message (lambda (&rest _)))\ 38 | (setq make-backup-files nil)\ 39 | (setq vc-handled-backends nil)\ 40 | (setq default-directory (file-truename default-directory))\ 41 | (setq generated-autoload-file (expand-file-name \"$@\"))\ 42 | (setq find-file-visit-truename t)\ 43 | (update-directory-autoloads default-directory))" 44 | 45 | build: version elpa autoloads 46 | $(CASK) build 47 | 48 | version: 49 | $(EMACS) --version 50 | 51 | test: version build 52 | $(CASK) exec buttercup -L . -L ./test/utils/ 53 | 54 | lint: version elpa 55 | $(CASK) exec $(EMACS) -Q --batch \ 56 | --eval "(setq enable-local-variables :safe)" \ 57 | -l elisp-lint.el -f elisp-lint-files-batch \ 58 | --no-package-format \ 59 | --no-fill-column \ 60 | $(ELS) 61 | 62 | test-all: lint test 63 | 64 | clean: 65 | rm -f .depend elpa-$(EMACS) $(OBJECTS) $(PKG)-autoloads.el 66 | 67 | elpaclean: clean 68 | rm -f elpa* 69 | rm -rf .cask # Clean packages installed for development 70 | 71 | run-$(PKG): elpa 72 | cask exec $(EMACS) -Q -L . --eval "(require '$(PKG))" 73 | 74 | html: 75 | mkdocs build 76 | 77 | ## Templates ######################################################### 78 | 79 | define LOADDEFS_TMPL 80 | ;;; $(PKG)-autoloads.el --- automatically extracted autoloads 81 | ;; 82 | ;;; Code: 83 | (add-to-list 'load-path (directory-file-name \ 84 | (or (file-name-directory #$$) (car load-path)))) 85 | 86 | ;; Local Variables: 87 | ;; version-control: never 88 | ;; no-byte-compile: t 89 | ;; no-update-autoloads: t 90 | ;; End: 91 | ;;; $(PKG)-autoloads.el ends here 92 | 93 | endef 94 | export LOADDEFS_TMPL 95 | #' 96 | -------------------------------------------------------------------------------- /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 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].footnote:[https://technomancy.us/163] 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. Unfortunately in early 2013 19 | 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 | * 14 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 | * Summer 2013 - Bozhidar takes over the maintenance of `nrepl.el`. 36 | * 08 Aug 2013 - First release (0.1.8) under Bozhidar's stewardship. 37 | * 28 Oct 2013 - Bozhidar renames nrepl.el to CIDER and releases version 0.3. 38 | 39 | To be continued... 40 | -------------------------------------------------------------------------------- /.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 (`make test`). 41 | * Write [good commit messages][3]. 42 | * Mention related tickets in the commit messages (e.g. `[Fix #N] Add command ...`). 43 | * Update the [changelog][6]. 44 | * [Squash related commits together][5]. 45 | * Open a [pull request][4] that relates to *only* one subject with a clear title 46 | and description in grammatically correct, complete sentences. 47 | 48 | [1]: https://github.com/clojure-emacs/cider/issues 49 | [2]: http://gun.io/blog/how-to-github-fork-branch-and-pull-request 50 | [3]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html 51 | [4]: https://help.github.com/articles/using-pull-requests 52 | [5]: http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html 53 | [6]: https://github.com/clojure-emacs/cider/blob/master/CHANGELOG.md 54 | [7]: http://cider.readthedocs.org/en/latest/troubleshooting/ 55 | [8]: https://cider.readthedocs.io/en/latest/hacking_on_cider/ 56 | -------------------------------------------------------------------------------- /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 | * auto-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 | * eldoc support 14 | * highly customizable REPL prompt 15 | 16 | == Interacting with the REPL 17 | 18 | Interacting with CIDER's REPL is pretty simple - most of the time 19 | you'd just write expressions there and press kbd:[RET] to 20 | evaluate them. 21 | 22 | But the REPL is a bit more powerful than that and it allows you to do some things that might not be available in 23 | other Clojure REPLs. Some examples of such things would be: 24 | 25 | * You can close an incomplete expression with kbd:[C-Ret] 26 | * You can enter a multi-line expression by pressing kbd:[C-j] at the end of each line 27 | * You can quickly jump to the definition of a symbol (kbd:[.]) or to its documentation (kbd:[C-c C-d d]) 28 | * You can clear the output of the last expression with kbd:[C-c C-o] 29 | * You can clear the REPL buffer with kbd:[C-u C-c C-o] 30 | * You can jump between your source buffers and the REPL with kbd:[C-c C-z] 31 | * You can jump between your Clojure and ClojureScript REPLs with kbd:[C-c M-o] 32 | 33 | On top of this the REPL is extremely configurable and you can tweak almost every aspect of it. 34 | 35 | == Interrupting Evaluations 36 | 37 | If you accidentally try to evaluate something that's going to take a lot of time (if it finishes at all), you 38 | can interrupt the rouge evaluation operation by pressing kbd:[C-c C-c]. 39 | 40 | TIP: Note that this is different from the keybinding for interrupting evaluations in source buffers, 41 | namely kbd:[C-c C-b]. 42 | 43 | == Quitting a REPL 44 | 45 | When you're done with a REPL you can dispose of it with kbd:[C-c C-q]. 46 | 47 | Please, avoid killing REPL buffers with kbd:[C-c C-k] 48 | 49 | == Known Limitations 50 | 51 | Performance can degrade when the REPL buffer grows very large. This is 52 | especially true if either `cider-repl-use-clojure-font-lock` or 53 | `nrepl-log-messages` are enabled. You can use `cider-repl-clear-output` to 54 | either clear the result of the previous evaluation, or with a prefix argument 55 | clear the entire REPL buffer. 56 | 57 | Very long lines are guaranteed to bring Emacs to a crawl, so using a value of 58 | `cider-print-fn` that wraps lines beyond a certain width (i.e. any of the 59 | built-in options except for `pr`) is advised. 60 | -------------------------------------------------------------------------------- /legacy-manual/repl/basic_usage.md: -------------------------------------------------------------------------------- 1 | # Basic Usage 2 | 3 | CIDER comes with a powerful REPL that complements the interactive 4 | development functionality in `cider-mode`. Using the CIDER REPL you 5 | can experiment with your running program, test functions, or just 6 | explore a new library you're interested in using. The CIDER REPL offers a number of advanced features: 7 | 8 | * auto-completion 9 | * font-locking (the same as in `clojure-mode`) 10 | * quick access to many CIDER commands (e.g. definition and documentation lookup, tracing, etc) 11 | * pretty-printing of evaluation results 12 | * eldoc support 13 | * highly customizable REPL prompt 14 | 15 | ## Interacting with the REPL 16 | 17 | Interacting with CIDER's REPL is pretty simple - most of the time 18 | you'd just write expressions there and press RET to 19 | evaluate them. 20 | 21 | But the REPL is a bit more powerful than that and it allows you to do some things that might not be available in 22 | other Clojure REPLs. Some examples of such things would be: 23 | 24 | * You can close an incomplete expression with C-Ret 25 | * You can enter a multi-line expression by pressing C-j at the end of each line 26 | * You can quickly jump to the definition of a symbol (.) or to its documentation (C-c C-d d) 27 | * You can clear the output of the last expression with C-c C-o 28 | * You can clear the REPL buffer with C-u C-c C-o 29 | * You can jump between your source buffers and the REPL with C-c C-z 30 | * You can jump between your Clojure and ClojureScript REPLs with C-c M-o 31 | 32 | On top of this the REPL is extremely configurable and you can tweak almost every aspect of it. 33 | 34 | ## Interrupting Evaluations 35 | 36 | If you accidentally try to evaluate something that's going to take a lot of time (if it finishes at all), you 37 | can interrupt the rouge evaluation operation by pressing C-c C-c. 38 | 39 | !!! Tip 40 | 41 | Note that this is different from the keybinding for interrupting evaluations in source buffers, 42 | namely C-c C-b. 43 | 44 | ## Quitting a REPL 45 | 46 | When you're done with a REPL you can dispose of it with C-c C-q. 47 | 48 | Please, avoid killing REPL buffers with C-c C-k 49 | 50 | ## Known Limitations 51 | 52 | Performance can degrade when the REPL buffer grows very large. This is 53 | especially true if either `cider-repl-use-clojure-font-lock` or 54 | `nrepl-log-messages` are enabled. You can use `cider-repl-clear-output` to 55 | either clear the result of the previous evaluation, or with a prefix argument 56 | clear the entire REPL buffer. 57 | 58 | Very long lines are guaranteed to bring Emacs to a crawl, so using a value of 59 | `cider-print-fn` that wraps lines beyond a certain width (i.e. any of the 60 | built-in options except for `pr`) is advised. 61 | -------------------------------------------------------------------------------- /test/cider-overlay-tests.el: -------------------------------------------------------------------------------- 1 | ;;; cider-overlay-tests.el -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright © 2015-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors 4 | 5 | ;; Author: Artur Malabarba 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 | ;;; Code: 21 | 22 | (require 'buttercup) 23 | (require 'cider-overlays) 24 | 25 | (defmacro cider--with-overlay (overlay-args &rest body) 26 | "Run BODY in a temp buffer, with overlays created." 27 | (declare (indent 1) 28 | (debug (sexp sexp &rest form))) 29 | `(with-temp-buffer 30 | (insert "garbage") 31 | (save-excursion (insert "\nmore trash")) 32 | (cider--make-result-overlay ,@overlay-args) 33 | ,@body)) 34 | 35 | 36 | (describe "cider--make-result-overlay" 37 | :var (overlay-position this-command) 38 | 39 | (before-all 40 | (fset 'overlay-position (lambda () 41 | (mapcar #'overlay-start 42 | (overlays-at (point-min)))))) 43 | 44 | (it "can create overlays" 45 | (cider--with-overlay ("ok") 46 | (expect (overlays-at (point-min)) :to-be-truthy))) 47 | 48 | (describe "when overlay duration is `command`" 49 | (it "erases overlays after the next command is executed" 50 | (cider--with-overlay ("ok" :duration 'command) 51 | (run-hooks 'post-command-hook) 52 | (run-hooks 'post-command-hook) 53 | (expect (overlay-position) :to-equal nil)) 54 | 55 | (cider--with-overlay ("ok" :duration 'command) 56 | (setq this-command nil) 57 | (run-hooks 'post-command-hook) 58 | (expect (overlay-position) :to-equal nil)))) 59 | 60 | (describe "when overlay duration is given in secs" 61 | (it "erases overlays after that duration" 62 | (cider--with-overlay ("ok" :duration 1.5) 63 | (sleep-for 1) 64 | (expect (overlay-position) :not :to-equal nil) 65 | (sleep-for 1) 66 | (expect (overlay-position) :to-equal nil))))) 67 | 68 | (describe "cider--delete-overlay" 69 | :var (overlay-position) 70 | (it "deletes overlays" 71 | (cider--with-overlay ("ok") 72 | (mapc #'cider--delete-overlay (overlays-at (point-min))) 73 | (setq overlay-position (mapcar #'overlay-start (overlays-at (point-min)))) 74 | (expect overlay-position :to-equal nil)))) 75 | 76 | (provide 'cider-overlay-tests) 77 | ;;; cider-overlay-tests.el ends here 78 | -------------------------------------------------------------------------------- /test/cider-common-tests.el: -------------------------------------------------------------------------------- 1 | ;;; cider-common-tests.el 2 | 3 | ;; Copyright © 2012-2019 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-common) 32 | 33 | ;;; cider-common tests 34 | (describe "cider-abbreviate-ns" 35 | (it "handles nil input" 36 | (expect (cider-abbreviate-ns nil) :to-equal nil)) 37 | 38 | (it "handles empty string intput" 39 | (expect (cider-abbreviate-ns "") :to-equal "")) 40 | 41 | (it "shortens all ns segments but the last" 42 | (expect (cider-abbreviate-ns "some.test.ns") :to-equal "s.t.ns")) 43 | 44 | (it "handles single-segment namespaces" 45 | (expect (cider-abbreviate-ns "ns") :to-equal "ns"))) 46 | 47 | (describe "cider-last-ns-segment" 48 | (it "handles nil input" 49 | (expect (cider-last-ns-segment nil) :to-equal nil)) 50 | 51 | (it "handles empty string intput" 52 | (expect (cider-last-ns-segment "") :to-equal "")) 53 | 54 | (it "drops all ns segments but the last" 55 | (expect (cider-last-ns-segment "some.test.ns") :to-equal "ns")) 56 | 57 | (it "handles single-segment namespaces" 58 | (expect (cider-last-ns-segment "ns") :to-equal "ns"))) 59 | 60 | (describe "cider--kw-to-symbol" 61 | (it "returns symbol form of the given keyword" 62 | (expect (cider--kw-to-symbol "symbol") :to-equal "symbol") 63 | (expect (cider--kw-to-symbol ":clj.core/str") :to-equal "clj.core/str") 64 | (expect (cider--kw-to-symbol "::keyword") :to-equal "keyword") 65 | (expect (cider--kw-to-symbol nil) :to-equal nil))) 66 | 67 | (describe "cider-make-tramp-prefix" 68 | (it "returns tramp-prefix only" 69 | ;;; The third parameter is a host. It must contains a port number. 70 | (expect (cider-make-tramp-prefix "ssh" "cider-devs" "192.168.50.9#22") 71 | :to-equal "/ssh:cider-devs@192.168.50.9#22:") 72 | ;;; These two cases are for using ssh config alias. 73 | (expect (cider-make-tramp-prefix "ssh" nil "test.cider.com") 74 | :to-equal "/ssh:test.cider.com:") 75 | (expect (cider-make-tramp-prefix "ssh" nil "test.local") 76 | :to-equal "/ssh:test.local:"))) 77 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 doesn't support ClojureCLR. 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 link:basics/installation.adoc#setting-up-a-standalone-repl[standalone REPL] section. 84 | * Adjust the value of `cider-jack-in-dependencies`, so it includes the same nREPL value as the 85 | one that's bundled with Leiningen. 86 | -------------------------------------------------------------------------------- /test/cider-browse-ns-tests.el: -------------------------------------------------------------------------------- 1 | ;;; cider-browse-ns-tests.el 2 | 3 | ;; Copyright © 2012-2019 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 | (describe "cider-browse-ns--text-face" 34 | (it "identifies a function" 35 | (expect (cider-browse-ns--text-face '(dict "arglists" "fn arg list")) 36 | :to-equal 'font-lock-function-name-face)) 37 | 38 | (it "identifies a macro" 39 | (expect (cider-browse-ns--text-face '(dict "arglists" "fn arg list" "macro" "true")) 40 | :to-equal 'font-lock-keyword-face)) 41 | 42 | (it "identifies a variable" 43 | (expect (cider-browse-ns--text-face '(dict)) 44 | :to-equal 'font-lock-variable-name-face))) 45 | 46 | (describe "cider-browse-ns" 47 | :var (cider-browse-ns-buffer) 48 | (it "lists out all forms of a namespace with correct font-locks" 49 | (spy-on 'cider-sync-request:ns-vars-with-meta :and-return-value 50 | '(dict "blank?" 51 | (dict "arglists" "fn arg list" 52 | "doc" "\"True if s is nil, empty, or contains only whitespace.\""))) 53 | 54 | (with-temp-buffer 55 | (setq cider-browse-ns-buffer (buffer-name (current-buffer))) 56 | (cider-browse-ns "clojure.string") 57 | (search-forward "clojure") 58 | (expect (get-text-property (point) 'face) :to-equal 'font-lock-type-face) 59 | (search-forward "blank") 60 | (expect (get-text-property (point) 'font-lock-face) :to-equal 'font-lock-function-name-face) 61 | (search-forward "True") 62 | (expect (get-text-property (point) 'font-lock-face) :to-equal 'font-lock-doc-face)))) 63 | 64 | (describe "cider-browse-ns--first-doc-line" 65 | (it "returns Not documented if the doc string is missing" 66 | (expect (cider-browse-ns--first-doc-line nil) 67 | :to-equal "Not documented.")) 68 | 69 | (it "returns the first line of the doc string" 70 | (expect (cider-browse-ns--first-doc-line "True if s is nil, empty, or contains only whitespace.") 71 | :to-equal "True if s is nil, empty, or contains only whitespace.")) 72 | 73 | (it "returns the first sentence of the doc string if the first line contains multiple sentences" 74 | (expect (cider-browse-ns--first-doc-line "First sentence. Second sentence.") 75 | :to-equal "First sentence. ")) 76 | 77 | (it "returns the first line of the doc string if the first sentence spans multiple lines" 78 | (expect (cider-browse-ns--first-doc-line "True if s is nil, empty, or\n contains only whitespace.") 79 | :to-equal "True if s is nil, empty, or..."))) 80 | -------------------------------------------------------------------------------- /test/cider-selector-tests.el: -------------------------------------------------------------------------------- 1 | ;;; cider-selector-tests.el 2 | 3 | ;; Copyright © 2012-2019 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-connection-test-utils) 33 | 34 | ;; selector 35 | (defun cider-invoke-selector-method-by-key (ch) 36 | (let ((method (cl-find ch cider-selector-methods :key #'car))) 37 | (funcall (cl-third method)))) 38 | 39 | (defun cider--test-selector-method (method buffer-mode buffer-name) 40 | (with-temp-buffer 41 | (rename-buffer buffer-name) 42 | (setq major-mode buffer-mode) 43 | (let ((expected-buffer (current-buffer))) 44 | ;; switch to another buffer 45 | (with-temp-buffer 46 | (cider-invoke-selector-method-by-key method) 47 | (expect (current-buffer) :to-equal expected-buffer))))) 48 | 49 | (describe "cider-seletor-method-c" 50 | (it "switches to most recently visited clojure-mode buffer" 51 | (cider--test-selector-method ?c 'clojure-mode "*testfile*.clj"))) 52 | 53 | (describe "cider-seletor-method-e" 54 | (it "switches to most recently visited emacs-lisp-mode buffer" 55 | (kill-buffer "*scratch*") 56 | (cider--test-selector-method ?e 'emacs-lisp-mode "*testfile*.el"))) 57 | 58 | (describe "cider-seletor-method-r" 59 | :var (cider-current-repl) 60 | (it "switches to current REPL buffer" 61 | (spy-on 'cider-current-repl :and-return-value "*cider-repl xyz*") 62 | (cider--test-selector-method ?r 'cider-repl-mode "*cider-repl xyz*"))) 63 | 64 | ;; FIXME: should work but doesn't with a nonsense error 65 | ;; (describe "cider-selector-method-m" 66 | ;; (it "switches to current connection's *nrepl-messages* buffer" 67 | ;; (let ((buf (get-buffer-create "*nrepl-messages some-id*"))) 68 | ;; (with-repl-buffer "a-session" 'clj _ 69 | ;; (setq-local nrepl-messages-buffer buf) 70 | ;; (message "%S" (nrepl-messages-buffer (cider-current-repl))) 71 | ;; (cider--test-selector-method ?m nil "*nrepl-messages some-id*"))))) 72 | 73 | (describe "cider-seletor-method-x" 74 | (it "switches to *cider-error* buffer" 75 | (cider--test-selector-method ?x 'cider-stacktrace-mode "*cider-error*"))) 76 | 77 | (describe "cider-seletor-method-d" 78 | (it "switches to *cider-doc* buffer" 79 | (cider--test-selector-method ?d 'cider-stacktrace-mode "*cider-doc*"))) 80 | 81 | (describe "cider-seletor-method-s" 82 | :var (cider-scratch-find-or-create-buffer) 83 | (it "switches to *cider-scratch* buffer" 84 | (spy-on 'cider-scratch-find-or-create-buffer :and-return-value "*cider-scratch*") 85 | (cider--test-selector-method ?s 'cider-docview-mode "*cider-scratch*"))) 86 | -------------------------------------------------------------------------------- /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 https://github.com/clojure-emacs/cider-nrepl[nREPL 8 | middleware]. Starting 9 | with version 0.11, `cider-jack-in` (kbd:[C-c C-x (C-)j (C-)j]) 10 | automatically injects this middleware and other dependencies as required. 11 | 12 | NOTE: In the past, if you were setting up CIDER, you might have had to 13 | modify `profiles.clj` or `profile.boot`. CIDER now handles 14 | everything automatically and you don't need to add anything 15 | special to these files. 16 | 17 | If you prefer a standalone REPL, you will need to invoke 18 | `cider-connect` instead of `cider-jack-in` and manually add the 19 | dependencies to your Clojure project (explained in the following 20 | section). 21 | 22 | == Setting Up a Standalone REPL 23 | 24 | === Using Leiningen 25 | 26 | NOTE: Make sure you're using Leiningen 2.9.0 or newer, as 2.9.0 is the first 27 | release to ship with nREPL 0.6. 28 | 29 | Use the convenient plugin for defaults, either in your project's 30 | `project.clj` file or in the :repl profile in `~/.lein/profiles.clj`. 31 | 32 | [source,clojure] 33 | ---- 34 | :plugins [[cider/cider-nrepl "x.y.z"]] 35 | ---- 36 | 37 | A minimal `profiles.clj` for CIDER would be: 38 | 39 | [source,clojure] 40 | ---- 41 | {:repl {:plugins [[cider/cider-nrepl "0.21.1"]]}} 42 | ---- 43 | 44 | WARNING: Be careful not to place this in the `:user` profile, as this way CIDER's 45 | middleware will always get loaded, causing `lein` to start slower. You really 46 | need it just for `lein repl` and this is what the `:repl` profile is for. 47 | 48 | === Using Boot 49 | 50 | NOTE: Make sure you're using Boot 2.8.3 or newer, as 2.8.3 is the first 51 | release to ship with nREPL 0.6. 52 | 53 | Boot users can configure the tool to include the middleware automatically in 54 | all of their projects using a `~/.boot/profile.boot` file like so: 55 | 56 | [source,clojure] 57 | ---- 58 | (require 'boot.repl) 59 | 60 | (swap! boot.repl/*default-dependencies* 61 | concat '[[cider/cider-nrepl "0.21.1"]]) 62 | 63 | (swap! boot.repl/*default-middleware* 64 | conj 'cider.nrepl/cider-middleware) 65 | ---- 66 | 67 | For more information visit https://github.com/boot-clj/boot/wiki/Cider-REPL[boot-clj wiki]. 68 | 69 | === Using tools.deps 70 | 71 | TODO 72 | 73 | === Using Gradle 74 | 75 | TODO 76 | 77 | === Using Maven 78 | 79 | TODO 80 | 81 | == Using Embedded nREPL Server 82 | 83 | If you're embedding nREPL in your application, you'll have to start the 84 | server with CIDER's own nREPL handler. 85 | 86 | [source,clojure] 87 | ---- 88 | (ns my-app 89 | (:require [nrepl.server :as nrepl-server] 90 | [cider.nrepl :refer (cider-nrepl-handler)])) 91 | 92 | (defn -main 93 | [] 94 | (nrepl-server/start-server :port 7888 :handler cider-nrepl-handler)) 95 | ---- 96 | 97 | It goes without saying that your project should depend on `cider-nrepl`. 98 | 99 | NOTE: Prior to CIDER 0.18, CIDER and cider-nrepl were always released 100 | together and their versions had to match for things to work. But as 101 | the prominence of cider-nrepl grew and many other tools started using 102 | it, the two projects evolved separately and are no longer in tight 103 | lock-step. Any recent version of cider-nrepl should be compatible 104 | with a recent version of CIDER. You can check the required version of 105 | cider-nrepl for your version of CIDER by looking at 106 | `cider-required-middleware-version`. 107 | -------------------------------------------------------------------------------- /cider-tracing.el: -------------------------------------------------------------------------------- 1 | ;;; cider-tracing.el --- Executing tracing functionality -*- lexical-binding: t -*- 2 | 3 | ;; Copyright © 2013-2019 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 (symbol) 36 | "Toggle var tracing for SYMBOL." 37 | (thread-first `("op" "toggle-trace-var" 38 | "ns" ,(cider-current-ns) 39 | "sym" ,symbol) 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 | -------------------------------------------------------------------------------- /ROADMAP.md: -------------------------------------------------------------------------------- 1 | # CIDER Roadmap (as of June, 2018) 2 | 3 | That's a very high-level roadmap for CIDER. It focuses on the most 4 | important challenges we need to tackle. 5 | 6 | It's meant to give users a general idea about the direction we 7 | envision for the project's future, and collaborators a good list of 8 | high-impact tasks to tackle. 9 | 10 | ## Major Missing Features 11 | 12 | * find-references (https://github.com/clojure-emacs/cider/issues/1840) 13 | * basic refactoring stuff (potentially related to the merger of stuff from clj-refactor.el) 14 | * highlight symbol occurrences (https://github.com/clojure-emacs/cider/issues/1461) 15 | * macrostep style of macro expansion (https://github.com/clojure-emacs/cider/issues/1850) 16 | 17 | ## Internal improvements 18 | 19 | * Replace usages of Elisp's `read` with `parseedn`. 20 | * ~~Break down `cider-interaction.el` and remove this file completely.~~ (**DONE/0.18**) 21 | * ~~Improve the connection management (https://github.com/clojure-emacs/cider/pull/2069)~~ (**DONE/0.18**) 22 | * Improve nREPL callback handling (https://github.com/clojure-emacs/cider/issues/1099) 23 | * Better handling for huge output/results (we can warn users about it, 24 | truncate it in the REPL and store the whole result internally, etc). 25 | 26 | ## Better ClojureScript support 27 | 28 | ### Make it easier to start ClojureScript REPLs 29 | 30 | * Implement some deps injection for ClojureScript REPLs 31 | * ~~Providing meaningful errors when starting ClojureScript REPLs.~~ (**DONE/0.17**) 32 | * ~~Make it possible to have a project with only a ClojureScript REPL.~~(**DONE/0.18**) 33 | * Merge cljs-tooling into orchard and evolve it a bit (under 34 | consideration, might be better to keep it a separate library). 35 | * Add ability to restart a ClojureScript REPL (https://github.com/clojure-emacs/cider/issues/1874) 36 | 37 | ### Add ClojureScript support for more commands 38 | 39 | * clojure.test 40 | * tracing 41 | 42 | ### Always show meaningful errors if a command is not supported under ClojureScript 43 | 44 | Right now it's very confusing if you try to run a Clojure-only command with a ClojureScript REPL. 45 | You'd get some really weird error instead of something nice like "command X is not supported for ClojureScript". 46 | 47 | ### Add debugging support for ClojureScript 48 | 49 | There's a bit of info on the subject [here](https://github.com/clojure-emacs/cider/issues/1416). 50 | 51 | ## Gradual merger with refactor-nrepl 52 | 53 | It would make sense to move some important refactor-nrepl 54 | functionality into CIDER, provided it doesn't depend on anything 55 | complex (e.g. building an AST for the entire project). 56 | 57 | Below follow a few such candidates. 58 | 59 | This merger also relies on collaboration from the refactor-nrepl team. 60 | 61 | ### Move hotload deps to CIDER 62 | 63 | ### Move the ns-cleanup functionality to CIDER 64 | 65 | ## Socket REPL support (and potentially unrepl/prepl support as well) 66 | 67 | Eventually we want to support socket REPLs of any kind (plain, unrepl, 68 | prepl) in the same manner we support nREPL today (meaning everything 69 | should work with them). The bulk of the work to achieve this is 70 | related to making the CIDER client and server code nREPL agnostic, 71 | so. Work for this is already underway with respect to the server code 72 | (that's the `orchard` project), but hasn't started on the client 73 | (Emacs) side. 74 | 75 | ### Decouple the CIDER code from nREPL 76 | 77 | * Isolate the connection-specific code in a couple of client libraries and build a 78 | generic API on top of them dispatching based on the connection type. 79 | 80 | ### Implement a socket REPL client 81 | 82 | That should be relatively straightforward, as the communication 83 | protocol for the socket REPL is pretty simple. `parseclj` should be 84 | used to "encode/decode" EDN data. 85 | 86 | ### Transition everything non-nREPL specific to Orchard 87 | 88 | Already in progress, a lot of functionality already lives is orchard as of version 0.3. 89 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/index.adoc: -------------------------------------------------------------------------------- 1 | = CIDER 2 | 3 | CIDER is the **C**lojure(Script) **I**nteractive **D**evelopment **E**nvironment 4 | that **R**ocks! 5 | 6 | CIDER extends Emacs with support for interactive programming in Clojure. The 7 | features are centered around `cider-mode`, an Emacs minor-mode that complements 8 | https://github.com/clojure-emacs/clojure-mode[clojure-mode]. While `clojure-mode` supports editing Clojure source files, 9 | `cider-mode` adds support for interacting with a running Clojure process for 10 | compilation, debugging, definition and documentation lookup, running tests and 11 | so on. 12 | 13 | .Inspired by SLIME 14 | **** 15 | CIDER was originally inspired by the powerful Common Lisp interactive 16 | development environment https://github.com/slime/slime[SLIME]. In the beginning we started by 17 | adapting SLIME's core functionality to Clojure, but over the course of time 18 | CIDER became pretty different from SLIME in many areas. Check out 19 | https://www.youtube.com/watch?v=4X-1fJm25Ww&list=PLZdCLR02grLoc322bYirANEso3mmzvCiI&index=6[this presentation] 20 | if you'd like to know more about CIDER's early history. 21 | **** 22 | 23 | *Please consider 24 | xref:contributing/funding.adoc[supporting financially its ongoing development].* 25 | 26 | == Overview 27 | 28 | CIDER aims to provide an interactive development experience similar to the one 29 | you'd get when programming in Emacs Lisp, Common Lisp (with https://github.com/slime/slime[SLIME] or https://github.com/capitaomorte/sly[Sly]), 30 | Scheme (with https://github.com/jaor/geiser[Geiser]) and Smalltalk. 31 | 32 | Programmers are expected to program in a very dynamic and incremental manner, 33 | constantly re-evaluating existing Clojure definitions and adding new ones to 34 | their running applications. You never stop/start a Clojure application while 35 | using CIDER - you're constantly interacting with it and changing it. 36 | 37 | You can find more details about the typical CIDER workflow in the 38 | xref:usage/interactive_programming.adoc[Interactive Programming] section. While we're a bit 39 | short on video tutorials, you can check out this 40 | https://www.youtube.com/watch?v=aYA4AAjLfT0[introduction to CIDER] to get a 41 | feel about what do we mean by an "Interactive Development Environment". 42 | 43 | CIDER's built on top of https://github.com/nrepl/nrepl[nREPL], the Clojure networked REPL server. 44 | 45 | CIDER's basic architecture looks something like this: 46 | 47 | image::cider_architecture.png[,600] 48 | 49 | Clojure code gets executed by an nREPL server. CIDER sends requests to the 50 | server and processes its responses. The server's functionality is augmented by 51 | additional https://github.com/clojure-emacs/cider-nrepl[nREPL middleware], designed specifically to address the needs of an 52 | interactive development environment like CIDER. 53 | 54 | .An Editor-agnostic Foundation 55 | **** 56 | Much of the nREPL middleware we originally developed for CIDER is 57 | editor-agnostic and is being used by other Clojure development 58 | environments as well 59 | (e.g. https://github.com/tpope/vim-fireplace[vim-fireplace] & 60 | https://github.com/BetterThanTomorrow/calva[Calva]). 61 | **** 62 | 63 | == Features 64 | 65 | CIDER packs plenty of features. Here are some of them (in no particular order): 66 | 67 | * Interactive code evaluation 68 | * Powerful REPL 69 | * Code completion 70 | * Code reloading 71 | * Definition & documentation lookup 72 | * Enhanced error reporting 73 | * `clojure.test` integration 74 | * `clojure.spec` integration 75 | * Interactive debugger 76 | * ClojureScript support 77 | 78 | And many many more... The rest of this manual will be exploring CIDER's features in great detail. 79 | 80 | == CIDER in Action 81 | 82 | Below you can see a typical CIDER session. 83 | 84 | image::cider-overview.png[CIDER Screenshot] 85 | 86 | Here the user checked the documentation for `clojure.core/merge` straight from the source buffer 87 | and then jumped to a REPL buffer to try out something there. 88 | -------------------------------------------------------------------------------- /cider-scratch.el: -------------------------------------------------------------------------------- 1 | ;;; cider-scratch.el --- *scratch* buffer for Clojure -*- lexical-binding: t -*- 2 | 3 | ;; Copyright © 2014-2019 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 | (easy-menu-define cider-clojure-interaction-mode-menu map 52 | "Menu for Clojure Interaction mode" 53 | '("Clojure Interaction" 54 | (["Eval and print last sexp" #'cider-eval-print-last-sexp] 55 | "--" 56 | ["Reset" #'cider-scratch-reset]))) 57 | map)) 58 | 59 | (defconst cider-scratch-buffer-name "*cider-scratch*") 60 | 61 | ;;;###autoload 62 | (defun cider-scratch () 63 | "Go to the scratch buffer named `cider-scratch-buffer-name'." 64 | (interactive) 65 | (pop-to-buffer (cider-scratch-find-or-create-buffer))) 66 | 67 | (defun cider-scratch-find-or-create-buffer () 68 | "Find or create the scratch buffer." 69 | (or (get-buffer cider-scratch-buffer-name) 70 | (cider-scratch--create-buffer))) 71 | 72 | (define-derived-mode cider-clojure-interaction-mode clojure-mode "Clojure Interaction" 73 | "Major mode for typing and evaluating Clojure forms. 74 | Like clojure-mode except that \\[cider-eval-print-last-sexp] evals the Lisp expression 75 | before point, and prints its value into the buffer, advancing point. 76 | 77 | \\{cider-clojure-interaction-mode-map}" 78 | (setq-local sesman-system 'CIDER)) 79 | 80 | (defun cider-scratch--insert-welcome-message () 81 | "Insert the welcome message for the scratch buffer." 82 | (insert cider-scratch-initial-message)) 83 | 84 | (defun cider-scratch--create-buffer () 85 | "Create a new scratch buffer." 86 | (with-current-buffer (get-buffer-create cider-scratch-buffer-name) 87 | (cider-clojure-interaction-mode) 88 | (cider-scratch--insert-welcome-message) 89 | (current-buffer))) 90 | 91 | (defun cider-scratch-reset () 92 | "Reset the current scratch buffer." 93 | (interactive) 94 | (erase-buffer) 95 | (cider-scratch--insert-welcome-message)) 96 | 97 | (provide 'cider-scratch) 98 | 99 | ;;; cider-scratch.el ends here 100 | -------------------------------------------------------------------------------- /legacy-manual/about/contributing.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | ## Issues 4 | 5 | Report issues and suggest features and improvements on the 6 | [GitHub issue tracker](https://github.com/clojure-emacs/cider/issues). Don't ask 7 | questions on the issue tracker - use the [support channels](support.md) 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 | Before submitting a patch or a pull request make sure all tests are 24 | passing and that your patch is in line with the [contribution 25 | guidelines](https://github.com/clojure-emacs/cider/blob/master/.github/CONTRIBUTING.md). 26 | 27 | ## Documentation 28 | 29 | Good documentation is just as important as good code. 30 | 31 | Consider improving and extending this manual. 32 | 33 | ### Working on the Manual 34 | 35 | The manual is generated from the markdown files in the 36 | [doc](https://github.com/clojure-emacs/cider/tree/master/doc) folder of CIDER's 37 | GitHub repo and is published to [Read the Docs](readthedocs.org). The 38 | [MkDocs](http://www.mkdocs.org/) tool is used to convert the markdown sources to 39 | HTML. 40 | 41 | To make changes to the manual you simply have to change the files under 42 | `doc`. The manual will be regenerated automatically when changes to those files 43 | are merged in `master` (or the latest stable branch). 44 | 45 | You can install `MkDocs` locally and use the command `mkdocs serve` to see the 46 | result of changes you make to the manual locally: 47 | 48 | ``` 49 | $ cd path/to/cider/repo 50 | $ mkdocs serve 51 | ``` 52 | 53 | If you want to make changes to the manual's page structure you'll have to edit 54 | [mkdocs.yml](https://github.com/clojure-emacs/cider/blob/master/mkdocs.yml). 55 | 56 | ## Funding 57 | 58 | While CIDER is free software and will always be, the project would benefit immensely from some funding. 59 | Raising a monthly budget of a couple of thousand dollars would make it possible to pay people to work on 60 | certain complex features, fund other development related stuff (e.g. hardware, conference trips) and so on. 61 | Raising a monthly budget of over $5000 would open the possibility of someone working full-time on the project 62 | which would speed up the pace of development significantly. 63 | 64 | We welcome both individual and corporate sponsors! We also offer a wide array of funding channels to account 65 | for your preferences (although currently [Open Collective](https://opencollective.com/cider) is our preferred funding platform). 66 | 67 | If you're working in a company that's making significant use of CIDER we'd appreciate it if you suggest to your company 68 | to become a CIDER sponsor. 69 | 70 | You can support the development of CIDER, [clojure-mode][] and [inf-clojure][] via 71 | [Open Collective](https://opencollective.com/cider), 72 | [Salt](https://salt.bountysource.com/teams/cider), 73 | [Patreon](https://www.patreon.com/bbatsov), 74 | [Liberapay](https://liberapay.com/bbatsov/donate) and PayPal. 75 | 76 | [![Paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=GRQKNBM6P8VRQ) 77 | 78 | ### Open Collective 79 | 80 | * [[Become a backer](https://opencollective.com/cider#backer)] (for individuals) 81 | * [[Become a sponsor](https://opencollective.com/cider#sponsor)] (for companies) 82 | 83 | [clojure-mode]: https://github.com/clojure-emacs/clojure-mode 84 | [inf-clojure]: https://github.com/clojure-emacs/inf-clojure 85 | -------------------------------------------------------------------------------- /legacy-manual/caveats.md: -------------------------------------------------------------------------------- 1 | # Caveats 2 | 3 | CIDER is certainly not perfect and has some limitations that everyone 4 | should be aware of. 5 | 6 | ## ClojureScript limitations 7 | 8 | Currently, the following features are not supported for ClojureScript 9 | development: 10 | 11 | * Grimoire lookup 12 | * Reloading 13 | * Running tests 14 | * Tracing 15 | * Debugging (check out [this ticket](https://github.com/clojure-emacs/cider/issues/1416) 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 | ### Var Metadata 23 | 24 | Currently var metadata about the location of the var's definition within the 25 | ClojureScript source code (file, line & column) is set only when evaluating the 26 | entire source buffer (C-c C-k). All other interactive code evaluation 27 | commands (e.g. C-c C-e) don't set this metadata and you won't be able 28 | to use commands like `find-var` on such vars. This is a limitation of nREPL and 29 | Piggieback, that's beyond CIDER. You can find some discussions on the subject 30 | [here](http://dev.clojure.org/jira/browse/NREPL-59) and 31 | [here](https://github.com/clojure-emacs/cider/issues/830). 32 | 33 | ## Microsoft Windows 34 | 35 | ### Line separators 36 | 37 | On Microsoft Windows the JVM default line separator string is `\r\n` 38 | which can appear in Emacs as `^M` characters at the end of lines 39 | printed out by the JVM. One option is to set the 40 | `buffer-display-table` to not show these characters as detailed 41 | [here](http://stackoverflow.com/questions/10098925/m-character-showing-in-clojure-slime-repl/11787550#11787550) 42 | (changing `slime-repl-mode-hook` to 43 | `cider-repl-mode-hook`). Alternatively, setting the system property 44 | `line.separator` to `\n` at JVM startup will stop the carriage return 45 | from being printed and will fix output in all cider buffers. To do so 46 | add `"-Dline.separator=\"\n\""` to `:jvm-opts` in 47 | `~/.lein/profiles.clj`. 48 | 49 | ### Definition lookup in jar files 50 | 51 | In order for source lookup commands to work with `.jar` files you'll need to 52 | install either [7zip](http://www.7-zip.org/) or `pkunzip` and add its 53 | installation folder to Emacs's `exec-path`. Here's an example: 54 | 55 | ```el 56 | (add-to-list 'exec-path "C:/Program Files/7-Zip") 57 | ``` 58 | 59 | ## powershell.el 60 | 61 | The powershell inferior shell mode truncates CIDER's REPL output when 62 | loaded. As a workaround remove 63 | 64 | ```el 65 | (require 'powershell) 66 | ``` 67 | 68 | from your Emacs config. 69 | 70 | ## ClojureCLR Support 71 | 72 | CIDER currently doesn't support ClojureCLR. The reasons for this are the following: 73 | 74 | * nREPL itself runs only on the JVM (because it leverages Java APIs 75 | internally). There's an 76 | [nREPL port for ClojureCLR](https://github.com/clojure/clr.tools.nrepl), but 77 | it's not actively maintained and it doesn't behave like the Clojure nREPL. 78 | * `cider-nrepl` uses a lot of Java code internally itself. 79 | 80 | Those issues are not insurmountable, but are beyond the scope of our current roadmap. 81 | If someone would like to tackle them, we'd be happy to provide assistance. 82 | 83 | ## Injecting dependencies and Leiningen pedantic: abort mode 84 | 85 | Because injection currently creates an override of the nREPL dependency that 86 | Leingingen also pulls in starting up the REPL will fail if `:pedantic? :abort` 87 | is set. There are several ways to address this: 88 | 89 | * Remove the `:pedantic? :abort` setting. 90 | * Switch off injecting the dependencies with setting `cider-inject-dependencies-at-jack-in` to `nil` and 91 | provide the dependencies by editing your `~/.lein/profiles.clj` as described in 92 | the [standalone REPL](installation.md#setting-up-a-standalone-repl) section. 93 | * Adjust the value of `cider-jack-in-dependencies`, so it includes the same nREPL value as the 94 | one that's bundled with Leiningen. 95 | -------------------------------------------------------------------------------- /cider-classpath.el: -------------------------------------------------------------------------------- 1 | ;;; cider-classpath.el --- Basic Java classpath browser 2 | 3 | ;; Copyright © 2014-2019 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 | (require 'cider-compat) 30 | 31 | (defvar cider-classpath-buffer "*cider-classpath*") 32 | 33 | (defvar cider-classpath-mode-map 34 | (let ((map (make-sparse-keymap))) 35 | (set-keymap-parent map cider-popup-buffer-mode-map) 36 | (define-key map (kbd "RET") #'cider-classpath-operate-on-point) 37 | (define-key map "n" #'next-line) 38 | (define-key map "p" #'previous-line) 39 | map)) 40 | 41 | (defvar cider-classpath-mouse-map 42 | (let ((map (make-sparse-keymap))) 43 | (define-key map [mouse-1] #'cider-classpath-handle-mouse) 44 | map)) 45 | 46 | (define-derived-mode cider-classpath-mode special-mode "classpath" 47 | "Major mode for browsing the entries in Java's classpath. 48 | 49 | \\{cider-classpath-mode-map}" 50 | (setq-local electric-indent-chars nil) 51 | (setq-local sesman-system 'CIDER) 52 | (when cider-special-mode-truncate-lines 53 | (setq-local truncate-lines t))) 54 | 55 | (defun cider-classpath-list (buffer items) 56 | "Populate BUFFER with ITEMS." 57 | (with-current-buffer buffer 58 | (cider-classpath-mode) 59 | (let ((inhibit-read-only t)) 60 | (erase-buffer) 61 | (dolist (item items) 62 | (insert item "\n")) 63 | (goto-char (point-min))))) 64 | 65 | (defun cider-classpath-properties (text) 66 | "Decorate TEXT with a clickable keymap and function face." 67 | (let ((face (cond 68 | ((not (file-exists-p text)) 'font-lock-warning-face) 69 | ((file-directory-p text) 'dired-directory) 70 | (t 'default)))) 71 | (propertize text 72 | 'font-lock-face face 73 | 'mouse-face 'highlight 74 | 'keymap cider-classpath-mouse-map))) 75 | 76 | (defun cider-classpath-operate-on-point () 77 | "Expand browser according to thing at current point." 78 | (interactive) 79 | (let* ((bol (line-beginning-position)) 80 | (eol (line-end-position)) 81 | (line (buffer-substring-no-properties bol eol))) 82 | (find-file-other-window line))) 83 | 84 | (defun cider-classpath-handle-mouse (event) 85 | "Handle mouse click EVENT." 86 | (interactive "e") 87 | (cider-classpath-operate-on-point)) 88 | 89 | ;;;###autoload 90 | (defun cider-classpath () 91 | "List all classpath entries." 92 | (interactive) 93 | (cider-ensure-connected) 94 | (with-current-buffer (cider-popup-buffer cider-classpath-buffer 'select nil 'ancillary) 95 | (cider-classpath-list (current-buffer) 96 | (mapcar (lambda (name) 97 | (cider-classpath-properties name)) 98 | (cider-classpath-entries))))) 99 | 100 | ;;;###autoload 101 | (defun cider-open-classpath-entry () 102 | "Open a classpath entry." 103 | (interactive) 104 | (cider-ensure-connected) 105 | (when-let* ((entry (completing-read "Classpath entries: " (cider-classpath-entries)))) 106 | (find-file-other-window entry))) 107 | 108 | (provide 'cider-classpath) 109 | 110 | ;;; cider-classpath.el ends here 111 | -------------------------------------------------------------------------------- /test/nrepl-client-tests.el: -------------------------------------------------------------------------------- 1 | ;;; nrepl-client-tests.el 2 | 3 | ;; Copyright © 2012-2019 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 'nrepl-client) 32 | 33 | (describe "nrepl-server-buffer-name" 34 | :var (nrepl-hide-special-buffers params default-directory 35 | cider-session-name-template) 36 | (before-all 37 | (setq default-directory "/path/to/dirA/") 38 | (setq params '(:host "localhost" :port 1)) 39 | (setq cider-session-name-template "%J:%h:%p")) 40 | 41 | (describe "when nrepl-hide-special-buffers is t" 42 | (it "returns the name of the server buffer, which hides it in buffer changing commands" 43 | (setq nrepl-hide-special-buffers t 44 | nrepl-server-buffer-name-template "*nrepl-server %h:%p*") 45 | (expect (nrepl-server-buffer-name params) 46 | :to-equal " *nrepl-server localhost:1*")))) 47 | 48 | 49 | (describe "nrepl-dbind-response" 50 | (it "destructures a nREPL response dict and binds values to given vars" 51 | (expect (nrepl-dbind-response 52 | '(dict 53 | "id" "2" 54 | "new-session" "531acc73-bce4-4e77-a82b-537beeb581e9" 55 | "session" "39f630b9-9545-4ea0-860e-9846681d0741" 56 | "status" ("done")) 57 | (id session status) 58 | (list id session status)) 59 | :to-equal 60 | '("2" "39f630b9-9545-4ea0-860e-9846681d0741" ("done"))))) 61 | 62 | (describe "nrepl-make-buffer-name" 63 | :var (default-directory cider-session-name-template) 64 | (before-all 65 | (setq default-directory "/path/to/dirA/") 66 | (setq cider-session-name-template "%J:%h:%p")) 67 | (it "generates a buffer name from the given template" 68 | (let ((params '(:host "localhost" :port 1))) 69 | (expect (nrepl-make-buffer-name "*buff-name %s*" params) 70 | :to-equal "*buff-name to/dirA:localhost:1*"))) 71 | 72 | (it "respects the value of param `:project-dir'" 73 | (with-temp-buffer 74 | (let ((params '(:project-dir "path/to/dirB" :host "localhost" :port 1))) 75 | (expect (nrepl-make-buffer-name "*buff-name %s*" params) 76 | :to-equal "*buff-name to/dirB:localhost:1*")))) 77 | 78 | (it "understands all formats" 79 | (with-temp-buffer 80 | (let ((params '(:project-dir "path/to/dirB" :host "localhost" :port 100 81 | :repl-type cljs :cljs-repl-type "node"))) 82 | (expect (nrepl-make-buffer-name "*buff-name %j:%J:%h:%H:%p:%r:%S*" params) 83 | :to-equal "*buff-name dirB:to/dirB:localhost:100:cljs:node*")))) 84 | 85 | (it "strips trailing separators" 86 | (with-temp-buffer 87 | (let ((params '(:project-dir "path/to/dirB" :host "localhost" :port 100 88 | :repl-type cljs :cljs-repl-type nil))) 89 | (expect (nrepl-make-buffer-name "*buff-name [%r:%S]*" params) 90 | :to-equal "*buff-name [cljs]*") 91 | (expect (nrepl-make-buffer-name "*buff-name (%r:%S)*" params) 92 | :to-equal "*buff-name (cljs)*") 93 | (expect (nrepl-make-buffer-name "*buff-name %r:%S*" params) 94 | :to-equal "*buff-name cljs*"))))) 95 | -------------------------------------------------------------------------------- /legacy-manual/code_completion.md: -------------------------------------------------------------------------------- 1 | # Code Completion 2 | 3 | CIDER provides intelligent code completion for both source buffers (powered by 4 | `cider-mode`) and REPL buffers. 5 | 6 | !!! Note 7 | 8 | Internally CIDER leverages 9 | [compliment](https://github.com/alexander-yakushev/compliment) for Clojure and 10 | [cljs-tooling](https://github.com/clojure-emacs/cljs-tooling) for ClojureScript. 11 | Improvements to the two libraries automatically translate to improvements in CIDER. 12 | 13 | ## Standard completion 14 | 15 | Out-of-the box CIDER uses the standard Emacs tooling for code completion. When you 16 | press TAB or M-TAB you'll get completion candidates in a 17 | dedicated buffer. 18 | 19 | ![Code Completion](images/code_completion.png) 20 | 21 | ## Auto-completion 22 | 23 | While the standard Emacs tooling works just fine, we suggest that 24 | CIDER users consider using 25 | [`company-mode`](http://company-mode.github.io/) instead. Company mode 26 | can be used for auto-completion for both source code and REPL buffers. 27 | To install `company-mode`: 28 | 29 | M-x `package-install` RET `company` RET 30 | 31 | After installation, you can turn on `company-mode` globally: 32 | 33 | ```el 34 | (global-company-mode) 35 | ``` 36 | 37 | or through mode-specific hooks: 38 | 39 | ```el 40 | (add-hook 'cider-repl-mode-hook #'company-mode) 41 | (add-hook 'cider-mode-hook #'company-mode) 42 | ``` 43 | 44 | When `company-mode` is enabled, it will receive completion information 45 | from `cider-complete-at-point` and requires no additional setup or plugins. 46 | 47 | If you'd prefer to trigger completions manually you can add this to your config: 48 | 49 | ```el 50 | (setq company-idle-delay nil) ; never start completions automatically 51 | (global-set-key (kbd "M-TAB") #'company-complete) ; use M-TAB, a.k.a. C-M-i, as manual trigger 52 | ``` 53 | 54 | To make TAB complete, without losing the ability to manually indent, 55 | you can add this to your config: 56 | 57 | ```el 58 | (global-set-key (kbd "TAB") #'company-indent-or-complete-common) 59 | ``` 60 | 61 | ### Fuzzy candidate matching 62 | 63 | By default `company-mode` will provide completion candidates with the 64 | assumption that whatever you've typed so far is a prefix of what 65 | you're really trying to type. For example, if you type `map-` then 66 | you'll only get completion candidates that have `map-` as the 67 | beginning of their names. Sometimes, you don't know the exact prefix 68 | for the item you want to type. In this case, you can get 69 | CIDER-specific "fuzzy completion" by adding: 70 | 71 | ```el 72 | (add-hook 'cider-repl-mode-hook #'cider-company-enable-fuzzy-completion) 73 | (add-hook 'cider-mode-hook #'cider-company-enable-fuzzy-completion) 74 | ``` 75 | 76 | Now, `company-mode` will accept certain fuzziness when matching 77 | candidates against the prefix. For example, typing `mi` will show you 78 | `map-indexed` as one of the possible completion candidates and `cji` 79 | will complete to `clojure.java.io`. Different completion examples are 80 | shown 81 | [here](https://github.com/alexander-yakushev/compliment/wiki/Examples). 82 | 83 | ### Completion annotations 84 | 85 | Completion candidates will be annotated by default with an abbreviation 86 | corresponding to their type, and (contextually) their namespace. The function 87 | used to format the annotation can be configured by 88 | `cider-annotate-completion-function.` The abbreviations used are configured by 89 | `cider-completion-annotations-alist` and the context in which their namespace is 90 | included is configured by `cider-completion-annotations-include-ns.` 91 | 92 | ![Completion Annotations](images/completion-annotations.png) 93 | 94 | !!! Tip 95 | 96 | Completion annotations can be disabled by setting 97 | `cider-annotate-completion-candidates` to `nil`. 98 | 99 | ### Updating stale classes and methods cache 100 | 101 | Sometimes, the completion fails to recognize new classes that came with 102 | dependencies that were loaded dynamically after the REPL has started (e.g. via 103 | Boot). Executing `M-x cider-completion-flush-caches` (or going through the menu 104 | `CIDER Interaction->Misc->Flush completion cache`) forces the completion backend 105 | to re-read all classes it can find on the classpath. 106 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/usage/code_completion.adoc: -------------------------------------------------------------------------------- 1 | = Code Completion 2 | :experimental: 3 | 4 | CIDER provides intelligent code completion for both source buffers (powered by 5 | `cider-mode`) and REPL buffers. 6 | 7 | NOTE: Internally CIDER leverages 8 | https://github.com/alexander-yakushev/compliment[compliment] for Clojure and 9 | https://github.com/clojure-emacs/cljs-tooling[cljs-tooling] for ClojureScript. 10 | Improvements to the two libraries automatically translate to improvements in CIDER. 11 | 12 | == Standard completion 13 | 14 | Out-of-the box CIDER uses the standard Emacs tooling for code completion. When you 15 | press kbd:[TAB] or kbd:[M-TAB] you'll get completion candidates in a 16 | dedicated buffer. 17 | 18 | image::code_completion.png[Code Completion] 19 | 20 | == Auto-completion 21 | 22 | While the standard Emacs tooling works just fine, we suggest that 23 | CIDER users consider using 24 | http://company-mode.github.io/[`company-mode`] instead. Company mode 25 | can be used for auto-completion for both source code and REPL buffers. 26 | To install `company-mode`: 27 | 28 | kbd:[M-x] `package-install` kbd:[RET] `company` kbd:[RET] 29 | 30 | After installation, you can turn on `company-mode` globally: 31 | 32 | [source,lisp] 33 | ---- 34 | (global-company-mode) 35 | ---- 36 | 37 | or through mode-specific hooks: 38 | 39 | [source,lisp] 40 | ---- 41 | (add-hook 'cider-repl-mode-hook #'company-mode) 42 | (add-hook 'cider-mode-hook #'company-mode) 43 | ---- 44 | 45 | When `company-mode` is enabled, it will receive completion information 46 | from `cider-complete-at-point` and requires no additional setup or plugins. 47 | 48 | If you'd prefer to trigger completions manually you can add this to your config: 49 | 50 | [source,lisp] 51 | ---- 52 | (setq company-idle-delay nil) ; never start completions automatically 53 | (global-set-key (kbd "M-TAB") #'company-complete) ; use M-TAB, a.k.a. C-M-i, as manual trigger 54 | ---- 55 | 56 | To make kbd:[TAB] complete, without losing the ability to manually indent, 57 | you can add this to your config: 58 | 59 | [source,lisp] 60 | ---- 61 | (global-set-key (kbd "TAB") #'company-indent-or-complete-common) 62 | ---- 63 | 64 | === Fuzzy candidate matching 65 | 66 | By default `company-mode` will provide completion candidates with the 67 | assumption that whatever you've typed so far is a prefix of what 68 | you're really trying to type. For example, if you type `map-` then 69 | you'll only get completion candidates that have `map-` as the 70 | beginning of their names. Sometimes, you don't know the exact prefix 71 | for the item you want to type. In this case, you can get 72 | CIDER-specific "fuzzy completion" by adding: 73 | 74 | [source,lisp] 75 | ---- 76 | (add-hook 'cider-repl-mode-hook #'cider-company-enable-fuzzy-completion) 77 | (add-hook 'cider-mode-hook #'cider-company-enable-fuzzy-completion) 78 | ---- 79 | 80 | Now, `company-mode` will accept certain fuzziness when matching 81 | candidates against the prefix. For example, typing `mi` will show you 82 | `map-indexed` as one of the possible completion candidates and `cji` 83 | will complete to `clojure.java.io`. Different completion examples are 84 | shown 85 | https://github.com/alexander-yakushev/compliment/wiki/Examples[here]. 86 | 87 | === Completion annotations 88 | 89 | Completion candidates will be annotated by default with an abbreviation 90 | corresponding to their type, and (contextually) their namespace. The function 91 | used to format the annotation can be configured by 92 | `cider-annotate-completion-function.` The abbreviations used are configured by 93 | `cider-completion-annotations-alist` and the context in which their namespace is 94 | included is configured by `cider-completion-annotations-include-ns.` 95 | 96 | image::completion-annotations.png[Completion Annotations] 97 | 98 | TIP: Completion annotations can be disabled by setting 99 | `cider-annotate-completion-candidates` to `nil`. 100 | 101 | === Updating stale classes and methods cache 102 | 103 | Sometimes, the completion fails to recognize new classes that came with 104 | dependencies that were loaded dynamically after the REPL has started (e.g. via 105 | Boot). Executing `M-x cider-completion-flush-caches` (or going through the menu 106 | `+CIDER Interaction->Misc->Flush completion cache+`) forces the completion backend 107 | to re-read all classes it can find on the classpath. 108 | -------------------------------------------------------------------------------- /legacy-manual/repl/keybindings.md: -------------------------------------------------------------------------------- 1 | # REPL Keybindings 2 | 3 | Here's a list of the keybindings that are available in CIDER's REPL: 4 | 5 | Keyboard shortcut | Description 6 | -------------------------------------|------------------------------ 7 | RET | 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 is given then the input is evaluated without checking for completeness. 8 | C-RET | Close any unmatched parenthesis and then evaluate the current input in Clojure. 9 | C-j | Open a new line and indent. 10 | C-c C-o | 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. 11 | C-c M-o | Switch between the Clojure and ClojureScript REPLs for the current project. 12 | C-c C-u | Kill all text from the prompt to the current point. 13 | C-c C-b
C-c C-c| Interrupt any pending evaluations. 14 | C-up
C-down | Go to to previous/next input in history. 15 | M-p
M-n | Search the previous/next item in history using the current input as search pattern. If 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). 16 | M-s
M-r | Search forward/reverse through command history with regex. 17 | C-c C-n
C-c C-p | Move between the current and previous prompts in the REPL buffer. Pressing RET on a line with old input copies that line to the newest prompt. 18 | TAB | Complete symbol at point. 19 | C-c C-d d
C-c C-d C-d | 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 20 | C-c C-d j
C-c C-d C-j | 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. 21 | C-c C-d r
C-c C-d C-r | Lookup symbol in Grimoire. 22 | C-c C-d a
C-c C-d C-a | Apropos search for functions/vars. 23 | C-c C-d f
C-c C-d C-f | Apropos search for documentation. 24 | C-c C-z | Switch to the previous Clojure buffer. This complements C-c C-z used in cider-mode. 25 | C-c M-i | Inspect expression. Will act on expression at point if present. 26 | C-c M-n | Select a namespace and switch to it. 27 | C-c C-. | Jump to some namespace on the classpath. 28 | C-c M-t v | Toggle var tracing. 29 | C-c M-t n | Toggle namespace tracing. 30 | C-c C-t t
C-c C-t C-t | Run test at point. 31 | C-c C-t a
C-c C-t C-a | Re-run the last test you ran. 32 | C-c C-t n
C-c C-t C-n | Run tests for current namespace. 33 | C-c C-t l
C-c C-t C-l | Run tests for all loaded namespaces. 34 | C-c C-t p
C-c C-t C-p | Run tests for all project namespaces. This loads the additional namespaces. 35 | C-c C-t r
C-c C-t C-r | Re-run test failures/errors. 36 | C-c C-t b
C-c C-t C-b | Show the test report buffer. 37 | C-c C-q | Quit the current nREPL connection. With a prefix argument it will quit all connections. 38 | 39 | !!! Tip 40 | 41 | There's no need to memorize this list. In any REPL buffer you'll have a `REPL` 42 | menu available, which lists all the most important commands and their 43 | keybindings. You can also invoke `C-h f RET cider-repl-mode` to get a list of the 44 | keybindings for `cider-repl-mode`. 45 | 46 | ## REPL Shortcuts 47 | 48 | In the REPL you can also use "shortcut commands" by pressing `,` at the 49 | beginning of a REPL line. You'll be presented with a list of commands you can 50 | quickly run (like quitting, displaying some info, clearing the REPL, etc). The 51 | character used to trigger the shortcuts is configurable via 52 | `cider-repl-shortcut-dispatch-char`. Here's how you can change it to `;`: 53 | 54 | ```el 55 | (setq cider-repl-shortcut-dispatch-char ?\;) 56 | ``` 57 | -------------------------------------------------------------------------------- /test/cider-tests--no-auto.el: -------------------------------------------------------------------------------- 1 | ;;; cider-tests--no-auto.el --- Non-automated tests -*- lexical-binding: t -*- 2 | 3 | ;; Copyright © 2014-2019 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 | (require 'cider-compat) 37 | 38 | ;;; Docs 39 | ;; Presenting docs erroneously would cause an ugly scene. 40 | 41 | (defun cider-test-doc (sym &optional dump) 42 | "Compare `cider-doc' output for SYM to the canonical `clojure.repl/doc'. 43 | Prior to compare, Added/Deprecated info is removed from the former, and the 44 | leading line of all dashes and trailing nil (when no doc is present) are removed 45 | from the latter. Remaining content is compared for string equality." 46 | (let ((repl-doc (with-temp-buffer 47 | (let ((form (format "(clojure.repl/doc %s)" sym))) 48 | (insert (nrepl-dict-get (cider-nrepl-send-sync-request form) 49 | "out")) 50 | (goto-char (point-min)) 51 | (while (re-search-forward "^ nil\n" nil t) 52 | (replace-match "")) 53 | (goto-line 2) 54 | (buffer-substring (point) (point-max))))) 55 | (cider-doc (if-let* ((doc-buffer (cider-doc-buffer-for sym)) 56 | (with-current-buffer doc-buffer 57 | (let ((inhibit-read-only t)) 58 | (goto-char (point-min)) 59 | (while (re-search-forward 60 | "^\\(Added\\|Deprecated\\).*\n" nil t) 61 | (replace-match "")) 62 | (prog1 63 | (buffer-string) 64 | (kill-buffer)))) 65 | ""))) 66 | (when dump 67 | (message "== clojure.repl/doc ==\n%s" repl-doc) 68 | (message "== cider-doc ==\n%s" cider-doc)) 69 | (string= cider-doc repl-doc))) 70 | 71 | (defun cider-test-all-docs () 72 | "Verify docs for all special forms and every public var in `clojure/core'." 73 | (let ((syms (read 74 | (cider-nrepl-sync-request:eval 75 | "(->> (merge @#'clojure.repl/special-doc-map 76 | (->> (ns-map 'clojure.core) 77 | (filter (every-pred 78 | (comp var? val) 79 | (complement (comp :private meta val)))))) 80 | (keys) 81 | (remove '#{.}))" ; emacs lisp chokes on the dot symbol 82 | )))) 83 | (let (untested diffs) 84 | (dolist (sym syms) 85 | (let ((name (cond ((symbolp sym) (symbol-name sym)) 86 | ((listp sym) (symbol-name (cadr sym)))))) 87 | (if name 88 | (unless (cider-test-doc name) 89 | (setq diffs (cons sym diffs))) 90 | (setq untested (cons sym untested))))) 91 | (when untested 92 | (message "Could not test: %s" untested)) 93 | (when diffs 94 | (message "Mismatched: %s" diffs)) 95 | (concatenate 'list untested diffs)))) 96 | 97 | (describe "cider-test-all-docs" 98 | (it "returns nil if `cider-doc' output matches with the `clojure.repl/doc'" 99 | (expect (cider-test-all-docs) :to-equal nil))) 100 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/usage/pretty_printing.adoc: -------------------------------------------------------------------------------- 1 | = Pretty-printing 2 | 3 | == Configuring a printing function 4 | 5 | NOTE: Pretty-printing was overhauled in CIDER 0.21 to leverage new features introduced in nREPL 0.6. 6 | Refer to https://nrepl.org/nrepl/usage/misc.html#_pretty_printing[nREPL's documentation] for details. 7 | 8 | You can configure the function used by CIDER for pretty-printing evaluation 9 | results and other data using the option `cider-print-fn`, which can take the 10 | following possible values: 11 | 12 | * `nil` to defer to nREPL to choose the printing function. This will use the 13 | bound value of `+nrepl.middleware.print/*print-fn*+`, which defaults to the 14 | equivalent of `clojure.core/pr`. 15 | * `pr` to use the equivalent of `clojure.core/pr`. 16 | * `pprint` to use the built-in `clojure.pprint/pprint` (this is the default). 17 | * `fipp` to use the https://github.com/brandonbloom/fipp[Fast Idiomatic 18 | Pretty-Printer]. This is approximately 19 | 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 | Alternatively, `cider-print-fn` can be set to the namespace-qualified name of a 27 | Clojure var whose function takes three arguments: the object to print, the 28 | `java.io.PrintWriter` to print on, and a (possibly nil) map of options. 29 | 30 | [source,lisp] 31 | ---- 32 | (setq cider-print-fn "user/my-pprint") 33 | ---- 34 | 35 | Here's one example: 36 | 37 | [source,clojure] 38 | ---- 39 | (ns cider.pprint 40 | (:require 41 | [clojure.pprint :as pp])) 42 | 43 | (defn pprint 44 | "A simple wrapper around `clojure.pprint/write`. 45 | 46 | Its signature is compatible with the expectations of nREPL's wrap-print 47 | middleware." 48 | [value writer options] 49 | (apply pp/write value (mapcat identity (assoc options :stream writer)))) 50 | ---- 51 | 52 | == Limiting printed output 53 | 54 | You can set `cider-print-quota` to limit the number of bytes that will be 55 | returned by any printing operation. This defaults to one megabyte, and can be 56 | set to `nil` if no limit is desired. Note well that if no quota is set some 57 | printing operations may never terminate -- you can still use `cider-interrupt` to 58 | halt them. 59 | 60 | Your configured printing function might also support limiting the length and 61 | depth of printed objects -- either using `+clojure.core/*print-length*+` and 62 | `+clojure.core/*print-level*+` or in the provided <>. 63 | 64 | == Print options 65 | 66 | You can pass an options map to the print function by setting `cider-print-options`. Here's an example: 67 | 68 | [source,lisp] 69 | ---- 70 | (setq cider-print-options '(dict "length" 50 "right-margin" 70)) 71 | ---- 72 | 73 | NOTE: Each print engine has its own configuration options, so you'll have to be sure to set `cider-print-options` accordingly. 74 | 75 | Here's a table describing the differences in the names for the most common print 76 | options supported by every print engine. 77 | 78 | |=== 79 | | `clojure.core/pr` | `clojure.pprint` | Fipp & Puget | zprint 80 | 81 | | `clojure.core/*print-length*` 82 | | `length` 83 | | `print-length` 84 | | `max-length` 85 | 86 | | `clojure.core/*print-level*` 87 | | `level` 88 | | `print-level` 89 | | `max-depth` 90 | 91 | | `clojure.pprint/*print-right-margin*` 92 | | `right-margin` 93 | | `width` 94 | | `width` 95 | |=== 96 | 97 | Not all printing engines use (or default to) the dynamic variables in all cases, 98 | so setting them at the REPL may or may not have the intended effect. See the 99 | respective documentation of each engine: 100 | 101 | * `clojure.core/pr`: https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/+*print-dup*+ 102 | * `clojure.pprint`: https://clojuredocs.org/clojure.pprint/write 103 | * Fipp: https://github.com/brandonbloom/fipp/#printer-usage 104 | * Puget: https://github.com/greglook/puget#usage 105 | * zprint: https://github.com/kkinnear/zprint/#what-is-configurable 106 | 107 | == Width of printed output 108 | 109 | If you're using one of the printing engines provided with CIDER, the value of 110 | `fill-column` will be used for the relevant width option in the <>. You can override this by hardcoding the relevant option in 112 | `cider-print-options`. 113 | -------------------------------------------------------------------------------- /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), but it can be installed manually or via alternative package managers such 6 | as `el-get`. 7 | 8 | == Prerequisites 9 | 10 | You'll need to have Emacs installed, preferably the latest stable 11 | release. If you're new to Emacs you might want to go through 12 | https://www.gnu.org/software/emacs/tour/index.html[the guided tour of Emacs] 13 | and the built-in tutorial (just press kbd:[C-h t]). 14 | 15 | CIDER officially supports Emacs 25.1+, Java 8+ and Clojure(Script) 16 | 1.8+. CIDER 0.17 (Andalucía) was the final release which supported 17 | Java 7 and Clojure(Script) 1.7. 18 | 19 | You'll also need a recent version of either the Clojure CLI tools or your 20 | favorite build tool (Leiningen, Boot, or Gradle) to be able to start CIDER via 21 | `cider-jack-in`. Generally it's a good idea to use the latest stable versions. 22 | 23 | WARNING: CIDER does not support ClojureCLR. 24 | 25 | == Installation via package.el 26 | 27 | CIDER is available on the two major `package.el` community 28 | maintained repos - 29 | http://stable.melpa.org[MELPA Stable] 30 | and http://melpa.org[MELPA]. 31 | 32 | You can install CIDER with the following command: 33 | 34 | kbd:[M-x package-install cider ] 35 | 36 | or by adding this bit of Emacs Lisp code to your Emacs initialization file 37 | (`.emacs` or `init.el`): 38 | 39 | [source,lisp] 40 | ---- 41 | (unless (package-installed-p 'cider) 42 | (package-install 'cider)) 43 | ---- 44 | 45 | If the installation doesn't work try refreshing the package list: 46 | 47 | kbd:[M-x package-refresh-contents ] 48 | 49 | It's important to note that MELPA packages are built automatically 50 | from the `master` branch, and that means you'll be right on the 51 | leading edge of development. This has upsides and downsides; you'll 52 | see new features first, but you might experience some bugs from 53 | time to time. Nevertheless, installing from MELPA is a reasonable way 54 | to obtain CIDER. The `master` branch is normally quite stable 55 | and serious regressions there are usually fixed quickly. 56 | 57 | If you have concerns about living on the leading edge of CIDER 58 | deveopment, you can always pin CIDER to use MELPA Stable like this: 59 | 60 | [source,lisp] 61 | ---- 62 | (add-to-list 'package-pinned-packages '(cider . "melpa-stable") t) 63 | ---- 64 | 65 | TIP: If you don't want to (or can't) wait for MELPA to rebuild CIDER, 66 | you can easily build and install an up-to-date MELPA package locally yourself. Check out 67 | http://emacsredux.com/blog/2015/05/10/building-melpa-packages-locally/[this article] 68 | for details on the subject. 69 | 70 | NOTE: CIDER has dependencies (e.g. `queue` & `seq`) that are only available in the 71 | https://elpa.gnu.org/[GNU ELPA repository]. It's the only package repository 72 | enabled by default in Emacs and you should not disable it! 73 | 74 | == Installation via use-package 75 | 76 | `use-package` can be used to install CIDER via the `package.el`'s repositories 77 | http://stable.melpa.org[MELPA Stable] and http://melpa.org[MELPA]. 78 | 79 | If you wanted to install the version of CIDER which is what is to be found in 80 | the `master` branch, declare the following in your Emacs initialization file 81 | (`.emacs` or `init.el`): 82 | 83 | [source,lisp] 84 | ---- 85 | (use-package cider 86 | :ensure t) 87 | ---- 88 | 89 | However, if you wanted to be a bit more conservative and only use the stable 90 | releases of CIDER, you'd declare the following: 91 | 92 | [source,lisp] 93 | ---- 94 | (use-package cider 95 | :ensure t 96 | :pin melpa-stable) 97 | ---- 98 | 99 | After placing one of the above s-expressions, evaluate it, for it to take effect 100 | by entering: kbd:[C-x C-e]. 101 | 102 | For further configuration options with `use-package`, consult the 103 | official https://github.com/jwiegley/use-package[use-package repository]. 104 | 105 | == Installation via el-get 106 | 107 | CIDER is also available for installation from 108 | the https://github.com/dimitri/el-get[el-get] package manager. 109 | 110 | Provided you've already installed `el-get` you can install CIDER with the 111 | following command: 112 | 113 | kbd:[M-x el-get-install cider ] 114 | 115 | == Manual Installation 116 | 117 | Installing CIDER manually is discouraged unless you plan to work with CIDER's 118 | codebase. The manual installation is relatively involved as it requires manual 119 | installation of the dependencies. Check out the section 120 | xref:contributing/hacking.adoc[Hacking on CIDER] for more details. 121 | -------------------------------------------------------------------------------- /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 is given then the input is evaluated without checking for completeness. 11 | 12 | | kbd:[C-RET] 13 | | Close any unmatched parenthesis 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 r] + 59 | kbd:[C-c C-d C-r] 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 the additional namespaces. 107 | 108 | | kbd:[C-c C-t r] + 109 | kbd:[C-c C-t C-r] 110 | | Re-run test failures/errors. 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 all 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 | -------------------------------------------------------------------------------- /legacy-manual/pretty_printing.md: -------------------------------------------------------------------------------- 1 | # Pretty-printing 2 | 3 | ## Configuring a printing function 4 | 5 | !!! Note 6 | 7 | Pretty-printing was overhauled in CIDER 0.21 to leverage new features introduced in nREPL 0.6. 8 | Refer to [nREPL's documentation](https://nrepl.org/nrepl/usage/misc.html#_pretty_printing) for details. 9 | 10 | You can configure the function used by CIDER for pretty-printing evaluation 11 | results and other data using the option `cider-print-fn`, which can take the 12 | following possible values: 13 | 14 | - `nil` to defer to nREPL to choose the printing function. This will use the 15 | bound value of `nrepl.middleware.print/*print-fn*`, which defaults to the 16 | equivalent of `clojure.core/pr`. 17 | 18 | - `pr` to use the equivalent of \\=`clojure.core/pr\\=`. 19 | 20 | - `pprint` to use the built-in `clojure.pprint/pprint` (this is the default). 21 | 22 | - `fipp` to use the [Fast Idiomatic 23 | Pretty-Printer](https://github.com/brandonbloom/fipp). This is approximately 24 | 5-10x faster than `clojure.core/pprint`. 25 | 26 | - `puget` to use [Puget](https://github.com/greglook/puget), which provides 27 | [canonical serialization](https://github.com/greglook/puget#canonical-representation) 28 | of data on top of fipp, but at a slight performance cost. 29 | 30 | - `zprint` to use [zprint](https://github.com/kkinnear/zprint), a fast and 31 | flexible alternative to the libraries mentioned above. 32 | 33 | Alternatively, `cider-print-fn` can be set to the namespace-qualified name of a 34 | Clojure var whose function takes three arguments: the object to print, the 35 | `java.io.PrintWriter` to print on, and a (possibly nil) map of options. 36 | 37 | ``` el 38 | (setq cider-print-fn "user/my-pprint") 39 | ``` 40 | 41 | Here's one example: 42 | 43 | ``` clojure 44 | (ns cider.pprint 45 | (:require 46 | [clojure.pprint :as pp])) 47 | 48 | (defn pprint 49 | "A simple wrapper around `clojure.pprint/write`. 50 | 51 | Its signature is compatible with the expectations of nREPL's wrap-print 52 | middleware." 53 | [value writer options] 54 | (apply pp/write value (mapcat identity (assoc options :stream writer)))) 55 | ``` 56 | 57 | ## Limiting printed output 58 | 59 | You can set `cider-print-quota` to limit the number of bytes that will be 60 | returned by any printing operation. This defaults to one megabyte, and can be 61 | set to `nil` if no limit is desired. Note well that if no quota is set some 62 | printing operations may never terminate – you can still use `cider-interrupt` to 63 | halt them. 64 | 65 | Your configured printing function might also support limiting the length and 66 | depth of printed objects – either using `clojure.core/*print-length*` and 67 | `clojure.core/*print-level*` or in the provided [options map](#print-options). 68 | 69 | ## Print options 70 | 71 | You can pass an options map to the print function by setting `cider-print-options`. Here's an example: 72 | 73 | ``` el 74 | (setq cider-print-options '(dict "length" 50 "right-margin" 70)) 75 | ``` 76 | 77 | !!! Important 78 | 79 | Note that each print engine has its own configuration options, so you'll have to be sure to set `cider-print-options` accordingly. 80 | 81 | Here's a table describing the differences in the names for the most common print 82 | options supported by every print engine. 83 | 84 | | `clojure.core/pr` | `clojure.pprint` | Fipp & Puget | zprint | 85 | |---------------------------------------|------------------|----------------|--------------| 86 | | `clojure.core/*print-length*` | `length` | `print-length` | `max-length` | 87 | | `clojure.core/*print-level*` | `level` | `print-level` | `max-depth` | 88 | | `clojure.pprint/*print-right-margin*` | `right-margin` | `width` | `width` | 89 | 90 | Not all printing engines use (or default to) the dynamic variables in all cases, 91 | so setting them at the REPL may or may not have the intended effect. See the 92 | respective documentation of each engine: 93 | 94 | - `clojure.core/pr`: https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/*print-dup* 95 | - `clojure.pprint`: https://clojuredocs.org/clojure.pprint/write 96 | - Fipp: https://github.com/brandonbloom/fipp/#printer-usage 97 | - Puget: https://github.com/greglook/puget#usage 98 | - zprint: https://github.com/kkinnear/zprint/#what-is-configurable 99 | 100 | ## Width of printed output 101 | 102 | If you're using one of the printing engines provided with CIDER, the value of 103 | `fill-column` will be used for the relevant width option in the [options 104 | map](#print-options). You can override this by hardcoding the relevant option in 105 | `cider-print-options`. 106 | -------------------------------------------------------------------------------- /legacy-manual/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 r] \ns{cider-clojuredocs} 120 | \item[C-c C-d h] \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 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/config/indentation.adoc: -------------------------------------------------------------------------------- 1 | = Indentation 2 | 3 | CIDER relies on `clojure-mode` to do the indentation of Clojure code. While `clojure-mode` 4 | will generally indent code "the right way" from time to time you might want to teach it 5 | how to indent certain macros. 6 | 7 | There are two ways to do this - you can either add some indentation configuration in your Emacs config 8 | or you can add it to your Clojure code and let CIDER generate the necessary configuration for 9 | `clojure-mode` automatically. We'll refer to the first approach as "static indentation" and to the second 10 | one as "dynamic indentation". 11 | 12 | == Static Indentation 13 | 14 | NOTE: Everything is this section will work as described even if CIDER is not present/active. Static indentation 15 | doesn't require a REPL to work. 16 | 17 | `clojure-mode` is smart enough to indent most Clojure code correctly out-of-the-box, but it can't know 18 | if something is a macro and its body should be indented different. 19 | 20 | `clojure-mode` is very flexible when it comes to indentation configuration and here we are going to go over the basics. 21 | 22 | === Indentation Modes 23 | 24 | There are few common ways to indent Clojure code and all of them are supported by `clojure-mode`. 25 | 26 | The indentation of function forms is configured by the variable 27 | `clojure-indent-style`. It takes three possible values: 28 | 29 | - `always-align` (the default) 30 | 31 | [source,clojure] 32 | ---- 33 | (some-function 34 | 10 35 | 1 36 | 2) 37 | (some-function 10 38 | 1 39 | 2) 40 | ---- 41 | 42 | - `always-indent` 43 | 44 | [source,clojure] 45 | ---- 46 | (some-function 47 | 10 48 | 1 49 | 2) 50 | (some-function 10 51 | 1 52 | 2) 53 | ---- 54 | 55 | - `align-arguments` 56 | 57 | [source,clojure] 58 | ---- 59 | (some-function 60 | 10 61 | 1 62 | 2) 63 | (some-function 10 64 | 1 65 | 2) 66 | ---- 67 | 68 | TIP: You can read more about the indentation options in `clojure-mode` https://github.com/clojure-emacs/clojure-mode#indentation-options[here]. 69 | 70 | === Macro Indentation 71 | 72 | As mentioned earlier `clojure-mode` can't know if something in your code is a macro that has to be indented 73 | differently from a regular function invocation (most likely because the macro takes some forms as parameters). 74 | In such situation you need to 75 | teach `clojure-mode` how to indent the macro in question. Consider this simple example: 76 | 77 | [source,clojure] 78 | ---- 79 | (defmacro with-in-str 80 | "[DOCSTRING]" 81 | {:style/indent 1} 82 | [s & body] 83 | ...cut for brevity...) 84 | 85 | ;; Target indentation 86 | (with-in-str str 87 | (foo) 88 | (bar) 89 | (baz)) 90 | ---- 91 | 92 | To get `clojure-mode` to indent it properly you'll need to add the following code to your Emacs config: 93 | 94 | [source,lisp] 95 | ---- 96 | (put-clojure-indent 'with-in-str 1) 97 | 98 | ;; or 99 | 100 | (define-clojure-indent 101 | (with-in-str 1) 102 | ---- 103 | 104 | TIP: You can find more details https://github.com/clojure-emacs/clojure-mode#indentation-of-macro-forms[here]. 105 | 106 | == Dynamic Indentation 107 | 108 | It is common for macros to require special indentation mechanisms. This is most 109 | common in macros that start with `do`, `def`, or `with-`. CIDER has some 110 | heuristics to detect these macros, but it also lets you explicitly specify how 111 | a macro should be indented. 112 | 113 | Here's a simple example of how someone would specify the indent spec for a macro 114 | they've written (using an example in core): 115 | 116 | [source,clojure] 117 | ---- 118 | (defmacro with-in-str 119 | "[DOCSTRING]" 120 | {:style/indent 1} 121 | [s & body] 122 | ...cut for brevity...) 123 | 124 | ;; Target indentation 125 | (with-in-str str 126 | (foo) 127 | (bar) 128 | (baz)) 129 | ---- 130 | 131 | And here's a more complex one: 132 | 133 | [source,clojure] 134 | ---- 135 | (defmacro letfn 136 | "[DOCSTRING]" 137 | {:style/indent [1 [[:defn]] :form]} 138 | [fnspecs & body] 139 | ...cut for brevity...) 140 | 141 | ;; Target indentation 142 | (letfn [(six-times [y] 143 | (* (twice y) 3)) 144 | (twice [x] 145 | (* x 2))] 146 | (println "Twice 15 =" (twice 15)) 147 | (println "Six times 15 =" (six-times 15))) 148 | ---- 149 | 150 | Don't worry if this looks intimidating. For most macros the indent spec should 151 | be either just a number, or one of the keywords `:defn` or `:form`. A full 152 | description of the spec is provided in the 153 | xref:indent_spec.adoc[indent spec section of the manual]. 154 | 155 | If you _don't_ want to use this feature, you can disable it by setting 156 | `cider-dynamic-indentation` to `nil` in your Emacs init file. 157 | 158 | [source,lisp] 159 | ---- 160 | (setq cider-dynamic-indentation nil) 161 | ---- 162 | -------------------------------------------------------------------------------- /legacy-manual/additional_packages.md: -------------------------------------------------------------------------------- 1 | # Additional Packages 2 | 3 | There are many additional Emacs packages that can enhance your Clojure programming 4 | experience. The majority of the minor modes listed here should be enabled for both 5 | `cider-repl-mode` and `clojure-mode` for optimal effects. 6 | 7 | ## clj-refactor 8 | 9 | [clr-refactor](https://github.com/clojure-emacs/clj-refactor.el) builds on top 10 | of clojure-mode and CIDER and adds a ton of extra functionality (e.g. the 11 | ability to thread/unthread expression, find and replace usages, introduce let 12 | bindings, extract function and so on). 13 | 14 | A full list of features is available 15 | [here](https://github.com/clojure-emacs/clj-refactor.el/wiki). 16 | 17 | We hope to incorporate some of its features into clojure-mode and CIDER themselves 18 | down the road. 19 | 20 | **Make sure that the version of `clj-refactor` you've installed is compatible with 21 | your CIDER version.** 22 | 23 | ## emidje 24 | 25 | [Emidje](https://github.com/nubank/emidje) is a test runner, report 26 | viewer and formatting tool for 27 | [Midje](https://github.com/marick/Midje) within Emacs. 28 | 29 | Emidje extends CIDER to provide support for Midje tests in a similar 30 | fashion as `cider-test.el` does for clojure.test tests. In fact, most of 31 | Emidje functionalities were strongly inspired on `cider-test.el` 32 | features. 33 | 34 | ## helm-cider 35 | 36 | [helm-cider](https://github.com/clojure-emacs/helm-cider) provides Helm 37 | interface for certain CIDER commands (e.g. `cider-apropos`). 38 | 39 | ## cider-hydra 40 | 41 | [cider-hydra](https://github.com/clojure-emacs/cider-hydra) provides a nice way 42 | to navigate groups of related CIDER commands. 43 | 44 | You can think of it as a fancier [which-key](https://github.com/justbur/emacs-which-key). 45 | 46 | ## squiggly-clojure 47 | 48 | [squiggly-clojure](https://github.com/clojure-emacs/squiggly-clojure) is a 49 | Flycheck checker for Clojure, using tools like 50 | [eastwood](https://github.com/jonase/eastwood), 51 | [core.typed](http://typedclojure.org/) and 52 | [kibit](https://github.com/jonase/kibit). 53 | 54 | ## sayid 55 | 56 | [sayid](http://bpiel.github.io/sayid/) is a powerful alternative of CIDER's 57 | built-in basic tracing functionality. 58 | 59 | ## Inf-clojure 60 | 61 | This package provides basic interaction with a Clojure subprocess (REPL). It's 62 | based on ideas from the popular inferior-lisp package. 63 | 64 | [inf-clojure](https://github.com/clojure-emacs/inf-clojure) has two components - 65 | a nice Clojure REPL with auto-completion and a minor mode 66 | (`inf-clojure-minor-mode`), which extends clojure-mode with commands to evaluate 67 | forms directly in the REPL. 68 | 69 | It's basically a simple alternative of CIDER, which provides a subset of CIDER's 70 | functionality. 71 | 72 | ## subword-mode 73 | 74 | Enabling `CamelCase` support for editing commands(like 75 | `forward-word`, `backward-word`, etc) in the REPL is quite useful since 76 | we often have to deal with Java class and method names. The built-in 77 | Emacs minor mode `subword-mode` provides such functionality: 78 | 79 | ```el 80 | (add-hook 'cider-repl-mode-hook #'subword-mode) 81 | ``` 82 | 83 | ## Paredit 84 | 85 | The use of [paredit](http://mumble.net/~campbell/emacs/paredit.html) 86 | when editing Clojure (or any other Lisp) code is highly 87 | recommended. You're probably using it already in your `clojure-mode` 88 | buffers (if you're not you probably should). You might also want to 89 | enable `paredit` in the REPL buffer as well: 90 | 91 | ```el 92 | (add-hook 'cider-repl-mode-hook #'paredit-mode) 93 | ``` 94 | 95 | ## Smartparens 96 | 97 | [smartparens](https://github.com/Fuco1/smartparens) is an excellent alternative 98 | to paredit. Many Clojure hackers have adopted it recently and you might want 99 | to give it a try as well. To enable `smartparens` in the REPL buffer use the 100 | following code: 101 | 102 | ```el 103 | (add-hook 'cider-repl-mode-hook #'smartparens-strict-mode) 104 | ``` 105 | 106 | ## rainbow-delimiters 107 | 108 | [RainbowDelimiters](https://github.com/Fanael/rainbow-delimiters) is a minor 109 | mode which highlights parentheses, brackets, and braces according to their 110 | depth. Each successive level is highlighted in a different color. This makes it 111 | easy to spot matching delimiters, orient yourself in the code, and tell which 112 | statements are at a given depth. Assuming you've already installed 113 | RainbowDelimiters you can enable it in the REPL like this: 114 | 115 | ```el 116 | (add-hook 'cider-repl-mode-hook #'rainbow-delimiters-mode) 117 | ``` 118 | 119 | ## eval-sexp-fu 120 | 121 | [eval-sexp-fu](https://github.com/hchbaw/eval-sexp-fu.el) provides some visual 122 | feedback when evaluating expressions. [cider-eval-sexp-fu](https://github.com/clojure-emacs/cider-eval-sexp-fu) provides 123 | CIDER integration for `eval-sexp-fu`. 124 | 125 | ```el 126 | (require 'cider-eval-sexp-fu) 127 | ``` 128 | -------------------------------------------------------------------------------- /test/cider-interaction-tests.el: -------------------------------------------------------------------------------- 1 | ;;; cider-eval-tests.el 2 | 3 | ;; Copyright © 2012-2019 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-eval) 32 | (require 'cider-connection-test-utils) 33 | 34 | (describe "cider--var-namespace" 35 | (it "returns the namespace of a var" 36 | (expect (cider--var-namespace "#'a/var-two") :to-equal "a") 37 | (expect (cider--var-namespace "#'a-two/var") :to-equal "a-two") 38 | (expect (cider--var-namespace "#'a.two-three.b/var-c") :to-equal "a.two-three.b") 39 | (expect (cider--var-namespace "a/var-two") :to-equal "a") 40 | (expect (cider--var-namespace "a-two/var") :to-equal "a-two") 41 | (expect (cider--var-namespace "a.two-three.b/var-c") 42 | :to-equal "a.two-three.b"))) 43 | 44 | (describe "cider-to-nrepl-filename-function" 45 | (let ((windows-file-name "C:/foo/bar") 46 | (unix-file-name "/cygdrive/c/foo/bar")) 47 | (if (eq system-type 'cygwin) 48 | (and (expect (funcall cider-from-nrepl-filename-function windows-file-name) 49 | :to-equal unix-file-name) 50 | (expect (funcall cider-to-nrepl-filename-function unix-file-name) 51 | :to-equal windows-file-name)) 52 | 53 | (and (expect (funcall cider-from-nrepl-filename-function unix-file-name) 54 | :to-equal unix-file-name) 55 | (expect (funcall cider-to-nrepl-filename-function unix-file-name) 56 | :to-equal unix-file-name))))) 57 | 58 | (describe "cider-quit" 59 | (it "raises a user error if cider is not connected" 60 | (spy-on 'cider-connected-p :and-return-value nil) 61 | (expect (cider-quit) :to-throw 'user-error))) 62 | 63 | (describe "cider-restart" 64 | (it "raises a user error if cider is not connected" 65 | (spy-on 'cider-connected-p :and-return-value nil) 66 | (expect (cider-restart) :to-throw 'user-error))) 67 | 68 | (describe "cider-load-all-project-ns" 69 | (it "raises a user error if cider is not connected" 70 | (spy-on 'cider-connected-p :and-return-value nil) 71 | (expect (cider-load-all-project-ns) :to-throw 'user-error)) 72 | (it "raises a user error if the op is not supported" 73 | (spy-on 'cider-nrepl-op-supported-p :and-return-value nil) 74 | (expect (cider-load-all-project-ns) :to-throw 'user-error))) 75 | 76 | (describe "cider-load-file" 77 | (it "works as expected in empty Clojure buffers" 78 | (spy-on 'cider-request:load-file :and-return-value nil) 79 | (let ((default-directory "/tmp/a-dir")) 80 | (with-repl-buffer "load-file-session" 'clj b 81 | (with-temp-buffer 82 | (clojure-mode) 83 | (setq buffer-file-name (make-temp-name "tmp.clj")) 84 | (expect (cider-load-buffer) :not :to-throw)))))) 85 | 86 | (describe "cider-interactive-eval" 87 | (it "works as expected in empty Clojure buffers" 88 | (spy-on 'cider-nrepl-request:eval :and-return-value nil) 89 | (let ((default-directory "/tmp/a-dir")) 90 | (with-repl-buffer "interaction-session" 'clj b 91 | (with-temp-buffer 92 | (clojure-mode) 93 | (expect (cider-interactive-eval "(+ 1)") :not :to-throw)))))) 94 | 95 | (describe "cider--calculate-opening-delimiters" 96 | (it "returns the right opening delimiters" 97 | (with-temp-buffer 98 | (clojure-mode) 99 | (insert "(let [a 1] (let [b 2] (+ a b)))") 100 | (backward-char 2) 101 | (expect (cider--calculate-opening-delimiters) :to-equal '(40 40))))) 102 | 103 | (describe "cider--matching-delimiter" 104 | (it "returns the right closing delimiter" 105 | (expect (cider--matching-delimiter ?\() :to-equal ?\)) 106 | (expect (cider--matching-delimiter ?\{) :to-equal ?\}) 107 | (expect (cider--matching-delimiter ?\[) :to-equal ?\])) 108 | (it "returns the right opening delimiter" 109 | (expect (cider--matching-delimiter ?\)) :to-equal ?\() 110 | (expect (cider--matching-delimiter ?\}) :to-equal ?\{) 111 | (expect (cider--matching-delimiter ?\]) :to-equal ?\[))) 112 | -------------------------------------------------------------------------------- /cider-clojuredocs.el: -------------------------------------------------------------------------------- 1 | ;;; cider-clojuredocs.el --- ClojureDocs integration -*- lexical-binding: t -*- 2 | 3 | ;; Copyright © 2014-2019 Bozhidar Batsov and CIDER contributors 4 | ;; 5 | ;; Author: Bozhidar Batsov 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 | ;; A few commands for ClojureDocs documentation lookup. 25 | 26 | ;;; Code: 27 | 28 | (require 'cider-client) 29 | (require 'cider-common) 30 | (require 'subr-x) 31 | (require 'cider-compat) 32 | (require 'cider-popup) 33 | 34 | (require 'nrepl-dict) 35 | 36 | (require 'url-vars) 37 | 38 | (defconst cider-clojuredocs-url "https://clojuredocs.org/") 39 | 40 | (defconst cider-clojuredocs-buffer "*cider-clojuredocs*") 41 | 42 | (defun cider-sync-request:clojuredocs-lookup (ns sym) 43 | "Perform nREPL \"resource\" op with NS and SYM." 44 | (thread-first `("op" "clojuredocs-lookup" 45 | "ns" ,ns 46 | "symbol" ,sym) 47 | (cider-nrepl-send-sync-request) 48 | (nrepl-dict-get "clojuredocs"))) 49 | 50 | (defun cider-clojuredocs-replace-special (name) 51 | "Convert the dashes in NAME to a ClojureDocs friendly format. 52 | We need to handle \"?\", \".\", \"..\" and \"/\"." 53 | (thread-last name 54 | (replace-regexp-in-string "\\?" "_q") 55 | (replace-regexp-in-string "\\(\\.+\\)" "_\\1") 56 | (replace-regexp-in-string "/" "fs"))) 57 | 58 | (defun cider-clojuredocs-url (name ns) 59 | "Generate a ClojureDocs url from NAME and NS." 60 | (let ((base-url cider-clojuredocs-url)) 61 | (when (and name ns) 62 | (concat base-url ns "/" (cider-clojuredocs-replace-special name))))) 63 | 64 | (defun cider-clojuredocs-web-lookup (symbol) 65 | "Open the ClojureDocs documentation for SYMBOL in a web browser." 66 | (if-let* ((var-info (cider-var-info symbol))) 67 | (let ((name (nrepl-dict-get var-info "name")) 68 | (ns (nrepl-dict-get var-info "ns"))) 69 | (browse-url (cider-clojuredocs-url name ns))) 70 | (error "Symbol %s not resolved" symbol))) 71 | 72 | ;;;###autoload 73 | (defun cider-clojuredocs-web (&optional arg) 74 | "Open ClojureDocs documentation in the default web browser. 75 | 76 | Prompts for the symbol to use, or uses the symbol at point, depending on 77 | the value of `cider-prompt-for-symbol'. With prefix arg ARG, does the 78 | opposite of what that option dictates." 79 | (interactive "P") 80 | (funcall (cider-prompt-for-symbol-function arg) 81 | "ClojureDocs doc for" 82 | #'cider-clojuredocs-web-lookup)) 83 | 84 | (defun cider-create-clojuredocs-buffer (content) 85 | "Create a new ClojureDocs buffer with CONTENT." 86 | (with-current-buffer (cider-popup-buffer cider-clojuredocs-buffer t) 87 | (read-only-mode -1) 88 | (insert content) 89 | (cider-popup-buffer-mode 1) 90 | (view-mode 1) 91 | (goto-char (point-min)) 92 | (current-buffer))) 93 | 94 | (defun cider-clojuredocs--content (dict) 95 | "Generate a nice string from DICT." 96 | (with-temp-buffer 97 | (insert "= " (nrepl-dict-get dict "ns") "/" (nrepl-dict-get dict "name") "\n") 98 | (insert "== See Also\n") 99 | (insert "== Examples\n") 100 | (insert "== Notes\n") 101 | (buffer-string))) 102 | 103 | (defun cider-clojuredocs-lookup (symbol) 104 | "Look up the ClojureDocs documentation for SYMBOL. 105 | 106 | If SYMBOL is a special form, the clojure.core ns is used, as is 107 | ClojureDocs's convention." 108 | (if-let* ((var-info (cider-var-info symbol))) 109 | (let* ((name (nrepl-dict-get var-info "name")) 110 | (ns (nrepl-dict-get var-info "ns" "clojure.core")) 111 | (docs (cider-sync-request:clojuredocs-lookup ns name))) 112 | (pop-to-buffer (cider-create-clojuredocs-buffer (cider-clojuredocs--content docs)))) 113 | (error "Symbol %s not resolved" symbol))) 114 | 115 | ;;;###autoload 116 | (defun cider-clojuredocs (&optional arg) 117 | "Open ClojureDocs documentation in a popup buffer. 118 | 119 | Prompts for the symbol to use, or uses the symbol at point, depending on 120 | the value of `cider-prompt-for-symbol'. With prefix arg ARG, does the 121 | opposite of what that option dictates." 122 | (interactive "P") 123 | (when (derived-mode-p 'clojurescript-mode) 124 | (user-error "`cider-clojuredocs' doesn't support ClojureScript")) 125 | (funcall (cider-prompt-for-symbol-function arg) 126 | "ClojureDocs doc for" 127 | #'cider-clojuredocs-lookup)) 128 | 129 | (provide 'cider-clojuredocs) 130 | 131 | ;;; cider-clojuredocs.el ends here 132 | -------------------------------------------------------------------------------- /legacy-manual/index.md: -------------------------------------------------------------------------------- 1 |

2 | CIDER Logo 3 |

4 | 5 | !!! Warning 6 | 7 | This manual is now deprecated. Please visit the [new manual](https://docs.cider.mx). 8 | 9 | CIDER is the **C**lojure(Script) **I**nteractive **D**evelopment **E**nvironment 10 | that **R**ocks! 11 | 12 | CIDER extends Emacs with support for interactive programming in Clojure. The 13 | features are centered around `cider-mode`, an Emacs minor-mode that complements 14 | [clojure-mode][]. While `clojure-mode` supports editing Clojure source files, 15 | `cider-mode` adds support for interacting with a running Clojure process for 16 | compilation, debugging, definition and documentation lookup, running tests and 17 | so on. 18 | 19 | !!! Note 20 | 21 | CIDER was originally inspired by the powerful Common Lisp interactive 22 | development environment [SLIME][]. In the beginning we started by 23 | adapting SLIME's core functionality to Clojure, but over the course of time 24 | CIDER became pretty different from SLIME in many areas. Check out 25 | [this presentation](https://www.youtube.com/watch?v=4X-1fJm25Ww&list=PLZdCLR02grLoc322bYirANEso3mmzvCiI&index=6) 26 | if you'd like to know more about CIDER's early history. 27 | 28 | **Please consider 29 | [supporting financially its ongoing development](about/contributing.md#funding).** 30 | 31 | ## Overview 32 | 33 | CIDER aims to provide an interactive development experience similar to the one 34 | you'd get when programming in Emacs Lisp, Common Lisp (with [SLIME][] or [Sly][]), 35 | Scheme (with [Geiser][]) and Smalltalk. 36 | 37 | Programmers are expected to program in a very dynamic and incremental manner, 38 | constantly re-evaluating existing Clojure definitions and adding new ones to 39 | their running applications. You never stop/start a Clojure application while 40 | using CIDER - you're constantly interacting with it and changing it. 41 | 42 | You can find more details about the typical CIDER workflow in the 43 | [Interactive Programming](interactive_programming.md) section. While we're a bit 44 | short on video tutorials, you can check out this 45 | [into to CIDER](https://www.youtube.com/watch?v=aYA4AAjLfT0) to get a 46 | feel about what do we mean by an "Interactive Development Environment". 47 | 48 | CIDER's built on top of [nREPL][], the Clojure networked REPL server. 49 | 50 | CIDER's basic architecture looks something like this: 51 | 52 |

53 | 54 |

55 | 56 | Clojure code gets executed by an nREPL server. CIDER sends requests to the 57 | server and processes its responses. The server's functionality is augmented by 58 | additional [nREPL middleware][cider-nrepl], designed specifically to address the needs of an 59 | interactive development environment like CIDER. 60 | 61 | 62 | !!! Note 63 | 64 | Much of the nREPL middleware we originally 65 | developed for CIDER is editor-agnostic and is being used by other Clojure 66 | development environments as well (e.g. [vim-fireplace][] & [calva][]). 67 | 68 | CIDER packs plenty of features. Here are some of them (in no particular order): 69 | 70 | * [Powerful REPL](using_the_repl.md) 71 | * [Interactive code evaluation](interactive_programming.md) 72 | * Compilation notes (error and warning highlighting) 73 | * [Human-friendly stacktraces](navigating_stacktraces.md) 74 | * [Smart code completion](code_completion.md) 75 | * Definition lookup 76 | * Documentation lookup 77 | * Resource lookup 78 | * Apropos 79 | * [Debugger](debugging.md) 80 | * [Value inspector](miscellaneous_features.md#value-inspection) 81 | * [Function tracing](miscellaneous_features.md#tracing-function-execution) 82 | * [Interactive macroexpansion](miscellaneous_features.md#macroexpansion) 83 | * Enhanced Clojure font-locking and indentation 84 | * [Grimoire](http://conj.io/) integration 85 | * [`clojure.test` integration](running_tests.md) 86 | * [Smart code reloading](miscellaneous_features.md#code-reloading) 87 | * [Pretty-printing of results](pretty_printing.md) 88 | * [Classpath browser](miscellaneous_features.md#classpath-browser) 89 | * [Namespace browser](miscellaneous_features.md#namespace-browser) 90 | * [REPL history browser](miscellaneous_features.md#repl-history-browser) 91 | * nREPL session management 92 | * [Scratchpad](miscellaneous_features.md#using-a-scratchpad) 93 | * [Minibuffer code evaluation](miscellaneous_features.md#evaluating-clojure-code-in-the-minibuffer) 94 | * Integration with [company-mode][] 95 | * [Support for working with multiple REPLs](managing_connections.md) 96 | 97 | ![CIDER Screenshot](images/cider-overview.png) 98 | 99 | [nREPL]: https://github.com/nrepl/nrepl 100 | [SLIME]: https://github.com/slime/slime 101 | [Sly]: https://github.com/capitaomorte/sly 102 | [Geiser]: https://github.com/jaor/geiser 103 | [company-mode]: http://company-mode.github.io/ 104 | [leiningen]: http://leiningen.org/ 105 | [boot]: http://boot-clj.com/ 106 | [piggieback]: https://github.com/nrepl/piggieback 107 | [vim-fireplace]: https://github.com/tpope/vim-fireplace 108 | [calva]: https://github.com/BetterThanTomorrow/calva 109 | [cider-nrepl]: https://github.com/clojure-emacs/cider-nrepl 110 | [clojure-mode]: https://github.com/clojure-emacs/clojure-mode 111 | [which-key]: https://github.com/justbur/emacs-which-key 112 | --------------------------------------------------------------------------------