Skip to content

Commit

Permalink
Rearrange lisp and ruby helpers.
Browse files Browse the repository at this point in the history
  • Loading branch information
technomancy committed Nov 20, 2008
1 parent 99cd8e8 commit 12ac2f0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 34 deletions.
6 changes: 3 additions & 3 deletions elpa-to-submit/inf-ruby.el
Expand Up @@ -180,11 +180,11 @@ run)."
(mapc #'car inf-ruby-implementations))
inf-ruby-default-implementation)))

(let ((buffer-name (format "*%s*" (or impl "ruby")))
(cmd (cdr (assoc (or impl "ruby") inf-ruby-implementations))))
(let ((buffer-name (format "*%s*" impl))
(cmd (cdr (assoc impl inf-ruby-implementations))))
(if (not (comint-check-proc buffer-name))
(let ((cmdlist (split-string cmd)))
(set-buffer (apply 'make-comint "ruby" (car cmdlist)
(set-buffer (apply 'make-comint impl (car cmdlist)
nil (cdr cmdlist)))
(inf-ruby-mode)))
(setq inf-ruby-buffer buffer-name)
Expand Down
22 changes: 13 additions & 9 deletions starter-kit-lisp.el
Expand Up @@ -4,21 +4,24 @@

(add-hook 'emacs-lisp-mode-hook 'eldoc-mode)

(add-hook 'emacs-lisp-mode-hook
;; If you're saving an elisp file, likely the .elc is no longer valid.
(lambda ()
(make-local-variable 'after-save-hook)
(add-hook 'after-save-hook
(lambda ()
(if (file-exists-p (concat buffer-file-name "c"))
(delete-file (concat buffer-file-name "c")))))))
(add-hook 'emacs-lisp-mode-hook 'emacs-lisp-remove-elc-on-save)

(defun emacs-lisp-remove-elc-on-save ()
"If you're saving an elisp file, likely the .elc is no longer valid."
(make-local-variable 'after-save-hook)
(add-hook 'after-save-hook
(lambda ()
(if (file-exists-p (concat buffer-file-name "c"))
(delete-file (concat buffer-file-name "c"))))))

(font-lock-add-keywords 'emacs-lisp-mode
'(("(\\|)" . 'paren-face)))

(font-lock-add-keywords 'scheme-mode
'(("(\\|)" . 'paren-face)))

(define-key lisp-mode-shared-map (kbd "C-c l") "lambda")

(defface paren-face
'((((class color) (background dark))
(:foreground "grey20"))
Expand All @@ -27,4 +30,5 @@
"Face used to dim parentheses."
:group 'starter-kit-faces)

(provide 'starter-kit-lisp)
(provide 'starter-kit-lisp)
;; starter-kit-lisp.el ends here
28 changes: 6 additions & 22 deletions starter-kit-ruby.el
Expand Up @@ -2,29 +2,13 @@
;;
;; Part of the Emacs Starter Kit

(eval-after-load 'ruby-mode
'(progn
(require 'inf-ruby)
(require 'ruby-compilation)

;; TODO: move this stuff to autoloads?
(require 'ruby-mode)
(require 'ruby-compilation)

(defun rr (&optional arg)
"Run a Ruby interactive shell session in a buffer."
(interactive "P")
(let ((impl (if (not arg)
"mri"
(completing-read "Ruby Implementation: "
'("ruby" "jruby" "rubinius" "yarv")))))
(run-ruby (cdr (assoc impl '(("mri" . "irb")
("jruby" . "jruby -S irb")
("rubinius" . "rbx")
("yarv" . "irb1.9")))))
(with-current-buffer "*ruby*"
(rename-buffer (format "*%s*" impl) t))))

(define-key ruby-mode-map (kbd "C-M-h") 'backward-kill-word)
(define-key ruby-mode-map (kbd "RET") 'ruby-reindent-then-newline-and-indent)
(define-key ruby-mode-map (kbd "C-c l") (lambda ()
(interactive) (insert "lambda")))
(define-key ruby-mode-map (kbd "RET") 'reindent-then-newline-and-indent)
(define-key ruby-mode-map (kbd "C-c l") "lambda")))

(global-set-key (kbd "C-h r") 'ri)

Expand Down

0 comments on commit 12ac2f0

Please sign in to comment.