| @@ -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 |
| @@ -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: |
| @@ -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 |
| @@ -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: |