forked from flyingmachine/emacs-for-clojure
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
Conflicts: elpa/archives/gnu/archive-contents
- Loading branch information
Showing
110 changed files
with
77,114 additions
and
159 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
;;; cider-autoloads.el --- automatically extracted autoloads | ||
;; | ||
;;; Code: | ||
|
||
|
||
;;;### (autoloads (cider cider-jack-in) "cider" "cider.el" (21410 | ||
;;;;;; 46219 594436 0)) | ||
;;; Generated autoloads from cider.el | ||
|
||
(autoload 'cider-jack-in "cider" "\ | ||
Start a nREPL server for the current project and connect to it. | ||
If PROMPT-PROJECT is t, then prompt for the project for which to | ||
start the server. | ||
\(fn &optional PROMPT-PROJECT)" t nil) | ||
|
||
(autoload 'cider "cider" "\ | ||
Connect to an nREPL server identified by HOST and PORT. | ||
\(fn HOST PORT)" t nil) | ||
|
||
(eval-after-load 'clojure-mode '(progn (define-key clojure-mode-map (kbd "C-c M-j") 'cider-jack-in) (define-key clojure-mode-map (kbd "C-c M-c") 'cider))) | ||
|
||
;;;*** | ||
|
||
;;;### (autoloads (cider-macroexpand-all cider-macroexpand-1) "cider-macroexpansion" | ||
;;;;;; "cider-macroexpansion.el" (21410 46219 576456 0)) | ||
;;; Generated autoloads from cider-macroexpansion.el | ||
|
||
(autoload 'cider-macroexpand-1 "cider-macroexpansion" "\ | ||
Invoke 'macroexpand-1' on the expression at point. | ||
If invoked with a PREFIX argument, use 'macroexpand' instead of | ||
'macroexpand-1'. | ||
\(fn &optional PREFIX)" t nil) | ||
|
||
(autoload 'cider-macroexpand-all "cider-macroexpansion" "\ | ||
Invoke 'clojure.walk/macroexpand-all' on the expression at point. | ||
\(fn)" t nil) | ||
|
||
;;;*** | ||
|
||
;;;### (autoloads (cider-mode) "cider-mode" "cider-mode.el" (21410 | ||
;;;;;; 46219 579114 0)) | ||
;;; Generated autoloads from cider-mode.el | ||
|
||
(autoload 'cider-mode "cider-mode" "\ | ||
Minor mode for REPL interaction from a Clojure buffer. | ||
\\{cider-mode-map} | ||
\(fn &optional ARG)" t nil) | ||
|
||
;;;*** | ||
|
||
;;;### (autoloads (cider-selector) "cider-selector" "cider-selector.el" | ||
;;;;;; (21410 46219 586507 0)) | ||
;;; Generated autoloads from cider-selector.el | ||
|
||
(autoload 'cider-selector "cider-selector" "\ | ||
Select a new buffer by type, indicated by a single character. | ||
The user is prompted for a single character indicating the method by | ||
which to choose a new buffer. The `?' character describes then | ||
available methods. OTHER-WINDOW provides an optional target. | ||
See `def-cider-selector-method' for defining new methods. | ||
\(fn &optional OTHER-WINDOW)" t nil) | ||
|
||
;;;*** | ||
|
||
;;;### (autoloads nil nil ("cider-client.el" "cider-eldoc.el" "cider-interaction.el" | ||
;;;;;; "cider-pkg.el" "cider-repl.el" "cider-util.el" "cider-version.el" | ||
;;;;;; "nrepl-client.el") (21410 46219 627094 149000)) | ||
|
||
;;;*** | ||
|
||
(provide 'cider-autoloads) | ||
;; Local Variables: | ||
;; version-control: never | ||
;; no-byte-compile: t | ||
;; no-update-autoloads: t | ||
;; coding: utf-8 | ||
;; End: | ||
;;; cider-autoloads.el ends here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
;;; cider-client.el --- A layer of abstraction above the actual client code. | ||
|
||
;; Copyright © 2013 Bozhidar Batsov | ||
;; | ||
;; Author: Bozhidar Batsov <[email protected]> | ||
|
||
;; 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: | ||
|
||
;; A layer of abstraction above the actual client code. | ||
|
||
;;; Code: | ||
|
||
(require 'nrepl-client) | ||
|
||
;;; Words of inspiration | ||
(defun cider-user-first-name () | ||
"Find the current user's first name." | ||
(let ((name (if (string= (user-full-name) "") | ||
(user-login-name) | ||
(user-full-name)))) | ||
(string-match "^[^ ]*" name) | ||
(capitalize (match-string 0 name)))) | ||
|
||
(defvar cider-words-of-inspiration | ||
`("The best way to predict the future is to invent it. -Alan Kay" | ||
"A point of view is worth 80 IQ points. -Alan Kay" | ||
"Lisp isn't a language, it's a building material. -Alan Kay" | ||
"Simple things should be simple, complex things should be possible. -Alan Kay" | ||
"Measuring programming progress by lines of code is like measuring aircraft building progress by weight. -Bill Gates" | ||
"Controlling complexity is the essence of computer programming. -Brian Kernighan" | ||
"The unavoidable price of reliability is simplicity. -C.A.R. Hoare" | ||
"You're bound to be unhappy if you optimize everything. -Donald Knuth" | ||
"Simplicity is prerequisite for reliability. -Edsger W. Dijkstra" | ||
"Deleted code is debugged code. -Jeff Sickel" | ||
"The key to performance is elegance, not battalions of special cases. -Jon Bentley and Doug McIlroy" | ||
"First, solve the problem. Then, write the code. -John Johnson" | ||
"Simplicity is the ultimate sophistication. -Leonardo da Vinci" | ||
"Programming is not about typing... it's about thinking. -Rich Hickey" | ||
"Design is about pulling things apart. -Rich Hickey" | ||
"Programmers know the benefits of everything and the tradeoffs of nothing. -Rich Hickey" | ||
"Code never lies, comments sometimes do. -Ron Jeffries" | ||
"The true delight is in the finding out rather than in the knowing. -Isaac Asimov" | ||
"Take this REPL, fellow hacker, and may it serve you well." | ||
"Let the hacking commence!" | ||
"Hacks and glory await!" | ||
"Hack and be merry!" | ||
"Your hacking starts... NOW!" | ||
"May the Source be with you!" | ||
"May the Source shine upon thy REPL!" | ||
"Code long and prosper!" | ||
"Happy hacking!" | ||
"Backend is up, REPL is operational!" | ||
"Your imagination is the only limit to what you can do with this REPL!" | ||
"This REPL is yours to command!" | ||
"Fame is but a hack away!" | ||
,(format "%s, this could be the start of a beautiful program." | ||
(cider-user-first-name))) | ||
"Scientifically-proven optimal words of hackerish encouragement.") | ||
|
||
(defun cider-random-words-of-inspiration () | ||
"Select a random entry from `cider-words-of-inspiration'." | ||
(eval (nth (random (length cider-words-of-inspiration)) | ||
cider-words-of-inspiration))) | ||
|
||
(defun cider-display-connected-message () | ||
"Message displayed on successful connection." | ||
(message "Connected. %s" (cider-random-words-of-inspiration))) | ||
|
||
(add-hook 'nrepl-connected-hook 'cider-display-connected-message) | ||
|
||
;;; Evaluation helpers | ||
(defun cider-eval (input callback &optional ns session) | ||
"Send the request INPUT and register the CALLBACK as the response handler. | ||
NS & SESSION specify the context in which to evaluate the request." | ||
;; namespace forms are always evaluated in the "user" namespace | ||
(let ((ns (if (string-match "^[[:space:]]*\(ns\\([[:space:]]*$\\|[[:space:]]+\\)" input) | ||
"user" | ||
ns))) | ||
;; prevent forms from being evaluated in the wrong or a non-existing namespace | ||
(when (and ns | ||
(derived-mode-p 'clojure-mode) | ||
(not (string= ns nrepl-buffer-ns))) | ||
(cider-eval-ns-form)) | ||
(nrepl-send-string input callback ns session))) | ||
|
||
(defun cider-tooling-eval (input callback &optional ns) | ||
"Send the request INPUT and register the CALLBACK as the response handler. | ||
NS specifies the namespace in which to evaluate the request." | ||
;; namespace forms are always evaluated in the "user" namespace | ||
(cider-eval input callback ns (nrepl-current-tooling-session))) | ||
|
||
(defun cider-eval-sync (input &optional ns session) | ||
"Send the INPUT to the backend synchronously. | ||
NS & SESSION specify the evaluation context." | ||
(nrepl-send-string-sync input ns session)) | ||
|
||
(defun cider-eval-and-get-value (input &optional ns session) | ||
"Send the INPUT to the backend synchronously and return the value. | ||
NS & SESSION specify the evaluation context." | ||
(cider-get-value (cider-eval-sync input ns session))) | ||
|
||
(defun cider-tooling-eval-sync (input &optional ns) | ||
"Send the INPUT to the backend using a tooling session synchronously. | ||
NS specifies the namespace in which to evaluate the request." | ||
(cider-eval-sync input ns (nrepl-current-tooling-session))) | ||
|
||
(defun cider-get-value (eval-result) | ||
"Get the value from EVAL-RESULT." | ||
(plist-get eval-result :value)) | ||
|
||
(defun cider-send-op (op attributes handler) | ||
"Send the specified OP with ATTRIBUTES and response HANDLER." | ||
(let ((buffer (current-buffer))) | ||
(nrepl-send-request (append | ||
(list "op" op | ||
"session" (nrepl-current-session) | ||
"ns" nrepl-buffer-ns) | ||
attributes) | ||
handler))) | ||
|
||
(defun cider-send-load-file (file-contents file-path file-name) | ||
"Perform the nREPL \"load-file\" op. | ||
FILE-CONTENTS, FILE-PATH and FILE-NAME are details of the file to be | ||
loaded." | ||
(let ((buffer (current-buffer))) | ||
(nrepl-send-request (list "op" "load-file" | ||
"session" (nrepl-current-session) | ||
"file" file-contents | ||
"file-path" file-path | ||
"file-name" file-name) | ||
(cider-load-file-handler buffer)))) | ||
|
||
(defun cider-interrupt () | ||
"Interrupt any pending evaluations." | ||
(interactive) | ||
(let ((pending-request-ids (cider-util--hash-keys nrepl-pending-requests))) | ||
(dolist (request-id pending-request-ids) | ||
(nrepl-send-interrupt request-id (cider-interrupt-handler (current-buffer)))))) | ||
|
||
(defun cider-current-repl-buffer () | ||
"The current REPL buffer." | ||
(when (nrepl-current-connection-buffer) | ||
(buffer-local-value 'nrepl-repl-buffer | ||
(get-buffer (nrepl-current-connection-buffer))))) | ||
|
||
(provide 'cider-client) | ||
|
||
;;; cider-client.el ends here |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
;;; cider-eldoc.el --- eldoc support for Clojure | ||
|
||
;; Copyright © 2012-2013 Tim King, Phil Hagelberg | ||
;; Copyright © 2013 Bozhidar Batsov, Hugo Duncan, Steve Purcell | ||
;; | ||
;; Author: Tim King <[email protected]> | ||
;; Phil Hagelberg <[email protected]> | ||
;; Bozhidar Batsov <[email protected]> | ||
;; Hugo Duncan <[email protected]> | ||
;; Steve Purcell <[email protected]> | ||
|
||
;; 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: | ||
|
||
;; eldoc support for Clojure. | ||
|
||
;;; Code: | ||
|
||
(require 'cider-client) | ||
(require 'cider-interaction) ; for cider-symbol-at-point | ||
|
||
(require 'eldoc) | ||
(require 'dash) | ||
|
||
(defvar cider-extra-eldoc-commands '("cider-complete" "yas/expand") | ||
"Extra commands to be added to eldoc's safe commands list.") | ||
|
||
(defun cider-eldoc-format-thing (thing) | ||
"Format the eldoc THING." | ||
(propertize thing 'face 'font-lock-function-name-face)) | ||
|
||
(defun cider-highlight-args (arglist pos) | ||
"Format the the function ARGLIST for eldoc. | ||
POS is the index of the currently highlighted argument." | ||
(let* ((rest-pos (cider--find-rest-args-position arglist)) | ||
(i 0)) | ||
(mapconcat | ||
(lambda (arg) | ||
(let ((argstr (format "%s" arg))) | ||
(if (eq arg '&) | ||
argstr | ||
(prog1 | ||
(if (or (= (1+ i) pos) | ||
(and rest-pos (> (+ 1 i) rest-pos) | ||
(> pos rest-pos))) | ||
(propertize argstr 'face | ||
'eldoc-highlight-function-argument) | ||
argstr) | ||
(setq i (1+ i)))))) arglist " "))) | ||
|
||
(defun cider--find-rest-args-position (arglist) | ||
"Find the position of & in the ARGLIST vector." | ||
(-elem-index '& (append arglist ()))) | ||
|
||
(defun cider-highlight-arglist (arglist pos) | ||
"Format the ARGLIST for eldoc. | ||
POS is the index of the argument to highlight." | ||
(concat "[" (cider-highlight-args arglist pos) "]")) | ||
|
||
(defun cider-eldoc-format-arglist (arglist pos) | ||
"Format all the ARGLIST for eldoc. | ||
POS is the index of current argument." | ||
(concat "(" | ||
(mapconcat (lambda (args) (cider-highlight-arglist args pos)) | ||
(read arglist) " ") ")")) | ||
|
||
(defun cider-eldoc-info-in-current-sexp () | ||
"Return a list of the current sexp and the current argument index." | ||
(save-excursion | ||
(let ((argument-index (1- (eldoc-beginning-of-sexp)))) | ||
;; If we are at the beginning of function name, this will be -1. | ||
(when (< argument-index 0) | ||
(setq argument-index 0)) | ||
;; Don't do anything if current word is inside a string. | ||
(if (= (or (char-after (1- (point))) 0) ?\") | ||
nil | ||
(list (cider-symbol-at-point) argument-index))))) | ||
|
||
(defun cider-eldoc () | ||
"Backend function for eldoc to show argument list in the echo area." | ||
(when (cider-connected-p) | ||
(let* ((info (cider-eldoc-info-in-current-sexp)) | ||
(thing (car info)) | ||
(pos (cadr info)) | ||
(form (format "(try | ||
(:arglists | ||
(clojure.core/meta | ||
(clojure.core/resolve | ||
(clojure.core/read-string \"%s\")))) | ||
(catch Throwable t nil))" thing)) | ||
(value (when thing | ||
(cider-get-value (cider-tooling-eval-sync form nrepl-buffer-ns))))) | ||
(unless (string= value "nil") | ||
(format "%s: %s" | ||
(cider-eldoc-format-thing thing) | ||
(cider-eldoc-format-arglist value pos)))))) | ||
|
||
(defun cider-turn-on-eldoc-mode () | ||
"Turn on eldoc mode in the current buffer." | ||
(setq-local eldoc-documentation-function 'cider-eldoc) | ||
(apply 'eldoc-add-command cider-extra-eldoc-commands) | ||
(turn-on-eldoc-mode)) | ||
|
||
(provide 'cider-eldoc) | ||
;;; cider-eldoc ends here |
Binary file not shown.
Oops, something went wrong.