Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updated to Emacs 24 and switched over to using the package.el with

melpa repo.
  • Loading branch information...
commit 852eb70840feb38006ccd42bb896b1c54ea0d1ca 1 parent 05713c0
@darrenaustin authored
Showing with 53 additions and 26,234 deletions.
  1. +0 −2  emacs.d/config-magit.el
  2. +7 −5 emacs.d/config-misc.el
  3. +0 −7 emacs.d/config-nav.el
  4. +0 −1  emacs.d/config-org.el
  5. +0 −1  emacs.d/config-registers.el
  6. +0 −9 emacs.d/config-scala.el
  7. +0 −2  emacs.d/config-shell.el
  8. +0 −1  emacs.d/config-text.el
  9. +1 −10 emacs.d/config-theme.el
  10. +9 −22 emacs.d/custom.el
  11. +36 −31 emacs.d/init.el
  12. +0 −665 emacs.d/vendor/clojure/clojure-mode.el
  13. +0 −173 emacs.d/vendor/clojure/clojure-test-mode.el
  14. +0 −18 emacs.d/vendor/clojure/swank-clojure-autoload.el
  15. +0 −150 emacs.d/vendor/clojure/swank-clojure.el
  16. +0 −17 emacs.d/vendor/clojure/swank/clj_contrib/macroexpand.clj
  17. +0 −20 emacs.d/vendor/clojure/swank/clj_contrib/pprint.clj
  18. +0 −14 emacs.d/vendor/clojure/swank/commands.clj
  19. +0 −308 emacs.d/vendor/clojure/swank/commands/basic.clj
  20. +0 −9 emacs.d/vendor/clojure/swank/commands/contrib.clj
  21. +0 −26 emacs.d/vendor/clojure/swank/commands/contrib/swank_arglists.clj
  22. +0 −116 emacs.d/vendor/clojure/swank/commands/contrib/swank_c_p_c.clj
  23. +0 −100 emacs.d/vendor/clojure/swank/commands/indent.clj
  24. +0 −284 emacs.d/vendor/clojure/swank/commands/inspector.clj
  25. +0 −252 emacs.d/vendor/clojure/swank/core.clj
  26. +0 −54 emacs.d/vendor/clojure/swank/core/connection.clj
  27. +0 −4 emacs.d/vendor/clojure/swank/core/hooks.clj
  28. +0 −51 emacs.d/vendor/clojure/swank/core/protocol.clj
  29. +0 −79 emacs.d/vendor/clojure/swank/core/server.clj
  30. +0 −29 emacs.d/vendor/clojure/swank/core/threadmap.clj
  31. +0 −110 emacs.d/vendor/clojure/swank/loader.clj
  32. +0 −46 emacs.d/vendor/clojure/swank/swank.clj
  33. +0 −78 emacs.d/vendor/clojure/swank/util.clj
  34. +0 −33 emacs.d/vendor/clojure/swank/util/clojure.clj
  35. +0 −31 emacs.d/vendor/clojure/swank/util/concurrent/mbox.clj
  36. +0 −44 emacs.d/vendor/clojure/swank/util/concurrent/thread.clj
  37. +0 −12 emacs.d/vendor/clojure/swank/util/hooks.clj
  38. +0 −36 emacs.d/vendor/clojure/swank/util/io.clj
  39. +0 −26 emacs.d/vendor/clojure/swank/util/net/sockets.clj
  40. +0 −16 emacs.d/vendor/clojure/swank/util/string.clj
  41. +0 −15 emacs.d/vendor/clojure/swank/util/sys.clj
  42. +0 −3,036 emacs.d/vendor/magit/magit.el
  43. +0 −1,469 emacs.d/vendor/markdown/markdown-mode.el
  44. +0 −706 emacs.d/vendor/nav/nav.el
  45. +0 −2,522 emacs.d/vendor/org/Changes.org
  46. +0 −511 emacs.d/vendor/org/Makefile
  47. +0 −39 emacs.d/vendor/org/README
  48. +0 −60 emacs.d/vendor/org/contrib/README
  49. +0 −306 emacs.d/vendor/org/contrib/babel/langs/ob-oz.el
  50. +0 −370 emacs.d/vendor/org/contrib/babel/library-of-babel.org
  51. +0 −1,769 emacs.d/vendor/org/contrib/lisp/htmlize.el
  52. +0 −130 emacs.d/vendor/org/contrib/lisp/org-annotate-file.el
  53. +0 −88 emacs.d/vendor/org/contrib/lisp/org-bookmark.el
  54. +0 −143 emacs.d/vendor/org/contrib/lisp/org-checklist.el
  55. +0 −539 emacs.d/vendor/org/contrib/lisp/org-choose.el
  56. +0 −235 emacs.d/vendor/org/contrib/lisp/org-collector.el
  57. +0 −38 emacs.d/vendor/org/contrib/lisp/org-contribdir.el
  58. +0 −279 emacs.d/vendor/org/contrib/lisp/org-depend.el
  59. +0 −1,144 emacs.d/vendor/org/contrib/lisp/org-drill.el
  60. +0 −159 emacs.d/vendor/org/contrib/lisp/org-elisp-symbol.el
  61. +0 −200 emacs.d/vendor/org/contrib/lisp/org-eval-light.el
  62. +0 −220 emacs.d/vendor/org/contrib/lisp/org-eval.el
  63. +0 −155 emacs.d/vendor/org/contrib/lisp/org-exp-bibtex.el
  64. +0 −346 emacs.d/vendor/org/contrib/lisp/org-expiry.el
  65. +0 −1,385 emacs.d/vendor/org/contrib/lisp/org-export-generic.el
  66. +0 −219 emacs.d/vendor/org/contrib/lisp/org-git-link.el
  67. +0 −310 emacs.d/vendor/org/contrib/lisp/org-interactive-query.el
  68. +0 −399 emacs.d/vendor/org/contrib/lisp/org-invoice.el
  69. +0 −65 emacs.d/vendor/org/contrib/lisp/org-jira.el
  70. +0 −180 emacs.d/vendor/org/contrib/lisp/org-learn.el
  71. +0 −249 emacs.d/vendor/org/contrib/lisp/org-mac-iCal.el
  72. +0 −465 emacs.d/vendor/org/contrib/lisp/org-mac-link-grabber.el
  73. +0 −332 emacs.d/vendor/org/contrib/lisp/org-mairix.el
  74. +0 −64 emacs.d/vendor/org/contrib/lisp/org-man.el
  75. +0 −245 emacs.d/vendor/org/contrib/lisp/org-mime.el
  76. +0 −257 emacs.d/vendor/org/contrib/lisp/org-mtags.el
  77. +0 −642 emacs.d/vendor/org/contrib/lisp/org-panel.el
  78. +0 −271 emacs.d/vendor/org/contrib/lisp/org-registry.el
  79. +0 −108 emacs.d/vendor/org/contrib/lisp/org-screen.el
  80. +0 −232 emacs.d/vendor/org/contrib/lisp/org-secretary.el
  81. +0 −94 emacs.d/vendor/org/contrib/lisp/org-special-blocks.el
  82. +0 −171 emacs.d/vendor/org/contrib/lisp/org-static-mathjax.el
  83. +0 −488 emacs.d/vendor/org/contrib/lisp/org-toc.el
  84. +0 −219 emacs.d/vendor/org/contrib/lisp/org-track.el
  85. +0 −527 emacs.d/vendor/org/contrib/lisp/org-velocity.el
  86. +0 −339 emacs.d/vendor/org/contrib/lisp/org-wikinodes.el
  87. +0 −653 emacs.d/vendor/org/contrib/lisp/org2rem.el
  88. +0 −115 emacs.d/vendor/org/contrib/lisp/orgtbl-sqlinsert.el
  89. +0 −39 emacs.d/vendor/org/contrib/lisp/test-org-export-preproc.el
  90. +0 −1  emacs.d/vendor/org/contrib/scripts/.gitignore
  91. +0 −220 emacs.d/vendor/org/contrib/scripts/StartOzServer.oz
  92. +0 −56 emacs.d/vendor/org/contrib/scripts/dir2org.zsh
  93. BIN  emacs.d/vendor/org/contrib/scripts/ditaa.jar
  94. +0 −106 emacs.d/vendor/org/contrib/scripts/org2hpda
  95. +0 −1  emacs.d/vendor/org/contrib/scripts/staticmathjax/.gitignore
  96. +0 −79 emacs.d/vendor/org/contrib/scripts/staticmathjax/README.org
  97. +0 −91 emacs.d/vendor/org/contrib/scripts/staticmathjax/README.txt
  98. +0 −11 emacs.d/vendor/org/contrib/scripts/staticmathjax/application.ini
  99. +0 −1  emacs.d/vendor/org/contrib/scripts/staticmathjax/chrome/chrome.manifest
  100. +0 −198 emacs.d/vendor/org/contrib/scripts/staticmathjax/chrome/content/main.js
  101. +0 −11 emacs.d/vendor/org/contrib/scripts/staticmathjax/chrome/content/main.xul
  102. +0 −1  emacs.d/vendor/org/contrib/scripts/staticmathjax/defaults/preferences/prefs.js
  103. +0 −1  emacs.d/vendor/org/doc/.nosearch
  104. +0 −18 emacs.d/vendor/org/doc/dir
Sorry, we could not display the entire diff because too many files (312) changed.
View
2  emacs.d/config-magit.el
@@ -1,9 +1,7 @@
;;; config-magit.el --- configuration for project magit panel
-(add-to-list 'load-path (config-file "vendor/magit/"))
(require 'magit)
(global-set-key "\C-xg" 'magit-status)
(provide 'config-magit)
-
View
12 emacs.d/config-misc.el
@@ -2,17 +2,19 @@
(when window-system
(setq frame-title-format '("%b"))
- (tooltip-mode -1)
(tool-bar-mode -1)
- (blink-cursor-mode -1)
- (mouse-wheel-mode t)
- (menu-bar-mode -1))
+ (tooltip-mode -1)
+ (scroll-bar-mode -1)
+ (blink-cursor-mode)
+ (mouse-wheel-mode))
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
-(setq visible-bell t
+(setq default-frame-alist '((width . 100) (height . 60)))
+
+(setq visible-bell nil
font-lock-maximum-decoration t
inhibit-startup-message t
transient-mark-mode t
View
7 emacs.d/config-nav.el
@@ -1,7 +0,0 @@
-;;; config-nav.el --- configuration for project nav panel
-
-(add-to-list 'load-path (config-file "vendor/nav/"))
-(require 'nav)
-
-(provide 'config-nav)
-
View
1  emacs.d/config-org.el
@@ -1,6 +1,5 @@
;;; config-org.el --- Org mode configuration
-(add-to-list 'load-path (config-file "vendor/org/lisp"))
(require 'org-install)
(setq org-directory "~/Dropbox/Notes/")
View
1  emacs.d/config-registers.el
@@ -7,7 +7,6 @@
;; You should add registers here for the files you edit most often.
(dolist (r `((?i (file . ,(config-file "init.el")))
- (?b (file . ,(config-file "config-bindings.el")))
(?r (file . ,(config-file "config-registers.el")))))
(set-register (car r) (cadr r)))
View
9 emacs.d/config-scala.el
@@ -1,9 +0,0 @@
-;;; config-scala.el --- Configuration for the Scala Programming Language
-
-(require 'config-coding)
-
-(add-to-list 'load-path (config-file "vendor/scala/"))
-(require 'scala-mode-auto)
-(add-hook 'scala-mode-hook 'run-coding-hook)
-
-(provide 'config-scala)
View
2  emacs.d/config-shell.el
@@ -3,5 +3,3 @@
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
(provide 'config-shell)
-
-
View
1  emacs.d/config-text.el
@@ -20,7 +20,6 @@
"culpa qui officia deserunt mollit anim id est laborum."))
;; Markdown support
-(add-to-list 'load-path (config-file "vendor/markdown"))
(require 'markdown-mode)
(add-to-list 'auto-mode-alist '("\\.md$" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.markdown$" . markdown-mode))
View
11 emacs.d/config-theme.el
@@ -3,15 +3,6 @@
(require 'color-theme)
-(color-theme-initialize)
-
-;(load-file (config-file "vendor/themes/blackboard.el"))
-;(color-theme-blackboard)
-
-;(load-file (config-file "vendor/themes/color-theme-tangotango.el"))
-;(color-theme-tangotango)
-
-(load-file (config-file "vendor/themes/color-theme-twilight.el"))
-(color-theme-twilight)
+(load-theme 'twilight t)
(provide 'config-theme)
View
31 emacs.d/custom.el
@@ -1,25 +1,12 @@
(custom-set-variables
- ;; custom-set-variables was added by Custom.
- ;; If you edit it by hand, you could mess it up, so be careful.
- ;; Your init file should contain only one such instance.
- ;; If there is more than one, they won't work right.
- '(aquamacs-additional-fontsets nil t)
- '(aquamacs-autoface-mode nil)
- '(aquamacs-customization-version-id 211 t)
- '(aquamacs-tool-bar-user-customization (quote ((16777249 new-file open-file recent-files save-buffer aquamacs-print nil undo redo cut copy paste isearch-forward nil customize help))) t)
- '(cygwin-mount-cygwin-bin-directory "c:\\cygwin\\bin")
- '(default-frame-alist (quote ((menu-bar-lines . 1) (fringe) (right-fringe) (left-fringe . 1) (internal-border-width . 0) (vertical-scroll-bars . right) (cursor-type . box) (background-color . "#141414") (background-mode . dark) (border-color . "black") (cursor-color . "#A7A7A7") (foreground-color . "#F8F8F8") (mouse-color . "sienna1") (tool-bar-lines . 1))))
- '(emacsw32-style-frame-title t)
- '(iswitchb-max-to-show 4)
- '(ns-alternate-modifier (quote alt))
- '(ns-tool-bar-display-mode (quote both) t)
- '(ns-tool-bar-size-mode (quote regular) t)
- '(org-agenda-files (quote ("~/Dropbox/Projects/resume/tasks.org" "~/Dropbox/Notes/home.org")))
- '(p4-executable "c:/cygwin/bin/p4.exe")
- '(visual-line-mode nil t))
+ ;; custom-set-variables was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.
+ '(custom-safe-themes (quote ("6cfe5b2f818c7b52723f3e121d1157cf9d95ed8923dbc1b47f392da80ef7495d" default))))
(custom-set-faces
- ;; custom-set-faces was added by Custom.
- ;; If you edit it by hand, you could mess it up, so be careful.
- ;; Your init file should contain only one such instance.
- ;; If there is more than one, they won't work right.
+ ;; custom-set-faces was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.
)
View
67 emacs.d/init.el
@@ -17,7 +17,40 @@
(require 'ansi-color)
(require 'recentf)
-;; my configuration for various modes
+;; Mac OS sane keyboard config
+(when (eq system-type 'darwin)
+ (setq mac-option-modifier 'alt)
+ (setq mac-command-modifier 'meta)
+ (global-set-key (kbd "M-h") 'ns-do-hide-emacs)
+ (global-set-key (kbd "M-H") 'ns-do-hide-others))
+
+;; Init package system and make sure my standard packages are installed
+(require 'package)
+(add-to-list 'package-archives
+ '("melpa" . "http://melpa.milkbox.net/packages/")
+;; '("marmalade" . "http://marmalade-repo.org/packages/")
+ )
+(package-initialize)
+
+(when (not package-archive-contents)
+ (package-refresh-contents))
+
+(defvar my-packages
+ '(
+ color-theme
+ color-theme-solarized
+ markdown-mode
+ magit
+ org
+ twilight-theme
+ )
+ "A list of packages to ensure are installed at launch.")
+
+(dolist (p my-packages)
+ (when (not (package-installed-p p))
+ (package-install p)))
+
+;; configuration for various modes
(require 'config-registers)
(require 'config-misc)
(require 'config-text)
@@ -25,20 +58,10 @@
(require 'config-coding)
(require 'config-ruby)
;(require 'config-lisp)
-(require 'config-scala)
-;(require 'config-theme)
+(require 'config-theme)
(require 'config-shell)
-(require 'config-nav)
(require 'config-magit)
-(load custom-file 'noerror)
-
-;; Mac OS config
-(when (eq system-type 'darwin)
- (setq mac-option-modifier 'alt)
- (setq mac-command-modifier 'meta)
- (global-set-key (kbd "M-h") 'ns-do-hide-emacs)
- (global-set-key (kbd "M-H") 'ns-do-hide-others))
(setq config-system-name
;; Work around a bug on OS X where system-name is FQDN
@@ -50,22 +73,4 @@
(setq system-specific-config (concat config-dir config-system-name ".el"))
(if (file-exists-p system-specific-config) (load system-specific-config))
-(if (not (file-exists-p (expand-file-name "~/.emacs.d/elpa/package.el")))
- (let ((buffer (url-retrieve-synchronously
- "http://tromey.com/elpa/package-install.el")))
- (save-excursion
- (set-buffer buffer)
- (goto-char (point-min))
- (re-search-forward "^$" nil 'move)
- (eval-region (point) (point-max))
- (kill-buffer (current-buffer)))))
-
-;;; This was installed by package-install.el.
-;;; This provides support for the package system and
-;;; interfacing with ELPA, the package archive.
-;;; Move this code earlier if you want to reference
-;;; packages in your .emacs.
-(when
- (load
- (expand-file-name "~/.emacs.d/elpa/package.el"))
- (package-initialize))
+(load custom-file 'noerror)
View
665 emacs.d/vendor/clojure/clojure-mode.el
@@ -1,665 +0,0 @@
-;;; clojure-mode.el --- Major mode for Clojure code
-
-;; Copyright (C) 2007, 2008, 2009 Jeffrey Chu and Lennart Staflin
-;;
-;; Authors: Jeffrey Chu <jochu0@gmail.com>
-;; Lennart Staflin <lenst@lysator.liu.se>
-;; URL: http://www.emacswiki.org/cgi-bin/wiki/ClojureMode
-;; Version: 1.0
-;; Keywords: languages, lisp
-
-;; This file is not part of GNU Emacs.
-
-;;; Commentary:
-
-;; Provides font-lock, indentation, and functions for communication
-;; with subprocesses for Clojure. (http://clojure.org)
-
-;;; Installation:
-
-;; (0) Add this file to your load-path, usually the ~/.emacs.d directory.
-;; (1) Either:
-;; Add these lines to your .emacs:
-;; (autoload 'clojure-mode "clojure-mode" "A major mode for Clojure" t)
-;; (add-to-list 'auto-mode-alist '("\\.clj$" . clojure-mode))
-;; Or generate autoloads with the `update-directory-autoloads' function.
-
-;; Paredit users:
-
-;; Download paredit v21 or greater
-;; http://mumble.net/~campbell/emacs/paredit.el
-
-;; Use paredit as you normally would with any other mode; for instance:
-;;
-;; ;; require or autoload paredit-mode
-;; (defun lisp-enable-paredit-hook () (paredit-mode 1))
-;; (add-hook 'clojure-mode-hook 'lisp-enable-paredit-hook)
-
-;; The clojure-install function can check out and configure all the
-;; dependencies get going with Clojure, including SLIME integration.
-;; To use this function, you may have to manually load clojure-mode.el
-;; using M-x load-file or M-x eval-buffer.
-
-;;; Todo:
-
-;; * hashbang is also a valid comment character
-;; * do the inferior-lisp functions work without SLIME? needs documentation
-
-;;; License:
-
-;; 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 GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
-
-;;; Code:
-
-(require 'cl)
-
-(defgroup clojure-mode nil
- "A mode for Clojure"
- :prefix "clojure-mode-"
- :group 'applications)
-
-(defcustom clojure-mode-font-lock-multiline-def t
- "Set to non-nil in order to enable font-lock of
-multi-line (def...) forms. Changing this will require a
-restart (ie. M-x clojure-mode) of existing clojure mode buffers."
- :type 'boolean
- :group 'clojure-mode)
-
-(defcustom clojure-mode-font-lock-comment-sexp nil
- "Set to non-nil in order to enable font-lock of (comment...)
-forms. This option is experimental. Changing this will require a
-restart (ie. M-x clojure-mode) of existing clojure mode buffers."
- :type 'boolean
- :group 'clojure-mode)
-
-(defcustom clojure-mode-load-command "(clojure/load-file \"%s\")\n"
- "*Format-string for building a Clojure expression to load a file.
-This format string should use `%s' to substitute a file name
-and should result in a Clojure expression that will command the inferior Clojure
-to load that file."
- :type 'string
- :group 'clojure-mode)
-
-(defcustom clojure-mode-use-backtracking-indent nil
- "Set to non-nil to enable backtracking/context sensitive
-indentation."
- :type 'boolean
- :group 'clojure-mode)
-
-(defcustom clojure-max-backtracking 3
- "Maximum amount to backtrack up a list to check for context."
- :type 'integer
- :group 'clojure-mode)
-
-(defcustom clojure-src-root (expand-file-name "~/src")
- "Directory that contains checkouts for clojure, clojure-contrib,
-slime, and swank-clojure. This value is used by `clojure-install'
-and `clojure-slime-config'."
- :type 'string
- :group 'clojure-mode)
-
-(defvar clojure-mode-map
- (let ((map (make-sparse-keymap)))
- (set-keymap-parent map lisp-mode-shared-map)
- (define-key map "\e\C-x" 'lisp-eval-defun)
- (define-key map "\C-x\C-e" 'lisp-eval-last-sexp)
- (define-key map "\C-c\C-e" 'lisp-eval-last-sexp)
- (define-key map "\C-c\C-l" 'clojure-load-file)
- (define-key map "\C-c\C-r" 'lisp-eval-region)
- (define-key map "\C-c\C-z" 'run-lisp)
- map)
- "Keymap for ordinary Clojure mode.
-All commands in `lisp-mode-shared-map' are inherited by this map.")
-
-
-(easy-menu-define clojure-menu clojure-mode-map "Menu used in `clojure-mode'."
- '("Clojure"
- ["Eval defun" lisp-eval-defun t]
- ["Eval defun and go" lisp-eval-defun-and-go t]
- ["Eval last sexp" lisp-eval-last-sexp t]
- ["Eval region" lisp-eval-region t]
- ["Eval region and go" lisp-eval-region-and-go t]
- ["Load file..." clojure-load-file t]
- ["Run Lisp" run-lisp t]))
-
-
-(defvar clojure-mode-syntax-table
- (let ((table (copy-syntax-table emacs-lisp-mode-syntax-table)))
- (modify-syntax-entry ?~ "' " table)
- (modify-syntax-entry ?, " " table)
- (modify-syntax-entry ?\{ "(}" table)
- (modify-syntax-entry ?\} "){" table)
- (modify-syntax-entry ?\[ "(]" table)
- (modify-syntax-entry ?\] ")[" table)
- (modify-syntax-entry ?^ "'" table)
- table))
-
-
-(defvar clojure-prev-l/c-dir/file nil
- "Record last directory and file used in loading or compiling.
-This holds a cons cell of the form `(DIRECTORY . FILE)'
-describing the last `clojure-load-file' or `clojure-compile-file' command.")
-
-(defvar clojure-def-regexp "^\\s *\\((def\\S *\\s +\\(\\S +\\)\\)"
- "A regular expression to match any top-level definitions.")
-
-;;;###autoload
-(defun clojure-mode ()
- "Major mode for editing Clojure code - similar to Lisp mode..
-Commands:
-Delete converts tabs to spaces as it moves back.
-Blank lines separate paragraphs. Semicolons start comments.
-\\{clojure-mode-map}
-Note that `run-lisp' may be used either to start an inferior Lisp job
-or to switch back to an existing one.
-
-Entry to this mode calls the value of `clojure-mode-hook'
-if that value is non-nil."
- (interactive)
- (kill-all-local-variables)
- (use-local-map clojure-mode-map)
- (setq major-mode 'clojure-mode)
- (setq mode-name "Clojure")
- (lisp-mode-variables nil)
- (set-syntax-table clojure-mode-syntax-table)
-
- (set (make-local-variable 'comment-start-skip)
- "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *")
- (set (make-local-variable 'lisp-indent-function)
- 'clojure-indent-function)
- (set (make-local-variable 'font-lock-multiline) t)
-
- (setq lisp-imenu-generic-expression
- `((nil ,clojure-def-regexp 2)))
- (setq imenu-create-index-function
- (lambda ()
- (imenu--generic-function lisp-imenu-generic-expression)))
-
- (if (and (not (boundp 'font-lock-extend-region-functions))
- (or clojure-mode-font-lock-multiline-def
- clojure-mode-font-lock-comment-sexp))
- (message "Clojure mode font lock extras are unavailable, please upgrade to atleast version 22 ")
-
- (when clojure-mode-font-lock-multiline-def
- (add-to-list 'font-lock-extend-region-functions 'clojure-font-lock-extend-region-def t))
-
- (when clojure-mode-font-lock-comment-sexp
- (add-to-list 'font-lock-extend-region-functions 'clojure-font-lock-extend-region-comment t)
- (make-local-variable 'clojure-font-lock-keywords)
- (add-to-list 'clojure-font-lock-keywords 'clojure-font-lock-mark-comment t)
- (set (make-local-variable 'open-paren-in-column-0-is-defun-start) nil)))
-
- (setq font-lock-defaults
- '(clojure-font-lock-keywords ; keywords
- nil nil
- (("+-*/.<>=!?$%_&~^:@" . "w")) ; syntax alist
- nil
- (font-lock-mark-block-function . mark-defun)
- (font-lock-syntactic-face-function . lisp-font-lock-syntactic-face-function)))
-
- (if (fboundp 'run-mode-hooks)
- (run-mode-hooks 'clojure-mode-hook)
- (run-hooks 'clojure-mode-hook))
-
- ;; Enable curly braces when paredit is enabled in clojure-mode-hook
- (when (and (featurep 'paredit) paredit-mode (>= paredit-version 21))
- (define-key clojure-mode-map "{" 'paredit-open-curly)
- (define-key clojure-mode-map "}" 'paredit-close-curly)))
-
-(defun clojure-font-lock-def-at-point (point)
- "Find the position range between the top-most def* and the
-fourth element afterwards. Note that this means there's no
-gaurantee of proper font locking in def* forms that are not at
-top-level."
- (goto-char point)
- (condition-case nil
- (beginning-of-defun)
- (error nil))
-
- (let ((beg-def (point)))
- (when (and (not (= point beg-def))
- (looking-at "(def"))
- (condition-case nil
- (progn
- ;; move forward as much as possible until failure (or success)
- (forward-char)
- (dotimes (i 4)
- (forward-sexp)))
- (error nil))
- (cons beg-def (point)))))
-
-(defun clojure-font-lock-extend-region-def ()
- "Move fontification boundaries to always include the first four
-elements of a def* forms."
- (let ((changed nil))
- (let ((def (clojure-font-lock-def-at-point font-lock-beg)))
- (when def
- (destructuring-bind (def-beg . def-end) def
- (when (and (< def-beg font-lock-beg)
- (< font-lock-beg def-end))
- (setq font-lock-beg def-beg
- changed t)))))
-
- (let ((def (clojure-font-lock-def-at-point font-lock-end)))
- (when def
- (destructuring-bind (def-beg . def-end) def
- (when (and (< def-beg font-lock-end)
- (< font-lock-end def-end))
- (setq font-lock-end def-end
- changed t)))))
- changed))
-
-(defun clojure-font-lock-extend-region-comment ()
- "Move fontification boundaries to always contain
- entire (comment ..) sexp. Does not work if you have a
- white-space between ( and comment, but that is omitted to make
- this run faster."
- (let ((changed nil))
- (goto-char font-lock-beg)
- (condition-case nil (beginning-of-defun) (error nil))
- (let ((pos (re-search-forward "(comment\\>" font-lock-end t)))
- (when pos
- (forward-char -8)
- (when (< (point) font-lock-beg)
- (setq font-lock-beg (point)
- changed t))
- (condition-case nil (forward-sexp) (error nil))
- (when (> (point) font-lock-end)
- (setq font-lock-end (point)
- changed t))))
- changed))
-
-
-(defun clojure-font-lock-mark-comment (limit)
- "Marks all (comment ..) forms with font-lock-comment-face."
- (let (pos)
- (while (and (< (point) limit)
- (setq pos (re-search-forward "(comment\\>" limit t)))
- (when pos
- (forward-char -8)
- (condition-case nil
- (add-text-properties (1+ (point)) (progn (forward-sexp) (1- (point)))
- '(face font-lock-comment-face multiline t))
- (error (forward-char 8))))))
- nil)
-
-(defconst clojure-font-lock-keywords
- (eval-when-compile
- `( ;; Definitions.
- (,(concat "(\\(?:clojure/\\)?\\(def"
- ;; Function declarations.
- "\\(n-?\\|multi\\|macro\\|method\\|test\\|"
- ;; Variable declarations.
- "struct\\|once\\|"
- "\\)\\)\\>"
- ;; Any whitespace
- "[ \r\n\t]*"
- ;; Possibly type or metadata
- "\\(?:#^\\(?:{[^}]*}\\|\\sw+\\)[ \r\n\t]*\\)?"
-
- "\\(\\sw+\\)?")
- (1 font-lock-keyword-face)
- (3 font-lock-function-name-face nil t))
- ;; Control structures
- (,(concat
- "(\\(?:clojure/\\)?"
- (regexp-opt
- '("let" "letfn" "do"
- "cond" "condp"
- "for" "loop" "recur"
- "when" "when-not" "when-let" "when-first"
- "if" "if-let" "if-not"
- "." ".." "->" "doto"
- "and" "or"
- "dosync" "doseq" "dotimes" "dorun" "doall"
- "load" "import" "unimport" "ns" "in-ns" "refer"
- "try" "catch" "finally" "throw"
- "with-open" "with-local-vars" "binding"
- "gen-class" "gen-and-load-class" "gen-and-save-class") t)
- "\\>")
- . 1)
- ;; Built-ins
- (,(concat
- "(\\(?:clojure/\\)?"
- (regexp-opt
- '(
- "implement" "proxy" "lazy-cons" "with-meta"
- "struct" "struct-map" "delay" "locking" "sync" "time" "apply"
- "remove" "merge" "interleave" "interpose" "distinct" "for"
- "cons" "concat" "lazy-cat" "cycle" "rest" "frest" "drop" "drop-while"
- "nthrest" "take" "take-while" "take-nth" "butlast" "drop-last"
- "reverse" "sort" "sort-by" "split-at" "partition" "split-with"
- "first" "ffirst" "rfirst" "when-first" "zipmap" "into" "set" "vec" "into-array"
- "to-array-2d" "not-empty" "seq?" "not-every?" "every?" "not-any?" "empty?"
- "map" "mapcat" "vector?" "list?" "hash-map" "reduce" "filter"
- "vals" "keys" "rseq" "subseq" "rsubseq" "count"
- "fnseq" "lazy-cons" "repeatedly" "iterate"
- "repeat" "replicate" "range"
- "line-seq" "resultset-seq" "re-seq" "re-find" "tree-seq" "file-seq" "xml-seq"
- "iterator-seq" "enumeration-seq"
- "symbol?" "string?" "vector" "conj" "str"
- "pos?" "neg?" "zero?" "nil?" "inc" "format"
- "alter" "commute" "ref-set" "floor" "assoc" "send" "send-off" ) t)
- "\\>")
- 1 font-lock-builtin-face)
- ;; (fn name? args ...)
- (,(concat "(\\(?:clojure/\\)?\\(fn\\)[ \t]+"
- ;; Possibly type
- "\\(?:#^\\sw+[ \t]*\\)?"
- ;; Possibly name
- "\\(\\sw+\\)?" )
- (1 font-lock-keyword-face)
- (2 font-lock-function-name-face nil t))
- ;; Constant values.
- ("\\<:\\sw+\\>" 0 font-lock-builtin-face)
- ;; Meta type annotation #^Type
- ("#^\\sw+" 0 font-lock-type-face)
- ("\\<io\\!\\>" 0 font-lock-warning-face)))
- "Default expressions to highlight in Clojure mode.")
-
-
-(defun clojure-load-file (file-name)
- "Load a Lisp file into the inferior Lisp process."
- (interactive (comint-get-source "Load Clojure file: " clojure-prev-l/c-dir/file
- '(clojure-mode) t))
- (comint-check-source file-name) ; Check to see if buffer needs saved.
- (setq clojure-prev-l/c-dir/file (cons (file-name-directory file-name)
- (file-name-nondirectory file-name)))
- (comint-send-string (inferior-lisp-proc)
- (format clojure-mode-load-command file-name))
- (switch-to-lisp t))
-
-
-
-(defun clojure-indent-function (indent-point state)
- "This function is the normal value of the variable `lisp-indent-function'.
-It is used when indenting a line within a function call, to see if the
-called function says anything special about how to indent the line.
-
-INDENT-POINT is the position where the user typed TAB, or equivalent.
-Point is located at the point to indent under (for default indentation);
-STATE is the `parse-partial-sexp' state for that position.
-
-If the current line is in a call to a Lisp function
-which has a non-nil property `lisp-indent-function',
-that specifies how to do the indentation. The property value can be
-* `defun', meaning indent `defun'-style;
-* an integer N, meaning indent the first N arguments specially
- like ordinary function arguments and then indent any further
- arguments like a body;
-* a function to call just as this function was called.
- If that function returns nil, that means it doesn't specify
- the indentation.
-
-This function also returns nil meaning don't specify the indentation."
- (let ((normal-indent (current-column)))
- (goto-char (1+ (elt state 1)))
- (parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t)
- (if (and (elt state 2)
- (not (looking-at "\\sw\\|\\s_")))
- ;; car of form doesn't seem to be a symbol
- (progn
- (if (not (> (save-excursion (forward-line 1) (point))
- calculate-lisp-indent-last-sexp))
- (progn (goto-char calculate-lisp-indent-last-sexp)
- (beginning-of-line)
- (parse-partial-sexp (point)
- calculate-lisp-indent-last-sexp 0 t)))
- ;; Indent under the list or under the first sexp on the same
- ;; line as calculate-lisp-indent-last-sexp. Note that first
- ;; thing on that line has to be complete sexp since we are
- ;; inside the innermost containing sexp.
- (backward-prefix-chars)
- (if (and (eq (char-after (point)) ?\[)
- (eq (char-after (elt state 1)) ?\())
- (+ (current-column) 2) ;; this is probably inside a defn
- (current-column)))
- (let ((function (buffer-substring (point)
- (progn (forward-sexp 1) (point))))
- (open-paren (elt state 1))
- method)
- (setq method (get (intern-soft function) 'clojure-indent-function))
-
- (cond ((member (char-after open-paren) '(?\[ ?\{))
- (goto-char open-paren)
- (1+ (current-column)))
- ((or (eq method 'defun)
- (and (null method)
- (> (length function) 3)
- (string-match "\\`\\(?:clojure/\\)?def" function)))
- (lisp-indent-defform state indent-point))
-
- ((integerp method)
- (lisp-indent-specform method state
- indent-point normal-indent))
- (method
- (funcall method indent-point state))
- (clojure-mode-use-backtracking-indent
- (clojure-backtracking-indent indent-point state normal-indent)))))))
-
-(defun clojure-backtracking-indent (indent-point state normal-indent)
- "Experimental backtracking support. Will upwards in an sexp to
-check for contextual indenting."
- (let (indent (path) (depth 0))
- (goto-char (elt state 1))
- (while (and (not indent)
- (< depth clojure-max-backtracking))
- (let ((containing-sexp (point)))
- (parse-partial-sexp (1+ containing-sexp) indent-point 1 t)
- (when (looking-at "\\sw\\|\\s_")
- (let* ((start (point))
- (fn (buffer-substring start (progn (forward-sexp 1) (point))))
- (meth (get (intern-soft fn) 'clojure-backtracking-indent)))
- (let ((n 0))
- (when (< (point) indent-point)
- (condition-case ()
- (progn
- (forward-sexp 1)
- (while (< (point) indent-point)
- (parse-partial-sexp (point) indent-point 1 t)
- (incf n)
- (forward-sexp 1)))
- (error nil)))
- (push n path))
- (when meth
- (let ((def meth))
- (dolist (p path)
- (if (and (listp def)
- (< p (length def)))
- (setq def (nth p def))
- (if (listp def)
- (setq def (car (last def)))
- (setq def nil))))
- (goto-char (elt state 1))
- (when def
- (setq indent (+ (current-column) def)))))))
- (goto-char containing-sexp)
- (condition-case ()
- (progn
- (backward-up-list 1)
- (incf depth))
- (error (setq depth clojure-max-backtracking)))))
- indent))
-
-;; (defun clojure-indent-defn (indent-point state)
-;; "Indent by 2 if after a [] clause that's at the beginning of a
-;; line"
-;; (if (not (eq (char-after (elt state 2)) ?\[))
-;; (lisp-indent-defform state indent-point)
-;; (goto-char (elt state 2))
-;; (beginning-of-line)
-;; (skip-syntax-forward " ")
-;; (if (= (point) (elt state 2))
-;; (+ (current-column) 2)
-;; (lisp-indent-defform state indent-point))))
-
-;; (put 'defn 'clojure-indent-function 'clojure-indent-defn)
-;; (put 'defmacro 'clojure-indent-function 'clojure-indent-defn)
-
-;; clojure backtracking indent is experimental and the format for these
-
-;; entries are subject to change
-(put 'implement 'clojure-backtracking-indent '(4 (2)))
-(put 'proxy 'clojure-backtracking-indent '(4 4 (2)))
-
-
-(defun put-clojure-indent (sym indent)
- (put sym 'clojure-indent-function indent)
- (put (intern (format "clojure/%s" (symbol-name sym))) 'clojure-indent-function indent))
-
-(defmacro define-clojure-indent (&rest kvs)
- `(progn
- ,@(mapcar (lambda (x) `(put-clojure-indent (quote ,(first x)) ,(second x))) kvs)))
-
-(define-clojure-indent
- (catch 2)
- (defmuti 1)
- (do 0)
- (for 1)
- (if 1)
- (if-not 1)
- (let 1)
- (letfn 1)
- (loop 1)
- (struct-map 1)
- (assoc 1)
- (condp 2)
-
- (fn 'defun))
-
-;; built-ins
-(define-clojure-indent
- (ns 1)
- (binding 1)
- (comment 0)
- (defstruct 1)
- (doseq 1)
- (dotimes 1)
- (doto 1)
- (implement 1)
- (let 1)
- (when-let 1)
- (if-let 1)
- (locking 1)
- (proxy 2)
- (sync 1)
- (when 1)
- (when-first 1)
- (when-let 1)
- (when-not 1)
- (with-local-vars 1)
- (with-open 1)
- (with-precision 1))
-
-;;; SLIME integration
-
-;;;###autoload
-(defun clojure-slime-config ()
- "Load Clojure SLIME support out of the `clojure-src-root' directory.
-
-Since there's no single conventional place to keep Clojure, this
-is bundled up as a function so that you can call it after you've set
-`clojure-src-root' in your personal config."
-
- (add-to-list 'load-path (concat clojure-src-root "/slime"))
- (add-to-list 'load-path (concat clojure-src-root "/slime/contrib"))
- (add-to-list 'load-path (concat clojure-src-root "/swank-clojure"))
-
- (require 'slime-autoloads)
- (require 'swank-clojure-autoload)
-
- (slime-setup '(slime-fancy slime-repl))
-
- (setq swank-clojure-jar-path (concat clojure-src-root "/clojure/clojure.jar")
- swank-clojure-extra-classpaths
- (list (concat clojure-src-root "/clojure-contrib/src/"))))
-
-;;;###autoload
-(defun clojure-install (src-root)
- "Perform the initial Clojure install along with Emacs support libs.
-
-This requires git, a JVM, ant, and an active Internet connection."
- (interactive (list
- (read-string (concat "Install Clojure in (default: "
- clojure-src-root "): ")
- nil nil clojure-src-root)))
-
- (make-directory src-root t)
-
- (if (file-exists-p (concat src-root "/clojure"))
- (error "Clojure is already installed at %s/clojure" src-root))
-
- (message "Checking out source... this will take a while...")
- (dolist (cmd '("git clone git://github.com/kevinoneill/clojure.git"
- "git clone git://github.com/kevinoneill/clojure-contrib.git"
- "git clone git://github.com/jochu/swank-clojure.git"
- "git clone --depth 2 git://github.com/nablaone/slime.git"))
- (unless (= 0 (shell-command (format "cd %s; %s" src-root cmd)))
- (error "Clojure installation step failed: %s" cmd)))
-
- (message "Compiling...")
- (unless (= 0 (shell-command (format "cd %s/clojure; ant" src-root)))
- (error "Couldn't compile Clojure."))
-
- (with-output-to-temp-buffer "clojure-install-note"
- (princ
- (if (equal src-root clojure-src-root)
- "Add a call to \"\(eval-after-load 'clojure-mode '\(clojure-slime-config\)\)\"
-to your .emacs so you can use SLIME in future sessions."
- (setq clojure-src-root src-root)
- (format "You've installed clojure in a non-default location. If you want
-to use this installation in the future, you will need to add the following
-lines to your personal Emacs config somewhere:
-
-\(setq clojure-src-root \"%s\"\)
-\(eval-after-load 'clojure-mode '\(clojure-slime-config\)\)" src-root)))
- (princ "\n\n Press M-x slime to launch Clojure."))
-
- (clojure-slime-config))
-
-(defun clojure-update ()
- "Update clojure-related repositories and recompile clojure.
-
-Works with clojure etc. installed via `clojure-install'. Code
-should be checked out in the `clojure-src-root' directory."
- (interactive)
-
- (message "Updating...")
- (dolist (repo '("clojure" "clojure-contrib" "swank-clojure" "slime"))
- (unless (= 0 (shell-command (format "cd %s/%s; git pull origin master" clojure-src-root repo)))
- (error "Clojure update failed: %s" repo)))
-
- (message "Compiling...")
- (save-window-excursion
- (unless (= 0 (shell-command (format "cd %s/clojure; ant" clojure-src-root)))
- (error "Couldn't compile Clojure.")))
- (message "Finished updating Clojure."))
-
-(defun clojure-enable-slime-on-existing-buffers ()
- (interactive)
- (dolist (buffer (buffer-list))
- (if (equal '(major-mode . clojure-mode)
- (assoc 'major-mode (buffer-local-variables buffer)))
- (with-current-buffer buffer
- (slime-mode t)))))
-
-(add-hook 'slime-connected-hook 'clojure-enable-slime-on-existing-buffers)
-
-;;;###autoload
-(add-to-list 'auto-mode-alist '("\\.clj$" . clojure-mode))
-
-(provide 'clojure-mode)
-;;; clojure-mode.el ends here
View
173 emacs.d/vendor/clojure/clojure-test-mode.el
@@ -1,173 +0,0 @@
-;;; clojure-test-mode --- Minor mode for Clojure tests
-
-;; Copyright (C) 2009 Phil Hagelberg
-
-;; Author: Phil Hagelberg <technomancy@gmail.com>
-;; URL: http://emacswiki.org/cgi-bin/wiki/ClojureTestMode
-;; Version: 0.2
-;; Keywords: languages, lisp
-
-;; This file is not part of GNU Emacs.
-
-;;; Commentary:
-
-;; This file provides support for running Clojure tests (using the
-;; test-is framework) via SLIME and seeing feedback in the test buffer
-;; about which tests failed or errored.
-
-;;; Installation:
-
-;; (0) Add this file to your load-path, usually the ~/.emacs.d directory.
-;; (1) Either:
-;; Add these lines to your .emacs:
-;; (autoload 'clojure-test-mode "clojure-test-mode" "Clojure test mode" t)
-;; (add-hook 'clojure-mode-hook
-;; (lambda () (save-excursion
-;; (goto-char (point-min))
-;; (if (or (search-forward "(deftest" nil t)
-;; (search-forward "(with-test" nil t))
-;; (clojure-test-mode t)))))
-;;
-;; Or generate autoloads with the `update-directory-autoloads' function.
-
-;;; TODO:
-
-;; * Summary message in minibuffer
-;; * Errors *loading* the tests are not reported
-;; * Errors occasionally fail to highlight. Not consistently reproducible
-;; * Highlight tests as they fail? (big job, probably, useful for slow suites)
-
-;;; Code:
-
-(require 'clojure-mode)
-(require 'slime)
-
-;; Faces
-
-(defface clojure-test-failure-face
- '((((class color) (background light))
- :background "orange red") ;; TODO: Hard to read strings over this.
- (((class color) (background dark))
- :background "firebrick"))
- "Face for failures in Clojure tests."
- :group 'clojure-test-mode)
-
-(defface clojure-test-error-face
- '((((class color) (background light))
- :background "orange1")
- (((class color) (background dark))
- :background "orange4"))
- "Face for errors in Clojure tests."
- :group 'clojure-test-mode)
-
-;; Support Functions
-
-(defun clojure-test-eval (string &optional handler)
- (slime-eval-async `(swank:eval-and-grab-output ,string)
- (or handler #'identity)))
-
-(defun clojure-test-load-reporting ()
- "Redefine the test-is report function to store results in metadata."
- (clojure-test-eval
- "(use 'clojure.contrib.test-is)
- (ns clojure.contrib.test-is)
- (defonce old-report report)
- (defn report [event msg expected actual]
- (if-let [current-test (last *testing-vars*)]
- (alter-meta! current-test
- assoc :status (conj (:status ^current-test)
- [event msg (str expected) (str actual)
- ((file-position 2) 1)])))
- (old-report event msg expected actual))"))
-
-(defun clojure-test-get-results (result)
- (clojure-test-eval
- "(map #(cons (str (:name (meta %)))
- (:status (meta %))) (vals (ns-interns *ns*)))"
- #'clojure-test-extract-results))
-
-(defun clojure-test-extract-results (results)
- ;; slime-eval-async hands us a cons with a useless car
- (setq the-results nil)
- (mapcar #'clojure-test-extract-result (read (cadr results)))
- ;; TODO: (message "Ran 7 tests containing 16 assertions. 4 failures, 9 errors.")
- )
-
-(defun clojure-test-extract-result (result)
- "Parse the result from a single test. May contain multiple is blocks."
- (dolist (is-result (rest result))
- (setq the-is-result is-result)
- (destructuring-bind (event msg expected actual line) (coerce is-result 'list)
- (if (equal :fail event)
- (clojure-test-highlight-problem
- line event (format "Expected %s, got %s" expected actual))
- (if (equal :error event)
- (clojure-test-highlight-problem line event actual))))))
-
-(defun clojure-test-highlight-problem (line event message)
- ;; (add-to-list 'the-results (list line event message))
- (save-excursion
- (goto-line line)
- (set-mark-command nil)
- (end-of-line)
- (let ((overlay (make-overlay (mark) (point))))
- (overlay-put overlay 'face (if (equal event :fail)
- 'clojure-test-failure-face
- 'clojure-test-error-face))
- (overlay-put overlay 'message message))))
-
-;; Commands
-
-(defun clojure-test-run-tests ()
- "Run all the tests in the current namespace."
- (interactive)
- ;; TODO: this is async; might need to make sure it finishes before
- ;; we load the file next.
- (clojure-test-clear)
- (slime-load-file (buffer-file-name))
- (clojure-test-eval "(clojure.contrib.test-is/run-tests)"
- #'clojure-test-get-results))
-
-(defun clojure-test-show-result ()
- "Show the result of the test under point."
- (interactive)
- (let ((overlay (car (overlays-at (point)))))
- (if overlay
- (message (overlay-get overlay 'message)))))
-
-(defun clojure-test-clear ()
- "Remove overlays and clear stored results."
- (interactive)
- (remove-overlays)
- (clojure-test-eval
- "(doseq [t (vals (ns-interns *ns*))]
- (alter-meta! t assoc :status [])
- (alter-meta! t assoc :test nil))"))
-
-(defvar clojure-test-mode-map
- (let ((map (make-sparse-keymap)))
- (define-key map (kbd "C-c C-,") 'clojure-test-run-tests)
- (define-key map (kbd "C-c '") 'clojure-test-show-result)
- map)
- "Keymap for Clojure test mode.")
-
-;;;###autoload
-(define-minor-mode clojure-test-mode
- "A minor mode for running Clojure tests."
- nil " Test" clojure-test-mode-map
- (if (slime-connected-p)
- (clojure-test-load-reporting)
- (slime)
- (add-hook 'slime-connected-hook 'clojure-test-load-reporting)))
-
-;;;###autoload
-(add-hook 'clojure-mode-hook
- (lambda () (save-excursion
- (goto-char (point-min))
- (if (or (search-forward "(deftest" nil t)
- (search-forward "(with-test" nil t))
- (clojure-test-mode t)))))
-;; Don't want to make this a defun since that means the hook would
-;; autoload the whole file.
-
-(provide 'clojure-test-mode) ;;; clojure-test-mode.el ends here
View
18 emacs.d/vendor/clojure/swank-clojure-autoload.el
@@ -1,18 +0,0 @@
-
-(autoload 'swank-clojure-init "swank-clojure" "Initialize clojure for swank")
-(autoload 'swank-clojure-cmd "swank-clojure" "Command to start clojure")
-
-(eval-after-load "slime"
- '(progn
- (require 'swank-clojure)
- (add-to-list 'slime-lisp-implementations `(clojure ,(swank-clojure-cmd) :init swank-clojure-init) t)
- (add-hook 'slime-indentation-update-hooks 'swank-clojure-update-indentation)
- (add-hook 'slime-repl-mode-hook 'swank-clojure-slime-repl-modify-syntax t)
- (add-hook 'clojure-mode-hook 'swank-clojure-slime-mode-hook t)))
-
-(defmacro swank-clojure-config (&rest body)
- `(eval-after-load "swank-clojure"
- '(progn
- ,@body)))
-
-(provide 'swank-clojure-autoload)
View
150 emacs.d/vendor/clojure/swank-clojure.el
@@ -1,150 +0,0 @@
-;;;; swank-clojure.el --- slime settings for clojure
-;;;
-;;; Copyright (C) 2008 Jeffrey Chu
-;;;
-;;; This file is licensed under the terms of the GNU General Public
-;;; License as distributed with Emacs (press C-h C-c to view it).
-;;;
-;;; See swank-clojure.clj for instructions
-;;;
-
-(eval-and-compile
- (defvar swank-clojure-path
- (let ((path (file-truename (or (locate-library "swank-clojure")
- load-file-name))))
- (and path (file-name-directory path)))
- "Directory containing the swank-clojure package. This is used
-to load the supporting clojure library swank."))
-
-(defgroup swank-clojure nil
- "SLIME/swank support for clojure"
- :prefix "swank-clojure-"
- :group 'applications)
-
-(defcustom swank-clojure-java-path "java"
- "The location of the java executable"
- :type 'string
- :group 'swank-clojure)
-
-(defcustom swank-clojure-jar-path nil
- "The location of the jar file for clojure. For example,
-/path/to/clojure.jar "
- :type 'string
- :group 'swank-clojure)
-
-(defcustom swank-clojure-extra-classpaths (when (file-directory-p "~/.clojure") (directory-files "~/.clojure" t ".jar$"))
- "The classpath from which clojure will load from (passed into
-java as the -cp argument). On default, it includes all jar files
-within ~/.clojure/"
- :type 'list
- :group 'swank-clojure)
-
-(defcustom swank-clojure-library-paths nil
- "The library paths used when loading shared libraries,
-used to set the java.library.path property"
- :type 'list
- :group 'swank-clojure)
-
-(defcustom swank-clojure-extra-vm-args nil
- "Extra arguments to be passed to the Java VM when starting clojure.
-For example -Xmx512m or -Dsun.java2d.noddraw=true"
- :type 'list
- :group 'swank-clojure)
-
-(defcustom swank-clojure-binary nil
- "Used as a binary executable (instead of
-swank-clojure-java-path) if non-nil."
- :type 'string
- :group 'swank-clojure)
-
-(defcustom swank-clojure-init-files nil
- "If provided, will be used to initialize the REPL environment."
- :type 'list
- :group 'swank-clojure)
-
-(defcustom swank-clojure-compile-p nil
- "Whether or not to instruct swank-clojure to swank files. Set
- to nil if it's causing you problems."
- :type 'boolean
- :group 'swank-clojure)
-
-
-(defun swank-clojure-init (file encoding)
- (concat
- (format "(add-classpath %S)\n\n" (concat "file:///" swank-clojure-path))
- (when swank-clojure-compile-p
- "(require 'swank.loader)\n\n(swank.loader/init)\n\n")
- "(require 'swank.swank)\n\n"
- (when (boundp 'slime-protocol-version)
- (format "(swank.swank/ignore-protocol-version %S)\n\n" slime-protocol-version))
- (format "(swank.swank/start-server %S :encoding %S)\n\n"
- file (format "%s" encoding))))
-
-(defun swank-clojure-find-package ()
- (let ((regexp "^(\\(clojure.core/\\)?\\(in-\\)?ns\\s-+[:']?\\([^()]+\\>\\)"))
- (save-excursion
- (when (or (re-search-backward regexp nil t)
- (re-search-forward regexp nil t))
- (match-string-no-properties 3)))))
-
-(defun swank-clojure-slime-mode-hook ()
- (slime-mode 1)
- (set (make-local-variable 'slime-find-buffer-package-function) 'swank-clojure-find-package))
-
-(defun swank-clojure-update-indentation (sym indent)
- (put sym 'clojure-indent-function indent))
-
-(defun swank-clojure-concat-paths (paths)
- "Concatenate given list of `paths' using `path-separator'. (`expand-file-name'
-will be used over paths too.)"
- (mapconcat 'identity (mapcar 'expand-file-name paths) path-separator))
-
-(defun swank-clojure-cmd ()
- "Create the command to start clojure according to current settings."
- (if (and (not swank-clojure-binary) (not swank-clojure-jar-path))
- (error "You must specifiy either a `swank-clojure-binary' or a `swank-clojure-jar-path'")
- (if swank-clojure-binary
- (if (listp swank-clojure-binary)
- swank-clojure-binary
- (list swank-clojure-binary))
- (delete-if
- 'null
- (append
- (list swank-clojure-java-path)
- swank-clojure-extra-vm-args
- (list
- (when swank-clojure-library-paths
- (concat "-Djava.library.path="
- (swank-clojure-concat-paths swank-clojure-library-paths)))
- "-classpath"
- (swank-clojure-concat-paths
- (cons swank-clojure-jar-path swank-clojure-extra-classpaths))
- "clojure.main")
- (let ((init-opts '()))
- (dolist (init-file swank-clojure-init-files init-opts)
- (setq init-opts (append init-opts (list "-i" init-file))))
- init-opts)
- (list "--repl"))))))
-
-;; Change the repl to be more clojure friendly
-(defun swank-clojure-slime-repl-modify-syntax ()
- (when (string-match "\\*slime-repl clojure\\*" (buffer-name))
- ;; modify syntax
- (modify-syntax-entry ?~ "' ")
- (modify-syntax-entry ?, " ")
- (modify-syntax-entry ?\{ "(}")
- (modify-syntax-entry ?\} "){")
- (modify-syntax-entry ?\[ "(]")
- (modify-syntax-entry ?\] ")[")
- (modify-syntax-entry ?^ "'")
- (modify-syntax-entry ?= "'")
-
- ;; set indentation function (already local)
- (setq lisp-indent-function 'clojure-indent-function)
-
- ;; set paredit keys
- (when (and (featurep 'paredit) paredit-mode (>= paredit-version 21))
- (define-key slime-repl-mode-map "{" 'paredit-open-curly)
- (define-key slime-repl-mode-map "}" 'paredit-close-curly))))
-
-(provide 'swank-clojure)
View
17 emacs.d/vendor/clojure/swank/clj_contrib/macroexpand.clj
@@ -1,17 +0,0 @@
-(ns swank.clj-contrib.macroexpand)
-
-(def
- #^{:private true}
- walk-enabled?
- (.getResource (clojure.lang.RT/baseLoader) "clojure/contrib/walk.clj"))
-
-(when walk-enabled?
- (require 'clojure.contrib.walk))
-
-(defmacro macroexpand-all* [form]
- (if walk-enabled?
- `(clojure.contrib.walk/macroexpand-all ~form)
- `(macroexpand ~form)))
-
-(defn macroexpand-all [form]
- (macroexpand-all* form))
View
20 emacs.d/vendor/clojure/swank/clj_contrib/pprint.clj
@@ -1,20 +0,0 @@
-(ns swank.clj-contrib.pprint)
-
-(def
- #^{:private true}
- pprint-enabled?
- (try (.loadClass (clojure.lang.RT/baseLoader) "clojure.contrib.pprint.PrettyWriter") (catch Exception e nil)))
-
-(when pprint-enabled?
- (use 'clojure.contrib.pprint))
-
-(defmacro pretty-pr-code*
- ([code]
- (if pprint-enabled?
- `(binding [*print-suppress-namespaces* true]
- (with-pprint-dispatch *code-dispatch* (write ~code :pretty true :stream nil)))
- `(pr-str ~code)))
- {:private true})
-
-(defn pretty-pr-code [code]
- (pretty-pr-code* code))
View
14 emacs.d/vendor/clojure/swank/commands.clj
@@ -1,14 +0,0 @@
-(ns swank.commands)
-
-(defonce slime-fn-map {})
-
-(defmacro defslimefn
- ([fname & body]
- `(alter-var-root #'slime-fn-map
- assoc
- (symbol "swank" ~(name fname))
- (defn ~fname ~@body)))
- {:indent 'defun})
-
-(defn slime-fn [sym]
- (slime-fn-map (symbol "swank" (name sym))))
View
308 emacs.d/vendor/clojure/swank/commands/basic.clj
@@ -1,308 +0,0 @@
-(ns swank.commands.basic
- (:refer-clojure :exclude [load-file])
- (:use (swank util commands core)
- (swank.util.concurrent thread)
- (swank.util string clojure)
- (swank.clj-contrib pprint macroexpand))
- (:require (swank.util [sys :as sys]))
- (:import (java.io StringReader File)
- (java.util.zip ZipFile)
- (clojure.lang LineNumberingPushbackReader)))
-
-;;;; Connection
-
-(defslimefn connection-info []
- `(:pid ~(sys/get-pid)
- :style :spawn
- :lisp-implementation (:type "clojure" :name "clojure")
- :package (:name ~(name (ns-name *ns*))
- :prompt ~(name (ns-name *ns*)))
- :version ~(deref *protocol-version*)))
-
-(defslimefn quit-lisp []
- (System/exit 0))
-
-;;;; Evaluation
-
-(defn- eval-region
- "Evaluate string, return the results of the last form as a list and
- a secondary value the last form."
- ([string]
- (with-open [rdr (LineNumberingPushbackReader. (StringReader. string))]
- (loop [form (read rdr false rdr), value nil, last-form nil]
- (if (= form rdr)
- [value last-form]
- (recur (read rdr false rdr)
- (eval form)
- form))))))
-
-(defslimefn interactive-eval-region [string]
- (with-emacs-package
- (pr-str (first (eval-region string)))))
-
-(defslimefn interactive-eval [string]
- (with-emacs-package
- (pr-str (first (eval-region string)))))
-
-(defslimefn listener-eval [form]
- (with-emacs-package
- (with-package-tracking
- (let [[value last-form] (eval-region form)]
- (when (and last-form (not (one-of? last-form '*1 '*2 '*3 '*e)))
- (set! *3 *2)
- (set! *2 *1)
- (set! *1 value))
- (send-repl-results-to-emacs value)))))
-
-(defslimefn eval-and-grab-output [string]
- (with-emacs-package
- (with-local-vars [retval nil]
- (list (with-out-str
- (var-set retval (pr-str (first (eval-region string)))))
- (var-get retval)))))
-
-;;;; Macro expansion
-
-(defn- apply-macro-expander [expander string]
- (pretty-pr-code (expander (read-from-string string))))
-
-(defslimefn swank-macroexpand-1 [string]
- (apply-macro-expander macroexpand-1 string))
-
-(defslimefn swank-macroexpand [string]
- (apply-macro-expander macroexpand string))
-
-;; not implemented yet, needs walker
-(defslimefn swank-macroexpand-all [string]
- (apply-macro-expander macroexpand-all string))
-
-;;;; Compiler / Execution
-
-(def *compiler-exception-location-re* #"^clojure\\.lang\\.Compiler\\$CompilerException: ([^:]+):([^:]+):")
-(defn- guess-compiler-exception-location [#^Throwable t]
- (when (instance? clojure.lang.Compiler$CompilerException t)
- (let [[match file line] (re-find *compiler-exception-location-re* (.toString t))]
- (when (and file line)
- `(:location (:file ~file) (:line ~(Integer/parseInt line)) nil)))))
-
-;; TODO: Make more and better guesses
-(defn- exception-location [#^Throwable t]
- (or (guess-compiler-exception-location t)
- '(:error "No error location available")))
-
-;; plist of message, severity, location, references, short-message
-(defn- exception-to-message [#^Throwable t]
- `(:message ~(.toString t)
- :severity :error
- :location ~(exception-location t)
- :references nil
- :short-message ~(.toString t)))
-
-(defn- compile-file-for-emacs*
- "Compiles a file for emacs. Because clojure doesn't compile, this is
- simple an alias for load file w/ timing and messages. This function
- is to reply with the following:
- (:swank-compilation-unit notes results durations)"
- ([file-name]
- (let [start (System/nanoTime)]
- (try
- (let [ret (clojure.core/load-file file-name)
- delta (- (System/nanoTime) start)]
- `(:compilation-result nil ~(pr-str ret) ~(/ delta 1000000000.0)))
- (catch Throwable t
- (let [delta (- (System/nanoTime) start)
- causes (exception-causes t)
- num (count causes)]
- (.printStackTrace t) ;; prints to *inferior-lisp*
- `(:compilation-result
- ~(map exception-to-message causes) ;; notes
- nil ;; results
- ~(/ delta 1000000000.0) ;; durations
- )))))))
-
-(defslimefn compile-file-for-emacs
- ([file-name load? compile-options]
- (when load?
- (compile-file-for-emacs* file-name))))
-
-(defslimefn load-file [file-name]
- (pr-str (clojure.core/load-file file-name)))
-
-(defslimefn compile-string-for-emacs [string buffer position directory debug]
- (let [start (System/nanoTime)
- ret (with-emacs-package (eval-region string))
- delta (- (System/nanoTime) start)]
- `(:compilation-result nil ~(pr-str ret) ~(/ delta 1000000000.0))))
-
-;;;; Describe
-
-(defn- describe-to-string [var]
- (with-out-str
- (print-doc var)))
-
-(defn- describe-symbol* [symbol-name]
- (with-emacs-package
- (if-let [v (ns-resolve (maybe-ns *current-package*) (symbol symbol-name))]
- (describe-to-string v)
- (str "Unknown symbol " symbol-name))))
-
-(defslimefn describe-symbol [symbol-name]
- (describe-symbol* symbol-name))
-
-(defslimefn describe-function [symbol-name]
- (describe-symbol* symbol-name))
-
-;; Only one namespace... so no kinds
-(defslimefn describe-definition-for-emacs [name kind]
- (describe-symbol* name))
-
-;; Only one namespace... so only describe symbol
-(defslimefn documentation-symbol
- ([symbol-name default] (documentation-symbol symbol-name))
- ([symbol-name] (describe-symbol* symbol-name)))
-
-
-;;;; Operator messages
-(defslimefn operator-arglist [name package]
- (try
- (let [f (read-from-string name)]
- (cond
- (keyword? f) "([map])"
- (symbol? f) (let [var (ns-resolve (maybe-ns package) f)]
- (if-let [args (and var (:arglists (meta var)))]
- (pr-str args)
- nil))
- :else nil))
- (catch Throwable t nil)))
-
-;;;; Completions
-
-(defn- vars-with-prefix
- "Filters a coll of vars and returns only those that have a given
- prefix."
- ([#^String prefix vars]
- (filter #(.startsWith #^String % prefix) (map (comp name :name meta) vars))))
-
-(defn- maybe-alias [sym ns]
- (or (resolve-ns sym (maybe-ns ns))
- (maybe-ns ns)))
-
-(defslimefn simple-completions [symbol-string package]
- (try
- (let [[sym-ns sym-name] (symbol-name-parts symbol-string)
- ns (if sym-ns (maybe-alias (symbol sym-ns) package) (maybe-ns package))
- vars (if sym-ns (vals (ns-publics ns)) (filter var? (vals (ns-map ns))))
- matches (seq (sort (vars-with-prefix sym-name vars)))]
- (if sym-ns
- (list (map (partial str sym-ns "/") matches)
- (if matches
- (str sym-ns "/" (reduce largest-common-prefix matches))
- symbol-string))
- (list matches
- (if matches
- (reduce largest-common-prefix matches)
- symbol-string))))
- (catch java.lang.Throwable t
- (list nil symbol-string))))
-
-
-(defslimefn list-all-package-names
- ([] (map (comp str ns-name) (all-ns)))
- ([nicknames?] (list-all-package-names)))
-
-(defslimefn set-package [name]
- (let [ns (maybe-ns name)]
- (in-ns (ns-name ns))
- (list (str (ns-name ns))
- (str (ns-name ns)))))
-
-;;;; Source Locations
-(comment
- "Sets the default directory (java's user.dir). Note, however, that
- this will not change the search path of load-file. ")
-(defslimefn set-default-directory
- ([directory & ignore]
- (System/setProperty "user.dir" directory)
- directory))
-
-
-;;;; meta dot find
-
-(defn- slime-find-file-in-dir [#^File file #^String dir]
- (let [file-name (. file (getPath))
- child (File. (File. dir) file-name)]
- (or (when (.exists child)
- `(:file ~(.getPath child)))
- (try
- (let [zipfile (ZipFile. dir)]
- (when (.getEntry zipfile file-name)
- `(:zip ~dir ~file-name)))
- (catch Throwable e false)))))
-
-(defn- slime-find-file-in-paths [#^String file paths]
- (let [f (File. file)]
- (if (.isAbsolute f)
- `(:file ~file)
- (first (filter identity (map #(slime-find-file-in-dir f %) paths))))))
-
-(defn- get-path-prop
- "Returns a coll of the paths represented in a system property"
- ([prop]
- (seq (-> (System/getProperty prop)
- (.split File/pathSeparator))))
- ([prop & props]
- (lazy-cat (get-path-prop prop) (mapcat get-path-prop props))))
-
-(defn- slime-search-paths []
- (concat (get-path-prop "user.dir" "java.class.path" "sun.boot.class.path")
- (let [loader (clojure.lang.RT/baseLoader)]
- (when (instance? java.net.URLClassLoader loader)
- (map #(.getPath #^java.net.URL %)
- (.getURLs #^java.net.URLClassLoader (cast java.net.URLClassLoader (clojure.lang.RT/baseLoader))))))))
-
-(defn- namespace-to-path [ns]
- (let [#^String ns-str (name (ns-name ns))]
- (-> ns-str
- (.substring 0 (.lastIndexOf ns-str "."))
- (.replace \- \_)
- (.replace \. \/))))
-
-(defslimefn find-definitions-for-emacs [name]
- (let [sym-name (read-from-string name)
- sym-var (ns-resolve (maybe-ns *current-package*) sym-name)]
- (when-let [meta (and sym-var (meta sym-var))]
- (if-let [path (or
- ;; Check first check using full namespace
- (slime-find-file-in-paths (str (namespace-to-path (:ns meta))
- File/separator
- (:file meta)) (slime-search-paths))
- ;; Otherwise check using just the filename
- (slime-find-file-in-paths (:file meta) (slime-search-paths)))]
- `((~(str "(defn " (:name meta) ")")
- (:location
- ~path
- (:line ~(:line meta))
- nil)))
- `((~(str (:name meta))
- (:error "Source definition not found.")))))))
-
-
-(defslimefn throw-to-toplevel []
- (throw *debug-quit-exception*))
-
-(defslimefn invoke-nth-restart-for-emacs [level n]
- (if (= n 1)
- (let [cause (.getCause *current-exception*)]
- (invoke-debugger cause *debug-thread-id*)
- (.getMessage cause))
- (throw *debug-quit-exception*)))
-
-(defslimefn backtrace [start end]
- (doall (take (- end start) (drop start (exception-stacktrace *current-exception*)))))
-
-(defslimefn buffer-first-change [file-name] nil)
-
-(defslimefn frame-catch-tags-for-emacs [n] nil)
-(defslimefn frame-locals-for-emacs [n] nil)
-
-(defslimefn create-repl [target] '("user" user))
View
9 emacs.d/vendor/clojure/swank/commands/contrib.clj
@@ -1,9 +0,0 @@
-(ns swank.commands.contrib
- (:use (swank util core commands)))
-
-(defslimefn swank-require [keys]
- (binding [*ns* (find-ns 'swank.commands.contrib)]
- (doseq [k (if (seq? keys) keys (list keys))]
- (try
- (require (symbol (str "swank.commands.contrib." (name k))))
- (catch java.io.FileNotFoundException fne nil)))))
View
26 emacs.d/vendor/clojure/swank/commands/contrib/swank_arglists.clj
@@ -1,26 +0,0 @@
-(ns swank.commands.contrib.swank-arglists
- (:use (swank util core commands)))
-
-((slime-fn 'swank-require) :swank-c-p-c)
-
-(defslimefn arglist-for-echo-area [raw-specs & options]
- (let [{:keys [arg-indices
- print-right-margin
- print-lines]} (apply hash-map options)]
- ;; Yeah, I'm lazy -- I'll flesh this out later
- (if (and raw-specs
- (seq? raw-specs)
- (seq? (first raw-specs)))
- ((slime-fn 'operator-arglist) (ffirst raw-specs) *current-package*)
- nil)))
-
-(defslimefn variable-desc-for-echo-area [variable-name]
- (with-emacs-package
- (or
- (try
- (when-let [sym (read-from-string variable-name)]
- (when-let [var (resolve sym)]
- (when (.isBound #^clojure.lang.Var var)
- (str variable-name " => " (var-get var)))))
- (catch Exception e nil))
- "")))
View
116 emacs.d/vendor/clojure/swank/commands/contrib/swank_c_p_c.clj
@@ -1,116 +0,0 @@
-(ns swank.commands.contrib.swank-c-p-c
- (:use (swank util core commands)
- (swank.util string clojure)))
-
-(defn- compound-prefix-match?
- "Takes a `prefix' and a `target' string and returns whether `prefix'
- is a compound-prefix of `target'.
-
- Viewing each of `prefix' and `target' as a series of substrings
- delimited by `delimiter', if each substring of `prefix' is a prefix
- of the corresponding substring in `target' then we call `prefix' a
- compound-prefix of `target'."
- ([delimiter #^String prefix #^String target]
- (let [prefixes (.split prefix delimiter -1)
- targets (.split target delimiter -1)]
- (when (<= (count prefixes) (count targets))
- (every? true? (map #(.startsWith #^String %1 %2) targets prefixes))))))
-
-(defn- unacronym
- "Interposes delimiter between each character of string."
- ([delimiter #^String string]
- (apply str (interpose delimiter string)))
- {:tag String})
-
-(defn- compound-prefix-match-acronyms?
- ([delimiter prefix target]
- (or (compound-prefix-match? delimiter prefix target)
- (compound-prefix-match? delimiter (unacronym delimiter prefix) target))))
-
-(defn- find-ns-str
- "Given an string its-name, returns either an ns if a like named ns
- exists, or nil. If its-name is nil, returns the default ns."
- ([its-name] (find-ns-str its-name nil))
- ([its-name cur-ns-name]
- (if (nil? its-name)
- (maybe-ns nil)
- (and its-name
- (resolve-ns (symbol its-name) (maybe-ns cur-ns-name))))))
-
-(defn- completion-list-ns
- "Returns a list of nses that are possible compound completions of sym.
- The compound completion delimiter is `.'"
- ([sym cur-ns-name]
- (filter (partial compound-prefix-match-acronyms? "\\." sym)
- (concat (map (comp name ns-name) (all-ns))
- (map name (keys (ns-aliases (find-ns-str cur-ns-name))))))))
-
-(defn- completion-list-var
- "Returns a list of vars that are possible compound completions of sym,
- given that maybe-ns is nil or an ns in which to search of vars, and
- current-ns is the ns of the context of the completion or nil.
- The compound completion delimiter is `-'"
- ([sym-name sym-ns-name cur-ns-name]
- (let [sym-ns (find-ns-str sym-ns-name cur-ns-name)
- cur-ns (find-ns-str cur-ns-name)
- vars-of-ns (delay
- (filter
- var?
- (vals (if (or (not sym-ns-name)
- (= sym-ns cur-ns))
- ;; In current namespace complete to all
- ;; vars, in other namespaces -- only to
- ;; public vars.
- (ns-map cur-ns)
- (ns-publics sym-ns)))))
- completions (delay
- (filter
- (partial compound-prefix-match-acronyms? "-" sym-name)
- (map
- (comp name :name meta) ;name of var as String
- (force vars-of-ns))))]
- (cond
- (and sym-ns-name (not sym-ns)) ;invalid ns given
- nil
- (and sym-ns-name sym-ns) ;valid ns given
- (map (partial str sym-ns-name "/")
- (force completions))
- :else ;no ns given
- (force completions)))))
-
-(defn- compound-complete
- "Returns a list of possible completions of sym in cur-ns."
- [sym cur-ns-name]
- (let [[sym-ns-name sym-name] (symbol-name-parts sym)]
- (if sym-ns-name
- (completion-list-var sym-name sym-ns-name cur-ns-name)
- (concat
- (completion-list-var sym-name nil cur-ns-name)
- (map #(str % \/)
- (completion-list-ns sym-name cur-ns-name))))))
-
-(defslimefn completions [string package]
- (let [matches (sort (compound-complete string package))
- longest-comp (if (seq matches)
- (let [last-char (fn [#^String string]
- ;; only for non-empty strings
- (.charAt string
- (dec (.length string))))
- #^String
- prefix (reduce largest-common-prefix matches)]
- ;; Remove trailing \- or \. (if completing a
- ;; namespace) from longest completable
- ;; string, unless the text before it is not
- ;; expandable, so that cursor is positioned
- ;; before the dash or dot.
- (if (and
- (not (empty? prefix))
- (or (= \- (last-char prefix))
- (and (not (char-position \/ prefix))
- (= \. (last-char prefix))))
- (not-every? #(.startsWith #^String % prefix)
- matches))
- (.substring prefix 0 (dec (.length prefix)))
- prefix))
- string)]
- (list matches longest-comp)))
View
100 emacs.d/vendor/clojure/swank/commands/indent.clj
@@ -1,100 +0,0 @@
-(ns swank.commands.indent
- (:use (swank util core)
- (swank.core hooks connection)
- (swank.util hooks)))
-
-(defn- need-full-indentation-update?
- "Return true if the indentation cache should be updated for all
- namespaces.
-
- This is a heuristic so as to avoid scanning all symbols from all
- namespaces. Instead, we only check whether the set of namespaces in
- the cache match the set of currently defined namespaces."
- ([connection]
- (not= (hash (all-ns))
- (hash @(connection :indent-cache-pkg)))))
-
-(defn- find-args-body-position
- "Given an arglist, return the number of arguments before
- [... & body]
- If no & body is found, nil will be returned"
- ([args]
- (when (coll? args)
- (when-let [amp-position (position '#{&} args)]
- (when-let [body-position (position '#{body clauses} args)]
- (when (= (inc amp-position) body-position)
- amp-position))))))
-
-(defn- find-arglists-body-position
- "Find the smallest body position from an arglist"
- ([arglists]
- (let [positions (remove nil? (map find-args-body-position arglists))]
- (when-not (empty? positions)
- (apply min positions)))))
-
-(defn- find-var-body-position
- "Returns a var's :indent override or the smallest body position of a
- var's arglists"
- ([var]
- (let [var-meta (meta var)]
- (or (:indent var-meta)
- (find-arglists-body-position (:arglists var-meta))))))
-
-(defn- var-indent-representation
- "Returns the slime indentation representation (name . position) for
- a given var. If there is no indentation representation, nil is
- returned."
- ([var]
- (when-let [body-position (find-var-body-position var)]
- (when (or (= body-position 'defun)
- (not (neg? body-position)))
- (list (name (:name (meta var)))
- '.
- body-position)))))
-
-(defn- get-cache-update-for-var
- "Checks whether a given var needs to be updated in a cache. If it
- needs updating, return [var-name var-indentation-representation].
- Otherwise return nil"
- ([find-in-cache var]
- (when-let [indent (var-indent-representation var)]
- (let [name (:name ^var)]
- (when-not (= (find-in-cache name) indent)
- [name indent])))))
-
-(defn- get-cache-updates-in-namespace
- "Finds all cache updates needed within a namespace"
- ([find-in-cache ns]
- (remove nil? (map (partial get-cache-update-for-var find-in-cache) (vals (ns-interns ns))))))
-
-(defn- update-indentation-delta
- "Update the cache and return the changes in a (symbol '. indent) list.
- If FORCE is true then check all symbols, otherwise only check
- symbols belonging to the buffer package"
- ([cache-ref load-all-ns?]
- (let [find-in-cache @cache-ref]
- (let [namespaces (if load-all-ns? (all-ns) [(maybe-ns *current-package*)])
- updates (mapcat (partial get-cache-updates-in-namespace find-in-cache) namespaces)]
- (when (seq updates)
- (dosync (alter cache-ref into updates))
- (map second updates))))))
-
-(defn- perform-indentation-update
- "Update the indentation cache in connection and update emacs.
- If force is true, then start again without considering the old cache."
- ([conn force]
- (let [cache (conn :indent-cache)]
- (let [delta (update-indentation-delta cache force)]
- (dosync
- (ref-set (conn :indent-cache-pkg) (hash (all-ns)))
- (when (seq delta)
- (send-to-emacs `(:indentation-update ~delta))))))))
-
-(defn- sync-indentation-to-emacs
- "Send any indentation updates to Emacs via emacs-connection"
- ([]
- (perform-indentation-update
- *current-connection*
- (need-full-indentation-update? *current-connection*))))
-
-(add-hook *pre-reply-hook* #'sync-indentation-to-emacs)
View
284 emacs.d/vendor/clojure/swank/commands/inspector.clj
@@ -1,284 +0,0 @@
-(ns swank.commands.inspector
- (:use (swank util core commands)
- (swank.core connection)))
-
-;;;; Inspector for basic clojure data structures
-
-;; This a mess, I'll clean up this code after I figure out exactly
-;; what I need for debugging support.
-
-(def *inspectee* (ref nil))
-(def *inspectee-content* (ref nil))
-(def *inspectee-parts* (ref nil))
-(def *inspectee-actions* (ref nil))
-(def *inspector-stack* (ref nil))
-(def *inspector-history* (ref nil))
-
-(defn reset-inspector []
- (dosync
- (ref-set *inspectee* nil)
- (ref-set *inspectee-content* nil)
- (ref-set *inspectee-parts* [])
- (ref-set *inspectee-actions* [])
- (ref-set *inspector-stack* nil)
- (ref-set *inspector-history* [])))
-
-(defn inspectee-title [obj]
- (cond
- (instance? clojure.lang.LazySeq obj) (str "clojure.lang.LazySeq@...")
- :else (str obj)))
-
-(defn print-part-to-string [value]
- (let [s (inspectee-title value)
- pos (position #{value} @*inspector-history*)]
- (if pos
- (str "#" pos "=" s)
- s)))
-
-(defn assign-index [o dest]
- (dosync
- (let [index (count @dest)]
- (alter dest conj o)
- index)))
-
-(defn value-part [obj s]
- (list :value (or s (print-part-to-string obj))
- (assign-index obj *inspectee-parts*)))
-
-(defn action-part [label lambda refresh?]
- (list :action label
- (assign-index (list lambda refresh?)
- *inspectee-actions*)))
-
-(defn label-value-line
- ([label value] (label-value-line label value true))
- ([label value newline?]
- (list* (str label) ": " (list :value value)
- (if newline? '((:newline)) nil))))
-
-(defmacro label-value-line* [& label-values]
- `(concat ~@(map (fn [[label value]]
- `(label-value-line ~label ~value))
- label-values)))
-
-;; Inspection
-
-;; This is the simple version that only knows about clojure stuff.
-;; Many of these will probably be redefined by swank-clojure-debug
-(defmulti emacs-inspect
- (fn known-types [obj]
- (cond
- (map? obj) :map
- (vector? obj) :vector
- (var? obj) :var
- (string? obj) :string
- (seq? obj) :seq
- (instance? Class obj) :class
- (instance? clojure.lang.Namespace obj) :namespace)))
-
-(defn inspect-meta-information [obj]
- (when (> (count (meta obj)) 0)
- (concat
- '("Meta Information: " (:newline))
- (mapcat (fn [[key val]]
- `(" " (:value ~key) " = " (:value ~val) (:newline)))
- (meta obj)))))
-
-(defmethod emacs-inspect :map [obj]
- (concat
- (label-value-line*
- ("Class" (class obj))
- ("Count" (count obj)))
- '("Contents: " (:newline))
- (inspect-meta-information obj)
- (mapcat (fn [[key val]]
- `(" " (:value ~key) " = " (:value ~val)
- (:newline)))
- obj)))
-
-(defmethod emacs-inspect :vector [obj]
- (concat
- (label-value-line*
- ("Class" (class obj))
- ("Count" (count obj)))
- '("Contents: " (:newline))
- (inspect-meta-information obj)
- (mapcat (fn [i val]
- `(~(str " " i ". ") (:value ~val) (:newline)))
- (iterate inc 0)
- obj)))
-
-(defmethod emacs-inspect :var [#^clojure.lang.Var obj]
- (concat
- (label-value-line*
- ("Class" (class obj)))
- (inspect-meta-information obj)
- (when (.isBound obj)
- `("Value: " (:value ~(var-get obj))))))
-
-(defmethod emacs-inspect :string [obj]
- (concat
- (label-value-line*
- ("Class" (class obj)))
- (inspect-meta-information obj)
- (list (str "Value: " (pr-str obj)))))
-
-(defmethod emacs-inspect :seq [obj]
- (concat
- (label-value-line*
- ("Class" (class obj)))
- '("Contents: " (:newline))
- (inspect-meta-information obj)
- (mapcat (fn [i val]
- `(~(str " " i ". ") (:value ~val) (:newline)))
- (iterate inc 0)
- obj)))
-
-(defmethod emacs-inspect :default [obj]
- `("Type: " (:value ~(class obj)) (:newline)
- "Value: " (:value ~(str obj)) (:newline)
- "Don't know how to inspect the object" (:newline)))
-
-(defmethod emacs-inspect :class [#^Class obj]
- (let [meths (. obj getMethods)
- fields (. obj getFields)]
- (concat
- `("Type: " (:value ~(class obj)) (:newline)
- "---" (:newline)
- "Fields: " (:newline))
- (mapcat (fn [f]
- `(" " (:value ~f) (:newline))) fields)
- '("---" (:newline)
- "Methods: " (:newline))
- (mapcat (fn [m]
- `(" " (:value ~m) (:newline))) meths))))
-
-
-(defn ns-refers-by-ns [#^clojure.lang.Namespace ns]
- (categorize-by (fn [#^clojure.lang.Var v] (. v ns))
- (map val (ns-refers ns))))
-
-(defmethod emacs-inspect :namespace [#^clojure.lang.Namespace obj]
- (concat
- (label-value-line*
- ("Class" (class obj))
- ("Count" (count (ns-map obj))))
- '("---" (:newline)
- "Refer from: " (:newline))
- (mapcat (fn [[ns refers]]
- `(" "(:value ~ns) " = " (:value ~refers) (:newline)))
- (ns-refers-by-ns obj))
- (label-value-line*
- ("Imports" (ns-imports obj))
- ("Interns" (ns-interns obj)))))
-
-(defn inspector-content [specs]
- (flet [(fn spec-seq [seq]
- (let [[f & args] seq]
- (cond
- (= f :newline) (str \newline)
-
- (= f :value)
- (let [[obj & [str]] args]
- (value-part obj str))
-
- (= f :action)
- (let [[label lambda & options] args
- {:keys [refresh?]} (apply hash-map options)]
- (action-part label lambda refresh?)))))
- (fn spec-value [val]
- (cond
- (string? val) val
- (seq? val) (spec-seq val)))]
- (map spec-value specs)))
-
-;; Works for infinite sequences, but it lies about length. Luckily, emacs doesn't
-;; care.
-(defn content-range [lst start end]
- (let [amount-wanted (- end start)
- shifted (drop start lst)
- taken (take amount-wanted shifted)
- amount-taken (count taken)]
- (if (< amount-taken amount-wanted)
- (list taken (+ amount-taken start) start end)
- ;; There's always more until we know there isn't
- (list taken (+ end 500) start end))))
-
-(defn inspect-object [o]
- (dosync
- (ref-set *inspectee* o)
- (alter *inspector-stack* conj o)
- (when-not (filter #(identical? o %) @*inspector-history*)
- (alter *inspector-history* conj o))
- (ref-set *inspectee-content* (inspector-content (emacs-inspect o)))
- (list :title (inspectee-title o)
- :id (assign-index o *inspectee-parts*)
- :content (content-range @*inspectee-content* 0 500))))
-
-(defslimefn init-inspector [string]
- (with-emacs-package
- (reset-inspector)
- (inspect-object (eval (read-from-string string)))))
-
-(defn inspect-in-emacs [what]
- (flet [(fn send-it []
- (with-emacs-package
- (reset-inspector)
- (send-to-emacs `(:inspect ~(inspect-object what)))))]
- (cond
- *current-connection* (send-it)
- (comment (first @*connections*))
- ;; TODO: take a second look at this, will probably need garbage collection on *connections*
- (comment
- (binding [*current-connection* (first @*connections*)]
- (send-it))))))
-
-(defslimefn inspector-nth-part [index]
- (get @*inspectee-parts* index))
-
-(defslimefn inspect-nth-part [index]
- (with-emacs-package
- (inspect-object ((slime-fn 'inspector-nth-part) index))))
-
-(defslimefn inspector-range [from to]
- (content-range @*inspectee-content* from to))
-
-(defn ref-pop [ref]
- (let [[f & r] @ref]
- (ref-set ref r)
- f))
-
-(defslimefn inspector-call-nth-action [index & args]
- (let [[fn refresh?] (get @*inspectee-actions* index)]
- (apply fn args)
- (if refresh?
- (inspect-object (dosync (ref-pop *inspector-stack*)))
- nil)))
-
-(defslimefn inspector-pop []
- (with-emacs-package
- (cond
- (rest @*inspector-stack*)
- (inspect-object
- (dosync
- (ref-pop *inspector-stack*)
- (ref-pop *inspector-stack*)))
- :else nil)))
-
-(defslimefn inspector-next []
- (with-emacs-package
- (let [pos (position #{@*inspectee*} @*inspector-history*)]
- (cond
- (= (inc pos) (count @*inspector-history*)) nil
- :else (inspect-object (get @*inspector-history* (inc pos)))))))
-
-(defslimefn inspector-reinspect []
- (inspect-object @*inspectee*))
-
-(defslimefn quit-inspector []
- (reset-inspector)
- nil)
-
-(defslimefn describe-inspectee []
- (with-emacs-package
- (str @*inspectee*)))
View
252 emacs.d/vendor/clojure/swank/core.clj
@@ -1,252 +0,0 @@
-(ns swank.core
- (:use (swank util commands)
- (swank.util hooks)
- (swank.util.concurrent thread)
- (swank.core connection hooks threadmap))
- (:require (swank.util.concurrent [mbox :as mb])))
-
-;; Protocol version
-(defonce *protocol-version* (ref nil))
-
-;; Emacs packages
-(def *current-package*)
-
-(defonce *active-threads* (ref ()))
-
-(defn maybe-ns [package]
- (cond
- (symbol? package) (or (find-ns package) (maybe-ns 'user))
- (string? package) (maybe-ns (symbol package))
- (keyword? package) (maybe-ns (name package))
- (instance? clojure.lang.Namespace package) package
- :else (maybe-ns 'user)))
-
-(defmacro with-emacs-package [& body]
- `(binding [*ns* (maybe-ns *current-package*)]
- ~@body))
-
-(defmacro with-package-tracking [& body]
- `(let [last-ns# *ns*]
- (try
- ~@body
- (finally
- (when-not (= last-ns# *ns*)
- (send-to-emacs `(:new-package ~(str (ns-name *ns*)) ~(str (ns-name *ns*)))))))))
-
-(defmacro dothread-swank [& body]