Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add projectile, add ido auto-complete support, add lambda pretty replacer #14

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
*#*
*-history
.smex-items
places
places
*.bat
40 changes: 0 additions & 40 deletions elpa/Save-visited-files-readme.txt

This file was deleted.

39 changes: 39 additions & 0 deletions elpa/ac-cider-0.2.1/ac-cider-autoloads.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
;;; ac-cider-autoloads.el --- automatically extracted autoloads
;;
;;; Code:
(add-to-list 'load-path (or (file-name-directory #$) (car load-path)))

;;;### (autoloads nil "ac-cider" "ac-cider.el" (21721 36942 0 0))
;;; Generated autoloads from ac-cider.el

(defface ac-cider-candidate-face '((t (:inherit ac-candidate-face))) "\
Face for nrepl candidates." :group (quote auto-complete))

(defface ac-cider-selection-face '((t (:inherit ac-selection-face))) "\
Face for the nrepl selected candidate." :group (quote auto-complete))

(defconst ac-cider-source-defaults '((available . ac-cider-available-p) (candidate-face . ac-cider-candidate-face) (selection-face . ac-cider-selection-face) (prefix . cider-completion-symbol-start-pos) (match . ac-cider-match-fuzzy) (document . ac-cider-documentation) (cache)) "\
Defaults common to the various completion sources.")

(defvar ac-source-cider-everything (append '((candidates . ac-cider-candidates-everything) (symbol . "v")) ac-cider-source-defaults) "\
Auto-complete source for CIDER buffers.")

(autoload 'ac-cider-setup "ac-cider" "\
Add the CIDER completion source to the front of `ac-sources'.
This affects only the current buffer.

\(fn)" t nil)

(autoload 'ac-cider-popup-doc "ac-cider" "\
A popup alternative to `cider-doc'.

\(fn)" t nil)

;;;***

;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; End:
;;; ac-cider-autoloads.el ends here
1 change: 1 addition & 0 deletions elpa/ac-cider-0.2.1/ac-cider-pkg.el
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(define-package "ac-cider" "0.2.1" "Clojure auto-complete sources using CIDER" '((cider "0.8.0") (auto-complete "1.4") (cl-lib "0.3")) :url "https://github.com/clojure-emacs/ac-cider" :keywords '("languages" "clojure" "nrepl" "cider" "compliment"))
Binary file not shown.
206 changes: 206 additions & 0 deletions elpa/ac-cider-0.2.1/ac-cider.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
;;; ac-cider.el --- Clojure auto-complete sources using CIDER

;; Copyright (C) 2012-2014 Alex Yakushev <alex@bytopia.org>

;; Author: Alex Yakushev <alex@bytopia.org>
;; Steve Purcell <steve@sanityinc.com>
;; Sam Aaron <samaaron@gmail.com>
;;
;; URL: https://github.com/clojure-emacs/ac-cider
;; Keywords: languages, clojure, nrepl, cider, compliment
;; Version: 0.2.1
;; X-Original-Version: 0.2.1
;; Package-Requires: ((cider "0.8.0") (auto-complete "1.4") (cl-lib "0.3"))

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

;; Provides a number of auto-complete sources for Clojure projects using CIDER
;; and compliment. This is a replacement for now deprecated ac-nrepl project by
;; Steve Purcell.

;;; Installation:

;; Available as a package in melpa.org.
;; M-x package-install ac-cider

;;; Usage:

;; (require 'ac-cider)
;; (add-hook 'cider-mode-hook 'ac-flyspell-workaround)
;; (add-hook 'cider-mode-hook 'ac-cider-setup)
;; (add-hook 'cider-repl-mode-hook 'ac-cider-setup)
;; (eval-after-load "auto-complete"
;; '(progn
;; (add-to-list 'ac-modes 'cider-mode)
;; (add-to-list 'ac-modes 'cider-repl-mode)))

;; If you want to trigger auto-complete using TAB in CIDER buffers, add this to
;; your configuration file, but note that it is incompatible with (setq
;; tab-always-indent 'complete):

;; (defun set-auto-complete-as-completion-at-point-function ()
;; (setq completion-at-point-functions '(auto-complete)))
;; (add-hook 'auto-complete-mode-hook 'set-auto-complete-as-completion-at-point-function)
;;
;; (add-hook 'cider-mode-hook 'set-auto-complete-as-completion-at-point-function)

;;; Code:

(require 'cider)
(require 'auto-complete)
(require 'cl-lib)

(defun ac-cider-available-p ()
"Return t if CIDER supports completion, otherwise nil."
(functionp 'cider-complete))

(defvar ac-cider-documentation-cache '())

(defun ac-cider-candidates-everything ()
"Return all candidates for a symbol at point."
(setq ac-cider-documentation-cache nil)
(cider-complete ac-prefix))

(defun ac-cider-documentation (symbol)
"Return documentation for the given SYMBOL, if available.
Caches fetched documentation for the current completion call."
(when symbol
(let ((cached-doc (assoc (substring-no-properties symbol)
ac-cider-documentation-cache)))
(if cached-doc
(cdr cached-doc)
(let* ((doc
(substring-no-properties
(replace-regexp-in-string
"\r" ""
(nrepl-dict-get (nrepl-send-sync-request
(list "op" "complete-doc"
"session" (nrepl-current-session)
"ns" (cider-current-ns)
"symbol" symbol))
"completion-doc"))))
(doc (if (string= "\"\"" doc)
"No documentation available."
doc)))
(add-to-list 'ac-cider-documentation-cache
(cons (substring-no-properties symbol) doc))
doc)))))

(defun ac-cider--is-separator (c)
(or (= c 45) (= c 46)))

(defun ac-cider--is-capital (c)
(and (<= 65 c) (<= c 90)))

(defun ac-cider-fuzzy-matches-p (prefix candidate)
"Return t if PREFIX and CANDIDATE are matched."
(let ((pre (string-to-list prefix))
(cand (string-to-list candidate))
(camelcase nil))
(when (= (car pre) 46)
(setq camelcase t)
(setq pre (cdr pre))
(setq cand (cdr cand)))
(if (string-prefix-p prefix candidate)
t
(let ((result :not-yet) (skipping nil))
(when (= (car pre) (car cand))
(while (eq result :not-yet)
(cond ((not pre) (setq result t))
((not cand) (setq result nil))
(skipping (if camelcase
(if (ac-cider--is-capital (car cand))
(setq skipping nil)
(setq cand (cdr cand)))
(if (ac-cider--is-separator (car cand))
(progn
(when (ac-cider--is-separator (car pre))
(setq pre (cdr pre)))
(setq cand (cdr cand))
(setq skipping nil))
(setq cand (cdr cand)))))
((= (car pre) (car cand)) (progn (setq pre (cdr pre))
(setq cand (cdr cand))))
(t (progn (setq skipping
(or camelcase
(not (ac-cider--is-separator (car cand)))))
(setq cand (cdr cand))))))
result)))))

(defun ac-cider-match-fuzzy (prefix candidates)
"Returns candidates that match fuzzily with the prefix."
(cl-remove-if-not (lambda (cand)
(ac-cider-fuzzy-matches-p prefix cand))
candidates))

;;;###autoload
(defface ac-cider-candidate-face
'((t (:inherit ac-candidate-face)))
"Face for nrepl candidates."
:group 'auto-complete)

;;;###autoload
(defface ac-cider-selection-face
'((t (:inherit ac-selection-face)))
"Face for the nrepl selected candidate."
:group 'auto-complete)

;;;###autoload
(defconst ac-cider-source-defaults
'((available . ac-cider-available-p)
(candidate-face . ac-cider-candidate-face)
(selection-face . ac-cider-selection-face)
(prefix . cider-completion-symbol-start-pos)
(match . ac-cider-match-fuzzy)
(document . ac-cider-documentation)
(cache))
"Defaults common to the various completion sources.")

;;;###autoload
(defvar ac-source-cider-everything
(append
'((candidates . ac-cider-candidates-everything)
(symbol . "v"))
ac-cider-source-defaults)
"Auto-complete source for CIDER buffers.")

;;;###autoload
(defun ac-cider-setup ()
"Add the CIDER completion source to the front of `ac-sources'.
This affects only the current buffer."
(interactive)
(setq-default ac-use-fuzzy nil)
(add-to-list 'ac-sources 'ac-source-cider-everything))

;;;###autoload
(defun ac-cider-popup-doc ()
"A popup alternative to `cider-doc'."
(interactive)
(popup-tip (ac-cider-documentation (symbol-name (symbol-at-point)))
:point (cider-completion-symbol-start-pos)
:around t
:scroll-bar t
:margin t))

(provide 'ac-cider)

;; Local Variables:
;; coding: utf-8
;; indent-tabs-mode: nil
;; eval: (checkdoc-minor-mode 1)
;; End:

;;; ac-cider.el ends here
Binary file added elpa/ac-cider-0.2.1/ac-cider.elc
Binary file not shown.
54 changes: 54 additions & 0 deletions elpa/ac-nrepl-0.21/ac-nrepl-autoloads.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
;;; ac-nrepl-autoloads.el --- automatically extracted autoloads
;;
;;; Code:
(add-to-list 'load-path (or (file-name-directory #$) (car load-path)))

;;;### (autoloads nil "ac-nrepl" "ac-nrepl.el" (21706 21578 0 0))
;;; Generated autoloads from ac-nrepl.el

(defface ac-nrepl-candidate-face '((t (:inherit ac-candidate-face))) "\
Face for nrepl candidates." :group (quote auto-complete))

(defface ac-nrepl-selection-face '((t (:inherit ac-selection-face))) "\
Face for the nrepl selected candidate." :group (quote auto-complete))

(defconst ac-nrepl-source-defaults '((available . ac-nrepl-available-p) (candidate-face . ac-nrepl-candidate-face) (selection-face . ac-nrepl-selection-face) (prefix . ac-nrepl-symbol-start-pos) (document . ac-nrepl-documentation)) "\
Defaults common to the various completion sources.")

(defvar ac-source-nrepl-ns (append '((candidates . ac-nrepl-candidates-ns) (symbol . "n")) ac-nrepl-source-defaults) "\
Auto-complete source for nrepl ns completion.")

(defvar ac-source-nrepl-vars (append '((candidates . ac-nrepl-candidates-vars) (symbol . "v")) ac-nrepl-source-defaults) "\
Auto-complete source for nrepl var completion.")

(defvar ac-source-nrepl-ns-classes (append '((candidates . ac-nrepl-candidates-ns-classes) (symbol . "c")) ac-nrepl-source-defaults) "\
Auto-complete source for nrepl ns-specific class completion.")

(defvar ac-source-nrepl-all-classes (append '((candidates . ac-nrepl-candidates-all-classes) (symbol . "c")) ac-nrepl-source-defaults) "\
Auto-complete source for nrepl all class completion.")

(defvar ac-source-nrepl-java-methods (append '((candidates . ac-nrepl-candidates-java-methods) (symbol . "m")) ac-nrepl-source-defaults) "\
Auto-complete source for nrepl java method completion.")

(defvar ac-source-nrepl-static-methods (append '((candidates . ac-nrepl-candidates-static-methods) (symbol . "s")) ac-nrepl-source-defaults) "\
Auto-complete source for nrepl java static method completion.")

(autoload 'ac-nrepl-setup "ac-nrepl" "\
Add the nrepl completion source to the front of `ac-sources'.
This affects only the current buffer.

\(fn)" t nil)

(autoload 'ac-nrepl-popup-doc "ac-nrepl" "\
A popup alternative to `nrepl-doc'.

\(fn)" t nil)

;;;***

;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; End:
;;; ac-nrepl-autoloads.el ends here
1 change: 1 addition & 0 deletions elpa/ac-nrepl-0.21/ac-nrepl-pkg.el
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(define-package "ac-nrepl" "0.21" "auto-complete sources for Clojure using nrepl completions" '((cider "0.1") (auto-complete "1.4")))
Binary file not shown.
Loading