[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

emacs .el files

Alex Katebi

8/8/2008 3:58:00 PM

[Note: parts of this message were removed to make it a legal post.]

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

2 Answers

Eric Schulte

8/8/2008 4:09:00 PM

0

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 Mode
;;;
;;; and
;;;
;;; Inferior Ruby Mode - 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/project...
;;
(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 "<C-return>") 'ri-ruby-complete-symbol)
(local-set-key "\C-c\C-a" 'ri-ruby-show-args)
))


On Saturday, August 9, at 00:57, Alex Katebi 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

--
schulte

Alex Katebi

8/8/2008 4:37:00 PM

0

[Note: parts of this message were removed to make it a legal post.]

Hello Eric,

I did the whole thing and it works great!

Thanks,
-Alex

On Fri, Aug 8, 2008 at 12:08 PM, Eric Schulte <schulte.eric@gmail.com>wrote:

> 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 Mode
> ;;;
> ;;; and
> ;;;
> ;;; Inferior Ruby Mode - 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/project...
> ;;
> (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 "<C-return>") 'ri-ruby-complete-symbol)
> (local-set-key "\C-c\C-a" 'ri-ruby-show-args)
> ))
>
>
> On Saturday, August 9, at 00:57, Alex Katebi 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
>
> --
> schulte
>
>