Skip to content

Commit

Permalink
ruby-compilation cleanups.
Browse files Browse the repository at this point in the history
  • Loading branch information
technomancy committed Dec 11, 2008
1 parent 0716d25 commit 680a6d6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 64 deletions.
58 changes: 0 additions & 58 deletions elpa-to-submit/pcmpl-rake.el

This file was deleted.

22 changes: 18 additions & 4 deletions elpa-to-submit/ruby-compilation.el
Expand Up @@ -49,9 +49,7 @@
;;; Code:

(require 'ansi-color)
(require 'pcmpl-rake)
(require 'compile)
(require 'inf-ruby)
(require 'which-func)

(defvar ruby-compilation-error-regexp
Expand All @@ -78,23 +76,26 @@
(ruby-args-to-list (expand-file-name cmd)))))
(pop-to-buffer (ruby-compilation-do name cmdlist))))

;;;###autoload
(defun ruby-compilation-rake (&optional edit task)
"Run a rake process dumping output to a ruby compilation buffer."
(interactive "P")
(let* ((task (or task (if (stringp edit) edit)
(completing-read "Rake: " (pcmpl-rake-tasks))))
(completing-read "Rake: " (ruby-compilation-rake-tasks))))
(rake-args (if (and edit (not (stringp edit)))
(read-from-minibuffer "Edit Rake Command: " (concat task " "))
task)))
(pop-to-buffer (ruby-compilation-do
"rake" (cons "rake"
(ruby-args-to-list rake-args))))))

;;;###autoload
(defun ruby-compilation-this-buffer ()
"Run the current buffer through Ruby compilation."
(interactive)
(ruby-compilation-run (buffer-file-name)))

;;;###autoload
(defun ruby-compilation-this-test ()
"Run the test at point through Ruby compilation."
(interactive)
Expand Down Expand Up @@ -197,6 +198,19 @@ compilation buffer."
(dolist (executable (list "jruby" "rbx" "ruby1.9" "ruby1.8" "ruby"))
(add-to-list 'safe-local-variable-values
(cons 'ruby-compilation-executable executable)))


(defun ruby-compilation-rake-tasks ()
"Return a list of all the rake tasks defined in the current
projects. I know this is a hack to put all the logic in the
exec-to-string command, but it works and seems fast"
(delq nil (mapcar '(lambda(line)
(if (string-match "rake \\([^ ]+\\)" line) (match-string 1 line)))
(split-string (shell-command-to-string "rake -T") "[\n]"))))

;;;###autoload
(defun pcomplete/rake ()
"Completion rules for the `ssh' command."
(pcomplete-here (pcmpl-rake-tasks)))

(provide 'ruby-compilation)
;;; ruby-compilation.el ends here
2 changes: 1 addition & 1 deletion starter-kit-misc.el
Expand Up @@ -14,7 +14,6 @@
inhibit-startup-message t
transient-mark-mode t
color-theme-is-global t
imenu-auto-rescan t
delete-by-moving-to-trash t
shift-select-mode nil
truncate-partial-width-windows nil
Expand Down Expand Up @@ -62,6 +61,7 @@

(set-default 'indent-tabs-mode nil)
(set-default 'indicate-empty-lines t)
(set-default 'imenu-auto-rescan t)

(defalias 'yes-or-no-p 'y-or-n-p)
(random t) ;; Seed the random-number generator
Expand Down
2 changes: 1 addition & 1 deletion starter-kit-ruby.el
Expand Up @@ -4,8 +4,8 @@

(eval-after-load 'ruby-mode
'(progn
(require 'inf-ruby)
(require 'ruby-compilation)
(add-hook 'ruby-mode-hook 'inf-ruby-keys)
(define-key ruby-mode-map (kbd "RET") 'reindent-then-newline-and-indent)
(define-key ruby-mode-map (kbd "C-c l") "lambda")))

Expand Down

0 comments on commit 680a6d6

Please sign in to comment.