Large diffs are not rendered by default.

@@ -1,6 +1,6 @@
;;; cider-doc.el --- CIDER documentation functionality -*- lexical-binding: t -*-

;; Copyright © 2014 Jeff Valk
;; Copyright © 2014-2015 Jeff Valk

;; Author: Jeff Valk <jv@jeffvalk.com>

@@ -43,16 +43,16 @@
(defvar cider-doc-map
(let (cider-doc-map)
(define-prefix-command 'cider-doc-map)
(define-key cider-doc-map (kbd "a") 'cider-apropos)
(define-key cider-doc-map (kbd "C-a") 'cider-apropos)
(define-key cider-doc-map (kbd "A") 'cider-apropos-documentation)
(define-key cider-doc-map (kbd "d") 'cider-doc)
(define-key cider-doc-map (kbd "C-d") 'cider-doc)
(define-key cider-doc-map (kbd "g") 'cider-grimoire)
(define-key cider-doc-map (kbd "C-g") 'cider-grimoire)
(define-key cider-doc-map (kbd "h") 'cider-grimoire-web)
(define-key cider-doc-map (kbd "j") 'cider-javadoc)
(define-key cider-doc-map (kbd "C-j") 'cider-javadoc)
(define-key cider-doc-map (kbd "a") #'cider-apropos)
(define-key cider-doc-map (kbd "C-a") #'cider-apropos)
(define-key cider-doc-map (kbd "A") #'cider-apropos-documentation)
(define-key cider-doc-map (kbd "d") #'cider-doc)
(define-key cider-doc-map (kbd "C-d") #'cider-doc)
(define-key cider-doc-map (kbd "r") #'cider-grimoire)
(define-key cider-doc-map (kbd "C-r") #'cider-grimoire)
(define-key cider-doc-map (kbd "h") #'cider-grimoire-web)
(define-key cider-doc-map (kbd "j") #'cider-javadoc)
(define-key cider-doc-map (kbd "C-j") #'cider-javadoc)
cider-doc-map)
"CIDER documentation keymap.")

@@ -125,13 +125,13 @@

(defvar cider-docview-mode-map
(let ((map (make-sparse-keymap)))
(define-key map "q" 'cider-popup-buffer-quit-function)
(define-key map "g" 'cider-docview-grimoire)
(define-key map "G" 'cider-docview-grimoire-web)
(define-key map "j" 'cider-docview-javadoc)
(define-key map "s" 'cider-docview-source)
(define-key map (kbd "<backtab>") 'backward-button)
(define-key map (kbd "TAB") 'forward-button)
(define-key map "q" #'cider-popup-buffer-quit-function)
(define-key map "g" #'cider-docview-grimoire)
(define-key map "G" #'cider-docview-grimoire-web)
(define-key map "j" #'cider-docview-javadoc)
(define-key map "s" #'cider-docview-source)
(define-key map (kbd "<backtab>") #'backward-button)
(define-key map (kbd "TAB") #'forward-button)
(easy-menu-define cider-docview-mode-menu map
"Menu for CIDER's doc mode"
`("CiderDoc"
@@ -144,6 +144,11 @@
))
map))

(defvar cider-docview-symbol)
(defvar cider-docview-javadoc-url)
(defvar cider-docview-file)
(defvar cider-docview-line)

(define-derived-mode cider-docview-mode special-mode "Doc"
"Major mode for displaying CIDER documentation
@@ -164,29 +169,34 @@
(interactive)
(if cider-docview-javadoc-url
(browse-url cider-docview-javadoc-url)
(message "No Javadoc available for %s" cider-docview-symbol)))
(error "No Javadoc available for %s" cider-docview-symbol)))

(defun cider-docview-source ()
"Open the source for the current symbol, if available."
(interactive)
(if cider-docview-file
(let ((buffer (and cider-docview-file
(not (cider--tooling-file-p cider-docview-file))
(cider-find-file cider-docview-file))))
(cider-jump-to buffer (cons cider-docview-line nil) nil))
(message "No source location for %s" cider-docview-symbol)))
(-if-let (buffer (and (not (cider--tooling-file-p cider-docview-file))
(cider-find-file cider-docview-file)))
(cider-jump-to buffer (if cider-docview-line
(cons cider-docview-line nil)
cider-docview-symbol)
nil)
(user-error
(substitute-command-keys
"Can't find the source because it wasn't defined with `cider-eval-buffer'")))
(error "No source location for %s" cider-docview-symbol)))

(defun cider-docview-grimoire ()
(interactive)
(if cider-buffer-ns
(cider-grimoire-lookup cider-docview-symbol)
(message "%s cannot be looked up on Grimoire")))
(error "%s cannot be looked up on Grimoire" cider-docview-symbol)))

(defun cider-docview-grimoire-web ()
(interactive)
(if cider-buffer-ns
(cider-grimoire-web-lookup cider-docview-symbol)
(message "%s cannot be looked up on Grimoire")))
(error "%s cannot be looked up on Grimoire" cider-docview-symbol)))


;;; Font Lock and Formatting
@@ -292,7 +302,8 @@ Tables are marked to be ignored by line wrap."
(special (nrepl-dict-get info "special-form"))
(forms (nrepl-dict-get info "forms-str"))
(args (nrepl-dict-get info "arglists-str"))
(doc (nrepl-dict-get info "doc"))
(doc (or (nrepl-dict-get info "doc")
"Not documented."))
(url (nrepl-dict-get info "url"))
(class (nrepl-dict-get info "class"))
(member (nrepl-dict-get info "member"))
@@ -324,10 +335,9 @@ Tables are marked to be ignored by line wrap."
(emit (concat "Added in " added) 'font-lock-comment-face))
(when depr
(emit (concat "Deprecated in " depr) 'font-lock-comment-face))
(when doc
(if class
(cider-docview-render-java-doc (current-buffer) doc)
(emit (concat " " doc))))
(if class
(cider-docview-render-java-doc (current-buffer) doc)
(emit (concat " " doc)))
(when url
(newline)
(insert " Please see ")
@@ -348,6 +358,11 @@ Tables are marked to be ignored by line wrap."
(browse-url (button-get x 'url))))
(insert ".")
(newline))
(newline)
(insert-text-button "[source]"
'follow-link t
'action (lambda (_x)
(cider-docview-source)))
(let ((beg (point-min))
(end (point-max)))
(nrepl-dict-map (lambda (k v)
@@ -1,7 +1,7 @@
;;; cider-eldoc.el --- eldoc support for Clojure -*- lexical-binding: t -*-

;; Copyright © 2012-2014 Tim King, Phil Hagelberg
;; Copyright © 2013-2014 Bozhidar Batsov, Hugo Duncan, Steve Purcell
;; Copyright © 2012-2015 Tim King, Phil Hagelberg
;; Copyright © 2013-2015 Bozhidar Batsov, Hugo Duncan, Steve Purcell
;;
;; Author: Tim King <kingtim@gmail.com>
;; Phil Hagelberg <technomancy@gmail.com>
@@ -149,11 +149,12 @@ Return the number of nested sexp the point was over or after. "
(cider-eldoc-format-thing thing)
(cider-eldoc-format-arglist value pos))))))

(defun cider-turn-on-eldoc-mode ()
(defun cider-eldoc-setup ()
"Turn on eldoc mode in the current buffer."
(setq-local eldoc-documentation-function 'cider-eldoc)
(apply 'eldoc-add-command cider-extra-eldoc-commands)
(eldoc-mode +1))
(setq-local eldoc-documentation-function #'cider-eldoc)
(apply #'eldoc-add-command cider-extra-eldoc-commands))

(define-obsolete-function-alias 'cider-turn-on-eldoc-mode 'eldoc-mode)

(provide 'cider-eldoc)

@@ -1,6 +1,6 @@
;;; cider-grimoire.el --- Grimoire integration -*- lexical-binding: t -*-

;; Copyright © 2014 Bozhidar Batsov
;; Copyright © 2014-2015 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>

@@ -26,6 +26,7 @@
;;; Code:

(require 'cider-interaction)
(require 'url-vars)

(defconst cider-grimoire-url "http://conj.io/")

@@ -49,13 +50,19 @@
(let ((name (nrepl-dict-get var-info "name"))
(ns (nrepl-dict-get var-info "ns")))
(browse-url (cider-grimoire-url name ns)))
(message "Symbol %s not resolved" symbol)))
(error "Symbol %s not resolved" symbol)))

;;;###autoload
(defun cider-grimoire-web (query)
"Open the grimoire documentation for QUERY in the default web browser."
(defun cider-grimoire-web (&optional arg)
"Open grimoire documentation in the default web browser.
Prompts for the symbol to use, or uses the symbol at point, depending on
the value of `cider-prompt-for-symbol'. With prefix arg ARG, does the
opposite of what that option dictates."
(interactive "P")
(cider-read-symbol-name "Symbol: " 'cider-grimoire-web-lookup query))
(funcall (cider-prompt-for-symbol-function arg)
"Grimoire doc for"
#'cider-grimoire-web-lookup))

(defun cider-create-grimoire-buffer (content)
"Create a new grimoire buffer with CONTENT."
@@ -82,12 +89,18 @@
(delete-blank-lines)
;; and create a new buffer with whatever is left
(pop-to-buffer (cider-create-grimoire-buffer (buffer-string))))))
(message "Symbol %s not resolved" symbol)))
(error "Symbol %s not resolved" symbol)))

;;;###autoload
(defun cider-grimoire (query)
"Open the grimoire documentation for QUERY in a popup buffer."
(defun cider-grimoire (&optional arg)
"Open grimoire documentation in a popup buffer.
Prompts for the symbol to use, or uses the symbol at point, depending on
the value of `cider-prompt-for-symbol'. With prefix arg ARG, does the
opposite of what that option dictates."
(interactive "P")
(cider-read-symbol-name "Symbol: " 'cider-grimoire-lookup query))
(funcall (cider-prompt-for-symbol-function arg)
"Grimoire doc for"
#'cider-grimoire-lookup))

(provide 'cider-grimoire)
@@ -0,0 +1,309 @@
;;; cider-inspector.el --- Object inspector -*- lexical-binding: t -*-

;; Copyright © 2013-2015 Vital Reactor, LLC
;; Copyright © 2014-2015 Bozhidar Batsov

;; Author: Ian Eslick <ian@vitalreactor.com>
;; Bozhidar Batsov <bozhidar@batsov.com>

;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.

;; This file is not part of GNU Emacs.

;;; Commentary:

;; Clojure object inspector inspired by SLIME.

;;; Code:

(require 'cl-lib)
(require 'cider-interaction)

;; ===================================
;; Inspector Key Map and Derived Mode
;; ===================================

(defconst cider-inspector-buffer "*cider inspect*")

;;; Customization
(defgroup cider-inspector nil
"Presentation and behaviour of the cider value inspector."
:prefix "cider-inspector-"
:group 'cider
:package-version '(cider . "0.10.0"))

(defcustom cider-inspector-page-size 32
"Default page size in paginated inspector view.
The page size can be also changed interactively within the inspector."
:type '(integer :tag "Page size" 32)
:group 'cider-inspector
:package-version '(cider . "0.10.0"))

(push cider-inspector-buffer cider-ancillary-buffers)

(defvar cider-inspector-mode-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map cider-popup-buffer-mode-map)
(define-key map [return] #'cider-inspector-operate-on-point)
(define-key map "\C-m" #'cider-inspector-operate-on-point)
(define-key map [mouse-1] #'cider-inspector-operate-on-click)
(define-key map "l" #'cider-inspector-pop)
(define-key map "g" #'cider-inspector-refresh)
;; Page-up/down
(define-key map [next] #'cider-inspector-next-page)
(define-key map [prior] #'cider-inspector-prev-page)
(define-key map " " #'cider-inspector-next-page)
(define-key map (kbd "M-SPC") #'cider-inspector-prev-page)
(define-key map (kbd "S-SPC") #'cider-inspector-prev-page)
(define-key map "s" #'cider-inspector-set-page-size)
(define-key map [tab] #'cider-inspector-next-inspectable-object)
(define-key map "\C-i" #'cider-inspector-next-inspectable-object)
(define-key map [(shift tab)] #'cider-inspector-previous-inspectable-object) ; Emacs translates S-TAB
(define-key map [backtab] #'cider-inspector-previous-inspectable-object) ; to BACKTAB on X.
map))

(define-derived-mode cider-inspector-mode fundamental-mode "Inspector"
"Major mode for inspecting Clojure data structures.
\\{cider-inspector-mode-map}"
(set-syntax-table clojure-mode-syntax-table)
(setq buffer-read-only t)
(setq-local electric-indent-chars nil)
(setq-local truncate-lines t))

;;;###autoload
(defun cider-inspect (expression)
"Eval the string EXPRESSION and inspect the result."
(interactive
(list (cider-read-from-minibuffer "Inspect value: "
(cider-sexp-at-point))))
(cider-inspect-expr expression (cider-current-ns)))

;; Operations
(defun cider-inspector--value-handler (_buffer value)
(cider-make-popup-buffer cider-inspector-buffer 'cider-inspector-mode)
(cider-irender cider-inspector-buffer value))

(defun cider-inspector--out-handler (_buffer value)
(cider-emit-interactive-eval-output value))

(defun cider-inspector--err-handler (_buffer err)
(cider-emit-interactive-eval-err-output err))

(defun cider-inspector--done-handler (buffer)
(when (get-buffer cider-inspector-buffer)
(with-current-buffer buffer
(cider-popup-buffer-display cider-inspector-buffer t))))

(defun cider-inspector-response-handler (buffer)
"Create an inspector response handler for BUFFER.
The \"value\" slot of each successive response (if it exists) will be
rendered into `cider-inspector-buffer'. Once a response is received with a
\"status\" slot containing \"done\", `cider-inspector-buffer' will be
displayed.
Used for all inspector nREPL ops."
(nrepl-make-response-handler buffer
#'cider-inspector--value-handler
#'cider-inspector--out-handler
#'cider-inspector--err-handler
#'cider-inspector--done-handler))

(defun cider-inspect-expr (expr ns)
(cider--prep-interactive-eval expr)
(nrepl-send-request (append (nrepl--eval-request expr ns)
(list "inspect" "true"
"page-size" (or cider-inspector-page-size 32)))
(cider-inspector-response-handler (current-buffer))))

(defun cider-inspector-pop ()
(interactive)
(nrepl-send-request (list "op" "inspect-pop"
"session" (cider-current-session))
(cider-inspector-response-handler (current-buffer))))

(defun cider-inspector-push (idx)
(nrepl-send-request (list "op" "inspect-push"
"idx" (number-to-string idx)
"session" (cider-current-session))
(cider-inspector-response-handler (current-buffer))))

(defun cider-inspector-refresh ()
(interactive)
(nrepl-send-request (list "op" "inspect-refresh"
"session" (cider-current-session))
(cider-inspector-response-handler (current-buffer))))

(defun cider-inspector-next-page ()
"Jump to the next page when inspecting a paginated sequence/map.
Does nothing if already on the last page."
(interactive)
(nrepl-send-request (list "op" "inspect-next-page"
"session" (cider-current-session))
(cider-inspector-response-handler (current-buffer))))

(defun cider-inspector-prev-page ()
"Jump to the previous page when expecting a paginated sequence/map.
Does nothing if already on the first page."
(interactive)
(nrepl-send-request (list "op" "inspect-prev-page"
"session" (cider-current-session))
(cider-inspector-response-handler (current-buffer))))

(defun cider-inspector-set-page-size (page-size)
"Set the page size in pagination mode to the specified value.
Current page will be reset to zero."
(interactive "nPage size:")
(nrepl-send-request (list "op" "inspect-set-page-size"
"session" (cider-current-session)
"page-size" page-size)
(cider-inspector-response-handler (current-buffer))))

;; Render Inspector from Structured Values
(defun cider-irender (buffer str)
(with-current-buffer buffer
(cider-inspector-mode)
(let ((inhibit-read-only t))
(condition-case nil
(cider-irender* (car (read-from-string str)))
(error (newline) (insert "Inspector error for: " str))))
(goto-char (point-min))))

(defun cider-irender* (elements)
(dolist (el elements)
(cider-irender-el* el)))

(defun cider-irender-el* (el)
(cond ((symbolp el) (insert (symbol-name el)))
((stringp el) (insert (propertize el 'font-lock-face 'font-lock-keyword-face)))
((and (consp el) (eq (car el) :newline))
(newline))
((and (consp el) (eq (car el) :value))
(cider-irender-value (cadr el) (caddr el)))
(t (message "Unrecognized inspector object: %s" el))))

(defun cider-irender-value (value idx)
(cider-propertize-region
(list 'cider-value-idx idx
'mouse-face 'highlight)
(cider-irender-el* (cider-font-lock-as-clojure value))))


;; ===================================================
;; Inspector Navigation (lifted from SLIME inspector)
;; ===================================================

(defun cider-find-inspectable-object (direction limit)
"Find the next/previous inspectable object.
DIRECTION can be either 'next or 'prev.
LIMIT is the maximum or minimum position in the current buffer.
Return a list of two values: If an object could be found, the
starting position of the found object and T is returned;
otherwise LIMIT and NIL is returned."
(let ((finder (ecase direction
(next 'next-single-property-change)
(prev 'previous-single-property-change))))
(let ((prop nil) (curpos (point)))
(while (and (not prop) (not (= curpos limit)))
(let ((newpos (funcall finder curpos 'cider-value-idx nil limit)))
(setq prop (get-text-property newpos 'cider-value-idx))
(setq curpos newpos)))
(list curpos (and prop t)))))

(defun cider-inspector-next-inspectable-object (arg)
"Move point to the next inspectable object.
With optional ARG, move across that many objects.
If ARG is negative, move backwards."
(interactive "p")
(let ((maxpos (point-max)) (minpos (point-min))
(previously-wrapped-p nil))
;; Forward.
(while (> arg 0)
(cl-destructuring-bind (pos foundp)
(cider-find-inspectable-object 'next maxpos)
(if foundp
(progn (goto-char pos) (setq arg (1- arg))
(setq previously-wrapped-p nil))
(if (not previously-wrapped-p) ; cycle detection
(progn (goto-char minpos) (setq previously-wrapped-p t))
(error "No inspectable objects")))))
;; Backward.
(while (< arg 0)
(cl-destructuring-bind (pos foundp)
(cider-find-inspectable-object 'prev minpos)
;; CIDER-OPEN-INSPECTOR inserts the title of an inspector page
;; as a presentation at the beginning of the buffer; skip
;; that. (Notice how this problem can not arise in ``Forward.'')
(if (and foundp (/= pos minpos))
(progn (goto-char pos) (setq arg (1+ arg))
(setq previously-wrapped-p nil))
(if (not previously-wrapped-p) ; cycle detection
(progn (goto-char maxpos) (setq previously-wrapped-p t))
(error "No inspectable objects")))))))

(defun cider-inspector-previous-inspectable-object (arg)
"Move point to the previous inspectable object.
With optional ARG, move across that many objects.
If ARG is negative, move forwards."
(interactive "p")
(cider-inspector-next-inspectable-object (- arg)))

(defun cider-inspector-property-at-point ()
(let* ((properties '(cider-value-idx cider-range-button
cider-action-number))
(find-property
(lambda (point)
(cl-loop for property in properties
for value = (get-text-property point property)
when value
return (list property value)))))
(or (funcall find-property (point))
(funcall find-property (1- (point))))))

(defun cider-inspector-operate-on-point ()
"Invoke the command for the text at point.
1. If point is on a value then recursivly call the inspector on
that value.
2. If point is on an action then call that action.
3. If point is on a range-button fetch and insert the range."
(interactive)
(cl-destructuring-bind (property value)
(cider-inspector-property-at-point)
(cl-case property
(cider-value-idx
(cider-inspector-push value))
;; TODO: range and action handlers
(t (error "No object at point")))))

(defun cider-inspector-operate-on-click (event)
"Move to EVENT's position and operate the part."
(interactive "@e")
(let ((point (posn-point (event-end event))))
(cond ((and point
(or (get-text-property point 'cider-value-idx)))
;; (get-text-property point 'cider-range-button)
;; (get-text-property point 'cider-action-number)))
(goto-char point)
(cider-inspector-operate-on-point))
(t
(error "No clickable part here")))))

(provide 'cider-inspector)

;;; cider-inspector.el ends here

Large diffs are not rendered by default.

@@ -1,7 +1,7 @@
;;; cider-macroexpansion.el --- Macro expansion support -*- lexical-binding: t -*-

;; Copyright © 2012-2014 Tim King, Phil Hagelberg
;; Copyright © 2013-2014 Bozhidar Batsov, Hugo Duncan, Steve Purcell
;; Copyright © 2012-2015 Tim King, Phil Hagelberg
;; Copyright © 2013-2015 Bozhidar Batsov, Hugo Duncan, Steve Purcell
;;
;; Author: Tim King <kingtim@gmail.com>
;; Phil Hagelberg <technomancy@gmail.com>
@@ -52,10 +52,28 @@ Possible values are:
:group 'cider
:package-version '(cider . "0.7.0"))

(define-obsolete-variable-alias
'cider-macroexpansion-suppress-namespaces
'cider-macroexpansion-display-namespaces
"0.8.0")
(defcustom cider-macroexpansion-print-metadata nil
"Determines if metadata is included in macroexpansion results."
:type 'boolean
:group 'cider
:package-version '(cider . "0.9.0"))

(defun cider-sync-request:macroexpand (expander expr &optional display-namespaces)
"Macroexpand, using EXPANDER, the given EXPR.
The default for DISPLAY-NAMESPACES is taken from
`cider-macroexpansion-display-namespaces'."
(cider-ensure-op-supported "macroexpand")
(-> (list "op" "macroexpand"
"expander" expander
"code" expr
"ns" (cider-current-ns)
"display-namespaces"
(or display-namespaces
(symbol-name cider-macroexpansion-display-namespaces)))
(append (when cider-macroexpansion-print-metadata
(list "print-meta" "true")))
(nrepl-send-sync-request)
(nrepl-dict-get "expansion")))

(defun cider-macroexpand-undo (&optional arg)
"Undo the last macroexpansion, using `undo-only'.
@@ -78,7 +96,7 @@ This variable specifies both what was expanded and the expander.")
"Substitute the form preceding point with its macroexpansion using EXPANDER."
(interactive)
(let* ((expansion (cider-sync-request:macroexpand expander (cider-last-sexp)))
(bounds (cons (save-excursion (backward-sexp) (point)) (point))))
(bounds (cons (save-excursion (clojure-backward-logical-sexp 1) (point)) (point))))
(cider-redraw-macroexpansion-buffer
expansion (current-buffer) (car bounds) (cdr bounds))))

@@ -144,34 +162,34 @@ and point is placed after the expanded form."
"Create a new macroexpansion buffer."
(with-current-buffer (cider-popup-buffer cider-macroexpansion-buffer t)
(clojure-mode)
(clojure-disable-cider)
(cider-mode -1)
(cider-macroexpansion-mode 1)
(current-buffer)))

(defvar cider-macroexpansion-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "g") 'cider-macroexpand-again)
(define-key map (kbd "q") 'cider-popup-buffer-quit-function)
(define-key map (kbd "d") 'cider-doc)
(define-key map (kbd "j") 'cider-javadoc)
(define-key map (kbd ".") 'cider-jump-to-var)
(define-key map (kbd "g") #'cider-macroexpand-again)
(define-key map (kbd "q") #'cider-popup-buffer-quit-function)
(define-key map (kbd "d") #'cider-doc)
(define-key map (kbd "j") #'cider-javadoc)
(define-key map (kbd ".") #'cider-find-var)
(easy-menu-define cider-macroexpansion-mode-menu map
"Menu for CIDER's doc mode"
'("Macroexpansion"
["Restart expansion" cider-macroexpand-again]
["Macroexpand-1" cider-macroexpand-1-inplace]
["Macroexpand-all" cider-macroexpand-all-inplace]
["Go to source" cider-jump-to-var]
["Go to source" cider-find-var]
["Go to doc" cider-doc]
["Go to Javadoc" cider-docview-javadoc]
["Quit" cider-popup-buffer-quit-function]))
(cl-labels ((redefine-key (from to)
(dolist (mapping (where-is-internal from cider-mode-map))
(define-key map mapping to))))
(redefine-key 'cider-macroexpand-1 'cider-macroexpand-1-inplace)
(redefine-key 'cider-macroexpand-all 'cider-macroexpand-all-inplace)
(redefine-key 'advertised-undo 'cider-macroexpand-undo)
(redefine-key 'undo 'cider-macroexpand-undo))
(redefine-key 'cider-macroexpand-1 #'cider-macroexpand-1-inplace)
(redefine-key 'cider-macroexpand-all #'cider-macroexpand-all-inplace)
(redefine-key 'advertised-undo #'cider-macroexpand-undo)
(redefine-key 'undo #'cider-macroexpand-undo))
map))

(define-minor-mode cider-macroexpansion-mode
@@ -0,0 +1,197 @@
;;; cider-mode.el --- Minor mode for REPL interactions -*- lexical-binding: t -*-

;; Copyright © 2012-2015 Tim King, Phil Hagelberg
;; Copyright © 2013-2015 Bozhidar Batsov, Hugo Duncan, Steve Purcell
;;
;; Author: Tim King <kingtim@gmail.com>
;; Phil Hagelberg <technomancy@gmail.com>
;; Bozhidar Batsov <bozhidar@batsov.com>
;; Hugo Duncan <hugo@hugoduncan.org>
;; Steve Purcell <steve@sanityinc.com>

;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.

;; This file is not part of GNU Emacs.

;;; Commentary:

;; Minor mode for REPL interactions.

;;; Code:

(require 'cider-interaction)
(require 'cider-eldoc)

(defcustom cider-mode-line-show-connection t
"If the mode-line lighter should detail the connection."
:group 'cider
:type 'boolean
:package-version '(cider "0.10.0"))

(defun cider--modeline-info ()
"Return info for the `cider-mode' modeline.
Info contains project name and host:port endpoint."
(let ((current-connection (cider-current-repl-buffer)))
(if current-connection
(with-current-buffer current-connection
(concat
(when nrepl-sibling-buffer-alist
(concat cider-repl-type ":"))
(when cider-mode-line-show-connection
(format "%s@%s:%s"
(or (nrepl--project-name nrepl-project-dir) "<no project>")
(pcase (car nrepl-endpoint)
("localhost" "")
(x x))
(cadr nrepl-endpoint)))))
"not connected")))

;;;###autoload
(defcustom cider-mode-line
'(:eval (format " cider[%s]" (cider--modeline-info)))
"Mode line lighter for `cider-mode'.
The value of this variable is a mode line template as in
`mode-line-format'. See Info Node `(elisp)Mode Line Format' for
details about mode line templates.
Customize this variable to change how `cider-mode' displays its
status in the mode line. The default value displays the current connection.
Set this variable to nil to disable the mode line
entirely."
:group 'cider
:type 'sexp
:risky t
:package-version '(cider "0.7.0"))

(defvar cider-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "C-c C-d") #'cider-doc-map)
(define-key map (kbd "M-.") #'cider-find-var)
(define-key map (kbd "C-c C-.") #'cider-find-ns)
(define-key map (kbd "M-,") #'cider-jump-back)
(define-key map (kbd "C-c M-.") #'cider-find-resource)
(define-key map (kbd "M-TAB") #'complete-symbol)
(define-key map (kbd "C-M-x") #'cider-eval-defun-at-point)
(define-key map (kbd "C-c C-c") #'cider-eval-defun-at-point)
(define-key map (kbd "C-x C-e") #'cider-eval-last-sexp)
(define-key map (kbd "C-c C-e") #'cider-eval-last-sexp)
(define-key map (kbd "C-c C-w") #'cider-eval-last-sexp-and-replace)
(define-key map (kbd "C-c M-e") #'cider-eval-last-sexp-to-repl)
(define-key map (kbd "C-c M-p") #'cider-insert-last-sexp-in-repl)
(define-key map (kbd "C-c C-p") #'cider-pprint-eval-last-sexp)
(define-key map (kbd "C-c C-f") #'cider-pprint-eval-defun-at-point)
(define-key map (kbd "C-c C-r") #'cider-eval-region)
(define-key map (kbd "C-c C-n") #'cider-eval-ns-form)
(define-key map (kbd "C-c M-:") #'cider-read-and-eval)
(define-key map (kbd "C-c C-u") #'cider-undef)
(define-key map (kbd "C-c C-m") #'cider-macroexpand-1)
(define-key map (kbd "C-c M-m") #'cider-macroexpand-all)
(define-key map (kbd "C-c M-n") #'cider-repl-set-ns)
(define-key map (kbd "C-c M-i") #'cider-inspect)
(define-key map (kbd "C-c M-t v") #'cider-toggle-trace-var)
(define-key map (kbd "C-c M-t n") #'cider-toggle-trace-ns)
(define-key map (kbd "C-c C-z") #'cider-switch-to-repl-buffer)
(define-key map (kbd "C-c M-o") #'cider-find-and-clear-repl-buffer)
(define-key map (kbd "C-c C-k") #'cider-load-buffer)
(define-key map (kbd "C-c C-l") #'cider-load-file)
(define-key map (kbd "C-c C-b") #'cider-interrupt)
(define-key map (kbd "C-c ,") #'cider-test-run-tests)
(define-key map (kbd "C-c C-,") #'cider-test-rerun-tests)
(define-key map (kbd "C-c M-,") #'cider-test-run-test)
(define-key map (kbd "C-c C-t") #'cider-test-show-report)
(define-key map (kbd "C-c M-s") #'cider-selector)
(define-key map (kbd "C-c M-r") #'cider-rotate-default-connection)
(define-key map (kbd "C-c M-d") #'cider-display-connection-info)
(define-key map (kbd "C-c C-x") #'cider-refresh)
(define-key map (kbd "C-c C-q") #'cider-quit)
(easy-menu-define cider-mode-menu map
"Menu for CIDER mode"
`("CIDER"
["Complete symbol" complete-symbol]
"--"
,cider-doc-menu
"--"
("Eval"
["Eval top-level sexp at point" cider-eval-defun-at-point]
["Eval last sexp" cider-eval-last-sexp]
["Eval last sexp in popup buffer" cider-pprint-eval-last-sexp]
["Eval last sexp to REPL buffer" cider-eval-last-sexp-to-repl]
["Eval last sexp and replace" cider-eval-last-sexp-and-replace]
["Eval region" cider-eval-region]
["Eval ns form" cider-eval-ns-form]
["Insert last sexp in REPL" cider-insert-last-sexp-in-repl]
"--"
["Load (eval) buffer" cider-load-buffer]
["Load (eval) file" cider-load-file])
("Macroexpand"
["Macroexpand-1" cider-macroexpand-1]
["Macroexpand-all" cider-macroexpand-all])
("Find"
["Find definition" cider-find-var]
["Find resource" cider-find-resource]
["Jump back" cider-jump-back])
("Test"
["Run test" cider-test-run-test]
["Run all tests" cider-test-run-tests]
["Rerun failed/erring tests" cider-test-rerun-tests]
["Show test report" cider-test-show-report])
"--"
["Run project (-main function)" cider-run]
["Inspect" cider-inspect]
["Toggle var tracing" cider-toggle-trace-var]
["Toggle ns tracing" cider-toggle-trace-ns]
["Refresh loaded code" cider-refresh]
"--"
["Debug top-level form" cider-debug-defun-at-point]
["List instrumented defs" cider-browse-instrumented-defs]
"--"
["Set ns" cider-repl-set-ns]
["Switch to REPL" cider-switch-to-repl-buffer]
["Switch to Relevant REPL" cider-switch-to-relevant-repl-buffer]
["Toggle REPL Pretty Print" cider-repl-toggle-pretty-printing]
["Clear REPL" cider-find-and-clear-repl-buffer]
"--"
("nREPL"
["Describe session" cider-describe-nrepl-session]
["Close session" cider-close-nrepl-session]
["Connection info" cider-display-connection-info]
["Rotate default connection" cider-rotate-default-connection])
"--"
["Interrupt evaluation" cider-interrupt]
"--"
["Quit" cider-quit]
["Restart" cider-restart]
"--"
["Version info" cider-version]))
map))

;;;###autoload
(define-minor-mode cider-mode
"Minor mode for REPL interaction from a Clojure buffer.
\\{cider-mode-map}"
nil
cider-mode-line
cider-mode-map
(cider-eldoc-setup)
(make-local-variable 'completion-at-point-functions)
(add-to-list 'completion-at-point-functions
#'cider-complete-at-point)
(setq next-error-function #'cider-jump-to-compilation-error))

(provide 'cider-mode)

;;; cider-mode.el ends here
@@ -0,0 +1,188 @@
;;; cider-overlays.el --- Managing CIDER overlays -*- lexical-binding: t; -*-

;; Copyright © 2015 Artur Malabarba

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

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:

;; Use `cider--make-overlay' to place a generic overlay at point. Or use
;; `cider--make-result-overlay' to place an interactive eval result overlay at
;; the end of a specified line.

;;; Code:

(require 'cider-util)


;;; Customization
(defface cider-result-overlay-face
'((t :inherit font-lock-builtin-face))
"Face used to display evaluation results at the end of line.
Only used on the result string if `cider-ovelays-use-font-lock' is nil.
If it is non-nil, this face is only used on the prefix (usually a \"=>\")."
:group 'cider
:package-version "0.9.1")

(defcustom cider-result-use-clojure-font-lock t
"If non-nil, interactive eval results are font-locked as Clojure code."
:group 'cider
:type 'boolean
:package-version '(cider . "0.10.0"))

(defcustom cider-ovelays-use-font-lock nil
"If non-nil, results overlays are font-locked as Clojure code.
If nil, apply `cider-result-overlay-face' to the entire overlay instead of
font-locking it."
:group 'cider
:type 'boolean
:package-version '(cider . "0.10.0"))

(defcustom cider-use-overlays 'both
"Whether to display evaluation results with overlays.
If t, use overlays. If nil, display on the echo area. If both, display on
both places.
Only applies to evaluation commands. To configure the debugger overlays,
see `cider-debug-use-overlays'."
:type '(choice (const :tag "End of line" t)
(const :tag "Bottom of screen" nil)
(const :tag "Both" both))
:group 'cider
:package-version '(cider . "0.10.0"))

(defcustom cider-eval-result-prefix "=> "
"The prefix displayed in the minibuffer before a result value."
:type 'string
:group 'cider
:package-version '(cider . "0.5.0"))
(define-obsolete-variable-alias 'cider-interactive-eval-result-prefix 'cider-eval-result-prefix "0.10.0")

(defcustom cider-eval-result-duration 'command
"Duration, in seconds, of CIDER's eval-result overlays.
If nil, overlays last indefinitely. If command, they're erased after the
next command.
Also see `cider-use-overlays'."
:type '(choice (integer :tag "Duration in seconds")
(const :tag "Until next command" command)
(const :tag "Last indefinitely" nil))
:group 'cider
:package-version '(cider . "0.10.0"))


;;; Overlay logic
(defun cider--delete-overlay (ov &rest _)
"Safely delete overlay OV.
Never throws errors, and can be used in an overlay's modification-hooks."
(ignore-errors (delete-overlay ov)))

(defun cider--make-overlay (l r type &rest props)
"Place an overlay between L and R and return it.
TYPE is a symbol put on the overlay's cider-type property. It is used to
easily remove all overlays from a region with:
(remove-overlays start end 'cider-type TYPE)
PROPS is a plist of properties and values to add to the overlay."
(let ((o (make-overlay l (or r l) (current-buffer))))
(overlay-put o 'cider-type type)
(while props (overlay-put o (pop props) (pop props)))
(push #'cider--delete-overlay (overlay-get o 'modification-hooks))
o))

(defun cider--make-result-overlay (value &optional where duration &rest props)
"Place an overlay displaying VALUE at the end of line.
VALUE is used as the overlay's after-string property, meaning it is
displayed at the end of the overlay. The overlay itself is placed from
beginning to end of current line.
Return nil if the overlay was not placed or is not visible, and return the
overlay otherwise.
Return the overlay if it was placed successfully, and nil if it failed.
If WHERE is a number or a marker, it is the character position of the line
to use, otherwise use `point'.
If DURATION is non-nil it should be a number, and the overlay will be
deleted after that many seconds. It can also be the symbol command, so the
overlay will be deleted after the next command (this mimics the behaviour
of the echo area).
PROPS are passed to `cider--make-overlay' with a type of result."
;; If the marker points to a dead buffer, don't do anything.
(-if-let (buffer (if (markerp where) (marker-buffer where)
(current-buffer)))
(with-current-buffer buffer
(remove-overlays nil nil 'cider-type 'result)
(save-excursion
(when where (goto-char where))
;; Make sure the overlay is actually at the end of the sexp.
(skip-chars-backward "\r\n[:blank:]")
(let* ((display-string (concat (propertize " " 'cursor 1000)
cider-eval-result-prefix
(format "%s" value)))
(o (apply #'cider--make-overlay
(line-beginning-position) (line-end-position)
'result
'after-string
(if cider-ovelays-use-font-lock
display-string
(propertize display-string 'face 'cider-result-overlay-face))
props)))
(pcase duration
((pred numberp) (run-at-time duration nil #'cider--delete-overlay o))
(`command (add-hook 'post-command-hook #'cider--remove-result-overlay nil 'local)))
(-when-let (win (get-buffer-window buffer))
;; Left edge is visible.
(when (and (pos-visible-in-window-p (point) win)
;; Right edge is visible. This is a little conservative
;; if the overlay contains line breaks.
(or (< (+ (current-column) (string-width value))
(window-width win))
(not truncate-lines)))
o)))))
nil))


;;; Displaying eval result
(defun cider--remove-result-overlay ()
"Remove result overlay from current buffer.
This function also removes itself from `post-command-hook'."
(remove-hook 'post-command-hook #'cider--remove-result-overlay 'local)
(remove-overlays nil nil 'cider-type 'result))

(defun cider--display-interactive-eval-result (value &optional point)
"Display the result VALUE of an interactive eval operation.
VALUE is syntax-highlighted and displayed in the echo area.
If POINT and `cider-use-overlays' are non-nil, it is also displayed in an
overlay at the end of the line containing POINT.
Note that, while POINT can be a number, it's preferable to be a marker, as
that will better handle some corner cases where the original buffer is not
focused."
(let* ((font-value (if cider-result-use-clojure-font-lock
(cider-font-lock-as-clojure value)
value))
(used-overlay
(when (and point cider-use-overlays)
(cider--make-result-overlay font-value point cider-eval-result-duration))))
(message
"%s"
(propertize (format "%s%s" cider-eval-result-prefix font-value)
;; The following hides the message from the echo-area, but
;; displays it in the Messages buffer. We only hide the message
;; if the user wants to AND if the overlay succeeded.
'invisible (and used-overlay
(not (eq cider-use-overlays 'both)))))))

(provide 'cider-overlays)
;;; cider-overlays.el ends here
@@ -0,0 +1,12 @@
(define-package "cider" "20150818.441" "Clojure Interactive Development Environment that Rocks"
'((clojure-mode "4.2.0")
(dash "2.4.1")
(pkg-info "0.4")
(emacs "24.3")
(queue "0.1.1")
(spinner "1.4"))
:url "http://www.github.com/clojure-emacs/cider" :keywords
'("languages" "clojure" "cider"))
;; Local Variables:
;; no-byte-compile: t
;; End:

Large diffs are not rendered by default.

@@ -1,6 +1,6 @@
;;; cider-scratch.el --- *scratch* buffer for Clojure -*- lexical-binding: t -*-

;; Copyright © 2014 Bozhidar Batsov
;; Copyright © 2014-2015 Bozhidar Batsov
;;
;; Author: Tim King <kingtim@gmail.com>
;; Phil Hagelberg <technomancy@gmail.com>
@@ -35,7 +35,7 @@
(defvar cider-clojure-interaction-mode-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map clojure-mode-map)
(define-key map (kbd "C-j") 'cider-eval-print-last-sexp)
(define-key map (kbd "C-j") #'cider-eval-print-last-sexp)
map))

(defconst cider-scratch-buffer-name "*cider-scratch*")
@@ -1,7 +1,7 @@
;;; cider-selector.el --- Buffer selection command inspired by SLIME's selector -*- lexical-binding: t -*-

;; Copyright © 2012-2014 Tim King, Phil Hagelberg
;; Copyright © 2013-2014 Bozhidar Batsov, Hugo Duncan, Steve Purcell
;; Copyright © 2012-2015 Tim King, Phil Hagelberg
;; Copyright © 2013-2015 Bozhidar Batsov, Hugo Duncan, Steve Purcell
;;
;; Author: Tim King <kingtim@gmail.com>
;; Phil Hagelberg <technomancy@gmail.com>
@@ -32,7 +32,6 @@

(require 'cider-client)
(require 'cider-interaction)
(require 'cider-repl) ; for cider-get-repl-buffer

(defconst cider-selector-help-buffer "*Selector Help*"
"The name of the selector's help buffer.")
@@ -50,7 +49,7 @@ DESCRIPTION is a one-line description of what the key selects.")
Only considers buffers that are not already visible."
(cl-loop for buffer in (buffer-list)
when (and (with-current-buffer buffer (eq major-mode mode))
(not (string-match "^ " (buffer-name buffer)))
(not (string-match-p "^ " (buffer-name buffer)))
(null (get-buffer-window buffer 'visible)))
return buffer
finally (error "Can't find unshown buffer in %S" mode)))
@@ -105,7 +104,7 @@ is chosen. The returned buffer is selected with
`(setq cider-selector-methods
(cl-sort (cons (list ,key ,description ,method)
(cl-remove ,key cider-selector-methods :key #'car))
#'< :key #'car))))
#'< :key #'car))))

(def-cider-selector-method ?? "Selector help buffer."
(ignore-errors (kill-buffer cider-selector-help-buffer))
@@ -119,8 +118,8 @@ is chosen. The returned buffer is selected with
(cider-selector)
(current-buffer))

(pushnew (list ?4 "Select in other window" (lambda () (cider-selector t)))
cider-selector-methods :key #'car)
(cl-pushnew (list ?4 "Select in other window" (lambda () (cider-selector t)))
cider-selector-methods :key #'car)

(def-cider-selector-method ?c
"Most recently visited clojure-mode buffer."
@@ -135,7 +134,7 @@ is chosen. The returned buffer is selected with

(def-cider-selector-method ?r
"Current REPL buffer."
(cider-get-repl-buffer))
(cider-current-repl-buffer))

(def-cider-selector-method ?n
"Connections browser buffer."
@@ -150,11 +149,6 @@ is chosen. The returned buffer is selected with
"*cider-error* buffer."
cider-error-buffer)

(def-cider-selector-method ?s
"Cycle to the next CIDER connection's REPL."
(cider-rotate-connection)
(cider-get-repl-buffer))

(provide 'cider-selector)

;;; cider-selector.el ends here
@@ -1,6 +1,6 @@
;;; cider-stacktrace.el --- Stacktrace navigator -*- lexical-binding: t -*-

;; Copyright © 2014 Jeff Valk
;; Copyright © 2014-2015 Jeff Valk

;; Author: Jeff Valk <jv@jeffvalk.com>

@@ -53,11 +53,30 @@ If nil, messages will not be wrapped. If truthy but non-numeric,
:group 'cider-stacktrace
:package-version '(cider . "0.6.0"))

(defcustom cider-stacktrace-print-length 50
"Set the maximum length of sequences in displayed cause data.
This sets the value of Clojure's `*print-length*` when pretty printing the
`ex-data` map for exception causes in the stacktrace that are instances of
`IExceptionInfo`.
Be advised that setting this to `nil` will cause the attempted printing of
infinite data structures."
:type '(choice integer (const nil))
:group 'cider-stacktrace
:package-version '(cider . "0.9.0"))

(defcustom cider-stacktrace-print-level 50
"Set the maximum level of nested data to print.
Used when displaying stacktrace data (used for clojure's *print-level*)."
"Set the maximum level of nesting in displayed cause data.
This sets the value of Clojure's `*print-level*` when pretty printing the
`ex-data` map for exception causes in the stacktrace that are instances of
`IExceptionInfo`.
Be advised that setting this to `nil` will cause the attempted printing of
cyclical data structures."
:type '(choice integer (const nil))
:group 'cider
:group 'cider-stacktrace
:package-version '(cider . "0.8.0"))

(defvar cider-stacktrace-detail-max 2
@@ -129,24 +148,24 @@ Used when displaying stacktrace data (used for clojure's *print-level*)."

(defvar cider-stacktrace-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "M-p") 'cider-stacktrace-previous-cause)
(define-key map (kbd "M-n") 'cider-stacktrace-next-cause)
(define-key map (kbd "M-.") 'cider-stacktrace-jump)
(define-key map "q" 'cider-popup-buffer-quit-function)
(define-key map "j" 'cider-stacktrace-toggle-java)
(define-key map "c" 'cider-stacktrace-toggle-clj)
(define-key map "r" 'cider-stacktrace-toggle-repl)
(define-key map "t" 'cider-stacktrace-toggle-tooling)
(define-key map "d" 'cider-stacktrace-toggle-duplicates)
(define-key map "a" 'cider-stacktrace-toggle-all)
(define-key map "1" 'cider-stacktrace-cycle-cause-1)
(define-key map "2" 'cider-stacktrace-cycle-cause-2)
(define-key map "3" 'cider-stacktrace-cycle-cause-3)
(define-key map "4" 'cider-stacktrace-cycle-cause-4)
(define-key map "5" 'cider-stacktrace-cycle-cause-5)
(define-key map "0" 'cider-stacktrace-cycle-all-causes)
(define-key map [tab] 'cider-stacktrace-cycle-current-cause)
(define-key map [backtab] 'cider-stacktrace-cycle-all-causes)
(define-key map (kbd "M-p") #'cider-stacktrace-previous-cause)
(define-key map (kbd "M-n") #'cider-stacktrace-next-cause)
(define-key map (kbd "M-.") #'cider-stacktrace-jump)
(define-key map "q" #'cider-popup-buffer-quit-function)
(define-key map "j" #'cider-stacktrace-toggle-java)
(define-key map "c" #'cider-stacktrace-toggle-clj)
(define-key map "r" #'cider-stacktrace-toggle-repl)
(define-key map "t" #'cider-stacktrace-toggle-tooling)
(define-key map "d" #'cider-stacktrace-toggle-duplicates)
(define-key map "a" #'cider-stacktrace-toggle-all)
(define-key map "1" #'cider-stacktrace-cycle-cause-1)
(define-key map "2" #'cider-stacktrace-cycle-cause-2)
(define-key map "3" #'cider-stacktrace-cycle-cause-3)
(define-key map "4" #'cider-stacktrace-cycle-cause-4)
(define-key map "5" #'cider-stacktrace-cycle-cause-5)
(define-key map "0" #'cider-stacktrace-cycle-all-causes)
(define-key map [tab] #'cider-stacktrace-cycle-current-cause)
(define-key map [backtab] #'cider-stacktrace-cycle-all-causes)
(easy-menu-define cider-stacktrace-mode-menu map
"Menu for CIDER's stacktrace mode"
'("Stacktrace"
@@ -193,7 +212,7 @@ Find buttons with a 'filter property; if filter is a member of FILTERS, or
if filter is nil ('show all') and the argument list is non-nil, fontify the
button as disabled. Upon finding text with a 'hidden-count property, stop
searching and update the hidden count text."
(with-current-buffer (get-buffer cider-error-buffer)
(with-current-buffer cider-error-buffer
(save-excursion
(goto-char (point-min))
(let ((inhibit-read-only t)
@@ -209,7 +228,7 @@ searching and update the hidden count text."
(face (funcall get-face (if filter
(member filter filters)
filters))))
(button-put button 'font-lock-face face)))
(button-put button 'face face)))
(goto-char (or (next-property-change (point))
(point-max)))))
;; Update hidden count
@@ -223,7 +242,7 @@ searching and update the hidden count text."
Update `cider-stacktrace-hidden-frame-count' and indicate filters applied.
Currently collapsed stacktraces are ignored, and do not contribute to the
hidden count."
(with-current-buffer (get-buffer cider-error-buffer)
(with-current-buffer cider-error-buffer
(save-excursion
(goto-char (point-min))
(let ((inhibit-read-only t)
@@ -240,7 +259,7 @@ hidden count."

(defun cider-stacktrace-apply-cause-visibility ()
"Apply `cider-stacktrace-cause-visibility' to causes and reapply filters."
(with-current-buffer (get-buffer cider-error-buffer)
(with-current-buffer cider-error-buffer
(save-excursion
(goto-char (point-min))
(cl-flet ((next-detail (end)
@@ -270,18 +289,17 @@ hidden count."
(defun cider-stacktrace-previous-cause ()
"Move point to the previous exception cause, if one exists."
(interactive)
(with-current-buffer (get-buffer cider-error-buffer)
(with-current-buffer cider-error-buffer
(-when-let (pos (previous-single-property-change (point) 'cause))
(goto-char pos))))

(defun cider-stacktrace-next-cause ()
"Move point to the next exception cause, if one exists."
(interactive)
(with-current-buffer (get-buffer cider-error-buffer)
(with-current-buffer cider-error-buffer
(-when-let (pos (next-single-property-change (point) 'cause))
(goto-char pos))))


(defun cider-stacktrace-cycle-cause (num &optional level)
"Update element NUM of `cider-stacktrace-cause-visibility', optionally to LEVEL.
If LEVEL is not specified, its current value is incremented. When it reaches 3,
@@ -293,7 +311,7 @@ it wraps to 0."
(defun cider-stacktrace-cycle-all-causes ()
"Cycle the visibility of all exception causes."
(interactive)
(with-current-buffer (get-buffer cider-error-buffer)
(with-current-buffer cider-error-buffer
(save-excursion
;; Find nearest cause.
(unless (get-text-property (point) 'cause)
@@ -310,7 +328,7 @@ it wraps to 0."
(defun cider-stacktrace-cycle-current-cause ()
"Cycle the visibility of current exception at point, if any."
(interactive)
(with-current-buffer (get-buffer cider-error-buffer)
(with-current-buffer cider-error-buffer
(-when-let (num (get-text-property (point) 'cause))
(cider-stacktrace-cycle-cause num))))

@@ -403,18 +421,26 @@ it wraps to 0."
(method (button-get button 'method))
(info (or (and var (cider-var-info var))
(and class method (cider-member-info class method))
`(dict "file" ,(button-get button 'file))))
;; stacktrace returns more accurate line numbers
(info (nrepl-dict-put info "line" (button-get button 'line))))
(cider--jump-to-loc-from-info info t)))

(defun cider-stacktrace-jump ()
"Like `cider-jump-to-var', but uses the stack frame source at point, if available."
(interactive)
(nrepl-dict)))
;; Stacktrace returns more accurate line numbers, but if the function's
;; line was unreliable, then so is the stacktrace by the same amount.
;; Set `line-shift' to the number of lines from the beginning of defn.
(line-shift (- (or (button-get button 'line) 0)
(or (nrepl-dict-get info "line") 1)))
;; give priority to `info` files as `info` returns full paths.
(info (nrepl-dict-put info "file" (or (nrepl-dict-get info "file")
(button-get button 'file)))))
(cider--jump-to-loc-from-info info t)
(forward-line line-shift)
(back-to-indentation)))

(defun cider-stacktrace-jump (&optional arg)
"Like `cider-find-var', but uses the stack frame source at point, if available."
(interactive "P")
(let ((button (button-at (point))))
(if (and button (button-get button 'line))
(cider-stacktrace-navigate button)
(call-interactively 'cider-jump-to-var))))
(cider-find-var arg))))


;; Rendering
@@ -438,12 +464,12 @@ it wraps to 0."
(with-current-buffer buffer
(insert " Show: ")
(dolist (filter filters)
(insert-text-button (first filter)
'filter (second filter)
(insert-text-button (car filter)
'filter (cadr filter)
'follow-link t
'action 'cider-stacktrace-filter
'help-echo (format "Toggle %s stack frames"
(first filter)))
(car filter)))
(insert " "))
(let ((hidden "(0 frames hidden)"))
(put-text-property 0 (length hidden) 'hidden-count t hidden)
@@ -465,7 +491,7 @@ This associates text properties to enable filtering and source navigation."
'flags flags 'follow-link t
'action 'cider-stacktrace-navigate
'help-echo "View source at this location"
'font-lock-face 'cider-stacktrace-face)
'face 'cider-stacktrace-face)
(save-excursion
(let ((p4 (point))
(p1 (search-backward " "))
@@ -513,21 +539,26 @@ This associates text properties to enable filtering and source navigation."
"Set and apply CAUSES initial visibility, filters, and cursor position."
;; Partially display outermost cause if it's a compiler exception (the
;; description reports reader location of the error).
(nrepl-dbind-response (first causes) (class)
(nrepl-dbind-response (car causes) (class)
(when (equal class "clojure.lang.Compiler$CompilerException")
(cider-stacktrace-cycle-cause (length causes) 1)))
;; Fully display innermost cause. This also applies visibility/filters.
(cider-stacktrace-cycle-cause 1 cider-stacktrace-detail-max)
;; Move point to first stacktrace frame in displayed cause.
(goto-char (point-min))
(while (cider-stacktrace-next-cause))
(goto-char (next-single-property-change (point) 'flags)))
;; Move point to first stacktrace frame in displayed cause. If the error
;; buffer is visible in a window, ensure that window is selected while moving
;; point, so as to move both the buffer's and the window's point.
(with-selected-window (or (get-buffer-window cider-error-buffer)
(selected-window))
(with-current-buffer cider-error-buffer
(goto-char (point-min))
(while (cider-stacktrace-next-cause))
(goto-char (next-single-property-change (point) 'flags)))))

(defun cider-stacktrace-render (buffer causes)
"Emit into BUFFER useful stacktrace information for the CAUSES."
(with-current-buffer buffer
(cider-stacktrace-mode)
(let ((inhibit-read-only t))
(erase-buffer)
(newline)
;; Stacktrace filters
(cider-stacktrace-render-filters
@@ -1,6 +1,6 @@
;;; cider-test.el --- Test result viewer -*- lexical-binding: t -*-

;; Copyright © 2014 Jeff Valk
;; Copyright © 2014-2015 Jeff Valk

;; Author: Jeff Valk <jv@jeffvalk.com>

@@ -47,6 +47,12 @@
:group 'cider-test
:package-version '(cider . "0.8.0"))

(defcustom cider-auto-select-test-report-buffer t
"Determines if the test-report buffer should be auto-selected."
:type 'boolean
:group 'cider-test
:package-version '(cider . "0.9.0"))

(defvar cider-test-last-test-ns nil
"The namespace for which tests were last run.")

@@ -97,18 +103,19 @@

(defvar cider-test-report-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "C-c ,") 'cider-test-run-tests)
(define-key map (kbd "C-c C-,") 'cider-test-rerun-tests)
(define-key map (kbd "C-c M-,") 'cider-test-run-test)
(define-key map (kbd "M-p") 'cider-test-previous-result)
(define-key map (kbd "M-n") 'cider-test-next-result)
(define-key map (kbd "M-.") 'cider-test-jump)
(define-key map (kbd "t") 'cider-test-jump)
(define-key map (kbd "d") 'cider-test-ediff)
(define-key map (kbd "e") 'cider-test-stacktrace)
(define-key map "q" 'cider-popup-buffer-quit-function)
(define-key map (kbd "<backtab>") 'backward-button)
(define-key map (kbd "TAB") 'forward-button)
(define-key map (kbd "C-c ,") #'cider-test-run-tests)
(define-key map (kbd "C-c C-,") #'cider-test-rerun-tests)
(define-key map (kbd "C-c M-,") #'cider-test-run-test)
(define-key map (kbd "M-p") #'cider-test-previous-result)
(define-key map (kbd "M-n") #'cider-test-next-result)
(define-key map (kbd "M-.") #'cider-test-jump)
(define-key map (kbd "<backtab>") #'cider-test-previous-result)
(define-key map (kbd "TAB") #'cider-test-next-result)
(define-key map (kbd "RET") #'cider-test-jump)
(define-key map (kbd "t") #'cider-test-jump)
(define-key map (kbd "d") #'cider-test-ediff)
(define-key map (kbd "e") #'cider-test-stacktrace)
(define-key map "q" #'cider-popup-buffer-quit-function)
(easy-menu-define cider-test-report-mode-menu map
"Menu for CIDER's test result mode"
'("Test-Report"
@@ -155,16 +162,15 @@
(-when-let (pos (next-single-property-change (point) 'type))
(goto-char pos))))

(defun cider-test-jump ()
"Like `cider-jump-to-var', but uses the test at point's definition, if available."
(interactive)
(defun cider-test-jump (&optional arg)
"Like `cider-find-var', but uses the test at point's definition, if available."
(interactive "P")
(let ((ns (get-text-property (point) 'ns))
(var (get-text-property (point) 'var))
(line (get-text-property (point) 'line)))
(if (and ns var)
(cider-jump-to-var (concat ns "/" var) line)
(call-interactively 'cider-jump-to-var))))

(cider-find-var arg (concat ns "/" var) line)
(cider-find-var arg))))

;;; Error stacktraces

@@ -173,8 +179,10 @@
(let (causes)
(nrepl-send-request
(append
(list "op" "test-stacktrace" "session" (nrepl-current-session)
(list "op" "test-stacktrace" "session" (cider-current-session)
"ns" ns "var" var "index" index)
(when cider-stacktrace-print-length
(list "print-length" cider-stacktrace-print-length))
(when cider-stacktrace-print-level
(list "print-level" cider-stacktrace-print-level)))
(lambda (response)
@@ -186,8 +194,8 @@
cider-auto-select-error-buffer)
(reverse causes))))))))))

(defun cider-test-stacktrace (&optional button)
"Display stacktrace for the erring test at point, optionally from BUTTON."
(defun cider-test-stacktrace ()
"Display stacktrace for the erring test at point."
(interactive)
(let ((ns (get-text-property (point) 'ns))
(var (get-text-property (point) 'var))
@@ -239,7 +247,7 @@ With the actual value, the outermost '(not ...)' s-expression is removed."
(mapc (lambda (b) (when (get-buffer b) (kill-buffer b)))
cider-test-ediff-buffers))

(add-hook 'ediff-cleanup-hook 'cider-test-ediff-cleanup)
(add-hook 'ediff-cleanup-hook #'cider-test-ediff-cleanup)


;;; Report rendering
@@ -250,7 +258,7 @@ With the actual value, the outermost '(not ...)' s-expression is removed."
("pass" 'cider-test-success-face)
("fail" 'cider-test-failure-face)
("error" 'cider-test-error-face)
(t 'default)))
(_ 'default)))

(defun cider-test-render-summary (buffer summary)
"Emit into BUFFER the report SUMMARY statistics."
@@ -282,7 +290,7 @@ With the actual value, the outermost '(not ...)' s-expression is removed."
(progn (insert-text-button
error
'follow-link t
'action 'cider-test-stacktrace
'action '(lambda (_button) (cider-test-stacktrace))
'help-echo "View causes and stacktrace")
(newline))
(insert (cider-font-lock-as-clojure actual)))))
@@ -300,7 +308,7 @@ With the actual value, the outermost '(not ...)' s-expression is removed."
(unless (zerop (+ fail error))
(cider-insert "Results" 'bold t "\n")
(nrepl-dict-map
(lambda (var tests)
(lambda (_var tests)
(dolist (test tests)
(nrepl-dbind-response test (type)
(unless (equal "pass" type)
@@ -337,21 +345,25 @@ With the actual value, the outermost '(not ...)' s-expression is removed."
(defun cider-test-highlight-problem (buffer test)
"Highlight the BUFFER test definition for the non-passing TEST."
(with-current-buffer buffer
(nrepl-dbind-response test (type line message expected actual)
(save-excursion
(goto-char (point-min))
(forward-line (1- line))
(forward-whitespace 1)
(forward-char)
(let ((beg (point)))
(forward-sexp)
(let ((overlay (make-overlay beg (point))))
(overlay-put overlay 'font-lock-face (cider-test-type-face type))
(overlay-put overlay 'type type)
(overlay-put overlay 'help-echo message)
(overlay-put overlay 'message message)
(overlay-put overlay 'expected expected)
(overlay-put overlay 'actual actual)))))))
(nrepl-dbind-response test (type file line message expected actual)
;; we have to watch out for vars without proper location metadata
;; right now everything evaluated interactively lacks this data
;; TODO: Figure out what to do when the metadata is missing
(when (and file line (not (cider--tooling-file-p file)))
(save-excursion
(goto-char (point-min))
(forward-line (1- line))
(forward-whitespace 1)
(forward-char)
(let ((beg (point)))
(forward-sexp)
(let ((overlay (make-overlay beg (point))))
(overlay-put overlay 'font-lock-face (cider-test-type-face type))
(overlay-put overlay 'type type)
(overlay-put overlay 'help-echo message)
(overlay-put overlay 'message message)
(overlay-put overlay 'expected expected)
(overlay-put overlay 'actual actual))))))))

(defun cider-test-highlight-problems (ns results)
"Highlight all non-passing tests in the NS test RESULTS."
@@ -394,7 +406,7 @@ This uses the Leiningen convention of appending '-test' to the namespace name."
(when ns
(let ((suffix "-test"))
;; string-suffix-p is only available in Emacs 24.4+
(if (string-match (rx-to-string `(: ,suffix eos) t) ns)
(if (string-match-p (rx-to-string `(: ,suffix eos) t) ns)
ns
(concat ns suffix)))))

@@ -409,7 +421,7 @@ displayed. When test failures/errors occur, their sources are highlighted."
(message "Testing...")
(nrepl-send-request
(list "ns" ns "op" (if retest "retest" "test")
"tests" tests "session" (nrepl-current-session))
"tests" tests "session" (cider-current-session))
(lambda (response)
(nrepl-dbind-response response (summary results status out err)
(cond ((member "namespace-not-found" status)
@@ -425,7 +437,8 @@ displayed. When test failures/errors occur, their sources are highlighted."
(when (or (not (zerop (+ error fail)))
cider-test-show-report-on-success)
(cider-test-render-report
(cider-popup-buffer cider-test-report-buffer t)
(cider-popup-buffer cider-test-report-buffer
cider-auto-select-test-report-buffer)
ns summary results)))))))))

(defun cider-test-rerun-tests ()
@@ -445,7 +458,7 @@ current ns."
(clojure-find-ns)
(or (funcall cider-test-infer-test-ns (clojure-find-ns))
(when (eq major-mode 'cider-test-report-mode)
cider-test-last-test-ns))))
cider-test-last-test-ns))))
(cider-test-execute ns nil)
(message "No namespace to test in current context")))

@@ -461,7 +474,7 @@ is searched."
(cider-test-execute ns nil (list var))
(let ((ns (clojure-find-ns))
(def (clojure-find-def)))
(if (and ns (member (first def) '("deftest" "defspec")))
(if (and ns (member (car def) '("deftest" "defspec")))
(cider-test-execute ns nil (rest def))
(message "No test at point"))))))

@@ -0,0 +1,187 @@
;;; cider-util.el --- Common utility functions that don't belong anywhere else -*- lexical-binding: t -*-

;; Copyright © 2012-2015 Tim King, Phil Hagelberg
;; Copyright © 2013-2015 Bozhidar Batsov, Hugo Duncan, Steve Purcell
;;
;; Author: Tim King <kingtim@gmail.com>
;; Phil Hagelberg <technomancy@gmail.com>
;; Bozhidar Batsov <bozhidar@batsov.com>
;; Hugo Duncan <hugo@hugoduncan.org>
;; Steve Purcell <steve@sanityinc.com>

;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.

;; This file is not part of GNU Emacs.

;;; Commentary:

;; Common utility functions that don't belong anywhere else

;;; Code:

(require 'dash)
(require 'cl-lib)
(require 'clojure-mode)

(defcustom cider-font-lock-max-length 10000
"The max length of strings to fontify in `cider-font-lock-as'.
Setting this to nil removes the fontification restriction."
:group 'cider
:type 'boolean
:package-version '(cider . "0.10.0"))

(defun cider-util--hash-keys (hashtable)
"Return a list of keys in HASHTABLE."
(let ((keys '()))
(maphash (lambda (k _v) (setq keys (cons k keys))) hashtable)
keys))

(defun cider-util--clojure-buffers ()
"Return a list of all existing `clojure-mode' buffers."
(-filter
(lambda (buffer) (with-current-buffer buffer (derived-mode-p 'clojure-mode)))
(buffer-list)))

(defun cider-current-dir ()
"Return the directory of the current buffer."
(if buffer-file-name
(file-name-directory buffer-file-name)
default-directory))

;;; Text properties

(defun cider-maybe-intern (name)
"If NAME is a symbol, return it; otherwise, intern it."
(if (symbolp name) name (intern name)))

(defun cider-intern-keys (props)
"Copy plist-style PROPS with any non-symbol keys replaced with symbols."
(-map-indexed (lambda (i x) (if (cl-oddp i) x (cider-maybe-intern x))) props))

(defmacro cider-propertize-region (props &rest body)
"Execute BODY and add PROPS to all the text it inserts.
More precisely, PROPS are added to the region between the point's
positions before and after executing BODY."
(let ((start (cl-gensym)))
`(let ((,start (point)))
(prog1 (progn ,@body)
(add-text-properties ,start (point) ,props)))))

(put 'cider-propertize-region 'lisp-indent-function 1)

(defun cider-property-bounds (prop)
"Return the the positions of the previous and next change to PROP.
PROP is the name of a text property."
(let ((end (next-single-char-property-change (point) prop)))
(list (previous-single-char-property-change end prop) end)))

(defun cider-insert (text &optional face break more-text)
"Insert TEXT with FACE, optionally followed by a line BREAK and MORE-TEXT."
(insert (if face (propertize text 'font-lock-face face) text))
(when more-text (insert more-text))
(when break (insert "\n")))

;;; Font lock

(defun cider-font-lock-as (mode string)
"Use MODE to font-lock the STRING."
(if (or (null cider-font-lock-max-length)
(< (length string) cider-font-lock-max-length))
(with-temp-buffer
(insert string)
;; suppress major mode hooks as we care only about their font-locking
;; otherwise modes like whitespace-mode and paredit might interfere
(setq-local delay-mode-hooks t)
(setq delayed-mode-hooks nil)
(funcall mode)
(if (fboundp 'font-lock-ensure)
(font-lock-ensure)
(font-lock-fontify-buffer))
(buffer-string))
string))

(defun cider-font-lock-region-as (mode beg end &optional buffer)
"Use MODE to font-lock text between BEG and END.
Unless you specify a BUFFER it will default to the current one."
(with-current-buffer (or buffer (current-buffer))
(let ((text (buffer-substring beg end)))
(delete-region beg end)
(goto-char beg)
(insert (cider-font-lock-as mode text)))))

(defun cider-font-lock-as-clojure (string)
"Font-lock STRING as Clojure code."
(cider-font-lock-as 'clojure-mode string))

;;; Colors

(defun cider-scale-color (color scale)
"For a COLOR hex string or name, adjust intensity of RGB components by SCALE."
(let* ((rgb (color-values color))
(scaled-rgb (mapcar (lambda (n)
(format "%04x" (round (+ n (* scale 65535)))))
rgb)))
(apply #'concat "#" scaled-rgb)))

(defun cider-scale-background-color ()
"Scale the current background color to get a slighted muted version."
(let ((color (frame-parameter nil 'background-color))
(dark (eq (frame-parameter nil 'background-mode) 'dark)))
(cider-scale-color color (if dark 0.05 -0.05))))

(autoload 'pkg-info-version-info "pkg-info.el")

(defun cider--version ()
"Retrieve CIDER's version."
(condition-case nil
(pkg-info-version-info 'cider)
(error cider-version)))

;;; Strings

(defun cider-string-join (strings &optional separator)
"Join all STRINGS using SEPARATOR."
(mapconcat #'identity strings separator))

(defun cider-join-into-alist (candidates &optional separator)
"Make an alist from CANDIDATES.
The keys are the elements joined with SEPARATOR and values are the original
elements. Useful for `completing-read' when candidates are complex
objects."
(mapcar (lambda (el)
(if (listp el)
(cons (cider-string-join el (or separator ":")) el)
(cons el el)))
candidates))

(defun cider-namespace-qualified-p (sym)
"Return t if SYM is namespace-qualified."
(string-match-p "[^/]+/" sym))

(defun cider--insert-readme-button (label section-id)
"Insert a button that links to the online readme.
LABEL is the displayed string, and SECTION-ID is where it points
to."
(insert-button
label
'follow-link t
'action (lambda (&rest _) (interactive)
(browse-url (concat "https://github.com/clojure-emacs/cider#"
section-id)))))

(provide 'cider-util)

;;; cider-util.el ends here

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

This file was deleted.

This file was deleted.

@@ -0,0 +1,87 @@
# Changelog

## Up next
- Add `cljr-change-function-signature` to re-order or re-name function parameters.
- Keep pressing `l` after `cljr-expand-let` to expand further.

## 1.1.0

- Add `cljr-describe-refactoring` which shows the wiki page describing one of the available refactorings inline in emacs.
- Add `cljr-rename-file-or-dir` to replace `cljr-rename-file`.
- Add `cljr-inline-symbol` which replaces the symbol at point with its definition.
- Add `cljr-add-stubs` which adds a skeleton implementation of the protocol or interface at point.
- Add `cljr-reify-to-defrecord`
- Add `cljr-show-changelog` so users don't have to visit github to find out what's changed after a package update.
- Add `cljr-create-fn-from-example` to create function stub based on example usage
- Add `cljr-update-project-dependencies` (for leiningen only) prompts to update dependencies in project.clj, listing available versions
- Now `cljr--add-test-use-declarations` actually checks the file system in order to find its require for the source ns.
- Improvements to error handling and reporting around analyzing namespaces
- Configuration option `cljr-find-usages-ignore-analyzer-errors`: when true, find-usages will run even if there are compilation/analyzer problems in some namespaces; defaults to nil.
- Configuration option `cljr-favor-private-functions`: set to nil to create public functions where applicable.
- Better support for `cljr-use-metadata-for-privacy` when creating functions.
- Highlight the relevant form when extracting and promoting functions.
- Multiple cursors is used when extracting and promoting functions (disable by setting `cljr-use-multiple-cursors` to nil)
- Not using multiple-cursors when in evil-mode.

## 1.0.5

- Add `cljr-reload-config` to resubmit config settings to the middleware
- Add config setting for `clean-ns` to not do rewriting to favor prefix form.
- Add `cljr-extract-function`
- Add `cljr-hotload-dependency`
- Hotloading of artifacts added with `cljr-add-project-dependency`
- Add `cljr-remove-let`
- Add `cljr-clean-ns`
- Add `cljr-add-missing-libspec`
- Add `cljr-promote-function`
- Add `cljr-find-usages`
- Add `cljr-rename-symbol`

## 0.13

- Removed `cljr-cycle-stringlike`. This function was duplicating the functionality of `clojure-mode`s `clojure-toggle-keyword-string`
- Add `cljr-cycle-if`
- Common namespace shorthands are (optionally) automatically required when you type it.
- Comparator for sort require, use and import is configurable, add optional lenght based comparator to sort longer first
- Add semantic comparator to sort items closer to the current namespace first
- Add `cljr-project-clean` with configurable clean functions
- Add `cljr-sort-project-dependencies`
- Add `cljr-add-project-dependency`
- Add `cljr-remove-debug-fns`
- performance tweak for `cljr-remove-unused-requires` if `refactor-nrepl` is used

## 0.12

- When expanding let, or moving expressions to let, it now replaces
duplicates in the let body with the bound name.

## 0.11

- Add `cljr-raise-sexp`
- Add `cljr-remove-unused-requires`
- Add `cljr-move-form`

## 0.10

- Add `cljr-stop-referring`
- Add `cljr-destructure-keys`
- Add `cljr-sort-ns`

## 0.9

- Add `cljr-replace-use`
- Add `cljr-add-declaration`

## 0.8

- Add `cljr-cycle-stringlike`
- Add `cljr-cycle-coll`
- Add `cljr-cycle-privacy`

## 0.7

- Add `cljr-thread-first-all`, `cljr-thread-last-all` and `cljr-unwind-all`

## 0.6

- Add `cljr-move-to-let`
@@ -0,0 +1,387 @@
;;; clj-refactor-autoloads.el --- automatically extracted autoloads
;;
;;; Code:
(add-to-list 'load-path (or (file-name-directory #$) (car load-path)))

;;;### (autoloads nil "clj-refactor" "clj-refactor.el" (21971 43639
;;;;;; 625939 617000))
;;; Generated autoloads from clj-refactor.el

(autoload 'cljr-add-keybindings-with-prefix "clj-refactor" "\
Bind keys in `cljr--all-helpers' under a PREFIX key.
\(fn PREFIX)" nil nil)

(autoload 'cljr-add-keybindings-with-modifier "clj-refactor" "\
Bind keys in `cljr--all-helpers' under a MODIFIER key.
\(fn MODIFIER)" nil nil)

(autoload 'cljr-rename-file-or-dir "clj-refactor" "\
Rename a file or directory of files.
Buffers visiting any affected file are killed and the
corresponding files are revisited.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-rename-file-or-dir
\(fn OLD-PATH NEW-PATH)" t nil)

(autoload 'cljr-sort-ns "clj-refactor" "\
Sort the `ns' form according to `cljr-sort-comparator'.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-sort-ns
\(fn)" t nil)

(autoload 'cljr-remove-unused-requires "clj-refactor" "\
Remove from the ns form any requires not being used.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-remove-unused-requires
\(fn)" t nil)

(autoload 'cljr-add-require-to-ns "clj-refactor" "\
Add a require statement to the ns form in current buffer.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-add-require-to-ns
\(fn)" t nil)

(autoload 'cljr-add-use-to-ns "clj-refactor" "\
Add a use statement to the buffer's ns form.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-add-use-to-ns
\(fn)" t nil)

(autoload 'cljr-add-import-to-ns "clj-refactor" "\
Add an import statement to the buffer's ns form.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-add-import-to-ns
\(fn)" t nil)

(autoload 'cljr-replace-use "clj-refactor" "\
Replace any :use clause with the equivalent :require clause.
Presently, there's no support for :use clauses containing :exclude.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-replace-use
\(fn)" t nil)

(autoload 'cljr-stop-referring "clj-refactor" "\
Stop referring to vars in the namespace at point.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-stop-referring
\(fn)" t nil)

(autoload 'cljr-move-form "clj-refactor" "\
Move the form containing POINT to a new namespace.
If REGION is active, move all forms contained by region.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-move-form
\(fn)" t nil)

(autoload 'cljr-add-declaration "clj-refactor" "\
Add a declare for the current def near the top of the buffer.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-add-declaration
\(fn)" t nil)

(autoload 'cljr-extract-constant "clj-refactor" "\
Extract form at (or above) point as a constant.
Create a def for it at the top level, and replace its current
occurrence with the defined name.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-extract-constant
\(fn)" t nil)

(autoload 'cljr-cycle-thread "clj-refactor" "\
Cycle a threading macro between -> and ->>.
Also applies to other versions of the macros, like cond->.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-cycle-thread
\(fn)" t nil)

(autoload 'cljr-unwind "clj-refactor" "\
Unwind thread at point or above point by one level.
Return nil if there are no more levels to unwind.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-unwind
\(fn)" t nil)

(autoload 'cljr-unwind-all "clj-refactor" "\
Fully unwind thread at point or above point.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-unwind-all
\(fn)" t nil)

(autoload 'cljr-thread "clj-refactor" "\
Thread by one more level an existing threading macro.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-thread
\(fn)" t nil)

(autoload 'cljr-thread-first-all "clj-refactor" "\
Fully thread the form at point using ->.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-thread-first-all
\(fn)" t nil)

(autoload 'cljr-thread-last-all "clj-refactor" "\
Fully thread the form at point using ->>.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-thread-last-all
\(fn)" t nil)

(autoload 'cljr-introduce-let "clj-refactor" "\
Create a let form, binding the form at point.
The resulting let form can then be expanded with `\\[cljr-expand-let]'.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-introduce-let
\(fn)" t nil)

(autoload 'cljr-expand-let "clj-refactor" "\
Expand the let form above point by one level.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-expand-let
\(fn)" t nil)

(autoload 'cljr-move-to-let "clj-refactor" "\
Move the form at point to a binding in the nearest let.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-move-to-let
\(fn)" t nil)

(autoload 'cljr-destructure-keys "clj-refactor" "\
Change a symbol binding at point to a destructuring bind.
Keys to use in the destructuring are inferred from the code, and
their usage is replaced with the new local variables.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-destructure-keys
\(fn)" t nil)

(autoload 'cljr-cycle-privacy "clj-refactor" "\
Make public the current private def, or vice-versa.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-cycle-privacy
\(fn)" t nil)

(autoload 'cljr-cycle-coll "clj-refactor" "\
Convert the coll at (point) from (x) -> {x} -> [x] -> -> #{x} -> (x) recur
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-cycle-coll
\(fn)" t nil)

(autoload 'cljr-cycle-if "clj-refactor" "\
Change a surrounding if to if-not, or vice-versa.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-cycle-if
\(fn)" t nil)

(autoload 'cljr-raise-sexp "clj-refactor" "\
Like paredit-raise-sexp, but removes # in front of function literals and sets.
\(fn &optional ARGUMENT)" t nil)

(autoload 'cljr-splice-sexp-killing-backward "clj-refactor" "\
Like paredit-splice-sexp-killing-backward, but removes # in
front of function literals and sets.
\(fn &optional ARGUMENT)" t nil)

(autoload 'cljr-splice-sexp-killing-forward "clj-refactor" "\
Like paredit-splice-sexp-killing-backward, but removes # in
front of function literals and sets.
\(fn &optional ARGUMENT)" t nil)

(autoload 'cljr-slash "clj-refactor" "\
Inserts / as normal, but also checks for common namespace shorthands to require.
If `cljr-magic-require-namespaces' is non-nil, typing one of the
short aliases listed in `cljr-magic-requires' followed by this
command will add the corresponding require statement to the ns
form.
\(fn)" t nil)

(autoload 'cljr-project-clean "clj-refactor" "\
Run `cljr-project-clean-functions' on every clojure file, then
sorts the project's dependency vectors.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-project-clean
\(fn)" t nil)

(autoload 'cljr-sort-project-dependencies "clj-refactor" "\
Sorts all dependency vectors in project.clj
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-sort-project-dependencies
\(fn)" t nil)

(autoload 'cljr-add-project-dependency "clj-refactor" "\
Add a dependency to the project.clj file.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-add-project-dependency
\(fn FORCE)" t nil)

(autoload 'cljr-update-project-dependency "clj-refactor" "\
Update the version of the dependency at point.
\(fn)" t nil)

(autoload 'cljr-update-project-dependencies "clj-refactor" "\
Update all project dependencies.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-update-project-dependencies
\(fn)" t nil)

(autoload 'cljr-promote-function "clj-refactor" "\
Promote a function literal to an fn, or an fn to a defn.
With prefix PROMOTE-TO-DEFN, promote to a defn even if it is a
function literal.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-promote-function
\(fn PROMOTE-TO-DEFN)" t nil)

(autoload 'cljr-find-usages "clj-refactor" "\
Find all usages of the symbol at point in the project.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-find-usages
\(fn)" t nil)

(autoload 'cljr-rename-symbol "clj-refactor" "\
Rename the symbol at point and all of its occurrences.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-rename-symbol
\(fn)" t nil)

(autoload 'cljr-clean-ns "clj-refactor" "\
Clean the ns form for the current buffer.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-clean-ns
\(fn)" t nil)

(autoload 'cljr-add-missing-libspec "clj-refactor" "\
Requires or imports the symbol at point.
If the symbol at point is of the form str/join then the ns
containing join will be aliased to str.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-add-missing-libspec
\(fn)" t nil)

(autoload 'cljr-hotload-dependency "clj-refactor" "\
Download a dependency (if needed) and hotload it into the current repl session.
Defaults to the dependency vector at point, but prompts if none is found.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-hotload-dependency
\(fn)" t nil)

(autoload 'cljr-extract-function "clj-refactor" "\
Extract the form at (or above) point as a top-level defn.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-extract-function
\(fn)" t nil)

(autoload 'cljr-add-stubs "clj-refactor" "\
Adds implementation stubs for the interface or protocol at point.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-add-stubs
\(fn)" t nil)

(autoload 'cljr-inline-symbol "clj-refactor" "\
Inline the symbol at point.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-inline-symbol
\(fn)" t nil)

(autoload 'cljr-reload-config "clj-refactor" "\
Resend configuration settings to the middleware.
This can be used to avoid restarting the repl session after
changing settings.
\(fn)" t nil)

(autoload 'cljr-version "clj-refactor" "\
Returns the version of the middleware as well as this package.
\(fn)" t nil)

(autoload 'cljr-toggle-debug-mode "clj-refactor" "\
\(fn)" t nil)

(autoload 'cljr-create-fn-from-example "clj-refactor" "\
Create a top-level defn for the symbol at point.
The context in which symbol is being used should be that of a
function, and the arglist of the defn is guessed from this
context.
For instance, if the symbol is the first argument of a `map'
call, the defn is created with one argument. If it is the first
argument of a `reduce', the defn will take two arguments.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-create-fn-from-example
\(fn)" t nil)

(autoload 'cljr-change-function-signature "clj-refactor" "\
Change the function signature of the function at POINT.
See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-change-function-signature
\(fn)" t nil)

(autoload 'clj-refactor-mode "clj-refactor" "\
A mode to keep the clj-refactor keybindings.
\(fn &optional ARG)" t nil)

;;;***

;;;### (autoloads nil nil ("clj-refactor-pkg.el") (21971 43639 634820
;;;;;; 430000))

;;;***

;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; End:
;;; clj-refactor-autoloads.el ends here
@@ -0,0 +1,15 @@
(define-package "clj-refactor" "20150814.854" "A collection of clojure refactoring functions"
'((emacs "24.3")
(s "1.8.0")
(dash "2.4.0")
(yasnippet "0.6.1")
(paredit "24")
(multiple-cursors "1.2.2")
(cider "0.9.1")
(edn "1.1.2")
(inflections "2.3"))
:keywords
'("convenience" "clojure" "cider"))
;; Local Variables:
;; no-byte-compile: t
;; End: