From 12ac2f0e4c691d12c05a9438d074db05a931bf5f Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Wed, 19 Nov 2008 18:09:03 -0800 Subject: [PATCH] Rearrange lisp and ruby helpers. --- elpa-to-submit/inf-ruby.el | 6 +++--- starter-kit-lisp.el | 22 +++++++++++++--------- starter-kit-ruby.el | 28 ++++++---------------------- 3 files changed, 22 insertions(+), 34 deletions(-) diff --git a/elpa-to-submit/inf-ruby.el b/elpa-to-submit/inf-ruby.el index 2036b9a29d..b0c0e5aa59 100644 --- a/elpa-to-submit/inf-ruby.el +++ b/elpa-to-submit/inf-ruby.el @@ -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) diff --git a/starter-kit-lisp.el b/starter-kit-lisp.el index 7fdb0586a9..828f66ea99 100644 --- a/starter-kit-lisp.el +++ b/starter-kit-lisp.el @@ -4,14 +4,15 @@ (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))) @@ -19,6 +20,8 @@ (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")) @@ -27,4 +30,5 @@ "Face used to dim parentheses." :group 'starter-kit-faces) -(provide 'starter-kit-lisp) \ No newline at end of file +(provide 'starter-kit-lisp) +;; starter-kit-lisp.el ends here \ No newline at end of file diff --git a/starter-kit-ruby.el b/starter-kit-ruby.el index 9e045671ec..e98688e568 100644 --- a/starter-kit-ruby.el +++ b/starter-kit-ruby.el @@ -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)