[ANN] Emacs rails.el


#1

Features:

  • Management WEBrick - start, stop
  • Viewing log files
  • Abbrev from TextMate
  • Switching between View/Action

http://www.emacswiki.org/cgi-bin/emacs/rails.el


#2

I’m new to emacs, how should I enable this mode?
I’ve copied rails.el and all ruby’s el files to
C:\emacs-21.3\lisp\progmodes and edited the .emacs file, but there is
a problem.
I have syntax coloring, but an strange auto-complete, it autocomplete
everything, lisp command, dir and files, etc.

What’s wrong in my conif? May anyone help me, please?

Thanks

Here is my .emacs file:

(custom-set-variables
;; custom-set-variables was added by Custom – don’t edit or cut/paste
it!
;; Your init file should contain only one such instance.
'(case-fold-search t)
'(current-language-environment “Latin-1”)
'(default-frame-alist (quote ((mouse-color . “black”) (tool-bar-lines
. 0) (menu-bar-lines . 1) (background-color . “black”)
(foreground-color . “white”) (cursor-color . “orange”) (cursor-type .
box) (active-alpha . 0.875) (inactive-alpha . 0.75))))
'(default-input-method “latin-1-prefix”)
'(global-font-lock-mode t nil (font-lock))
'(pop-up-frames nil))
(custom-set-faces
;; custom-set-faces was added by Custom – don’t edit or cut/paste it!
;; Your init file should contain only one such instance.
'(default ((t (:stipple nil :background “black” :foreground “white”
:inverse-video nil :box nil :strike-through nil :overline nil
:underline nil :slant normal :weight normal :height 111 :width normal
:family “outline-consolas”))))
'(cursor ((t (:background “orange”))))
'(mouse ((t (:background “black”)))))

(autoload 'ruby-mode “ruby-mode” “Mode for editing ruby source files” t)
(setq auto-mode-alist (append '(("\.rb$" . ruby-mode))
auto-mode-alist))
(setq interpreter-mode-alist (append '((“ruby” . ruby-mode))
interpreter-mode-alist))

(autoload 'run-ruby “inf-ruby” “Run an inferior Ruby process”)
(autoload 'inf-ruby-keys “inf-ruby” “Set local key defs for inf-ruby
in ruby-mode”)
(add-hook 'ruby-mode-hook
'(lambda ()
(inf-ruby-keys)
))

;;(require 'ruby-electric)
(require 'rails)


#3

dima wrote:

Features:

  • Management WEBrick - start, stop
  • Viewing log files
  • Abbrev from TextMate
  • Switching between View/Action

http://www.emacswiki.org/cgi-bin/emacs/rails.el

I love it! Just made some adjustments for rjs templates, keep up the
good
work!

Zsombor


#4

Human D. wrote:

I’m new to emacs, how should I enable this mode?
I’ve copied rails.el and all ruby’s el files to
C:\emacs-21.3\lisp\progmodes and edited the .emacs file, but there is
a problem.
I have syntax coloring, but an strange auto-complete, it autocomplete
everything, lisp command, dir and files, etc.

What’s wrong in my conif? May anyone help me, please?

I do not know in what a problem, just in case here my fragment .emacs


(autoload 'ruby-mode “ruby-mode” “Ruby editing mode.” t)
(setq auto-mode-alist (cons '("\.rb$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\.rhtml$" . html-mode)
auto-mode-alist))

(modify-coding-system-alist 'file “\.rb$” 'utf-8-dos)
(modify-coding-system-alist 'file “\.rhtml$” 'utf-8-dos)

(require 'rails)

(add-hook 'ruby-mode-hook
(lambda()
(add-hook 'local-write-file-hooks
'(lambda()
(save-excursion
(untabify (point-min) (point-max))
(delete-trailing-whitespace)
)))
(set (make-local-variable 'indent-tabs-mode) 'nil)
(set (make-local-variable 'tab-width) 2)
(imenu-add-to-menubar “IMENU”)
(require 'ruby-electric)
(ruby-electric-mode t)
))


#5

Your Lisp coding style is really weird…all those )'s on separate lines
;-).

I’m going to love this, because, until now, I have not used a
Rails-aware editor.

Thanks!

Jules


#6

dima wrote:

Features:

  • Management WEBrick - start, stop
  • Viewing log files
  • Abbrev from TextMate
  • Switching between View/Action

http://www.emacswiki.org/cgi-bin/emacs/rails.el

New location of a file
https://opensvn.csie.org/mvision/emacs/.emacs.d/rails.el
Changes:

  • Added support RJS templates
  • Added navigation on configuration files in the menu
  • rails now run a minor-mode

#7

dima wrote:

Features:

  • Management WEBrick - start, stop
  • Viewing log files
  • Abbrev from TextMate
  • Switching between View/Action

http://www.emacswiki.org/cgi-bin/emacs/rails.el
Hm. I’m getting errors when trying to view a log file:

Symbol's function definition is void: rails-make-menu.

Any idea how I could fix this?

– stefan


For rails performance tuning, see: http://railsexpress.de/blog
Subscription: http://railsexpress.de/blog/xml/rss20/feed.xml


#8

dima wrote:

Hm. I’m getting errors when trying to view a log file:

Symbol’s function definition is void: rails-make-menu.

Any idea how I could fix this?
Already fixed, update you copy from
https://opensvn.csie.org/mvision/emacs/.emacs.d/rails.el

hm. now I get:

Compiling file c:/Programme/emacs-21.3/site-lisp/rails.el at Tue Feb 07
00:21:06 2006
!! File error ((“Cannot open load file” “snippet”))

when trying to byte-compile rails.el

– stefan


For rails performance tuning, see: http://railsexpress.de/blog
Subscription: http://railsexpress.de/blog/xml/rss20/feed.xml


#9

Hei Stefan!

Tue, 07 Feb 2006, Stefan K. skrev:

http://www.emacswiki.org/cgi-bin/emacs/rails.el
Compiling file c:/Programme/emacs-21.3/site-lisp/rails.el at Tue Feb 07
00:21:06 2006
!! File error ((“Cannot open load file” “snippet”))

when trying to byte-compile rails.el

~/lisp$ wget http://cryptocracy.hn.org/~cartel/elisp/snippet.el

in your .emacs:
(load “~/lisp/snippet.el”)
(load “~/lisp/rails.el”)
(require 'rails)

  • Henrik

#10

Henrik Ormåsen wrote:

when trying to byte-compile rails.el

  • Henrik

Thx. Now I only need a way to get color coding working for log views in
emacs …

– stefan


For rails performance tuning, see: http://railsexpress.de/blog
Subscription: http://railsexpress.de/blog/xml/rss20/feed.xml


#11

Hello, Stefan K.!
on 06.02.2006 16:42

dima wrote:

Features:

  • Management WEBrick - start, stop
  • Viewing log files
  • Abbrev from TextMate
  • Switching between View/Action

http://www.emacswiki.org/cgi-bin/emacs/rails.el
Hm. I’m getting errors when trying to view a log file:

Symbol’s function definition is void: rails-make-menu.

Any idea how I could fix this?
Already fixed, update you copy from
https://opensvn.csie.org/mvision/emacs/.emacs.d/rails.el


#12

rails.el is too cool! but I found a bit problem.

Although a view path will be set to “adminpage” from camel named
controller
such as “AdminPageController”, it should be “admin_page” in Rails rule.

The following patch fixes this problem.
http://rails.wota.jp/pubs/patches/rails-el-underscore.patch

thanks.

– Maiha


#13

Thx. Now I only need a way to get color coding working for log views in
emacs …

If you find out how to make emacs interpret the ANSI codes as colors,
please let me know :slight_smile:

cheers
Gerret


#14

Hello, Maiha Ishimura!
on 07.02.2006 15:21

– Maiha

I merge you patch.
Big thanks!


#15

On 2/7/06, Gerret A. removed_email_address@domain.invalid wrote:

Thx. Now I only need a way to get color coding working for log views in
emacs …

If you find out how to make emacs interpret the ANSI codes as colors,
please let me know :slight_smile:

There’s ansi-color.el [1]. AFAIK it’s been part of the GNU Emacs distro
since v 21. Works for me with shell-mode, but I haven’t tried
configuring
it with other items (like rails log files).

Cheers,
/Nick

[1] http://www.emacswiki.org/cgi-bin/wiki/ansi-color.el


#16

Hello, Nick S.!
on 07.02.2006 19:03

please let me know :)

There’s ansi-color.el [1]. AFAIK it’s been part of the GNU Emacs distro
since v 21. Works for me with shell-mode, but I haven’t tried
configuring it with other items (like rails log files).

Cheers,
/Nick

[1] http://www.emacswiki.org/cgi-bin/wiki/ansi-color.el
Thanks for assistance.
rails.el now display color logs:)


#17

Looks terrific. Two nits so far (emacs 21.3.1):

When I hit ‘ctrl-t’ I end up with:

“Symbol’s value as variable is void: html-mode-abbrev-table” the first
time. The second time I hit ctrl-t it works.

Also, I’ve included ‘snippet.el’ but can’t trigger abbreviation
expansion with TAB. Ideas?


from my .emacs:
;rails mode

(require 'snippet)

(defun try-complete-abbrev (old)
(if (expand-abbrev) t nil))

(setq hippie-expand-try-functions-list
'(try-complete-abbrev
try-complete-file-name
try-expand-dabbrev))

(add-hook 'ruby-mode-hook
(lambda()
(add-hook 'local-write-file-hooks
'(lambda()
(save-excursion
(untabify (point-min) (point-max))
(delete-trailing-whitespace)
)))
(set (make-local-variable 'indent-tabs-mode) 'nil)
(set (make-local-variable 'tab-width) 2)
(imenu-add-to-menubar “IMENU”)
(require 'ruby-electric)
(ruby-electric-mode t)
))

(require 'rails)


#18

San wrote :
| Also, I’ve included ‘snippet.el’ but can’t trigger abbreviation
| expansion with TAB. Ideas?

Hi,

In fact I also had a problem to make snippet work with ruby-mode: the
TAB does not work for expansion whereas any other key works. This is
IMHO related to the ruby-mode only (note that I also have problemn with
snippet + c-mode, but not related to the TAB key :wink:


Frederick R. aka Sleeper – removed_email_address@domain.invalid

Don’t diddle code to make it faster - find a better algorithm.
- The Elements of Programming Style (Kernighan & Plaugher)


#19

Hello, San!
on 08.02.2006 0:02

Looks terrific. Two nits so far (emacs 21.3.1):

When I hit ‘ctrl-t’ I end up with:

“Symbol’s value as variable is void: html-mode-abbrev-table” the first
time. The second time I hit ctrl-t it works.

try add in you .emacs this line, if not exists
(setq auto-mode-alist (cons '("\.rhtml$" . html-mode)
auto-mode-alist))

Also, I’ve included ‘snippet.el’ but can’t trigger abbreviation
expansion with TAB. Ideas?

rec - not work?

Hmm… no ideas
I’m using emacs from cvs 22.0.50.1 (2005/11/26), do not see this problem


#20

While we’re on the rails+emacs topic –

I’m still looking for a good way to auto-indent rhtml files in an
emacs buffer. Currently I use ruby-mode, ruby-electric and rails mode.
rhtml indentation is a real pain to keep like this.

If any of you have found a way to auto-indent rhtml I’d love to hear
about it.

cheers
Gerret