Skip to content
This repository has been archived by the owner on Jan 23, 2018. It is now read-only.

Commit

Permalink
Move swank payloads to lein-swank plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
technomancy committed Feb 21, 2012
1 parent 1dd73d6 commit 634b76e
Show file tree
Hide file tree
Showing 7 changed files with 10,982 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -5,3 +5,4 @@ multi-lib/
pom.xml
.lein-failures
.lein-deps-sum
/lein-swank/.lein-plugins/checksum
4 changes: 4 additions & 0 deletions lein-swank/resources/swank_elisp_payloads.clj
@@ -0,0 +1,4 @@
["swank/payload/slime.el"
"swank/payload/slime-repl.el"
"swank/payload/slime-frame-colors.el"
"swank/payload/slime-eldoc.el"]
37 changes: 37 additions & 0 deletions lein-swank/src/swank/payload/slime-compile-presave.el
@@ -0,0 +1,37 @@
;;; slime-compile-presave.el --- Refuse to save non-compiling Slime buffers

;; Copyright © 2011 Phil Hagelberg
;;
;; Authors: Phil Hagelberg <technomancy@gmail.com>
;; URL: http://github.com/technomancy/swank-clojure
;; Version: 1.0.0
;; Keywords: languages, lisp

;; This file is not part of GNU Emacs.

;;; Code:

(defvar slime-compile-presave? nil
"Refuse to save slime-enabled buffers if they don't compile.")

;;;###autoload
(defun slime-compile-presave-toggle ()
(interactive)
(message "slime-compile-presave %s."
(if (setq slime-compile-presave? (not slime-compile-presave?))
"enabled" "disabled")))

;;;###autoload
(defun slime-compile-presave-enable ()
(make-local-variable 'before-save-hook)
(add-hook 'before-save-hook (defun slime-compile-presave ()
(when slime-compile-presave?
(slime-eval `(swank:eval-and-grab-output
,(buffer-substring-no-properties
(point-min) (point-max))))))))

;;;###autoload
(add-hook 'slime-mode-hook 'slime-compile-presave-enable)

(provide 'slime-compile-presave)
;;; slime-compile-presave.el ends here
12 changes: 12 additions & 0 deletions lein-swank/src/swank/payload/slime-eldoc.el
@@ -0,0 +1,12 @@
(require 'eldoc)
(defun clojure-slime-eldoc-message ()
(when (and (featurep 'slime)
(slime-background-activities-enabled-p))
(slime-echo-arglist) ; async, return nil for now
nil))

(defun clojure-localize-documentation-function ()
(set (make-local-variable 'eldoc-documentation-function)
'clojure-slime-eldoc-message))

(add-hook 'slime-mode-hook 'clojure-localize-documentation-function)
18 changes: 18 additions & 0 deletions lein-swank/src/swank/payload/slime-frame-colors.el
@@ -0,0 +1,18 @@
(require 'ansi-color)

(defadvice sldb-insert-frame (around colorize-clj-trace (frame &optional face))
(progn
(ad-set-arg 0 (list (sldb-frame.number frame)
(ansi-color-apply (sldb-frame.string frame))
(sldb-frame.plist frame)))
ad-do-it
(save-excursion
(forward-line -1)
(skip-chars-forward "0-9 :")
(let ((beg-line (point)))
(end-of-line)
(remove-text-properties beg-line (point) '(face nil))))))

(ad-activate #'sldb-insert-frame)

(provide 'slime-frame-colors)

0 comments on commit 634b76e

Please sign in to comment.