S
Sam Kong
As I got more and more inclined to Ruby, I decided to switch to Linux
from Windows.
Most people in this group seem to be using Linux and I felt that I was
an outsider...
I'm trying to get familiar with Emacs.
Now I get syntax coloring for Ruby.
But one thing that I can't get is indentation.
Under Windows, I used UntraEdit or EditPlus and I expect the similar
behaviors.
I like tab-size to be 4.
I don't want my tabs to be replaced with spaces.
And of course, auto-indentation.
Also, if I hit backspace, it should act like a tab key backward if the
removed character is a tab.
I tried to modify my .emacs file but I couldn't get all the things I
want.
class C
def f
"Hello"
Now I want to type '<backspace>end' to make it like
class C
def f
"Hello"
end
But I get either of the two depending on .emacs.
1. When I hit <backspace>, the cursor goes to the first column(begin of
the line). And I hit <tab> and the cursor moves 8 columns instead of 4
even if tab size is 4.
2. When I hit <backspace>, the cursor moves only one column back and I
have to hit it 4 times. This is better than the first situation but not
what I exactly want.
Here's part of my .emacs.
-----
;;To use ruby-mode
(autoload 'ruby-mode "ruby-mode" "Load ruby-mode")
(add-to-list 'auto-mode-alist '("\\.rb\\'" . ruby-mode))
(setq interpreter-mode-alist (append '(("ruby" . ruby-mode))
interpreter-mode-alist))
;;To set inf-ruby key definition
(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)
(setq ruby-indent-level 4)
))
(setq ruby-mode-hook
(lambda ()
(setq tab-stop-list '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60
64 68 72 76 80))
(define-key ruby-mode-map "\r" 'newline-and-indent)
(define-key ruby-mode-map "\M-\C-h" 'backward-kill-word)
(setq indent-tabs-mode nil)
(setq c-tab-always-indent nil)
(abbrev-mode t)
(turn-on-font-lock)
(setq ruby-indent-level 4)
)
)
-----
Can you help me?
Thanks.
Sam
from Windows.
Most people in this group seem to be using Linux and I felt that I was
an outsider...
I'm trying to get familiar with Emacs.
Now I get syntax coloring for Ruby.
But one thing that I can't get is indentation.
Under Windows, I used UntraEdit or EditPlus and I expect the similar
behaviors.
I like tab-size to be 4.
I don't want my tabs to be replaced with spaces.
And of course, auto-indentation.
Also, if I hit backspace, it should act like a tab key backward if the
removed character is a tab.
I tried to modify my .emacs file but I couldn't get all the things I
want.
class C
def f
"Hello"
Now I want to type '<backspace>end' to make it like
class C
def f
"Hello"
end
But I get either of the two depending on .emacs.
1. When I hit <backspace>, the cursor goes to the first column(begin of
the line). And I hit <tab> and the cursor moves 8 columns instead of 4
even if tab size is 4.
2. When I hit <backspace>, the cursor moves only one column back and I
have to hit it 4 times. This is better than the first situation but not
what I exactly want.
Here's part of my .emacs.
-----
;;To use ruby-mode
(autoload 'ruby-mode "ruby-mode" "Load ruby-mode")
(add-to-list 'auto-mode-alist '("\\.rb\\'" . ruby-mode))
(setq interpreter-mode-alist (append '(("ruby" . ruby-mode))
interpreter-mode-alist))
;;To set inf-ruby key definition
(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)
(setq ruby-indent-level 4)
))
(setq ruby-mode-hook
(lambda ()
(setq tab-stop-list '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60
64 68 72 76 80))
(define-key ruby-mode-map "\r" 'newline-and-indent)
(define-key ruby-mode-map "\M-\C-h" 'backward-kill-word)
(setq indent-tabs-mode nil)
(setq c-tab-always-indent nil)
(abbrev-mode t)
(turn-on-font-lock)
(setq ruby-indent-level 4)
)
)
-----
Can you help me?
Thanks.
Sam