Skip to content

Commit 5023a0b

Browse files
authored
Update docs and variables related to enrich-classpath (clojure-emacs#3152)
1 parent 398b370 commit 5023a0b

File tree

7 files changed

+22
-106
lines changed

7 files changed

+22
-106
lines changed

Diff for: CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
* `cider-jack-in-lein-plugins` no longer affects non-Leiningen projects.
1111
* Third-party packages should rely on `cider-jack-in-dependencies` instead.
1212
* Upgrade cider-nrepl to [0.28.3](https://github.com/clojure-emacs/cider-nrepl/blob/v0.28.3/CHANGELOG.md#0283-2022-02-22).
13+
* Enable `cider-enrich-classpath` by default.
14+
* Remove `cider-jdk-src-paths` defcustom since enrich-classpath makes it redundant.
15+
* Remove `cider-resolve-java-class` function since enrich-classpath makes it redundant.
1316

1417
### Bugs fixed
1518

Diff for: cider-stacktrace.el

-1
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,6 @@ Achieved by destructively manipulating `cider-stacktrace-suppressed-errors'."
542542
(line-shift (- (or (button-get button 'line) 0)
543543
(or (nrepl-dict-get info "line") 1)))
544544
(file (or
545-
(and (null var) (cider-resolve-java-class class))
546545
(nrepl-dict-get info "file")
547546
(button-get button 'file)))
548547
;; give priority to `info` files as `info` returns full paths.

Diff for: cider-util.el

-28
Original file line numberDiff line numberDiff line change
@@ -797,34 +797,6 @@ KIND can be the symbols `ns', `var', `emph', `fn', or a face name."
797797
(t x)))
798798
menu-list))
799799

800-
(defcustom cider-jdk-src-paths '("/usr/lib/jvm/openjdk-8/src.zip")
801-
"Used by `cider-stacktrace-navigate'.
802-
Zip/jar files work, but it's better to extract them and put the directory
803-
paths here. Clojure sources here:
804-
https://repo1.maven.org/maven2/org/clojure/clojure/1.8.0/."
805-
:group 'cider
806-
:package-version '(cider . "0.17.0")
807-
:type '(list string))
808-
809-
(defun cider-resolve-java-class (class)
810-
"Return a path to a Java source file that corresponds to CLASS.
811-
812-
This will be a zip/jar path for archived sources and a normal
813-
file path otherwise."
814-
(when class
815-
(let ((file-name (concat (replace-regexp-in-string "\\." "/" class) ".java")))
816-
(cl-find-if
817-
'file-exists-p
818-
(mapcar
819-
(lambda (d)
820-
(cond ((file-directory-p d)
821-
(expand-file-name file-name d))
822-
((and (file-exists-p d)
823-
(member (file-name-extension d) '("jar" "zip")))
824-
(format "zip:file:%s!/%s" d file-name))
825-
(t (error "Unexpected archive: %s" d))))
826-
cider-jdk-src-paths)))))
827-
828800
(provide 'cider-util)
829801

830802
;;; cider-util.el ends here

Diff for: doc/modules/ROOT/pages/about/compatibility.adoc

+5-2
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,16 @@ and Boot releases.
1717

1818
== Java
1919

20-
CIDER officially targets Java 8, Java 11 and the most recent rapid
21-
release version (e.g. Java 15). Generally speaking, we aim
20+
CIDER officially targets Java 8, Java 11, Java 17, and the most recent rapid
21+
release version (e.g. Java 18). Generally speaking, we aim
2222
to support all Java releases that are currently officially supported
2323
by Oracle.
2424

2525
NOTE: The requirements for Java are pretty much ``cider-nrepl``'s requirements.
2626

27+
On Linux you are also strongly advised to make sure that JDK sources and javadocs are installed.
28+
You can find example commands in xref:troubleshooting.adoc#navigation-to-jdk-sources-doesnt-work[Troubleshooting].
29+
2730
== Clojure
2831

2932
CIDER targets Clojure 1.8+. As Clojure doesn't have the concept of supported releases

Diff for: doc/modules/ROOT/pages/config/basic_config.adoc

-61
Original file line numberDiff line numberDiff line change
@@ -211,67 +211,6 @@ different configurations.
211211
In this example, the path `/src` will be translated to the correct path of your
212212
Clojure project on the host machine. And `/root/.m2` to the host's `~/.m2` folder.
213213

214-
== Use a Local Copy of the JDK API Documentation
215-
216-
If you are targeting the JVM and prefer a local copy of the JDK API
217-
documentation over Oracle's official copy (e.g., for
218-
http://docs.oracle.com/javase/8/docs/api/[JavaSE 8]), per nREPL's
219-
http://docs.oracle.com/javase/8/docs/api/[`javadoc-info` logic (accurate as of 29 Dec 2014)],
220-
you can arrange your project to include the *root* path of the local API doc
221-
(i.e., where the `index.html` is located) to be included on your classpath
222-
(i.e., where the doc HTML files can be located by
223-
`clojure.java.io/resource`). For example, for Leiningen, with the local API
224-
path being `/usr/share/doc/java/api/`, put the following line in
225-
`project.clj`:
226-
227-
[source,clojure]
228-
----
229-
:dev {:resource-paths ["/usr/share/doc/java/api/"]}
230-
----
231-
232-
*or* the following line in `$HOME/.lein/profiles.clj`:
233-
234-
[source,clojure]
235-
----
236-
:user {:resource-paths ["/usr/share/doc/java/api/"]}
237-
----
238-
239-
More details can be found https://github.com/clojure-emacs/cider/issues/930[here].
240-
241-
== Use a Local Copy of the Java Source Code
242-
243-
When an exception is thrown, e.g. when eval-ing `(. clojure.lang.RT foo)`, a
244-
stack trace pops up. Some places of the stack trace link to Clojure files,
245-
others to Java files. By default, you can click the Clojure file links to
246-
navigate there. If you configure `cider-jdk-src-paths`, you can also click the
247-
Java file links to navigate there.
248-
249-
On Windows and macOS the JDK source code is bundled with the JDK. On Windows its
250-
typical location is `+C:\Program Files\Java\{jdk-version}\src.zip+`
251-
and on macOS it's `+/Library/Java/JavaVirtualMachines/{jdk-version}/Contents/Home/src.zip+`.
252-
253-
On Linux distributions usually the source code is distributed as a separate package.
254-
Here's how do get the JDK 8 source on Debian/Ubuntu:
255-
256-
$ sudo apt install openjdk-8-source
257-
258-
The zip is installed to `/usr/lib/jvm/openjdk-8/src.zip`.
259-
260-
Here's how to get the JDK 11 source on Red Hat/Fedora:
261-
262-
$ sudo dnf install java-11-openjdk-src
263-
264-
You can download Clojure Java source code from
265-
https://repo1.maven.org/maven2/org/clojure/clojure/1.8.0/clojure-1.8.0-sources.jar[here].
266-
267-
Extract both and configure e.g. like so:
268-
269-
(setq cider-jdk-src-paths '("~/java/clojure-1.8.0-sources"
270-
"~/java/openjvm-8-src"))
271-
272-
It's possible to point `cider-jdk-src-paths` to `jar` or `zip` files, but extracting
273-
them is better since you can use features like `ag` or `dired-jump`.
274-
275214
== Filter out namespaces in certain namespace-related commands
276215

277216
You can hide all nREPL middleware details from `cider-browse-ns*` and `cider-apropos*`

Diff for: doc/modules/ROOT/pages/troubleshooting.adoc

+13-3
Original file line numberDiff line numberDiff line change
@@ -310,20 +310,30 @@ the `enrich-classpath` integration like this:
310310

311311
=== Navigation to JDK sources doesn't work
312312

313-
If you can't navigate to the source of built-in methods like `.toUpperCase` you
313+
Firstly, make sure that you are using enrich-classpath. `cider-enrich-classpath` should be truthy.
314+
If you are launching your own repl process, it should have the enrich-classpath Leiningen plugin or `clojure` wrapper.
315+
316+
If you are on Linux and still can't navigate to the source of built-in methods like `.toUpperCase` you
314317
probably haven't installed the JDK sources. While you're at it - it's good to
315318
install the JDK's Javadocs as well. On Debian/Ubuntu:
316319

317320
[source,shell]
318321
----
319-
$ sudo apt install openjdk-11-source openjdk-11-doc
322+
$ sudo apt install openjdk-17-source openjdk-17-doc
320323
----
321324

322325
On Red Hat/Fedora/CentOS:
323326

324327
[source,shell]
325328
----
326-
$ sudo dnf install java-11-openjdk-src java-11-openjdk-javadoc
329+
$ sudo dnf install java-17-openjdk-src java-17-openjdk-javadoc
330+
----
331+
332+
On Guix:
333+
334+
[source,shell]
335+
----
336+
$ guix package -i openjdk:jdk
327337
----
328338

329339
NOTE: On Windows and macOS the JDK source code is bundled with the JDK.

Diff for: doc/modules/ROOT/pages/usage/working_with_documentation.adoc

+1-11
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,7 @@ by the symbol (special form, var, Java method, etc).
1616
CIDER provides a quick access to the online Javadoc documentation
1717
via the command `cider-javadoc`.
1818

19-
By default this will work only for Java code that's part of Clojure
20-
or the JDK. You can add additional remote JavaDoc URLs manually like this:
21-
22-
[source,clojure]
23-
----
24-
(javadoc/add-remote-javadoc "com.amazonaws." "http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/")
25-
(javadoc/add-remote-javadoc "org.apache.kafka." "https://kafka.apache.org/090/javadoc/")
26-
----
27-
28-
Down the road we might simplify the process by adding the ability to
29-
specify such mappings via CIDER's configuration.
19+
This requires `enrich-classpath` to be enabled.
3020

3121
== ClojureDocs
3222

0 commit comments

Comments
 (0)