jacott / enhanced-ruby-mode Goto Github PK
View Code? Open in Web Editor NEWAn enhanced ruby-mode for Emacs that uses Ripper in ruby 1.9.2 to highlight and indent the source code
License: Other
An enhanced ruby-mode for Emacs that uses Ripper in ruby 1.9.2 to highlight and indent the source code
License: Other
I don't seem to get the indentation to work as I want it to.
I want this:
test = {
a: 1,
b: 2,
c: {
d: 4
}
}
I always get this:
test = {
a: 1,
b: 2,
c: {
d: 4
}
}
Even after setting:
(setq ruby-deep-arglist t)
(setq ruby-deep-indent-paren nil)
(setq ruby-hanging-indent-level 2)
Am I doing something wrong? Or are those settings simply ignored?
(setq vc-follow-symlinks t)
(require 'enh-ruby-mode)
(setq enh-ruby-program "my/1.9/ruby/pah")
(add-to-list 'interpreter-mode-alist '("ruby" . enh-ruby-mode))
error in process filter: save-current-buffer: Selecting deleted buffer
error in process filter: Selecting deleted buffer
Thanks.
Start with the following code:
f(1, 2, 3)
with your cursor at 0. Hit M-SPC
, M-f
, C-w
and you SHOULD have selected the whole function call and killed it. But you're left with ")".
Likewise:
f 42 do
g
end
Puts M-f
across the do
puts the cursor at the beginning of end
, not one character past it.
If I open an empty file and try to insert a new line with ruby-electric, I get
Debugger entered--Lisp error: (error "expression ends prematurely")
signal(error ("expression ends prematurely"))
error("expression ends prematurely")
ruby-backward-sexp(1)
ruby-electric-return-can-be-expanded-p()
ruby-electric-return()
call-interactively(ruby-electric-return nil nil)
If I type def followed by an empty space, I get a wrongly indented end:
# Input: def SPC
def
end
Also within a class body, every time I press enter a new end is added:
# Input: class RET RET RET
class
end
end
end
My guess is that the culprit is ruby-backward-sexp.
love the mode, but I am finding when I make a newline (hit enter), there is a noticeable pause. strange, because I don't get any slowdown when doing any other kind of edit.
indentation is SO much better then official ruby-mode it is like a dream. The one issue I have noticed is if you type out this line
blah = foo(bin: 1,
baz: 2)
you will see when you hit enter, the b in baz is lined up with the open paren of the arg list. If you indent the second line, it lines up fine, and if the whole line exists first and you hit enter right after the comma, it also indents fine.
If I run M-x ruby-end-of-defun
in this file, where |
is the position of the cursor:
def te|st
"test"
end
The cursor ends up here:
def test
"test"
|end
Instead of here:
def test
"test"
end|
Even worse, if I run it at this position:
def test
"test"
e|nd
Then the CPU usage goes up to 100% and emacs is frozen in an infinite loop.
I love warnings, but one thing that is bugging me is that in rspec, this is how you do an assertion
foo.should == 1
you get as a warning
warning: possibly useless use of == in void context
I would rather have that then turn them off altogether, but it would be cool if there were some way to squelch certain warnings in certain buffers.
ERM sometimes freezes, and I get the following in /tmp/erb.log:
"p16:1:991:835:0:}\n\u0000\u0000\u0000\n"
no implicit conversion from nil to integer
/Users/Jell/.emacs.d/el-get/Enhanced-Ruby-Mode/ruby/erm_buffer.rb:68:in `[]'
/Users/Jell/.emacs.d/el-get/Enhanced-Ruby-Mode/ruby/erm_buffer.rb:68:in `realadd'
/Users/Jell/.emacs.d/el-get/Enhanced-Ruby-Mode/ruby/erm_buffer.rb:30:in `nadd'
/Users/Jell/.emacs.d/el-get/Enhanced-Ruby-Mode/ruby/erm_buffer.rb:47:in `add'
/Users/Jell/.emacs.d/el-get/Enhanced-Ruby-Mode/ruby/erm_buffer.rb:332:in `on_rbrace'
/Users/Jell/.emacs.d/el-get/Enhanced-Ruby-Mode/ruby/erm_buffer.rb:423:in `parse'
/Users/Jell/.emacs.d/el-get/Enhanced-Ruby-Mode/ruby/erm_buffer.rb:423:in `block in parse'
/Users/Jell/.emacs.d/el-get/Enhanced-Ruby-Mode/ruby/erm_buffer.rb:422:in `catch'
/Users/Jell/.emacs.d/el-get/Enhanced-Ruby-Mode/ruby/erm_buffer.rb:422:in `parse'
/Users/Jell/.emacs.d/el-get/Enhanced-Ruby-Mode/ruby/erm_buffer.rb:528:in `parse'
/Users/Jell/.emacs.d/el-get/Enhanced-Ruby-Mode/ruby/erm.rb:45:in `block in <main>'
/Users/Jell/.emacs.d/el-get/Enhanced-Ruby-Mode/ruby/erm.rb:26:in `open'
/Users/Jell/.emacs.d/el-get/Enhanced-Ruby-Mode/ruby/erm.rb:26:in `<main>'
So I'm guessing that ErmBuffer does not know about the p
command.
When using erm with https://github.com/purcell/mmm-mode/blob/master/mmm-erb.el the ruby code in erb files does not have syntax highlighting. Anyone had more luck with mmm-mode?
I simply love this mode and really want to use it all the time, but inserting snippets with YASnippet trips it up. Somehow, the initial snippet is not pushed down to the buffer. Because of that, the next change made indexes into the buffer string in bad spots. The parser recovers after the error, but the error is enough to cancel YASnippet's expansion, so they really don't peacefully coexist.
Ideally, it would be awesome to find a way to push down the YASnippet changes as they happen. If we can do that, this mode could keep parsing all the way through snippet expansion.
Another less ideal option is that YASnippet gives us before and after hooks. Is there someway I can disable the parser before expansion, then kick it back in after (somehow flushing the current buffer content to it)?
Messages Buffer shows
Error during redisplay: (void-variable ruby-font-lock-keywords) [2 times]
it used to work with default ruby-mode (from upstream ruby source)
With ruby-mode I was able to do something like this: (font-lock-add-keywords 'ruby-mode '(("\\<\\(require_relative\\|require\\|include\\|extend\\)\\>" . font-lock-keyword-face)))
But not in erm. It looks like it is working just for a seconds - when I edit buffer the font color changes but just after a second it goes back to default.
Is it possible to add custom keywords in erm?
When using Enhanced-Ruby-Mode with the latest official ruby-mode from the svn trunk, I get the following error when executing M-x run-ruby
:
inferior-ruby-mode: Symbol's function definition is void: ruby-mode-variables
The *ruby*
buffer is still created and irb is loaded, but Emacs does not automatically display the buffer. When Enhanced-Ruby-Mode is not being used, this error does not occur.
I love that you have string delimiters and operators, some things I would like to see (and would customize) are
I like to make dots, colons, and parens fade into the background a bit (makes things look kind of smalltalk-ish), and give different colors for arrays and hashes
I use whitespace-mode and my own highlighter for HACK/FIX/REFACTOR/etc tags and they're drowned out by your mode's highlighting. You can occasionally see blank-mode flickering and then getting overwritten.
I don't know modes/faces well enough to debug this.
My whitespace (customize) setup:
'(whitespace-global-modes (quote (ruby-mode emacs-lisp-mode scheme-mode)))
'(whitespace-style (quote (face tabs trailing lines-tail space-before-tab empty))))
This should work out of the box with 24... possibly 23 as well. Make a ruby file with a long line or mix in tabs and you should see extra highlighting with normal ruby mode but not on ERM.
Syntax highlighting should be done based on my chosen theme. You have hardcoded colors in here, goldenrod for example.
https://github.com/zenspider/enhanced-ruby-mode is the active fork. This one is dead for all concerned. Please file your issue against the active fork.
I can not get syntax highlighting nor indenting to work in enh-ruby-mode. It works fine in ruby-mode, but when enh-ruby-mode is turned on everything is just black text, and auto indent stops working. I am running emacs 24.4.1 on Debian Wheezy, and I installed version 20150312.1458 of enh-ruby-package from melpa archive.
~/.emacs.d/init.el
(load "package")
(package-initialize)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
;; Installs version 20150312.1458 of enh-ruby-package from melpa
(package-refresh-contents)
(package-install 'enh-ruby-mode)
(add-to-list 'load-path "(path-to)/Enhanced-Ruby-Mode") ; must be added after any path containing old ruby-mode
(autoload 'enh-ruby-mode "enh-ruby-mode" "Major mode for ruby files" t)
(add-to-list 'auto-mode-alist '("\\.rb$" . enh-ruby-mode))
(add-to-list 'interpreter-mode-alist '("ruby" . enh-ruby-mode))
Hi there,
Having a file including UTF-8 characters breaks syntax highlighting.
If I create a file "test.rb" as follows:
# -*- coding: utf-8 -*-
"testöåä"
And try to open it, the code won't be highlighted.
Trying to run M-x ruby-mode
returns erm-ruby-get-process: No catch for tag: interrupted, t
in the Message buffer.
After updating to the last version of ERM, I get this:
Debugger entered--Lisp error: (void-function flymake-delete-own-overlays)
flymake-delete-own-overlays()
erm-syntax-response("\n\n")
erm-parse("c\n\n")
erm-filter(#<process erm-ruby-process> "c\n\n\n\n")
accept-process-output(#<process erm-ruby-process> 0.5)
erm-wait-for-parse()
ruby-indent-line()
indent-according-to-mode()
evil-ret(nil)
call-interactively(evil-ret nil nil)
Benchmark::bm(20) do |x|
x.report("null_time") do
for i in 0..max do
# do nothing
end
end
x.report("benchmark-1") do
for i in 0..max do
# insert code here
end
end
x.report("benchmark-2") do
for i in 0..max do
# insert code here
end
end
end
I see no activities and old unresolved issues, has the main project moved to the zenspider's fork?
If so, updating the readme would be great, if not, what gives?
To reproduce:
# encoding: utf-8
class Foo
HERE = <<DOC
äöü
DOC
def bar(baz)
end
end
In this case it shifts the colors below the here-doc by the number of umlauts in the doc.
Hello!
At first: thank for this great mode! This mode solved for me problem with syntax highlighting inside %{}
when there was different kind of quotes. See screens: default ruby mode, enhanced ruby mode. And here is our discussion about this.
But I have one more question: why color of operators (<
, +
, =
) have changed? You could see changes on screens mentioned above.
Full my emacs config available here: https://github.com/yas375/emacs-config
Thanks in advance! =)
Python has had this problem for a while, with two conflicting modes both using python-mode
as their name. Don't fall into the same trap, please.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.