Skip to content
Browse files

Update live packs based on previous development. See recent commits f…

…or history.
  • Loading branch information...
1 parent c6abfb2 commit fa718c2ba7f48fa249c1f151ab3890bdfcbad7cf @samaaron samaaron committed Mar 30, 2013
Showing with 2,831 additions and 6,099 deletions.
  1. +2 −1 packs/live/bindings-pack/config/default-bindings.el
  2. +33 −0 packs/live/clojure-pack/config/nrepl-conf.el
  3. +3 −0 packs/live/clojure-pack/init.el
  4. +16 −10 packs/live/clojure-pack/lib/clojure-mode/README.md
  5. +6 −4 packs/live/clojure-pack/lib/clojure-mode/clojure-mode.el
  6. +18 −13 packs/live/clojure-pack/lib/clojure-mode/clojure-test-mode.el
  7. +21 −2 packs/live/clojure-pack/lib/nrepl/CHANGELOG.md
  8. +49 −46 packs/live/clojure-pack/lib/nrepl/README.md
  9. +230 −85 packs/live/clojure-pack/lib/nrepl/nrepl.el
  10. +56 −1 packs/live/clojure-pack/lib/nrepl/test/nrepl-tests.el
  11. +4 −2 packs/live/clojure-pack/lib/popup-el/popup.el
  12. +104 −0 packs/live/clojure-pack/lib/uuid/uuid.el
  13. +10 −5 packs/live/colour-pack/lib/cyberpunk.el
  14. +26 −21 packs/live/colour-pack/lib/gandalf.el
  15. +5 −5 packs/live/foundation-pack/config/built-in.el
  16. +23 −3 packs/live/foundation-pack/config/cosmetic.el
  17. +7 −0 packs/live/foundation-pack/config/ido-conf.el
  18. +10 −9 packs/live/foundation-pack/config/popwin-conf.el
  19. +7 −0 packs/live/foundation-pack/config/util-fns.el
  20. +20 −17 packs/live/foundation-pack/lib/elisp-slime-nav/elisp-slime-nav.el
  21. +21 −0 packs/live/foundation-pack/lib/popwin/NEWS.md
  22. +2 −2 packs/live/foundation-pack/lib/popwin/popwin.el
  23. +17 −6 packs/live/git-pack/lib/magit/.travis.yml
  24. +5 −5 packs/live/git-pack/lib/magit/Makefile
  25. +143 −0 packs/live/git-pack/lib/magit/contrib/magit-inotify.el
  26. +22 −25 packs/live/git-pack/lib/magit/magit-blame.el
  27. +27 −28 packs/live/git-pack/lib/magit/magit-key-mode.el
  28. +3 −1 packs/live/git-pack/lib/magit/magit-pkg.el.in
  29. +1 −2 packs/live/git-pack/lib/magit/magit-stgit.el
  30. +30 −1 packs/live/git-pack/lib/magit/magit-svn.el
  31. +1 −2 packs/live/git-pack/lib/magit/magit-topgit.el
  32. +293 −166 packs/live/git-pack/lib/magit/magit.el
  33. +18 −4 packs/live/git-pack/lib/magit/rebase-mode.el
  34. +2 −3 packs/live/git-pack/lib/magit/tests/magit-tests.el
  35. +5 −0 packs/live/lang-pack/config/glsl-conf.el
  36. +1 −0 packs/live/lang-pack/init.el
  37. +56 −0 packs/live/lang-pack/lib/glsl-mode/README
  38. +298 −0 packs/live/lang-pack/lib/glsl-mode/glsl-mode.el
  39. +0 −1 packs/live/power-pack/config/git-gutter-conf.el
  40. +56 −0 packs/live/power-pack/lib/emacs-git-gutter/Changes
  41. +3 −1 packs/live/power-pack/lib/emacs-git-gutter/Makefile
  42. +85 −18 packs/live/power-pack/lib/emacs-git-gutter/README.md
  43. +234 −101 packs/live/power-pack/lib/emacs-git-gutter/git-gutter.el
  44. BIN packs/live/power-pack/lib/emacs-git-gutter/image/git-gutter-separator.png
  45. +67 −15 packs/live/power-pack/lib/emacs-git-gutter/test-git-gutter.el
  46. +4 −2 packs/live/power-pack/lib/expand-region/.travis.yml
  47. +8 −0 packs/live/power-pack/lib/expand-region/Carton
  48. +6 −5 packs/live/power-pack/lib/expand-region/README.md
  49. +0 −38 packs/live/power-pack/lib/expand-region/autotest.watchr
  50. +8 −0 packs/live/power-pack/lib/expand-region/cperl-mode-expansions.el
  51. +31 −0 packs/live/power-pack/lib/expand-region/features/cperl-mode-expansions.feature
  52. +206 −206 packs/live/power-pack/lib/expand-region/features/fgallina-python-el-expansions.feature
  53. +2 −2 packs/live/power-pack/lib/expand-region/features/ruby-mode-expansions.feature
  54. +1 −5 packs/live/power-pack/lib/expand-region/features/support/env.el
  55. +0 −2 packs/live/power-pack/lib/expand-region/features/text-mode-expansions.feature
  56. +3 −0 packs/live/power-pack/lib/expand-region/run-tests.sh
  57. +6 −13 packs/live/power-pack/lib/expand-region/run-travis-ci.sh
  58. +0 −2,544 packs/live/power-pack/lib/expand-region/util/ert.el
  59. +2 −2 packs/live/power-pack/lib/expand-region/watch-tests.watchr
  60. +4 −3 packs/live/power-pack/lib/gh/Makefile
  61. +24 −6 packs/live/power-pack/lib/gh/gh-api.el
  62. +19 −13 packs/live/power-pack/lib/gh/gh-auth.el
  63. +12 −2 packs/live/power-pack/lib/gh/gh-common.el
  64. +103 −0 packs/live/power-pack/lib/gh/gh-profile.el
  65. +1 −0 packs/live/power-pack/lib/gh/gh-url.el
  66. +129 −39 packs/live/power-pack/lib/gist/gist.el
  67. +1 −1 packs/live/power-pack/lib/multiple-cursors/README.md
  68. +137 −0 packs/live/power-pack/lib/multiple-cursors/features/mark-things.feature
  69. +8 −0 packs/live/power-pack/lib/multiple-cursors/features/step-definitions/multiple-cursors-steps.el
  70. +17 −5 packs/live/power-pack/lib/multiple-cursors/mc-mark-more.el
  71. +33 −27 packs/live/power-pack/lib/multiple-cursors/multiple-cursors-core.el
  72. +2 −1 packs/live/power-pack/lib/multiple-cursors/run-travis-ci.sh
  73. +0 −2,544 packs/live/power-pack/lib/multiple-cursors/util/ert.el
  74. 0 packs/live/power-pack/lib/scratch/{el-get.el → el-get-conf.el}
  75. +1 −1 packs/live/power-pack/lib/undo-tree/undo-tree.el
  76. +23 −33 packs/live/power-pack/lib/volatile-highlights/volatile-highlights.el
View
3 packs/live/bindings-pack/config/default-bindings.el
@@ -33,6 +33,7 @@
(global-set-key (kbd "C-c g p") 'git-gutter:previous-diff)
(global-set-key (kbd "C-c g n") 'git-gutter:next-diff)
(global-set-key (kbd "C-c g d") 'git-gutter:popup-diff)
+(global-set-key (kbd "C-c g r") 'git-gutter:revert-hunk)
;;text manipulation shortcuts
(global-set-key (kbd "C-c t b") 'untabify-buffer)
@@ -185,7 +186,7 @@
;; File
(global-set-key (kbd "C-x M-f") 'ido-find-file-other-window)
(global-set-key (kbd "C-x C-M-f") 'find-file-in-project)
-(global-set-key (kbd "C-x f") 'recentf-ido-find-file)
+(global-set-key (kbd "C-x f") 'live-recentf-ido-find-file)
(global-set-key (kbd "C-x C-r") 'ido-recentf-open)
(global-set-key (kbd "M-`") 'file-cache-minibuffer-complete)
(global-set-key (kbd "C-x C-b") 'ibuffer)
View
33 packs/live/clojure-pack/config/nrepl-conf.el
@@ -26,6 +26,7 @@
(kbd "}") 'paredit-close-curly)))
(setq nrepl-popup-stacktraces nil)
+(setq nrepl-popup-stacktraces-in-repl nil)
(add-to-list 'same-window-buffer-names "*nrepl*")
;;Auto Complete
@@ -45,6 +46,38 @@
;;; Monkey Patch nREPL with better behaviour:
+(defun live-nrepl-err-handler (buffer ex root-ex session)
+ "Make an error handler for BUFFER, EX, ROOT-EX and SESSION."
+ ;; TODO: use ex and root-ex as fallback values to display when pst/print-stack-trace-not-found
+ (let ((replp (equal 'nrepl-mode (buffer-local-value 'major-mode buffer))))
+ (if (or (and nrepl-popup-stacktraces-in-repl replp)
+ (and nrepl-popup-stacktraces (not replp)))
+ (lexical-let ((nrepl-popup-on-error nrepl-popup-on-error)
+ (err-buffer (nrepl-popup-buffer nrepl-error-buffer t)))
+ (with-current-buffer buffer
+ (nrepl-send-string "(if-let [pst+ (clojure.core/resolve 'clj-stacktrace.repl/pst+)]
+ (pst+ *e) (clojure.stacktrace/print-stack-trace *e))"
+ (nrepl-make-response-handler err-buffer
+ '()
+ (lambda (err-buffer str)
+ (with-current-buffer err-buffer (goto-char (point-max)))
+ (nrepl-emit-into-popup-buffer err-buffer str)
+ (with-current-buffer err-buffer (goto-char (point-min)))
+ )
+ (lambda (err-buffer str)
+ (with-current-buffer err-buffer (goto-char (point-max)))
+ (nrepl-emit-into-popup-buffer err-buffer str)
+ (with-current-buffer err-buffer (goto-char (point-min)))
+ )
+ '())
+ (nrepl-current-ns)
+ (nrepl-current-tooling-session)))
+ (with-current-buffer nrepl-error-buffer
+ (compilation-minor-mode 1))
+ ))))
+
+;;(setq nrepl-err-handler 'live-nrepl-err-handler)
+
;;; Region discovery fix
(defun nrepl-region-for-expression-at-point ()
"Return the start and end position of defun at point."
View
3 packs/live/clojure-pack/init.el
@@ -2,6 +2,9 @@
(require 'rainbow-delimiters)
+(live-add-pack-lib "uuid")
+(require 'uuid)
+
(live-load-config-file "paredit-conf.el")
(live-load-config-file "mic-paren-conf.el")
(live-load-config-file "highlight-flash-conf.el")
View
26 packs/live/clojure-pack/lib/clojure-mode/README.md
@@ -65,16 +65,22 @@ current buffer with <kbd>C-c C-,</kbd>. Failing tests and errors will be
highlighted using overlays. To clear the overlays, use <kbd>C-c k</kbd>.
You can jump between implementation and test files with <kbd>C-c C-t</kbd> if
-your project is laid out in a way that clojure-test-mode expects. Your
-project root should have a `src/` directory containing files that
-correspond to their namespace. It should also have a `test/` directory
-containing files that correspond to their namespace, and the test
-namespaces should mirror the implementation namespaces with the
-addition of "-test" as the suffix to the last segment of the namespace.
-
-So `my.project.frob` would be found in `src/my/project/frob.clj` and
-its tests would be in `test/my/project/frob_test.clj` in the
-`my.project.frob-test` namespace.
+your project is laid out in a way that clojure-test-mode expects. Your project
+root should have a `src/` directory containing files that correspond to their
+namespace. It should also have a `test/` directory containing files that
+correspond to their namespace, and the test namespaces should mirror the
+implementation namespaces with the addition of "-test" as the suffix to the last
+segment of the namespace.
+
+So `my.project.frob` would be found in `src/my/project/frob.clj` and its tests
+would be in `test/my/project/frob_test.clj` in the `my.project.frob-test`
+namespace.
+
+This behavior can also be overridden by setting `clojure-test-for-fn` and
+`clojure-test-implementation-for-fn` with functions of your choosing.
+`clojure-test-for-fn` takes an implementation namespace and returns the full
+path of the test file. `clojure-test-implementation-for-fn` takes a test
+namespace and returns the full path for the implementation file.
## Paredit
View
10 packs/live/clojure-pack/lib/clojure-mode/clojure-mode.el
@@ -6,7 +6,7 @@
;; Lennart Staflin <lenst@lysator.liu.se>
;; Phil Hagelberg <technomancy@gmail.com>
;; URL: http://github.com/technomancy/clojure-mode
-;; Version: 2.0.0
+;; Version: 2.1.0
;; Keywords: languages, lisp
;; This file is not part of GNU Emacs.
@@ -189,7 +189,7 @@
"load-file" "load-reader" "load-string" "loaded-libs" "locking"
"long" "long-array" "longs" "loop" "macroexpand"
"macroexpand-1" "make-array" "make-hierarchy" "map" "map?"
- "mapcat" "max" "max-key" "memfn" "memoize"
+ "map-indexed" "mapcat" "max" "max-key" "memfn" "memoize"
"merge" "merge-with" "meta" "method-sig" "methods"
"min" "min-key" "mod" "name" "namespace"
"neg?" "newline" "next" "nfirst" "nil?"
@@ -388,7 +388,7 @@ numbers count from the end:
leiningen.compile -> leiningen.test.compile (uses 1)
clojure.http.client -> clojure.http.test.client (uses -1)")
-(defvar clojure-mode-version "2.0.0"
+(defvar clojure-mode-version "2.1.0"
"The current version of `clojure-mode'.")
(defun clojure-mode-display-version ()
@@ -913,7 +913,7 @@ This function also returns nil meaning don't specify the indentation."
((or (eq method 'defun)
(and (null method)
(> (length function) 3)
- (string-match "\\`\\(?:\\S +/\\)?def\\|with-"
+ (string-match "\\`\\(?:\\S +/\\)?\\(def\\|with-\\)"
function)))
(lisp-indent-defform state indent-point))
@@ -1279,6 +1279,8 @@ Clojure test file for the given namespace.")
(put 'clojure-mode-load-command 'safe-local-variable 'stringp)
(add-to-list 'auto-mode-alist '("\\.clj\\'" . clojure-mode))
+ (add-to-list 'auto-mode-alist '("\\.dtm\\'" . clojure-mode))
+ (add-to-list 'auto-mode-alist '("\\.edn\\'" . clojure-mode))
(add-to-list 'interpreter-mode-alist '("jark" . clojure-mode))
(add-to-list 'interpreter-mode-alist '("cake" . clojure-mode)))
View
31 packs/live/clojure-pack/lib/clojure-mode/clojure-test-mode.el
@@ -4,7 +4,7 @@
;; Author: Phil Hagelberg <technomancy@gmail.com>
;; URL: http://emacswiki.org/cgi-bin/wiki/ClojureTestMode
-;; Version: 2.0.0
+;; Version: 2.1.0
;; Keywords: languages, lisp, test
;; Package-Requires: ((clojure-mode "1.7") (nrepl "0.1.7"))
@@ -22,18 +22,23 @@
;; current buffer with C-c C-,. Failing tests and errors will be
;; highlighted using overlays. To clear the overlays, use C-c k.
-;; You can jump between implementation and test files with C-c t if
-;; your project is laid out in a way that clojure-test-mode
-;; expects. Your project root should have a src/ directory containing
-;; files that correspond to their namespace. It should also have a
-;; test/ directory containing files that correspond to their
-;; namespace, and the test namespaces should mirror the implementation
-;; namespaces with the addition of "test" as the second-to-last
-;; segment of the namespace.
-
-;; So my.project.frob would be found in src/my/project/frob.clj and
-;; its tests would be in test/my/project/test/frob.clj in the
-;; my.project.test.frob namespace.
+;; You can jump between implementation and test files with <kbd>C-c C-t</kbd> if
+;; your project is laid out in a way that clojure-test-mode expects. Your
+;; project root should have a `src/` directory containing files that correspond
+;; to their namespace. It should also have a `test/` directory containing files
+;; that correspond to their namespace, and the test namespaces should mirror the
+;; implementation namespaces with the addition of "-test" as the suffix to the
+;; last segment of the namespace.
+
+;; So `my.project.frob` would be found in `src/my/project/frob.clj` and its
+;; tests would be in `test/my/project/frob_test.clj` in the
+;; `my.project.frob-test` namespace.
+
+;; This behavior can also be overridden by setting `clojure-test-for-fn` and
+;; `clojure-test-implementation-for-fn` with functions of your choosing.
+;; `clojure-test-for-fn` takes an implementation namespace and returns the full
+;; path of the test file. `clojure-test-implementation-for-fn` takes a test
+;; namespace and returns the full path for the implementation file.
;;; History:
View
23 packs/live/clojure-pack/lib/nrepl/CHANGELOG.md
@@ -1,10 +1,16 @@
# Changelog
-## 0.1.7 (current)
+## 0.1.8 (current)
### New features
-* Add support for multiple nrepl session. A single session is closed with
+### Bugs fixed
+
+## 0.1.7 / 2013-03-13
+
+### New features
+
+* Add support for multiple nrepl sessions. A single session is closed with
`M-x nrepl-close`. A repl session is made default with
`M-x nrepl-make-repl-connection-default`.
* Added support for pretty-printing in the REPL buffer.
@@ -18,10 +24,23 @@ bound to <kbd>C-c M-c</kbd>.
* Added `nrepl-hide-special-buffers` setting to control the display of special
buffers like `*nrepl-server*` and `*nrepl-connection*`.
* Apply ANSI color codes to output sent to nrepl buffers.
+* Add a connection browser `nrepl-connection-browser` to allow control of
+ multiple connections.
+* Add macroexpand key bindings to `nrepl-mode-map`.
+* Don't suppress namespaces in macroexpansion.
+* Add explicit require of expected namespaces in the repl buffer.
+* Add command `nrepl-pprint-eval-last-expression`.
+* Add an event buffer for debugging.
+* Allow connections without repl buffers.
+* Add hook `nrepl-file-loaded-hook` which runs on load-file
+ completion.
+* Expand ido-completion to include "used" variables in addition to
+ "interned" variables.
### Bugs fixed
* More accurate matching of filenames in stacktraces.
+* Fix #290 - Macroexpand buffer truncates long expansions
## 0.1.6 / 2013-01-29
View
95 packs/live/clojure-pack/lib/nrepl/README.md
@@ -231,7 +231,7 @@ and it expects `clojure.pprint` to have been required already
<kbd>M-x nrepl-toggle-pretty-printing</kbd>
-## Keys
+## Keyboard shortcuts
* <kbd>M-x nrepl-jack-in</kbd>: Launch an nrepl server and a repl client.
Prompts for a project root if given a prefix argument.
@@ -243,63 +243,66 @@ M-c</kbd>.
### Clojure buffer commands:
-* <kbd>C-x C-e</kbd>: Evaluate the form preceding point and display the result in the echo area. If invoked with a prefix argument, insert the result into the current buffer.
-* <kbd>C-c C-p</kbd>: Evaluate the form preceding point and display the result in a popup buffer.
-* <kbd>C-M-x</kbd>: Evaluate the top level form under point and display the result in the echo area. If invoked with a prefix argument, insert the result into the current buffer. Also bound to <kbd>C-c C-c</kbd>.
-* <kbd>C-c C-r</kbd>: Evaluate the region and display the result in the echo area.
-* <kbd>C-c C-b</kbd>: Interrupt any pending evaluations.
-* <kbd>C-c C-m</kbd>: Invoke macroexpand-1 on the form at point and display the result in a macroexpansion buffer. If invoked with a prefix argument, macroexpand is used instead of macroexpand-1.
-* <kbd>C-c M-m</kbd>: Invoke clojure.walk/macroexpand-all on the form at point and display the result in a macroexpansion buffer.
-* <kbd>C-c C-n</kbd>: Eval the ns form.
-* <kbd>C-c M-n</kbd>: Switch the namespace of the repl buffer to the namespace of the current buffer.
-* <kbd>C-c C-z</kbd>: Select the repl buffer. With a prefix argument - changes the namespace of the REPL buffer to the one of the currently visited source file.
-* <kbd>C-c M-o</kbd>: Clear the entire REPL buffer, leaving only a prompt. Useful if you're running the REPL buffer in a side by side buffer.
-* <kbd>C-c C-k</kbd>: Load the current buffer.
-* <kbd>C-c C-l</kbd>: Load a file.
-* <kbd>C-c C-d</kbd>: Display doc string for the symbol at point. If invoked with a prefix argument, or no symbol is found at point, prompt for a symbol
-* <kbd>C-c C-s</kbd>: Display the source for the symbol at point. If invoked with a prefix argument, or no symbol is found at point, prompt for a symbol
-* <kbd>C-c C-j</kbd>: Display JavaDoc (in your default browser) for the symbol at point. If invoked with a prefix argument, or no symbol is found at point, prompt for a symbol
-* <kbd>M-.</kbd>: Jump to the definition of a symbol. If invoked with a prefix argument, or no symbol is found at point, prompt for a symbol.
-* <kbd>M-,</kbd>: Return to your pre-jump location.
-* <kbd>M-TAB</kbd>: Complete the symbol at point. (For `auto-complete` integration, see [`ac-nrepl`](https://github.com/purcell/ac-nrepl))
+
+Keyboard shortcut | Description
+-------------------------------------|-------------------------------
+<kbd>C-x C-e</kbd> | Evaluate the form preceding point and display the result in the echo area. If invoked with a prefix argument, insert the result into the current buffer.
+<kbd>C-c C-p</kbd> | Evaluate the form preceding point and display the result in a popup buffer.
+<kbd>C-M-x</kbd> <kbd>C-c C-c</kbd> | Evaluate the top level form under point and display the result in the echo area. If invoked with a prefix argument, insert the result into the current buffer.
+<kbd>C-c C-r</kbd> | Evaluate the region and display the result in the echo area.
+<kbd>C-c C-b</kbd> | Interrupt any pending evaluations.
+<kbd>C-c C-m</kbd> | Invoke `macroexpand-1` on the form at point and display the result in a macroexpansion buffer. If invoked with a prefix argument, `macroexpand` is used instead of `macroexpand-1`.
+<kbd>C-c M-m</kbd> | Invoke `clojure.walk/macroexpand-all` on the form at point and display the result in a macroexpansion buffer.
+<kbd>C-c C-n</kbd> | Eval the ns form.
+<kbd>C-c M-n</kbd> | Switch the namespace of the repl buffer to the namespace of the current buffer.
+<kbd>C-c C-z</kbd> | Select the REPL buffer. With a prefix argument - changes the namespace of the REPL buffer to the one of the currently visited source file.
+<kbd>C-c M-o</kbd> | Clear the entire REPL buffer, leaving only a prompt. Useful if you're running the REPL buffer in a side by side buffer.
+<kbd>C-c C-k</kbd> | Load the current buffer.
+<kbd>C-c C-l</kbd> | Load a file.
+<kbd>C-c C-d</kbd> | Display doc string for the symbol at point. If invoked with a prefix argument, or no symbol is found at point, prompt for a symbol.
+<kbd>C-c C-s</kbd> | Display the source for the symbol at point. If invoked with a prefix argument, or no symbol is found at point, prompt for a symbol.
+<kbd>C-c C-j</kbd> | Display JavaDoc (in your default browser) for the symbol at point. If invoked with a prefix argument, or no symbol is found at point, prompt for a symbol.
+<kbd>M-.</kbd> | Jump to the definition of a symbol. If invoked with a prefix argument, or no symbol is found at point, prompt for a symbol.
+<kbd>M-,</kbd> | Return to your pre-jump location.
+<kbd>M-TAB</kbd> | Complete the symbol at point. (For `auto-complete` integration, see [`ac-nrepl`](https://github.com/purcell/ac-nrepl))
### REPL buffer commands:
-* <kbd>RET</kbd>: Evaluate the current input in Clojure if it is complete. If incomplete, open a new line and indent. If invoked with a prefix argument is given then the input is evaluated without checking for completeness.
-* <kbd>C-RET</kbd>: Close any unmatched parenthesis and then evaluate the current input in Clojure. Also bound to M-RET.
-* <kbd>C-j</kbd>: Open a new line and indent.
-* <kbd>C-c M-o</kbd>: Clear the entire REPL buffer, leaving only a prompt.
-* <kbd>C-c C-o</kbd>: Remove the output of the previous evaluation from the REPL buffer.
-* <kbd>C-c C-u</kbd>: Kill all text from the prompt to the current point.
-* <kbd>C-c C-b</kbd>: Interrupt any pending evaluations. Also bound to <kbd>C-c C-c</kbd>.
-* <kbd>C-up, C-down</kbd>: Goto to previous/next input in history.
-* <kbd>M-p, M-n</kbd>: Search the previous/next item in history using the current input
-as search pattern. If M-p/M-n is typed two times in a row, the second invocation
-uses the same search pattern (even if the current input has changed).
-* <kbd>M-s, M-r</kbd>: Search forward/reverse through command history with regex.
-* <kbd>C-c C-n, C-c C-p</kbd>: Move between the current and previous prompts in the REPL buffer. Pressing RET on a line with old input copies that line to the newest prompt.
-
-* <kbd>TAB</kbd>: Complete symbol at point.
-* <kbd>C-c C-d</kbd>: Display doc string for the symbol at point. If invoked with a prefix argument, or no symbol is found at point, prompt for a symbol
-* <kbd>C-c C-j</kbd>: Display JavaDoc (in your default browser) for the symbol at point. If invoked with a prefix argument, or no symbol is found at point, prompt for a symbol
+Keyboard shortcut | Description
+-------------------------------------|------------------------------
+<kbd>RET</kbd> | Evaluate the current input in Clojure if it is complete. If incomplete, open a new line and indent. If invoked with a prefix argument is given then the input is evaluated without checking for completeness.
+<kbd>C-RET</kbd> | Close any unmatched parenthesis and then evaluate the current input in Clojure.
+<kbd>C-j</kbd> | Open a new line and indent.
+<kbd>C-c M-o</kbd> | Clear the entire REPL buffer, leaving only a prompt.
+<kbd>C-c C-o</kbd> | Remove the output of the previous evaluation from the REPL buffer.
+<kbd>C-c C-u</kbd> | Kill all text from the prompt to the current point.
+<kbd>C-c C-b</kbd> <kbd>C-c C-c</kbd>| Interrupt any pending evaluations.
+<kbd>C-up</kbd> <kbd>C-down</kbd> | Goto to previous/next input in history.
+<kbd>M-p</kbd> <kbd>M-n</kbd> | Search the previous/next item in history using the current input as search pattern. If <kbd>M-p/M-n</kbd> is typed two times in a row, the second invocation uses the same search pattern (even if the current input has changed).
+<kbd>M-s</kbd> <kbd>M-r</kbd> | Search forward/reverse through command history with regex.
+<kbd>C-c C-n</kbd> <kbd>C-c C-p</kbd> | Move between the current and previous prompts in the REPL buffer. Pressing <kbd>RET</kbd> on a line with old input copies that line to the newest prompt.
+<kbd>TAB</kbd> | Complete symbol at point.
+<kbd>C-c C-d</kbd> | Display doc string for the symbol at point. If invoked with a prefix argument, or no symbol is found at point, prompt for a symbol
+<kbd>C-c C-j</kbd> | Display JavaDoc (in your default browser) for the symbol at point. If invoked with a prefix argument, or no symbol is found at point, prompt for a symbol.
### Macroexpansion buffer commands:
-* <kbd>C-c C-m</kbd>: Invoke macroexpand-1 on the form at point and replace the original form with its expansion. If invoked with a prefix argument, macroexpand is used instead of macroexpand-1.
-* <kbd>C-c M-m</kbd>: Invoke clojure.walk/macroexpand-all on the form at point and replace the original form with its expansion.
-* <kbd>g</kbd>: The prior macroexpansion is performed again and the current contents of the macroexpansion buffer are replaced with the new expansion.
-* <kbd>C-/</kbd>, <kbd>C-x u</kbd>: Undo the last inplace expansion performed in the macroexpansion buffer.
-
+Keyboard shortcut | Description
+--------------------------------|-------------------------------
+<kbd>C-c C-m</kbd> | Invoke `macroexpand-1` on the form at point and replace the original form with its expansion. If invoked with a prefix argument, `macroexpand` is used instead of `macroexpand-1`.
+<kbd>C-c M-m</kbd> | Invoke `clojure.walk/macroexpand-all` on the form at point and replace the original form with its expansion.
+<kbd>g</kbd> | The prior macroexpansion is performed again and the current contents of the macroexpansion buffer are replaced with the new expansion.
+<kbd>C-/</kbd> <kbd>C-x u</kbd> | Undo the last inplace expansion performed in the macroexpansion buffer.
### Managing multiple sessions
-You can connection to multiple nREPL servers and use `nrepl-jack-in` multiple
-times. To close a single nREPL session, use `M-x nrepl-close`. `M-x
-nrepl-quit` closes all sessions.
+You can connect to multiple nREPL servers and use <kbd>M-x nrepl-jack-in</kbd> multiple
+times. To close a single nREPL session, use <kbd>M-x nrepl-close</kbd>. <kbd>M-x
+nrepl-quit</kbd> closes all sessions.
nrepl.el commands in a clojure buffer use the default connection. To make a
connection default, switch to it's repl buffer and use
-`M-x nrepl-make-repl-connection-default`.
+<kbd>M-x nrepl-make-repl-connection-default</kbd>.
## Requirements:
View
315 packs/live/clojure-pack/lib/nrepl/nrepl.el
@@ -5,7 +5,7 @@
;; Author: Tim King <kingtim@gmail.com>
;; Phil Hagelberg <technomancy@gmail.com>
;; URL: http://www.github.com/kingtim/nrepl.el
-;; Version: 0.1.7
+;; Version: 0.1.8
;; Keywords: languages, clojure, nrepl
;; Package-Requires: ((clojure-mode "2.0.0"))
@@ -54,6 +54,7 @@
(require 'arc-mode)
(require 'ansi-color)
(require 'eldoc)
+(require 'ewoc)
(require 'cl)
(require 'easymenu)
(require 'compile)
@@ -66,13 +67,20 @@
:prefix "nrepl-"
:group 'applications)
-(defconst nrepl-current-version "0.1.7-preview"
+(defconst nrepl-current-version "0.1.8-preview"
"The current nREPL.el version.")
(defun nrepl-version ()
- "Reports the version of nREPL.el in use."
+ "Report the version of nREPL.el and Clojure in use."
(interactive)
- (message "Currently using nREPL version %s" nrepl-current-version))
+ (message "Currently using nREPL.el version %s with Clojure %s"
+ nrepl-current-version
+ (nrepl-clojure-version)))
+
+(defun nrepl-clojure-version ()
+ "Retrieve the underlying process's Clojure version."
+ (let ((version-string (plist-get (nrepl-send-string-sync "(clojure-version)") :value)))
+ (substring version-string 1 (1- (length version-string)))))
(defcustom nrepl-connected-hook nil
"List of functions to call when connecting to the nREPL server."
@@ -402,15 +410,15 @@ With a PREFIX argument, print the result in the current buffer."
"Return the sexp at point as a string, otherwise nil."
(let ((bounds (nrepl-bounds-of-sexp-at-point)))
(if bounds
- (buffer-substring-no-properties (car bounds)
- (cdr bounds)))))
+ (buffer-substring-no-properties (first bounds)
+ (rest bounds)))))
(defun nrepl-sexp-at-point-with-bounds ()
"Return a list containing the sexp at point and its bounds."
(let ((bounds (nrepl-bounds-of-sexp-at-point)))
(if bounds
- (let ((start (car bounds))
- (end (cdr bounds)))
+ (let ((start (first bounds))
+ (end (rest bounds)))
(list (buffer-substring-no-properties start end)
(cons (set-marker (make-marker) start)
(set-marker (make-marker) end)))))))
@@ -467,7 +475,7 @@ Removes any leading slash if on Windows. Uses `find-file'."
(with-current-buffer buffer
(ring-insert find-tag-marker-ring (point-marker)))
(nrepl-jump-to-def-for
- (car (read-from-string value))))
+ (first (read-from-string value))))
(lambda (buffer out) (message out))
(lambda (buffer err) (message err))
nil))
@@ -530,7 +538,7 @@ Removes any leading slash if on Windows. Uses `find-file'."
(nrepl-current-tooling-session))
:value)))
(when strlst
- (car (read-from-string strlst)))))
+ (first (read-from-string strlst)))))
(defun nrepl-completion-complete-op-fn (str)
"Return a list of completions for STR using the nREPL \"complete\" op."
@@ -542,7 +550,7 @@ Removes any leading slash if on Windows. Uses `find-file'."
"symbol" str))
:value)))
(when strlst
- (car strlst))))
+ (first strlst))))
(defun nrepl-dispatch-complete-symbol (str)
"Return a list of completions for STR.
@@ -557,7 +565,7 @@ otherwise dispatch to internal completion function."
(let ((sap (symbol-at-point)))
(when (and sap (not (in-string-p)))
(let ((bounds (bounds-of-thing-at-point 'symbol)))
- (list (car bounds) (cdr bounds)
+ (list (first bounds) (rest bounds)
(completion-table-dynamic #'nrepl-dispatch-complete-symbol))))))
(defun nrepl-eldoc-format-thing (thing)
@@ -625,8 +633,8 @@ highlighing all arguments matching THE-POS."
(defun nrepl-eldoc ()
"Backend function for eldoc to show argument list in the echo area."
(let* ((info (nrepl-eldoc-info-in-current-sexp))
- (thing (car info))
- (pos (cadr info))
+ (thing (first info))
+ (pos (second info))
(form (format "(try
(:arglists
(clojure.core/meta
@@ -683,7 +691,7 @@ highlighing all arguments matching THE-POS."
"Destructure an nREPL RESPONSE dict.
Bind the value of the provided KEYS and execute BODY."
`(let ,(loop for key in keys
- collect `(,key (cdr (assoc ,(format "%s" key) ,response))))
+ collect `(,key (rest (assoc ,(format "%s" key) ,response))))
,@body))
(put 'nrepl-dbind-response 'lisp-indent-function 2)
@@ -761,7 +769,9 @@ DONE-HANDLER, and EVAL-ERROR-HANDLER as appropriate."
(lambda (buffer value)
(nrepl-emit-interactive-output value))
(lambda (buffer err)
- (message "%s" err))
+ (message "%s" err)
+ (nrepl-highlight-compilation-error-line
+ buffer err))
'()))
(defun nrepl-load-file-handler (buffer)
@@ -868,10 +878,18 @@ They exist for compatibility with `next-error'."
(defun nrepl-highlight-compilation-error-line (buffer message)
"Highlight compilation error line in BUFFER, using MESSAGE."
(with-current-buffer buffer
- (let ((error-line-number (nrepl-extract-error-line message)))
- (when (> error-line-number 0)
+ (let ((error-line-number (nrepl-extract-error-line message))
+ (error-filename (nrepl-extract-error-filename message)))
+ (when (and (> error-line-number 0)
+ (or (string= (buffer-file-name buffer) error-filename)
+ (string= "NO_SOURCE_PATH" error-filename)))
(save-excursion
- (goto-char (point-min))
+ ;; when we don't have a filename the line number
+ ;; is relative to form start
+ (if (string= error-filename "NO_SOURCE_PATH")
+ (beginning-of-defun)
+ ;; else we go to the top of the file
+ (goto-char (point-min)))
(forward-line (1- error-line-number))
(let ((overlay (make-overlay (progn (back-to-indentation) (point))
(progn (move-end-of-line nil) (point)))))
@@ -882,9 +900,14 @@ They exist for compatibility with `next-error'."
(defun nrepl-extract-error-line (stacktrace)
"Extract the error line number from STACKTRACE."
- (string-match "\\.clj:\\([0-9]+\\)" stacktrace)
+ (string-match "compiling:(.+:\\([0-9]+\\)" stacktrace)
(string-to-number (match-string 1 stacktrace)))
+(defun nrepl-extract-error-filename (stacktrace)
+ "Extract the error filename from STACKTRACE."
+ (string-match "compiling:(\\(.+\\):" stacktrace)
+ (substring-no-properties (match-string 1 stacktrace)))
+
(defun nrepl-stacktrace ()
"Retrieve the current stracktrace from the `nrepl-error-buffer'."
(sleep-for 0.3) ; ugly hack to account for a race condition
@@ -980,29 +1003,6 @@ ARG is passed along to `undo-only'."
"Specify the last macroexpansion preformed.
This variable specifies both what was expanded and the expander.")
-(defun nrepl-macroexpand-handler (buffer ns)
- "Make a response handler for macroexpansion from BUFFER in namespace NS."
- (lexical-let* ((ns ns))
- (nrepl-make-response-handler buffer nil
- (lambda (buffer str)
- (nrepl-initialize-macroexpansion-buffer
- str ns))
- nil nil)))
-
-(defun nrepl-macroexpand-inplace-handler
- (expansion-buffer start end current-point)
- "Make a response handler for inplace macroexpansion from EXPANSION-BUFFER.
-START, END and CURRENT-POINT are used to redraw the expansion."
- (lexical-let* ((start start)
- (end end)
- (current-point current-point))
- (nrepl-make-response-handler expansion-buffer
- nil
- (lambda (buffer str)
- (nrepl-redraw-macroexpansion-buffer
- str buffer start end current-point))
- nil nil)))
-
(defun nrepl-macroexpand-form (expander expr)
"Macroexpand, using EXPANDER, the given EXPR."
(format
@@ -1011,30 +1011,28 @@ START, END and CURRENT-POINT are used to redraw the expansion."
(defun nrepl-macroexpand-expr (expander expr &optional buffer)
"Macroexpand, use EXPANDER, the given EXPR from BUFFER."
- (let ((form (nrepl-macroexpand-form expander expr)))
+ (let* ((form (nrepl-macroexpand-form expander expr))
+ (expansion (plist-get (nrepl-send-string-sync form nrepl-buffer-ns) :stdout)))
(setq nrepl-last-macroexpand-expression form)
- (nrepl-send-string form (nrepl-macroexpand-handler buffer nrepl-buffer-ns)
- nrepl-buffer-ns)))
+ (nrepl-initialize-macroexpansion-buffer expansion nrepl-buffer-ns)))
(defun nrepl-macroexpand-expr-inplace (expander)
"Substitutes the current form at point with its macroexpansion using EXPANDER."
(interactive)
(let ((form-with-bounds (nrepl-sexp-at-point-with-bounds)))
(if form-with-bounds
(destructuring-bind (expr bounds) form-with-bounds
- (nrepl-send-string (nrepl-macroexpand-form expander expr)
- (nrepl-macroexpand-inplace-handler
- (current-buffer)
- (car bounds) (cdr bounds) (point))
- nrepl-buffer-ns)))))
+ (let* ((form (nrepl-macroexpand-form expander expr))
+ (expansion (plist-get (nrepl-send-string-sync form nrepl-buffer-ns) :stdout)))
+ (nrepl-redraw-macroexpansion-buffer
+ expansion (current-buffer) (first bounds) (rest bounds) (point)))))))
(defun nrepl-macroexpand-again ()
"Repeat the last macroexpansion."
(interactive)
- (nrepl-send-string
- nrepl-last-macroexpand-expression
- (nrepl-macroexpand-handler (current-buffer) nrepl-buffer-ns)
- nrepl-buffer-ns))
+ (let ((expansion
+ (plist-get (nrepl-send-string-sync nrepl-last-macroexpand-expression nrepl-buffer-ns) :stdout)))
+ (nrepl-initialize-macroexpansion-buffer expansion nrepl-buffer-ns)))
(defun nrepl-macroexpand-1 (&optional prefix)
"Invoke 'macroexpand-1' on the expression at point.
@@ -1094,21 +1092,22 @@ and point is placed at CURRENT-POINT."
(let ((buffer (current-buffer)))
(nrepl-send-string form
(nrepl-popup-eval-print-handler buffer)
- nrepl-buffer-ns)))
+ (nrepl-current-ns))))
(defun nrepl-interactive-eval-print (form)
"Evaluate the given FORM and print value in current buffer."
(let ((buffer (current-buffer)))
(nrepl-send-string form
(nrepl-interactive-eval-print-handler buffer)
- nrepl-buffer-ns)))
+ (nrepl-current-ns))))
(defun nrepl-interactive-eval (form)
"Evaluate the given FORM and print value in minibuffer."
+ (remove-overlays (point-min) (point-max) 'nrepl-note-p t)
(let ((buffer (current-buffer)))
(nrepl-send-string form
(nrepl-interactive-eval-handler buffer)
- nrepl-buffer-ns)))
+ (nrepl-current-ns))))
(defun nrepl-send-op (op attributes handler)
"Send the specified OP with ATTRIBUTES and response HANDLER."
@@ -1153,7 +1152,7 @@ Print its value into the current buffer"
(result-buffer (nrepl-popup-buffer nrepl-result-buffer nil)))
(nrepl-send-string (format "(clojure.pprint/pprint %s)" form)
(nrepl-popup-eval-out-handler result-buffer)
- nrepl-buffer-ns
+ (nrepl-current-ns)
(nrepl-current-tooling-session))))
;;;;; History
@@ -1177,7 +1176,7 @@ Print its value into the current buffer"
"Add STRING to the input history.
Empty strings and duplicates are ignored."
(unless (or (equal string "")
- (equal string (car nrepl-input-history)))
+ (equal string (first nrepl-input-history)))
(push string nrepl-input-history)
(incf nrepl-input-history-items-added)))
@@ -1443,24 +1442,32 @@ This will not work on non-current prompts."
'("nREPL"
["Jump" nrepl-jump]
["Jump back" nrepl-jump-back]
+ "--"
["Complete symbol" complete-symbol]
+ "--"
["Eval expression at point" nrepl-eval-expression-at-point]
["Eval last expression" nrepl-eval-last-expression]
["Eval last expression in popup buffer" nrepl-pprint-eval-last-expression]
["Eval region" nrepl-eval-region]
["Eval ns form" nrepl-eval-ns-form]
+ "--"
+ ["Load current buffer" nrepl-load-current-buffer]
+ ["Load file" nrepl-load-file]
+ "--"
["Macroexpand-1 last expression" nrepl-macroexpand-1]
["Macroexpand-all last expression" nrepl-macroexpand-all]
- ["Set ns" nrepl-set-ns]
+ "--"
["Display documentation" nrepl-doc]
["Display Source" nrepl-src]
["Display JavaDoc" nrepl-javadoc]
+ "--"
+ ["Set ns" nrepl-set-ns]
["Switch to REPL" nrepl-switch-to-repl-buffer]
["Toggle REPL Pretty Print" nrepl-pretty-toggle]
["Clear REPL" nrepl-find-and-clear-repl-buffer]
- ["Load current buffer" nrepl-load-current-buffer]
- ["Load file" nrepl-load-file]
- ["Interrupt" nrepl-interrupt]))
+ ["Interrupt" nrepl-interrupt]
+ "--"
+ ["Version info" nrepl-version]))
(defvar nrepl-macroexpansion-minor-mode-map
(let ((map (make-sparse-keymap)))
@@ -1534,15 +1541,20 @@ This will not work on non-current prompts."
'("nREPL"
["Jump" nrepl-jump]
["Jump back" nrepl-jump-back]
+ "--"
["Complete symbol" complete-symbol]
+ "--"
["Display documentation" nrepl-doc]
["Display source" nrepl-src]
["Display JavaDoc" nrepl-javadoc]
+ "--"
["Toggle pretty printing of results" nrepl-toggle-pretty-printing]
["Clear output" nrepl-clear-output]
["Clear buffer" nrepl-clear-buffer]
["Kill input" nrepl-kill-input]
- ["Interrupt" nrepl-interrupt]))
+ ["Interrupt" nrepl-interrupt]
+ "--"
+ ["Version info" nrepl-version]))
(defun clojure-enable-nrepl ()
"Turn on nrepl interaction mode (see command `nrepl-interaction-mode').
@@ -1940,7 +1952,8 @@ Moves CONNECITON-BUFFER to the front of `nrepl-connection-list'."
;; maintain the connection list in most recently used order
(lexical-let ((buf-name (buffer-name (get-buffer connection-buffer))))
(setq nrepl-connection-list
- (cons buf-name (delq buf-name nrepl-connection-list))))
+ (cons buf-name (delq buf-name nrepl-connection-list)))
+ (nrepl--connections-refresh))
(message "Not in an nREPL REPL buffer.")))
(defun nrepl--close-connection-buffer (connection-buffer)
@@ -1963,6 +1976,133 @@ Also closes associated repl and server buffers."
(buffer-local-value 'nrepl-repl-buffer
(get-buffer (nrepl-current-connection-buffer)))))
+;;; Connection browser
+(define-derived-mode nrepl-connections-buffer-mode nrepl-popup-buffer-mode
+ "nREPL-Connections"
+ "nREPL Connections Buffer Mode.
+\\{nrepl-connections-buffer-mode-map}
+\\{nrepl-popup-buffer-mode-map}"
+ (set (make-local-variable 'truncate-lines) t))
+
+(defvar nrepl-connections-buffer-mode-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map "d" 'nrepl-connections-make-default)
+ (define-key map "g" 'nrepl-connection-browser)
+ (define-key map (kbd "C-k") 'nrepl-connections-close-connection)
+ (define-key map (kbd "RET") 'nrepl-connections-goto-connection)
+ map))
+
+(defvar nrepl--connection-ewoc)
+(defconst nrepl--connection-browser-buffer-name "*nrepl-connections*")
+
+(defun nrepl-connection-browser ()
+ "Open a browser buffer for nREPL connections."
+ (interactive)
+ (lexical-let ((buffer (get-buffer nrepl--connection-browser-buffer-name)))
+ (if buffer
+ (progn
+ (nrepl--connections-refresh-buffer buffer)
+ (unless (get-buffer-window buffer)
+ (select-window (display-buffer buffer))))
+ (nrepl--setup-connection-browser))))
+
+(defun nrepl--connections-refresh ()
+ "Refresh the connections buffer, if the buffer exists.
+The connections buffer is determined by
+`nrepl--connection-browser-buffer-name'"
+ (lexical-let ((buffer (get-buffer nrepl--connection-browser-buffer-name)))
+ (when buffer
+ (nrepl--connections-refresh-buffer buffer))))
+
+(defun nrepl--connections-refresh-buffer (buffer)
+ "Refresh the connections BUFFER."
+ (nrepl--update-connections-display
+ (buffer-local-value 'nrepl--connection-ewoc buffer)
+ nrepl-connection-list))
+
+(defun nrepl--setup-connection-browser ()
+ "Create a browser buffer for nREPL connections."
+ (with-current-buffer (get-buffer-create nrepl--connection-browser-buffer-name)
+ (lexical-let ((ewoc (ewoc-create
+ 'nrepl--connection-pp
+ " Host Port Project\n")))
+ (set (make-local-variable 'nrepl--connection-ewoc) ewoc)
+ (nrepl--update-connections-display ewoc nrepl-connection-list)
+ (setq buffer-read-only t)
+ (nrepl-connections-buffer-mode)
+ (display-buffer (current-buffer)))))
+
+(defun nrepl--connection-pp (connection)
+ "Print an nREPL CONNECTION to the current buffer."
+ (lexical-let* ((buffer-read-only nil)
+ (buffer (get-buffer connection))
+ (endpoint (buffer-local-value 'nrepl-endpoint buffer)))
+ (insert
+ (format "%s %-16s %5s %s"
+ (if (equal connection (first nrepl-connection-list)) "*" " ")
+ (first endpoint)
+ (prin1-to-string (second endpoint))
+ (or (nrepl--project-name
+ (buffer-local-value 'nrepl-project-dir buffer))
+ "")))))
+
+(defun nrepl--project-name (path)
+ "Extracts a project name from PATH, possibly nil.
+The project name is the final component of PATH if not nil."
+ (when path
+ (file-name-nondirectory (directory-file-name path))))
+
+(defun nrepl--update-connections-display (ewoc connections)
+ "Update the connections EWOC to show CONNECTIONS."
+ (ewoc-filter ewoc (lambda (n) (member n connections)))
+ (let ((existing))
+ (ewoc-map (lambda (n) (setq existing (cons n existing))) ewoc)
+ (lexical-let ((added (set-difference connections existing)))
+ (mapc (apply-partially 'ewoc-enter-last ewoc) added)
+ (save-excursion (ewoc-refresh ewoc)))))
+
+(defun nrepl--ewoc-apply-at-point (f)
+ "Apply function F to the ewoc node at point.
+F is a function of two arguments, the ewoc and the data at point."
+ (lexical-let* ((ewoc nrepl--connection-ewoc)
+ (node (and ewoc (ewoc-locate ewoc))))
+ (when node
+ (funcall f ewoc (ewoc-data node)))))
+
+(defun nrepl-connections-make-default ()
+ "Make default the connection at point in the connection browser."
+ (interactive)
+ (save-excursion
+ (nrepl--ewoc-apply-at-point #'nrepl--connections-make-default)))
+
+(defun nrepl--connections-make-default (ewoc data)
+ "Make the connection in EWOC specified by DATA default.
+Refreshes EWOC."
+ (interactive)
+ (nrepl-make-repl-connection-default data)
+ (ewoc-refresh ewoc))
+
+(defun nrepl-connections-close-connection ()
+ "Close connection at point in the connection browser."
+ (interactive)
+ (nrepl--ewoc-apply-at-point #'nrepl--connections-close-connection))
+
+(defun nrepl--connections-close-connection (ewoc data)
+ "Close the connection in EWOC specified by DATA."
+ (nrepl-close (get-buffer data))
+ (nrepl--update-connections-display ewoc nrepl-connection-list))
+
+(defun nrepl-connections-goto-connection ()
+ "Goto connection at point in the connection browser."
+ (interactive)
+ (nrepl--ewoc-apply-at-point #'nrepl--connections-goto-connection))
+
+(defun nrepl--connections-goto-connection (ewoc data)
+ "Goto the repl for the connection in EWOC specified by DATA."
+ (let ((buffer (buffer-local-value 'nrepl-nrepl-buffer (get-buffer data))))
+ (when buffer
+ (select-window (display-buffer buffer)))))
+
;;; server messages
(defun nrepl-current-session ()
@@ -2024,7 +2164,10 @@ Use SESSION if it is non-nil, otherwise use the current session."
(defun nrepl-send-string (input callback &optional ns session)
"Send the request INPUT and register the CALLBACK as the response handler.
See command `nrepl-eval-request' for details on how NS and SESSION are processed."
- (nrepl-send-request (nrepl-eval-request input ns session) callback))
+ (let ((ns (if (string-match "[[:space:]]*\(ns\\([[:space:]]*$\\|[[:space:]]+\\)" input)
+ "user"
+ ns)))
+ (nrepl-send-request (nrepl-eval-request input ns session) callback)))
(defun nrepl-sync-request-handler (buffer)
"Make a synchronous request handler for BUFFER."
@@ -2401,7 +2544,7 @@ of the current source file."
;; TODO: immediate RET gives "" as selected for some reason
;; this is an OK workaround though
(cond ((equal "" selected)
- (nrepl-ido-select (car targets) targets callback))
+ (nrepl-ido-select (first targets) targets callback))
((equal "/" (substring selected -1)) ; selected a namespace
(nrepl-ido-read-var (substring selected 0 -1) callback))
((equal ".." selected)
@@ -2416,7 +2559,7 @@ of the current source file."
(lambda (buffer value)
;; make sure to eval the callback in the buffer that the symbol was requested from so we get the right namespace
(with-current-buffer buffer
- (let* ((targets (car (read-from-string value)))
+ (let* ((targets (first (read-from-string value)))
(selected (ido-completing-read "Var: " targets nil t)))
(nrepl-ido-select selected targets ido-callback))))
nil nil nil)))
@@ -2679,7 +2822,6 @@ If so ask the user for confirmation."
(defun nrepl--close-buffer (buffer)
"Close the nrepl BUFFER."
- (message "Close buffer %s" buffer)
(when (get-buffer-process buffer)
(delete-process (get-buffer-process buffer)))
(when (get-buffer buffer)
@@ -2699,7 +2841,8 @@ If so ask the user for confirmation."
"Close the nrepl connection for CONNECTION-BUFFER."
(interactive (list (nrepl-current-connection-buffer)))
(nrepl--close-connection-buffer connection-buffer)
- (nrepl-possibly-disable-on-existing-clojure-buffers))
+ (nrepl-possibly-disable-on-existing-clojure-buffers)
+ (nrepl--connections-refresh))
(defun nrepl-quit ()
"Quit the nrepl server."
@@ -2772,28 +2915,31 @@ restart the server."
(remhash id nrepl-requests)
(nrepl-setup-default-namespaces process))))))))
+(defun nrepl-make-repl (process)
+ "Make a repl for the connection PROCESS."
+ (lexical-let ((connection-buffer (process-buffer process))
+ (nrepl-buffer (nrepl-create-repl-buffer process)))
+ (with-current-buffer nrepl-buffer
+ (setq nrepl-connection-buffer (buffer-name connection-buffer)))
+ (with-current-buffer connection-buffer
+ (setq nrepl-repl-buffer (buffer-name nrepl-buffer)))))
+
(defun nrepl-new-session-handler (process no-repl-p)
"Create a new session handler for PROCESS.
When NO-REPL-P is truthy, suppress creation of a repl buffer."
(lexical-let ((process process)
(no-repl-p no-repl-p))
(lambda (response)
(nrepl-dbind-response response (id new-session)
+ (remhash id nrepl-requests)
(cond (new-session
- (with-current-buffer (process-buffer process)
+ (lexical-let ((connection-buffer (process-buffer process)))
(message "Connected. %s" (nrepl-random-words-of-inspiration))
(setq nrepl-session new-session
- nrepl-connection-buffer (current-buffer))
- (remhash id nrepl-requests)
+ nrepl-connection-buffer connection-buffer)
(unless no-repl-p
- (lexical-let ((repl-buffer (nrepl-create-repl-buffer
- process)))
- (with-current-buffer repl-buffer
- (setq nrepl-connection-buffer
- (buffer-name (process-buffer process))))
- (with-current-buffer (process-buffer process)
- (setq nrepl-repl-buffer
- (buffer-name repl-buffer)))))
+ (nrepl-make-repl process)
+ (nrepl-make-repl-connection-default connection-buffer))
(run-hooks 'nrepl-connected-hook))))))))
(defun nrepl-init-client-sessions (process no-repl-p)
@@ -2812,12 +2958,11 @@ When NO-REPL-P is truthy, suppress creation of a repl buffer."
(set-process-filter process 'nrepl-net-filter)
(set-process-sentinel process 'nrepl-sentinel)
(set-process-coding-system process 'utf-8-unix 'utf-8-unix)
+ (with-current-buffer (process-buffer process)
+ (setq nrepl-endpoint `(,host ,port)))
(let ((nrepl-connection-dispatch (buffer-name (process-buffer process))))
(nrepl-init-client-sessions process no-repl-p)
(nrepl-describe-session process))
- (nrepl-make-repl-connection-default (process-buffer process))
- (with-current-buffer (process-buffer process)
- (setq nrepl-endpoint `(,host ,port)))
process))
View
57 packs/live/clojure-pack/lib/nrepl/test/nrepl-tests.el
@@ -1,6 +1,6 @@
;;; nrepl-tests.el
-;; Copyright © 2012 Tim King
+;; Copyright © 2012-2013 Tim King
;; Author: Tim King
@@ -135,6 +135,18 @@
(let ((nrepl-hide-special-buffers t))
(should (equal (nrepl-server-buffer-name) " *nrepl-server*"))))
+(ert-deftest test-nrepl-extract-error-line ()
+ (let ((st "this context, compiling:(/some/test/file.clj:20) ala bala"))
+ (should (= (nrepl-extract-error-line st) 20)))
+ (let ((st "this context, compiling:(NO_SOURCE_PATH:20) ala bala"))
+ (should (= (nrepl-extract-error-line st) 20))))
+
+(ert-deftest test-nrepl-extract-error-filename ()
+ (let ((st "this context, compiling:(/some/test/file.clj:20) ala bala"))
+ (should (string= (nrepl-extract-error-filename st) "/some/test/file.clj")))
+ (let ((st "this context, compiling:(NO_SOURCE_PATH:20) ala bala"))
+ (should (string= (nrepl-extract-error-filename st) "NO_SOURCE_PATH"))))
+
(defmacro nrepl-test-with-two-buffers (buffer-names &rest body)
(lexical-let ((create (lambda (b) (list b `(generate-new-buffer " *temp*")))))
`(lexical-let (,@(mapcar create buffer-names))
@@ -183,3 +195,46 @@
(should (equal (append (list (buffer-name b)) connections)
(nrepl-connection-buffers)))
(should (equal (buffer-name b) (nrepl-current-connection-buffer))))))
+
+;;; connection browser
+
+(ert-deftest test-nrepl-connections-buffer ()
+ (with-temp-buffer
+ (lexical-let ((b1 (current-buffer)))
+ (set (make-local-variable 'nrepl-endpoint) '("localhost" 4005))
+ (set (make-local-variable 'nrepl-project-dir) "proj")
+ (with-temp-buffer
+ (lexical-let ((b2 (current-buffer)))
+ (set (make-local-variable 'nrepl-endpoint) '("123.123.123.123" 4006))
+ (let ((nrepl-connection-list
+ (list (buffer-name b1) (buffer-name b2))))
+ (nrepl-connection-browser)
+ (with-current-buffer "*nrepl-connections*"
+ (should (equal " Host Port Project
+
+* localhost 4005 proj
+ 123.123.123.123 4006 \n\n"
+ (buffer-string)))
+ (goto-char 80) ; somewhere in the second connection listed
+ (nrepl-connections-make-default)
+ (should (equal (buffer-name b2) (first nrepl-connection-list)))
+ (should (equal " Host Port Project
+
+ localhost 4005 proj
+* 123.123.123.123 4006 \n\n"
+ (buffer-string)))
+ (goto-char 80) ; somewhere in the second connection listed
+ (nrepl-connections-close-connection)
+ (should (equal (list (buffer-name b1)) nrepl-connection-list))
+ (should (equal " Host Port Project
+
+* localhost 4005 proj\n\n"
+ (buffer-string)))
+ (with-temp-buffer
+ (let ((b3 (current-buffer)))
+ (with-current-buffer b1
+ (set (make-local-variable 'nrepl-nrepl-buffer) b3))
+ (with-current-buffer "*nrepl-connections*"
+ (nrepl-connections-goto-connection)
+ (should (equal b3 (current-buffer))))))
+ (kill-buffer "*nrepl-connections*"))))))))
View
6 packs/live/clojure-pack/lib/popup-el/popup.el
@@ -1,10 +1,10 @@
;;; popup.el --- Visual Popup User Interface
-;; Copyright (C) 2009, 2010, 2011, 2012 Tomohiro Matsuyama
+;; Copyright (C) 2009, 2010, 2011, 2012, 2013 Tomohiro Matsuyama
;; Author: Tomohiro Matsuyama <tomo@cx4a.org>
;; Keywords: lisp
-;; Version: 0.5
+;; Version: 0.5.0
;; 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
@@ -30,6 +30,8 @@
(require 'cl)
+(defconst popup-version "0.5.0")
+
;;; Utilities
View
104 packs/live/clojure-pack/lib/uuid/uuid.el
@@ -0,0 +1,104 @@
+;;; uuid.el --- UUID's for EmacsLisp
+
+;; Copyright (C) 2012 Nic Ferrier
+
+;; Author: James Mastros
+;; Maintainer: Nic Ferrier <nferrier@ferrier.me.uk>
+;; Keywords: lisp
+;; Created: 5th September 2008
+;; Version: 0.0.3
+
+;; This file is free software
+
+;; It is Copyright 2005 James Mastros, and may be used under your
+;; choice of the GNU General Public License (version 2 or later),
+;; or the Artistic License, as promolgated by Perl.
+
+;;; Commentary:
+
+;; UUID's are useful for all sorts of things.
+
+;; Create, parse, and manipulate UUIDs/GUIDs, as specified in
+;; http://www.ietf.org/internet-drafts/draft-mealling-uuid-urn-05.txt
+
+;;; Code:
+
+(require 'cl)
+(require 'calc-comb)
+
+(defun uuid-create ()
+ "Create a new UUID object.
+
+Using version 4 (random) because it's likely easiest to
+implement, plus it satisifies the privicy concerns of
+wackos."
+ (let ((bits
+ (apply ; Note: Could use bit-vector under xemacs,
+ 'vector ; but gnuemacs doesn't have it.
+ (loop for i upto 127 collect (uuid-random-bit)))))
+ ;; Version field: byte 7, bits 7-4
+ (aset bits 60 0)
+ (aset bits 61 1)
+ (aset bits 62 0)
+ (aset bits 63 0)
+ ;; byte 9, bits 7-6
+ (aset bits 69 0)
+ (aset bits 70 1)
+ ;; byte 10, bit 0
+ (aset bits 71 1)
+ bits))
+
+(defun uuid-random-bit ()
+ (logand (math-random-digits 1) 1))
+
+(defun uuid-get-byte (uuid bytenum)
+ (let* ((lsb (* bytenum 8))
+ (msb (+ lsb 7))
+ (val 0))
+ (loop for bitnum from lsb to msb do
+ (let ((bit (aref uuid bitnum)))
+ (setq val (+ bit (lsh val 1)))))
+ val))
+
+(defun uuid-to-stringy (uuid)
+ "Convert UUID to a string"
+ (format "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x"
+ ;; time-low
+ (uuid-get-byte uuid 0)
+ (uuid-get-byte uuid 1)
+ (uuid-get-byte uuid 2)
+ (uuid-get-byte uuid 3)
+ ;; time-mid
+ (uuid-get-byte uuid 4)
+ (uuid-get-byte uuid 5)
+ ;; time-high-and-version
+ (uuid-get-byte uuid 6)
+ (uuid-get-byte uuid 7)
+ ;; clock-seq-and-reserved
+ (uuid-get-byte uuid 9)
+ ;; clock-seq-low
+ (uuid-get-byte uuid 8)
+ ;; node
+ (uuid-get-byte uuid 10)
+ (uuid-get-byte uuid 11)
+ (uuid-get-byte uuid 12)
+ (uuid-get-byte uuid 13)
+ (uuid-get-byte uuid 14)
+ (uuid-get-byte uuid 15)))
+
+
+(defun uuid-string ()
+ "Make a string form of a UUID directly."
+ (uuid-to-stringy (uuid-create)))
+
+(defun uuid-to-win32 (uuid)
+ (format "{%s}" (uuid-to-stringy uuid)))
+
+(defalias 'uuid-to-w32 'uuid-to-win32)
+(defalias 'uuid-to-win-nt 'uuid-to-win32)
+(defalias 'uuid-to-mswindows 'uuid-to-win32)
+
+
+(provide 'uuid)
+
+;;; uuid.el ends here
View
15 packs/live/colour-pack/lib/cyberpunk.el
@@ -54,6 +54,7 @@
(isearch ((t (:background "deep pink" :foreground "black"))))
(isearch-fail ((t (:background "red4"))))
(lazy-highlight ((t (:background "yellow" :foreground "black"))))
+ (next-error ((t (:background "deep pink" :foreground "black"))))
(query-replace ((t (:background "gray10"))))
(Highline-face ((t (:background "SeaGreen"))))
(hl-line ((t (:background "gray10"))))
@@ -77,6 +78,7 @@
(eval-sexp-fu-flash ((t (:background "grey15" :foreground "DeepPink3"))))
(nrepl-eval-sexp-fu-flash ((t (:background "grey15" :foreground "DeepPink3"))))
+ (nrepl-error-highlight-face ((t (:background "black" :foreground "red" :underline t))))
(ac-completion-face ((t (:foreground "darkgray" :underline t))))
(ac-candidate-face ((t (:background "gray60" :foreground "black"))))
@@ -175,12 +177,15 @@
(markdown-inline-code-face ((t (:foreground "#4c83ff"))))
(markdown-list-face ((t (:foreground "#8B8989"))))
- (git-gutter:modified ((t (:foreground "deep pink" :background "gray10"))) )
- (git-gutter:deleted ((t (:foreground "gray10" :background "gray10"))) )
- (git-gutter:added ((t (:foreground "#4c83ff" :background "gray10" ))) )
- (git-gutter:unchanged ((t (:background "gray10" ))) )
-
+ (git-gutter:modified ((t (:foreground "#4c83ff" :background "gray5"))) )
+ (git-gutter:deleted ((t (:foreground "gray10" :background "gray5"))) )
+ (git-gutter:added ((t (:foreground "#61CE3C" :background "gray5" ))) )
+ (git-gutter:unchanged ((t (:background "grey5" ))) )
+ (glsl-type-face ((t (:foreground "#4c83ff"))))
+ (glsl-keyword-face ((t (:foreground "#FBDE2D"))))
+ (glsl-variable-name-face ((t (:foreground "grey57"))))
+ (glsl-builtin-face ((t (:foreground "#FF6400"))))
))
)
View
47 packs/live/colour-pack/lib/gandalf.el
@@ -6,7 +6,7 @@
(require 'color-theme)
;;;###autoload
-(defun color-theme-gandalf()
+(defun color-theme-gandalf ()
"Gandalf colour theme by Sam Aaron"
(interactive)
(color-theme-install
@@ -23,11 +23,11 @@
(bold-italic ((t (:bold t))))
(border-glyph ((t (nil))))
(buffers-tab ((t (:background "white" :foreground "black"))))
- (font-lock-builtin-face ((t (:foreground "dark blue"))))
- (font-lock-comment-face ((t (:italic t :foreground "dark green" :italic t))))
+ (font-lock-builtin-face ((t (:foreground "blue" :bold t))))
+ (font-lock-comment-face ((t (:italic t :foreground "white" ))))
(font-lock-constant-face ((t (:foreground "dark blue"))))
(font-lock-doc-string-face ((t (:foreground "black"))))
- (font-lock-function-name-face ((t (:foreground "dark blue" :bold t))))
+ (font-lock-function-name-face ((t (:foreground "deep pink" :bold t))))
(font-lock-keyword-face ((t (:foreground "black" :bold t))))
(font-lock-preprocessor-face ((t (:foreground "black"))))
(font-lock-reference-face ((t (:foreground "dark cyan"))))
@@ -37,12 +37,14 @@
(font-lock-string-face ((t (:foreground "dark green" :bold t))))
+ (window-number-face ((t (:background "deep pink" :foreground "black"))))
+
(font-lock-type-face ((t (:foreground "blue"))))
- (font-lock-variable-name-face ((t (:foreground "dark cyan"))))
+ (font-lock-variable-name-face ((t (:foreground "#96CBFE" :bold t))))
(font-lock-warning-face ((t (:bold t :foreground "black"))))
(gui-element ((t (:background "grey40" :foreground "#96CBFE"))))
(region ((t (:background "#758BC6"))))
- (mode-line ((t (:background "grey50" :foreground "white"))))
+ (mode-line ((t (:background "deep pink" :foreground "white"))))
(mode-line-inactive ((t (:background "gray50" :foreground "black"))))
(highlight ((t (:background "grey70"))))
(isearch ((t (:background "deep pink" :foreground "black"))))
@@ -58,8 +60,6 @@
(vertical-border ((t (:background "black" :foreground "#333333"))))
(zmacs-region ((t (:background "snow" :foreground "ble"))))
(erc-default-face ((t (:foreground "dark green"))))
-
- ; NICK: add ido, and a bit of minibuffer colour.
(ido-first-match ((t (:foreground "black" :background "grey70"))))
(ido-only-match ((t (:foreground "black" :background "grey95"))))
(ido-subdir ((t (:foreground "white" :background "#758BC6"))))
@@ -75,21 +75,26 @@
(magit-branch ((t (:foreground "DarkGoldenRod"))))
;;rainbow-delimiters (
- (rainbow-delimiters-depth-1-face ((t (:foreground "dark red"))))
- (rainbow-delimiters-depth-2-face ((t (:foreground "dark green"))))
+ (rainbow-delimiters-depth-1-face ((t (:foreground "gray50"))))
+ (rainbow-delimiters-depth-2-face ((t (:foreground "black"))))
(rainbow-delimiters-depth-3-face ((t (:foreground "deep pink"))))
- (rainbow-delimiters-depth-4-face ((t (:foreground "brown"))))
- (rainbow-delimiters-depth-5-face ((t (:foreground "dark green"))))
+ (rainbow-delimiters-depth-4-face ((t (:foreground "#4c83ff"))))
+ (rainbow-delimiters-depth-5-face ((t (:foreground "light green"))))
(rainbow-delimiters-depth-6-face ((t (:foreground "dark blue"))))
(rainbow-delimiters-depth-7-face ((t (:foreground "dark orange"))))
(rainbow-delimiters-depth-8-face ((t (:foreground "slate blue"))))
(rainbow-delimiters-depth-9-face ((t (:foreground "grey10"))))
(rainbow-delimiters-unmatched-face ((t (:foreground "white"))))
(vhl/default-face ((t (:background "grey60"))))
- (undo-tree-visualizer-active-branch-face ((t (:foreground "deep pink" :background "grey40"))))
+ (undo-tree-visualizer-active-branch-face ((t (:foreground "deep pink" :background "grey40"))))
+
+ (markdown-link-face ((t (:background "#FBDE2D"))))
- (markdown-link-face ((t (:background "#FBDE2D"))))
+ (git-gutter:modified ((t (:foreground "#4c83ff" :background "gray60"))) )
+ (git-gutter:deleted ((t (:foreground "gray10" :background "gray60"))) )
+ (git-gutter:added ((t (:foreground "#61CE3C" :background "gray60" ))) )
+ (git-gutter:unchanged ((t (:background "gray60" ))) )
)
))
@@ -110,11 +115,11 @@
'(ediff-odd-diff-A ((((class color) (background dark)) (:background "dark green"))))
'(ediff-odd-diff-B ((((class color) (background dark)) (:background "dark red"))))
'(ediff-even-diff-B ((((class color) (background dark)) (:background "dark red"))))
-; '(ediff-current-diff-B ((((class color)) (:background "white"))))
-; '(ediff-even-diff-A ((((class color)) nil)))
-; '(ediff-even-diff-B ((((class color)) nil)))
-; '(ediff-fine-diff-A ((((class color)) (:background "cyan"))))
-; '(ediff-fine-diff-B ((((class color)) (:background "cyan"))))
-; '(ediff-odd-diff-A ((((class color)) nil)))
-; '(ediff-odd-diff-B ((((class color)) nil)))
+ ; '(ediff-current-diff-B ((((class color)) (:background "white"))))
+ ; '(ediff-even-diff-A ((((class color)) nil)))
+ ; '(ediff-even-diff-B ((((class color)) nil)))
+ ; '(ediff-fine-diff-A ((((class color)) (:background "cyan"))))
+ ; '(ediff-fine-diff-B ((((class color)) (:background "cyan"))))
+ ; '(ediff-odd-diff-A ((((class color)) nil)))
+ ; '(ediff-odd-diff-B ((((class color)) nil)))
)
View
10 packs/live/foundation-pack/config/built-in.el
@@ -40,17 +40,20 @@
truncate-partial-width-windows nil
delete-by-moving-to-trash nil
confirm-nonexistent-file-or-buffer nil
- query-replace-highlight t)
+ query-replace-highlight t
+ next-error-highlight t
+ next-error-highlight-no-select t)
;;set all coding systems to utf-8
-(setq utf-translate-cjk-mode nil) ; disable CJK coding/encoding (Chinese/Japanese/Korean characters)
(set-language-environment 'utf-8)
(set-default-coding-systems 'utf-8)
(setq locale-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
+;;disable CJK coding/encoding (Chinese/Japanese/Korean characters)
+(setq utf-translate-cjk-mode nil)
(set-default 'indent-tabs-mode nil)
(auto-compression-mode t)
@@ -67,15 +70,12 @@
;;remove all trailing whitespace and trailing blank lines before
;;saving the file
-
(defun live-cleanup-whitespace ()
(let ((whitespace-style '(trailing empty)) )
(whitespace-cleanup)))
(add-hook 'before-save-hook 'live-cleanup-whitespace)
-(remove-hook 'before-save-hook 'whitespace-cleanup)
-
;; savehist keeps track of some history
(setq savehist-additional-variables
;; search entries
View
26 packs/live/foundation-pack/config/cosmetic.el
@@ -16,9 +16,29 @@
;remove bells
(setq ring-bell-function 'ignore)
-(cond
- ((and (window-system) (eq system-type 'darwin))
- (add-to-list 'default-frame-alist '(font . "Menlo-12"))))
+;; font setitng functions
+(require 'cl)
+
+(defun live-set-default-font (font-string)
+ "Sets the default font and sets all frames to the same font trying to maintain window resolution. Only changes font if window system is not a basic terminal."
+ (interactive "MNew emacs live default font: ")
+ (setq default-frame-alist
+ (remove-if (lambda (x)
+ (eq 'font (car x)))
+ default-frame-alist))
+ (cond
+ ((member (window-system) '(x w32 ns))
+ (add-to-list 'default-frame-alist (cons 'font font-string))
+ (set-default-font font-string t t))))
+
+(defun live-set-default-darwin-font (font-string)
+ "Sets the default font and sets all frames to the same font trying to maintain window resolution. Only changes font if system-type is darwin in a window system."
+ (interactive "MNew darwin default font: ")
+ (cond
+ ((eq system-type 'darwin)
+ (live-set-default-font font-string))))
+
+(live-set-default-darwin-font "Menlo-12")
;; make fringe smaller
(if (fboundp 'fringe-mode)
View
7 packs/live/foundation-pack/config/ido-conf.el
@@ -12,6 +12,13 @@
(defvar live-symbol-names)
(defvar live-name-and-pos)
+(defun live-recentf-ido-find-file ()
+ "Find a recent file using ido."
+ (interactive)
+ (let ((file (ido-completing-read "Choose recent file: " recentf-list nil t)))
+ (when file
+ (find-file file))))
+
(defun live-ido-goto-symbol (&optional symbol-list)
"Refresh imenu and jump to a place in the buffer using Ido."
(interactive)
View
19 packs/live/foundation-pack/config/popwin-conf.el
@@ -23,6 +23,7 @@
("*nrepl-doc*" :height 30 :stick t)
("*nrepl-src*" :height 30 :stick t)
("*nrepl-result*" :height 30 :stick t)
+ ("*nrepl-macroexpansion*" :height 30 :stick t)
("*Kill Ring*" :height 30)
("*Compile-Log*" :height 30 :stick t)
("*git-gutter:diff*" :height 30 :stick t)))
@@ -39,12 +40,12 @@
(interactive)
(popwin:display-buffer "*ansi-term*"))
-(defun live-display-overtone-log ()
- (interactive)
- (if (live-file-open-as-buffer-p "~/.overtone/log/overtone.log")
- (popwin:display-buffer ))
- (bufferp "overtone.log")
- (buffer-live-p "overtone.log")
- (buffer-name (car (buffer-list)))
- (buffer-name)
- (popwin:display-buffer "*ansi-term*"))
+;; (defun live-display-overtone-log ()
+;; (interactive)
+;; (if (live-file-open-as-buffer-p "~/.overtone/log/overtone.log")
+;; (popwin:display-buffer ))
+;; (bufferp "overtone.log")
+;; (buffer-live-p "overtone.log")
+;; (buffer-name (car (buffer-list)))
+;; (buffer-name)
+;; (popwin:display-buffer "*ansi-term*"))
View
7 packs/live/foundation-pack/config/util-fns.el
@@ -63,3 +63,10 @@
"Predicate fn to determine whether point is at the end of the
buffer"
(<= (buffer-size) (point)))
+
+(defun live-indent-defun ()
+ "Indent the current defun."
+ (interactive)
+ (save-excursion
+ (mark-defun)
+ (indent-region (region-beginning) (region-end))))
View
37 packs/live/foundation-pack/lib/elisp-slime-nav/elisp-slime-nav.el
@@ -4,6 +4,7 @@
;; Keywords: navigation slime elisp emacs-lisp
;; URL: https://github.com/purcell/elisp-slime-nav
;; Version: DEV
+;; Package-Requires: ((cl-lib "0.2"))
;;
;;; Commentary:
;;
@@ -16,10 +17,11 @@
;;
;; Usage:
;;
+;; Enable the package in elisp and ielm modes by simply loading it:
+;;
;; (require 'elisp-slime-nav)
-;; (add-hook 'emacs-lisp-mode-hook 'elisp-slime-nav-mode)
;;
-;; When installing from an ELPA package, this hook is added for you.
+;; When installing from an ELPA package, this is not necessary.
;;
;; Known issues:
;;
@@ -28,24 +30,28 @@
;;
;;; Code:
+(eval-when-compile (require 'cl-lib))
+(require 'etags)
(require 'help-mode)
-(defvar elisp-slime-nav-mode-map (make-keymap))
+(defvar elisp-slime-nav-mode-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map (kbd "M-.") 'elisp-slime-nav-find-elisp-thing-at-point)
+ (define-key map (kbd "M-,") 'pop-tag-mark)
+ (define-key map (kbd "C-c C-d d") 'elisp-slime-nav-describe-elisp-thing-at-point)
+ (define-key map (kbd "C-c C-d C-d") 'elisp-slime-nav-describe-elisp-thing-at-point)
+ map))
;;;###autoload
(define-minor-mode elisp-slime-nav-mode
"Enable Slime-style navigation of elisp symbols using M-. and M-,"
nil " SliNav" elisp-slime-nav-mode-map)
-(eval-when-compile (require 'cl))
-(require 'etags)
-
-
(defun elisp-slime-nav--all-navigable-symbol-names ()
"Return a list of strings for the symbols to which navigation is possible."
- (loop for x being the symbols
- if (or (fboundp x) (boundp x) (symbol-plist x) (facep x))
- collect (symbol-name x)))
+ (cl-loop for x being the symbols
+ if (or (fboundp x) (boundp x) (symbol-plist x) (facep x))
+ collect (symbol-name x)))
(defun elisp-slime-nav--read-symbol-at-point ()
"Return the symbol at point as a string.
@@ -66,7 +72,7 @@ Argument SYM-NAME thing to find."
(interactive (list (elisp-slime-nav--read-symbol-at-point)))
(when sym-name
(let ((sym (intern sym-name)))
- (message "search for %s" (pp-to-string sym))
+ (message "Searching for %s..." (pp-to-string sym))
(ring-insert find-tag-marker-ring (point-marker))
(cond
((fboundp sym) (find-function sym))
@@ -89,16 +95,13 @@ Argument SYM-NAME thing to find."
(interactive (list (elisp-slime-nav--read-symbol-at-point)))
(help-xref-interned (intern sym-name)))
-
-(define-key elisp-slime-nav-mode-map (kbd "M-.") 'elisp-slime-nav-find-elisp-thing-at-point)
-(define-key elisp-slime-nav-mode-map (kbd "M-,") 'pop-tag-mark)
-(define-key elisp-slime-nav-mode-map (kbd "C-c C-d d") 'elisp-slime-nav-describe-elisp-thing-at-point)
-(define-key elisp-slime-nav-mode-map (kbd "C-c C-d C-d") 'elisp-slime-nav-describe-elisp-thing-at-point)
-
;;;###autoload
(dolist (hook '(emacs-lisp-mode-hook ielm-mode-hook))
(add-hook hook 'elisp-slime-nav-mode))
(provide 'elisp-slime-nav)
+;; Local Variables:
+;; indent-tabs-mode: nil
+;; End:
;;; elisp-slime-nav.el ends here
View
21 packs/live/foundation-pack/lib/popwin/NEWS.md
@@ -1,3 +1,24 @@
+v0.6.2
+======
+
+Highlight
+---------
+
+- GNU Emacs 24.3 support
+
+Fixed Bugs
+----------
+
+- Zombie timers
+
+v0.6.1
+======
+
+Fixed Bugs
+----------
+
+- Restore `window-start` incorrectly
+
v0.6
====
View
4 packs/live/foundation-pack/lib/popwin/popwin.el
@@ -1,10 +1,10 @@
;;; popwin.el --- Popup Window Manager.
-;; Copyright (C) 2011, 2012 Tomohiro Matsuyama
+;; Copyright (C) 2011, 2012, 2013 Tomohiro Matsuyama
;; Author: Tomohiro Matsuyama <tomo@cx4a.org>
;; Keywords: convenience
-;; Version: 0.6
+;; Version: 0.6.2
;; 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
View
23 packs/live/git-pack/lib/magit/.travis.yml
@@ -1,14 +1,25 @@
-language: emacs-lisp
+language: python
+python:
+ - "2.7"
+env:
+ matrix:
+ - EMACS=emacs
+ - EMACS=emacs24
+ - EMACS=emacs-snapshot
before_install:
- - git submodule update --init
+ - if [ "$EMACS" = "emacs24" ]; then
+ sudo add-apt-repository -y ppa:cassou/emacs &&
+ sudo apt-get update -qq &&
+ sudo apt-get install -qq emacs24 emacs24-el;
+ fi
- if [ "$EMACS" = 'emacs-snapshot' ]; then
sudo add-apt-repository -y ppa:cassou/emacs &&
sudo apt-get update -qq &&
sudo apt-get install -qq
emacs-snapshot-el emacs-snapshot-gtk emacs-snapshot;
fi
-env:
- - EMACS=emacs
- - EMACS=emacs-snapshot
+ - pip install virtualenv-emacs
+ - virtualenv_install_emacs --with-emacs=`which "$EMACS"` --marmalade
+ - elpa-get mocker cl-lib
script:
- make test EMACS=$EMACS
+ make test
View
10 packs/live/git-pack/lib/magit/Makefile
@@ -57,9 +57,9 @@ magit-$(VERSION).tar.gz: $(DIST_FILES) $(DIST_FILES_CONTRIB)
mkdir -p magit-$(VERSION)/contrib
cp -p $(DIST_FILES) magit-$(VERSION)
cp -p $(DIST_FILES_CONTRIB) magit-$(VERSION)/contrib
- echo "1s/=.*/=$(VERSION)/\nw" | ed -s magit-$(VERSION)/Makefile #NO_DIST
- echo "g/NO_DIST/d\nw" | ed -s magit-$(VERSION)/Makefile #NO_DIST
- echo ",s/@GIT_DEV_VERSION@/$(VERSION)/\nw" | ed -s magit-$(VERSION)/magit.el #NO_DIST
+ printf "1s/=.*/=$(VERSION)/\nw\n" | ed -s magit-$(VERSION)/Makefile #NO_DIST
+ printf "g/NO_DIST/d\nw\n" | ed -s magit-$(VERSION)/Makefile #NO_DIST
+ printf ",s/@GIT_DEV_VERSION@/$(VERSION)/\nw\n" | ed -s magit-$(VERSION)/magit.el #NO_DIST
tar -cvzf magit-$(VERSION).tar.gz magit-$(VERSION)
rm -rf magit-$(VERSION)
@@ -68,7 +68,7 @@ elpa: magit-$(VERSION).tar
magit-$(VERSION).tar: $(ELPA_FILES)
mkdir magit-$(VERSION)
cp -p $(ELPA_FILES) magit-$(VERSION)
- echo ",s/@GIT_DEV_VERSION@/$(VERSION)/\nw" | ed -s magit-$(VERSION)/magit.el #NO_DIST
+ printf ",s/@GIT_DEV_VERSION@/$(VERSION)/\nw\n" | ed -s magit-$(VERSION)/magit.el #NO_DIST
tar -cvf magit-$(VERSION).tar magit-$(VERSION)
rm -rf magit-$(VERSION)
@@ -77,7 +77,7 @@ install: install_core install_docs
install_core: core
mkdir -p $(ELISP_INSTALL_DIR)
install -m 644 $(ELS) $(ELCS) $(ELISP_INSTALL_DIR)
- echo ",s/@GIT_DEV_VERSION@/$(VERSION)/\nw" | ed -s $(ELISP_INSTALL_DIR)/magit.el #NO_DIST
+ printf ",s/@GIT_DEV_VERSION@/$(VERSION)/\nw\n" | ed -s $(ELISP_INSTALL_DIR)/magit.el #NO_DIST
mkdir -p $(DESTDIR)$(SYSCONFDIR)/emacs/site-start.d
install -m 644 50magit.el $(DESTDIR)$(SYSCONFDIR)/emacs/site-start.d/50magit.el
View
143 packs/live/git-pack/lib/magit/contrib/magit-inotify.el
@@ -0,0 +1,143 @@
+;;; magit-inotify.el --- Refresh status buffer if git tree changes -*- lexical-binding:t -*-
+
+;; Copyright (C) 2013 Rüdiger Sonderfeld
+
+;; Author: Rüdiger Sonderfeld <ruediger@c-plusplus.de>
+;; Keywords: tools
+
+;; 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:
+
+;; This module comes with a minor mode `magit-inotify' which tracks changes in
+;; the source tree using `inotify' and refreshes the magit status buffer.
+;; Emacs 24.4 is required to make this work because of the inotify support.
+
+;;; Code:
+
+(require 'magit)
+(require 'cl-lib)
+(require 'inotify)
+
+(defgroup magit-inotify nil
+ "Refresh status buffer if source tree changes"
+ :prefix "magit-inotify"
+ :group 'magit)
+
+(defun magit-inotify--directories ()
+ "List all directories containing files watched by git."
+ ;; TODO: add .git directory?
+ (cons
+ default-directory
+ (cl-remove-duplicates
+ (cl-loop for file in (magit-git-lines "ls-files")
+ with tmp
+ do (setq tmp (file-name-directory file))
+ when tmp
+ collect (expand-file-name tmp))
+ :test #'string=)))
+
+(defvar magit-inotify-data (make-hash-table)
+ "A hash table to map watch-descriptors to a list (DIRECTORY STATUS-BUFFER).")
+
+(defun magit-inotify--callback (ev)
+ "Handle inotify callbacks.
+Argument EV contains the watch data."
+ (let* ((wd (car ev))
+ (data (gethash wd magit-inotify-data))
+ (buffer (cadr data)))
+ (if (buffer-live-p buffer)
+ (with-current-buffer buffer
+ (magit-refresh))
+ (inotify-rm-watch wd)
+ (remhash wd magit-inotify-data))))
+
+(defcustom magit-inotify-aspects '(modify create delete attrib onlydir)
+ "Aspects to watch for.
+See `inotify-add-watch'."
+ :group 'magit-inotify
+ :type '(repeat symbol))
+
+(defun magit-inotify-start ()
+ "Start watching for changes to the source tree using inotify.
+This can only be called from a magit status buffer."
+ (unless (derived-mode-p 'magit-status-mode)
+ (error "Only works in magit status buffer"))
+ (dolist (dir (magit-inotify--directories))
+ (puthash (inotify-add-watch dir magit-inotify-aspects
+ #'magit-inotify--callback)
+ (list dir (current-buffer))
+ magit-inotify-data)))
+
+(defun magit-inotify-stop ()
+ "Stop watching for changes to the source tree using inotify.
+This can only be called from a magit status buffer."
+ (unless (derived-mode-p 'magit-status-mode)
+ (error "Only works in magit status buffer"))
+ (maphash
+ (lambda (k v)
+ (when (equal (cadr v) (current-buffer)) ; or use buffer?
+ (inotify-rm-watch k)
+ (remhash k magit-inotify-data)))
+ magit-inotify-data))
+
+(defun magit-inotify-watching-p ()
+ "Return non-nil if current source tree is watched."
+ (unless (derived-mode-p 'magit-status-mode)
+ (error "Only works in magit status buffer"))
+ (let (ret)
+ (maphash (lambda (_k v)
+ (when (and (not ret)
+ (equal (cadr v) (current-buffer)))
+ (setq ret t)))
+ magit-inotify-data)
+ ret))
+
+(defcustom magit-inotify-lighter " MagitInotify"
+ "String to display in mode line when `magit-inotify-mode' is active."
+ :group 'magit-inotify
+ :type 'string)
+
+;;;###autoload
+(define-minor-mode magit-inotify-mode
+ "Refresh status buffer if source tree changes."
+ :lighter magit-inotify-lighter
+ :group 'magit-inotify
+ (if magit-inotify-mode
+ (magit-inotify-start)
+ (magit-inotify-stop)))
+
+(defun magit-inotify-stop-all ()
+ "Stop watching for changes in all git trees."
+ (interactive)
+ (maphash
+ (lambda (k _v) (inotify-rm-watch k))
+ magit-inotify-data)
+ (clrhash magit-inotify-data))
+
+;;; Loading
+(easy-menu-add-item magit-mode-menu nil
+ ["Auto Refresh" magit-inotify-mode
+ :style toggle
+ :selected (magit-inotify-watching-p)
+ :help "Use inotify to watch for changes in the source tree."]
+ "Refresh")
+
+(defun magit-inotify-unload-function ()
+ "Cleanup when module is unloaded."
+ (easy-menu-remove-item magit-mode-menu nil "Auto Refresh"))
+
+(provide 'magit-inotify)
+
+;;; magit-inotify.el ends here
View
47 packs/live/git-pack/lib/magit/magit-blame.el
@@ -30,7 +30,7 @@
;;; Code:
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
(require 'magit)
(require 'easymenu)
@@ -135,35 +135,32 @@
(if sha1
(magit-show-commit sha1))))
-(defun magit-find-next-overlay-change (BEG END PROP)
+(defun magit-find-next-overlay-change (beg end prop)
"Return the next position after BEG where an overlay matching a
property PROP starts or ends. If there are no matching overlay
boundaries from BEG to END, the return value is nil."
+ (when (> beg end)
+ (let ((swap beg))
+ (setq beg end end swap)))
(save-excursion
- (goto-char BEG)
+ (goto-char beg)
(catch 'found
- (flet ((overlay-change (pos)
- (if (< BEG END) (next-overlay-change pos)
- (previous-overlay-change pos)))
- (within-bounds-p (pos)
- (if (< BEG END) (< pos END)
- (> pos END))))
- (let ((ov-pos BEG))
- ;; iterate through overlay changes from BEG to END
- (while (within-bounds-p ov-pos)
- (let* ((next-ov-pos (overlay-change ov-pos))
- ;; search for an overlay with a PROP property
- (next-ov
- (let ((overlays (overlays-at next-ov-pos)))
- (while (and overlays
- (not (overlay-get (car overlays) PROP)))
- (setq overlays (cdr overlays)))
- (car overlays))))
- (if next-ov
- ;; found the next overlay with prop PROP at next-ov-pos
- (throw 'found next-ov-pos)
- ;; no matching overlay found, keep looking
- (setq ov-pos next-ov-pos)))))))))
+ (let ((ov-pos beg))
+ ;; iterate through overlay changes from BEG to END
+ (while (< ov-pos end)
+ (let* ((next-ov-pos (next-overlay-change ov-pos))
+ ;; search for an overlay with a PROP property
+ (next-ov
+ (let ((overlays (overlays-at next-ov-pos)))
+ (while (and overlays
+ (not (overlay-get (car overlays) prop)))
+ (setq overlays (cdr overlays)))
+ (car overlays))))
+ (if next-ov
+ ;; found the next overlay with prop PROP at next-ov-pos
+ (throw 'found next-ov-pos)
+ ;; no matching overlay found, keep looking
+ (setq ov-pos next-ov-pos))))))))
(defun magit-blame-next-chunk (pos)
"Go to the next blame chunk."
View
55 packs/live/git-pack/lib/magit/magit-key-mode.el
@@ -1,13 +1,16 @@
(require 'magit)
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
(defvar magit-key-mode-key-maps '()
"This will be filled lazily with proper `define-key' built
keymaps as they're requested.")
-(defvar magit-key-mode-buf-name "*magit-key*"
- "Name of the buffer.")
+(defvar magit-key-mode-buf-name "*magit-key: %s*"
+ "Format string to create the name of the magit-key buffer.")
+
+(defvar magit-key-mode-last-buffer nil
+ "Store the last magit-key buffer used.")
(defvar magit-key-mode-current-args nil
"A hash-table of current argument set (which will eventually
@@ -269,7 +272,7 @@ The user is prompted for the key."
(goto-char (point-min))
(let* ((exec (get-text-property (point) 'key-group-executor))
(exec-alist (if exec `((,exec . ,(point))) nil)))
- (do nil ((eobp) (nreverse exec-alist))
+ (cl-do nil ((eobp) (nreverse exec-alist))
(when (not (eq exec (get-text-property (point) 'key-group-executor)))
(setq exec (get-text-property (point) 'key-group-executor))
(when exec (push (cons exec (point)) exec-alist)))
@@ -313,25 +316,22 @@ Put it in `magit-key-mode-key-maps' for fast lookup."
(interactive)
(magit-key-mode-help ',for-group)))
- (flet ((defkey (k action)
- (when (and (lookup-key map (car k))
- (not (numberp (lookup-key map (car k)))))
- (message "Warning: overriding binding for `%s' in %S"
- (car k) for-group)
- (ding)
- (sit-for 2))
- (define-key map (car k)
- `(lambda () (interactive) ,action))))
- (when actions
- (dolist (k actions)
- (defkey k `(magit-key-mode-command ',(nth 2 k)))))