Skip to content

Commit 44d0d5b

Browse files
committed
upgrade cider
1 parent 021adb6 commit 44d0d5b

38 files changed

+522
-382
lines changed

elpa/cider-0.18.0/cider-apropos.el renamed to elpa/cider-0.20.0/cider-apropos.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
;;; cider-apropos.el --- Apropos functionality for Clojure -*- lexical-binding: t -*-
22

3-
;; Copyright © 2014-2018 Jeff Valk, Bozhidar Batsov and CIDER contributors
3+
;; Copyright © 2014-2019 Jeff Valk, Bozhidar Batsov and CIDER contributors
44
;;
55
;; Author: Jeff Valk <jv@jeffvalk.com>
66

elpa/cider-0.18.0/cider-autoloads.el renamed to elpa/cider-0.20.0/cider-autoloads.el

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
Display CIDER's version.
1414
1515
\(fn)" t nil)
16+
(autoload 'cider-start-map "cider" "CIDER jack-in and connect keymap." t 'keymap)
1617

1718
(autoload 'cider-jack-in-clj "cider" "\
1819
Start an nREPL server for the current project and connect to it.
@@ -57,22 +58,22 @@ server buffer, in which case a new session for that server is created.
5758
\(fn PARAMS &optional OTHER-REPL)" t nil)
5859

5960
(autoload 'cider-connect-clj "cider" "\
60-
Initialize a CLJ connection to an nREPL server.
61+
Initialize a Clojure connection to an nREPL server.
6162
PARAMS is a plist optionally containing :host, :port and :project-dir. On
6263
prefix argument, prompt for all the parameters.
6364
6465
\(fn &optional PARAMS)" t nil)
6566

6667
(autoload 'cider-connect-cljs "cider" "\
67-
Initialize a CLJS connection to an nREPL server.
68+
Initialize a ClojureScript connection to an nREPL server.
6869
PARAMS is a plist optionally containing :host, :port, :project-dir and
6970
:cljs-repl-type (e.g. Node, Figwheel, etc). On prefix, prompt for all the
7071
parameters regardless of their supplied or default values.
7172
7273
\(fn &optional PARAMS)" t nil)
7374

7475
(autoload 'cider-connect-clj&cljs "cider" "\
75-
Initialize a CLJ and CLJS connection to an nREPL server..
76+
Initialize a Clojure and ClojureScript connection to an nREPL server.
7677
PARAMS is a plist optionally containing :host, :port, :project-dir and
7778
:cljs-repl-type (e.g. Node, Figwheel, etc). When SOFT-CLJS-START is
7879
non-nil, don't start if ClojureScript requirements are not met.
@@ -100,7 +101,7 @@ Start a connection of any type interactively.
100101

101102
(defalias 'cider-connect-sibling-clojurescript #'cider-connect-sibling-cljs)
102103

103-
(eval-after-load 'clojure-mode '(progn (define-key clojure-mode-map (kbd "C-c M-x") #'cider) (define-key clojure-mode-map (kbd "C-c M-j") #'cider-jack-in-clj) (define-key clojure-mode-map (kbd "C-c M-J") #'cider-jack-in-cljs) (define-key clojure-mode-map (kbd "C-c M-c") #'cider-connect-clj) (define-key clojure-mode-map (kbd "C-c M-C") #'cider-connect-cljs) (define-key clojure-mode-map (kbd "C-c C-x") 'cider-start-map) (define-key clojure-mode-map (kbd "C-c C-s") 'sesman-map) (require 'sesman) (sesman-install-menu clojure-mode-map) (add-hook 'clojure-mode-hook (lambda nil (setq-local sesman-system 'CIDER)))))
104+
(with-eval-after-load 'clojure-mode (define-key clojure-mode-map (kbd "C-c M-x") #'cider) (define-key clojure-mode-map (kbd "C-c M-j") #'cider-jack-in-clj) (define-key clojure-mode-map (kbd "C-c M-J") #'cider-jack-in-cljs) (define-key clojure-mode-map (kbd "C-c M-c") #'cider-connect-clj) (define-key clojure-mode-map (kbd "C-c M-C") #'cider-connect-cljs) (define-key clojure-mode-map (kbd "C-c C-x") 'cider-start-map) (define-key clojure-mode-map (kbd "C-c C-s") 'sesman-map) (require 'sesman) (sesman-install-menu clojure-mode-map) (add-hook 'clojure-mode-hook (lambda nil (setq-local sesman-system 'CIDER))))
104105

105106
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "cider" '("cider-")))
106107

@@ -490,7 +491,7 @@ variable to nil to disable the mode line entirely.")
490491

491492
(custom-autoload 'cider-mode-line "cider-mode" t)
492493

493-
(eval-after-load 'clojure-mode '(easy-menu-define cider-clojure-mode-menu-open clojure-mode-map "Menu for Clojure mode.\n This is displayed in `clojure-mode' buffers, if `cider-mode' is not active." `("CIDER" :visible (not cider-mode) ["Start a Clojure REPL" cider-jack-in :help "Starts an nREPL server (with Leiningen, Boot, or Gradle) and connects a REPL to it."] ["Connect to a Clojure REPL" cider-connect :help "Connects to a REPL that's already running."] ["Connect to a ClojureScript REPL" cider-connect-clojurescript :help "Connects to a ClojureScript REPL that's already running."] ["Start a Clojure REPL, and a ClojureScript REPL" cider-jack-in-cljs :help "Starts an nREPL server, connects a Clojure REPL to it, and then a ClojureScript REPL."] "--" ["View manual online" cider-view-manual])))
494+
(with-eval-after-load 'clojure-mode (easy-menu-define cider-clojure-mode-menu-open clojure-mode-map "Menu for Clojure mode.\n This is displayed in `clojure-mode' buffers, if `cider-mode' is not active." `("CIDER" :visible (not cider-mode) ["Start a Clojure REPL" cider-jack-in-clj :help "Starts an nREPL server and connects a Clojure REPL to it."] ["Connect to a Clojure REPL" cider-connect-clj :help "Connects to a REPL that's already running."] ["Start a ClojureScript REPL" cider-jack-in-cljs :help "Starts an nREPL server and connects a ClojureScript REPL to it."] ["Connect to a ClojureScript REPL" cider-connect-cljs :help "Connects to a ClojureScript REPL that's already running."] ["Start a Clojure REPL, and a ClojureScript REPL" cider-jack-in-clj&cljs :help "Starts an nREPL server, connects a Clojure REPL to it, and then a ClojureScript REPL."] "--" ["View manual online" cider-view-manual])))
494495

495496
(autoload 'cider-mode "cider-mode" "\
496497
Minor mode for REPL interaction from a Clojure buffer.

elpa/cider-0.18.0/cider-browse-ns.el renamed to elpa/cider-0.20.0/cider-browse-ns.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
;;; cider-browse-ns.el --- CIDER namespace browser
22

3-
;; Copyright © 2014-2018 John Andrews, Bozhidar Batsov and CIDER contributors
3+
;; Copyright © 2014-2019 John Andrews, Bozhidar Batsov and CIDER contributors
44

55
;; Author: John Andrews <john.m.andrews@gmail.com>
66

elpa/cider-0.18.0/cider-cheatsheet.el renamed to elpa/cider-0.20.0/cider-cheatsheet.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
;;; cider-cheatsheet.el --- Quick reference for Clojure -*- lexical-binding: t -*-
22

3-
;; Copyright © 2018 Kris Jenkins, Bozhidar Batsov and CIDER contributors
3+
;; Copyright © 2019 Kris Jenkins, Bozhidar Batsov and CIDER contributors
44
;;
55
;; Author: Kris Jenkins <krisajenkins@gmail.com>
66

elpa/cider-0.18.0/cider-classpath.el renamed to elpa/cider-0.20.0/cider-classpath.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
;;; cider-classpath.el --- Basic Java classpath browser
22

3-
;; Copyright © 2014-2018 Bozhidar Batsov and CIDER contributors
3+
;; Copyright © 2014-2019 Bozhidar Batsov and CIDER contributors
44

55
;; This program is free software: you can redistribute it and/or modify
66
;; it under the terms of the GNU General Public License as published by

elpa/cider-0.18.0/cider-client.el renamed to elpa/cider-0.20.0/cider-client.el

Lines changed: 68 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
;;; cider-client.el --- A layer of abstraction above low-level nREPL client code. -*- lexical-binding: t -*-
22

3-
;; Copyright © 2013-2018 Bozhidar Batsov
3+
;; Copyright © 2013-2019 Bozhidar Batsov
44
;;
55
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
66

@@ -145,15 +145,15 @@ to the file backing the current buffer. The command falls back to
145145
"Check for support of middleware op OP.
146146
Signal an error if it is not supported."
147147
(unless (cider-nrepl-op-supported-p op)
148-
(user-error "`%s' requires the nREPL op \"%s\". Please, install (or update) cider-nrepl %s and restart CIDER" this-command op (upcase cider-version))))
148+
(user-error "`%s' requires the nREPL op \"%s\" (provided by cider-nrepl)" this-command op)))
149149

150150
(defun cider-nrepl-send-request (request callback &optional connection)
151151
"Send REQUEST and register response handler CALLBACK.
152152
REQUEST is a pair list of the form (\"op\" \"operation\" \"par1-name\"
153153
\"par1\" ... ).
154154
If CONNECTION is provided dispatch to that connection instead of
155155
the current connection. Return the id of the sent message."
156-
(nrepl-send-request request callback (or connection (cider-current-repl))))
156+
(nrepl-send-request request callback (or connection (cider-current-repl 'any))))
157157

158158
(defun cider-nrepl-send-sync-request (request &optional connection abort-on-input)
159159
"Send REQUEST to the nREPL server synchronously using CONNECTION.
@@ -163,13 +163,13 @@ If ABORT-ON-INPUT is non-nil, the function will return nil
163163
at the first sign of user input, so as not to hang the
164164
interface."
165165
(nrepl-send-sync-request request
166-
(or connection (cider-current-repl))
166+
(or connection (cider-current-repl 'any))
167167
abort-on-input))
168168

169169
(defun cider-nrepl-send-unhandled-request (request &optional connection)
170170
"Send REQUEST to the nREPL CONNECTION and ignore any responses.
171171
Immediately mark the REQUEST as done. Return the id of the sent message."
172-
(let* ((conn (or connection (cider-current-repl)))
172+
(let* ((conn (or connection (cider-current-repl 'any)))
173173
(id (nrepl-send-request request #'ignore conn)))
174174
(with-current-buffer conn
175175
(nrepl--mark-id-completed id))
@@ -208,36 +208,81 @@ faster than \\=`clojure.core/pprint\\=` (this is the default)
208208
`puget' - to use Puget, which provides canonical serialization of data on
209209
top of fipp, but at a slight performance cost
210210
211-
Alternatively, can be the namespace-qualified name of a Clojure function of
212-
one argument. If the function cannot be resolved, an exception will be
213-
thrown.
211+
`zprint' - to use zprint, a fast and flexible alternative to the libraries
212+
mentioned above.
214213
215-
The function is assumed to respect the contract of \\=`clojure.pprint/pprint\\=`
216-
with respect to the bound values of \\=`*print-length*\\=`, \\=`*print-level*\\=`,
217-
\\=`*print-meta*\\=`, and \\=`clojure.pprint/*print-right-margin*\\=`."
214+
Alternatively, can be the namespace-qualified name of a Clojure function of
215+
two arguments - an object to print and an options map. The options map will
216+
have string keys. If the function
217+
cannot be resolved, an exception will be thrown.
218+
219+
The function should ideally have a two-arity variant that accepts the
220+
object to print and a map of configuration options for the printer. See
221+
`cider-pprint-options' for details.
222+
223+
The function is also assumed to respect the contract of
224+
\\=`clojure.pprint/pprint\\=` with respect to the bound values of
225+
\\=`*print-length*\\=`, \\=`*print-level*\\=`, \\=`*print-meta*\\=`, and
226+
\\=`clojure.pprint/*print-right-margin*\\=`. Those would normally serve as
227+
fallback values when a map of print options is not supplied explicitly."
218228
:type '(choice (const pprint)
219229
(const fipp)
220230
(const puget)
231+
(const zprint)
221232
string)
222233
:group 'cider
223234
:package-version '(cider . "0.11.0"))
224235

236+
(defcustom cider-pprint-options nil
237+
"A list of options for the pretty-printer that will be converted to a map.
238+
Note that map can only have string keys, so the printer functions should be
239+
able to handle those. Here's an example for `pprint':
240+
241+
'(dict \"length\" 50 \"right-margin\" 70)"
242+
:type 'list
243+
:group 'cider
244+
:package-version '(cider . "0.20.0"))
245+
225246
(defun cider--pprint-fn ()
226247
"Return the value to send in the pprint-fn slot of messages."
227248
(pcase cider-pprint-fn
228-
(`pprint "clojure.pprint/pprint")
229-
(`fipp "cider.nrepl.middleware.pprint/fipp-pprint")
230-
(`puget "cider.nrepl.middleware.pprint/puget-pprint")
249+
(`pprint "cider.nrepl.pprint/pprint")
250+
(`fipp "cider.nrepl.pprint/fipp-pprint")
251+
(`puget "cider.nrepl.pprint/puget-pprint")
252+
(`zprint "zprint.core/zprint-str")
231253
(_ cider-pprint-fn)))
232254

255+
(defvar cider--pprint-options-mapping
256+
'((right-margin
257+
((fipp . width) (puget . width) (zprint . width)))
258+
(length
259+
((fipp . print-length) (puget . print-length) (zprint . max-length)))
260+
(level
261+
((fipp . print-level) (puget . print-level) (zprint . max-depth))))
262+
"A mapping of print option for the various supported print engines.")
263+
264+
(defun cider--pprint-option (name printer)
265+
"Covert the generic NAME to its PRINTER specific variant.
266+
E.g. pprint's right-margin would become width for fipp.
267+
The function is useful when you want to generate dynamically
268+
print options.
269+
270+
NAME can be a string or a symbol. PRINTER has to be a symbol.
271+
The result will be a string."
272+
(let* ((name (cider-maybe-intern name))
273+
(result (cdr (assoc printer (cadr (assoc name cider--pprint-options-mapping))))))
274+
(symbol-name (or result name))))
275+
233276
(defun cider--nrepl-pprint-request-plist (right-margin &optional pprint-fn)
234277
"Plist to be appended to an eval request to make it use pprint.
235278
PPRINT-FN is the name of the Clojure function to use.
236279
RIGHT-MARGIN specifies the maximum column-width of the pretty-printed
237280
result, and is included in the request if non-nil."
238-
(nconc `("pprint" "true"
239-
"pprint-fn" ,(or pprint-fn (cider--pprint-fn)))
240-
(and right-margin `("print-right-margin" ,right-margin))))
281+
(let* ((print-options (or cider-pprint-options (nrepl-dict))))
282+
(when right-margin
283+
(setq print-options (nrepl-dict-put print-options (cider--pprint-option "right-margin" cider-pprint-fn) right-margin)))
284+
(nconc `("printer" ,(or pprint-fn (cider--pprint-fn)))
285+
(and (not (nrepl-dict-empty-p print-options)) `("print-options" ,print-options)))))
241286

242287
(defun cider--nrepl-content-type-plist ()
243288
"Plist to be appended to an eval request to make it use content-types."
@@ -368,7 +413,7 @@ is nil, use `cider-load-file-handler'."
368413
;;; Sync Requests
369414

370415
(defcustom cider-filtered-namespaces-regexps
371-
'("^cider.nrepl" "^refactor-nrepl" "^clojure.tools.nrepl" "^nrepl")
416+
'("^cider.nrepl" "^refactor-nrepl" "^nrepl")
372417
"List of regexps used to filter out some vars/symbols/namespaces.
373418
When nil, nothing is filtered out. Otherwise, all namespaces matching any
374419
regexp from this list are dropped out of the \"ns-list\" op. Also,
@@ -413,7 +458,8 @@ CONTEXT represents a completion context for compliment."
413458
"ns" ,(cider-current-ns)
414459
"symbol" ,str
415460
"context" ,context)
416-
(cider-nrepl-send-sync-request nil 'abort-on-input))))
461+
(cider-nrepl-send-sync-request (cider-current-repl)
462+
'abort-on-input))))
417463
(nrepl-dict-get dict "completions")))
418464

419465
(defun cider-sync-request:complete-flush-caches ()
@@ -429,7 +475,7 @@ CONTEXT represents a completion context for compliment."
429475
,@(when symbol `("symbol" ,symbol))
430476
,@(when class `("class" ,class))
431477
,@(when member `("member" ,member)))
432-
(cider-nrepl-send-sync-request))))
478+
(cider-nrepl-send-sync-request (cider-current-repl)))))
433479
(if (member "no-info" (nrepl-dict-get var-info "status"))
434480
nil
435481
var-info)))
@@ -441,7 +487,8 @@ CONTEXT represents a completion context for compliment."
441487
,@(when symbol `("symbol" ,symbol))
442488
,@(when class `("class" ,class))
443489
,@(when member `("member" ,member)))
444-
(cider-nrepl-send-sync-request nil 'abort-on-input))))
490+
(cider-nrepl-send-sync-request (cider-current-repl)
491+
'abort-on-input))))
445492
(if (member "no-eldoc" (nrepl-dict-get eldoc "status"))
446493
nil
447494
eldoc)))

elpa/cider-0.18.0/cider-common.el renamed to elpa/cider-0.20.0/cider-common.el

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
;;; cider-common.el --- Common use functions -*- lexical-binding: t; -*-
22

3-
;; Copyright © 2015-2018 Artur Malabarba
3+
;; Copyright © 2015-2019 Artur Malabarba
44

55
;; Author: Artur Malabarba <bruce.connor.am@gmail.com>
66

@@ -286,53 +286,53 @@ If no local or remote file exists, return nil."
286286
(defun cider-find-file (url)
287287
"Return a buffer visiting the file URL if it exists, or nil otherwise.
288288
If URL has a scheme prefix, it must represent a fully-qualified file path
289-
or an entry within a zip/jar archive. If URL doesn't contain a scheme
290-
prefix and is an absolute path, it is treated as such. Finally, if URL is
291-
relative, it is expanded within each of the open Clojure buffers till an
292-
existing file ending with URL has been found."
289+
or an entry within a zip/jar archive. If AVFS (archive virtual file
290+
system; see online docs) is mounted the archive entry is opened inside the
291+
AVFS directory, otherwise the entry is archived into a temporary read-only
292+
buffer. If URL doesn't contain a scheme prefix and is an absolute path, it
293+
is treated as such. Finally, if URL is relative, it is expanded within each
294+
of the open Clojure buffers till an existing file ending with URL has been
295+
found."
293296
(require 'arc-mode)
294297
(cond ((string-match "^file:\\(.+\\)" url)
295298
(when-let* ((file (cider--url-to-file (match-string 1 url)))
296299
(path (cider--file-path file)))
297300
(find-file-noselect path)))
298301
((string-match "^\\(jar\\|zip\\):\\(file:.+\\)!/\\(.+\\)" url)
299302
(when-let* ((entry (match-string 3 url))
300-
(file (cider--url-to-file (match-string 2 url)))
301-
(path (cider--file-path file))
302-
;; It is used for targeting useless intermediate buffer.
303-
;; That buffer is made by (find-file path) below.
304-
;; It has the name which is the last part of the path.
305-
(trash (replace-regexp-in-string "^/.+/" "" path))
306-
(name (format "%s:%s" path entry)))
307-
(or (find-buffer-visiting name)
308-
(if (tramp-tramp-file-p path)
309-
(progn
310-
;; Use emacs built in archiving.
311-
;; This makes a list of files in archived Zip or Jar.
312-
;; That list buffer is useless after jumping to the
313-
;; buffer which has the real definition.
314-
;; It'll be removed by (kill-buffer trash) below.
315-
(find-file path)
316-
(goto-char (point-min))
317-
;; Make sure the file path is followed by a newline to
318-
;; prevent eg. clj matching cljs.
319-
(search-forward (concat entry "\n"))
320-
;; moves up to matching line
321-
(forward-line -1)
322-
(archive-extract)
323-
;; Remove useless buffer made by (find-file path) above.
324-
(kill-buffer trash)
325-
(current-buffer))
326-
;; Use external zip program to just extract the single file
327-
(with-current-buffer (generate-new-buffer
328-
(file-name-nondirectory entry))
329-
(archive-zip-extract path entry)
330-
(set-visited-file-name name)
331-
(setq-local default-directory (file-name-directory path))
332-
(setq-local buffer-read-only t)
333-
(set-buffer-modified-p nil)
334-
(set-auto-mode)
335-
(current-buffer))))))
303+
(file (cider--url-to-file (match-string 2 url)))
304+
(path (cider--file-path file))
305+
(name (format "%s:%s" path entry))
306+
(avfs (format "%s%s#uzip/%s"
307+
(expand-file-name (or (getenv "AVFSBASE") "~/.avfs/"))
308+
path entry)))
309+
(cond
310+
;; 1) use avfs
311+
((file-exists-p avfs)
312+
(find-file-noselect avfs))
313+
;; 2) already uncompressed
314+
((find-buffer-visiting name))
315+
;; 3) on remotes use Emacs built-in archiving
316+
((tramp-tramp-file-p path)
317+
(find-file path)
318+
(goto-char (point-min))
319+
;; anchor to eol to prevent eg. clj matching cljs.
320+
(re-search-forward (concat entry "$"))
321+
(let ((archive-buffer (current-buffer)))
322+
(archive-extract)
323+
(kill-buffer archive-buffer))
324+
(current-buffer))
325+
;; 4) Use external zip program to extract a single file
326+
(t
327+
(with-current-buffer (generate-new-buffer
328+
(file-name-nondirectory entry))
329+
(archive-zip-extract path entry)
330+
(set-visited-file-name name)
331+
(setq-local default-directory (file-name-directory path))
332+
(setq-local buffer-read-only t)
333+
(set-buffer-modified-p nil)
334+
(set-auto-mode)
335+
(current-buffer))))))
336336
(t (if-let* ((path (cider--file-path url)))
337337
(find-file-noselect path)
338338
(unless (file-name-absolute-p url)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy