Emacs .el files

Hi All,
It would be nice if there was a README file in the “ruby/misc”
directory
on how to apply the emacs .el files to .emacs.
I copied all the .el files into the
/usr/share/emacs/site-list/site-start.d
directory. But I don’t know how to auto load and enable these features
from
.emacs or
from site-start.el. Could someone help me?

Thanks,
-Alex

the following two lines should get you going, the first line is only
necessary if you have not already placed the files in your site-lisp
directory

(add-to-list 'load-path “~/path/to/directory/containing/ruby-mode.el”)
(autoload 'ruby-mode “ruby-mode” “Mode for editing ruby source files”
t)

if you’re feeling ambitious about adding more functionality here is an
excerpt from my own site-start.el

– Eric

;;; Ruby M.
;;;
;;; and
;;;
;;; Inferior Ruby M. - ruby process in a buffer.
;;; adapted from cmuscheme.el
(add-to-list 'load-path “~/emacs/elisp/ruby-mode”)
;;; (1) modify .emacs to use ruby-mode
(autoload 'ruby-mode “ruby-mode”
“Mode for editing ruby source files” t)
(setq auto-mode-alist
(append '(("\.rb$" . ruby-mode)) auto-mode-alist))
(setq auto-mode-alist
(append '(("\.rjs$" . ruby-mode)) auto-mode-alist))
(setq auto-mode-alist
(append '(("\.rake$" . ruby-mode)) auto-mode-alist))
(setq auto-mode-alist
(append '((“Rakefile$” . ruby-mode)) auto-mode-alist))
(setq interpreter-mode-alist (append '((“ruby” . ruby-mode))
interpreter-mode-alist))
;;; (2) set to load inf-ruby and set inf-ruby key definition in
ruby-mode.
(autoload 'run-ruby “inf-ruby”
“Run an inferior Ruby process”)
(set 'ruby-program-name “irb --inf-ruby-mode -rubygems”)
(autoload 'inf-ruby-keys “inf-ruby”
“Set local key defs for inf-ruby in ruby-mode”)
(add-hook 'inferior-ruby-mode-hook
(lambda ()
(local-set-key “\C-cd” 'ri)
(local-set-key [tab] 'ri-ruby-complete-symbol)
(local-set-key “\C-c\C-a” 'ri-ruby-show-args)))

;;; Ruby Debugger
(autoload 'rubydb “rubydb3x” “Ruby debugger” t)

;;; Ruby Style
(require 'ruby-style)

;; Tab Completion
(require 'pabbrev)
(add-hook 'ruby-mode-hook
'(lambda ()
(pabbrev-mode)))

;;; ri (ruby interactive documentation)
;;
;; http://rubyforge.org/projects/ri-emacs
;;
(setq ri-ruby-script (expand-file-name
“~/emacs/elisp/ruby-mode/ri-emacs.rb”))
(autoload 'ri “~/emacs/elisp/ruby-mode/ri-ruby.el” nil t)
(load “~/emacs/elisp/ruby-mode/ri-ruby.el”)
;; Bind the ri command to a key.
;; Method/class completion is also available.
(add-hook 'ruby-mode-hook
(lambda ()
(local-set-key “\C-cd” 'ri)
(local-set-key (kbd “”) 'ri-ruby-complete-symbol)
(local-set-key “\C-c\C-a” 'ri-ruby-show-args)
))

On Saturday, August 9, at 00:57, Alex K. wrote:

Hi All,
It would be nice if there was a README file in the “ruby/misc”
directory
on how to apply the emacs .el files to .emacs.
I copied all the .el files into the
/usr/share/emacs/site-list/site-start.d
directory. But I don’t know how to auto load and enable these
features from
.emacs or
from site-start.el. Could someone help me?

Thanks,
-Alex

Hello Eric,

I did the whole thing and it works great!

Thanks,
-Alex

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs