12

You've configured company-mode to load after your init file is evaluated using the after-init-hook, but are then trying to modify company-backends right away. That variable isn't defined until company-mode is loaded. You either need to just require company, or defer setting that variable using eval-after-load: (eval-after-load 'company '(push 'company-...


5

I tried yafolding, seems to work (theres room for improvement on this, though) (require 'yafolding) (add-hook 'ruby-mode-hook 'yafolding-mode) (global-set-key (kbd "M-RET") 'yafolding-toggle-element) Possible alternatives: "yafolding", "hideshow", "folding.el", "imenu.el","vimish-fold" Here's a ...


3

In short, it is because Ruby's syntax is ambiguous, and because String#index accepts a regexp in its first argument. There are different tradeoffs different editors take regarding regular expressions in Ruby. We can discuss improving Emacs's tradeoff in a bug report.


2

The Ruby editing mode defines ruby-indent-tabs-mode and sets indent-tabs-mode to that value when the mode is invoked. The default for this is nil. To fix your problem, set this variable instead. This seems like a bug to me. There's no reason Ruby needs its own special setting for this. Note also that c-basic-offset doesn't affect Ruby. Ruby has ruby-...


2

@Dmitry made a great point that hippie-expand will do what I'm desiring when : is considered a punctuation character. It's obviously not ideal to just set (modify-syntax-entry ?: "." ruby-mode-syntax-table) in your init and call it a day, because then only some_action in :some_action is considered a symbol which would break expectations for other plugins. ...


2

This solution doesn't address code folding, but does aim to address the issue of navigation and code context awareness. imenu allows navigation of source files in all languages, including Ruby. But rspec doesn't support it out of the box. You can add support for imenu to rspec files with rspec mode (it's in melpa). imenu by itself is OK, but I highly ...


2

Found the answer in a youtube https://www.youtube.com/watch?v=l_gkh3CsbTk Specifically as a prelude user, what I did was kill emacs daemon ;; add to personal.el (prelude-require-packages '( robe )) emacs --daemon emacs ~/repo/app/controllers/foo_controller.rb M-x robe-start M-x robe-mode place cursor at contant/sumbol M-x robe-jump-to-module And sure ...


2

You're probably using the legacy indentation code, enabled with (setq ruby-use-smie nil). Set that variable to t (its default), restart Emacs, and the problem will disappear.


2

You might want to stick to the defaults, since: r = my_long_function_name( param1, param2) is arguably preferable over: r = my_long_function_name(param1, param2) But if you care (Emacs 26.3), for Python: (eval-after-load "python" (lambda () (fset 'old-python-indent--calculate-indentation (symbol-function 'python-indent--...


1

The problem with both of these is ruby-mode tries to be consistent and apply similar indentation rules to similar syntax constructs. We try to support the popular indentation approach for paren-less method calls: class Book < ActiveRecord::Base belongs_to :subject validates_presence_of :title validates_numericality_of :price, ...


1

Marking the region and calling M-x sort-paragraphs RET should do it sort-paragraphs is an interactive autoloaded compiled Lisp function in ‘sort.el’. (sort-paragraphs REVERSE BEG END) Sort paragraphs in region alphabetically; argument means descending order. Called from a program, there are three arguments: REVERSE (non-nil means reverse order), BEG and ...


1

Use bookmarks to identify and return to such positions. If you use Bookmark+ then you can easily create and use autonamed or temporary (i.e., non-persistent) bookmarks, and these can be automatically highlighted in various ways (e.g., fringe marker or position or line), if you want. Just hit C-x p RET to create an autonamed bookmark -- no need to provide a ...


1

Try this too (add-hook 'ruby-mode-hook 'turn-off-smartparens-mode)


1

Ah, I've answered a different question. I somehow managed to completely ignore the ~/ in (load "~/ruby-mode"). I've now edited that out of the paths I've used below, in order that what I've written is coherent. It might still be useful info, so I'll not delete it, but it's not what you were asking... Emacs looks for libraries in the directories specified ...


1

I use next function to run rails console on remote host. It seems that run-ruby doesn't care how REPL is started, so I pass it an ssh command. Most important part is the command itself: -t for pseudo-terminal mode, without it repl won't work; bash --login to get usual shell (for rbenv, rvm or other stuff that initialised on shell startup). If you use zsh, ...


1

Apparently, the thing to do is to edit the project over TRAMP (not in a shared directory). Running specs over TRAMP has just been fixed in rspec-mode.


1

Here's how to use global installed from a Ubuntu repository. The version I've had in 6.6.3-2. First, copy the example config to your home directory. A commentary at its top makes it seem like this is unnecessary, but that's not true. The default config it has is much different, and doesn't recognize .rb files at all, AFAICT. cat /usr/share/doc/global/...


1

(require 'hideshow) ;; Set up hs-mode (HideShow) for Ruby (add-to-list 'hs-special-modes-alist `(ruby-mode ,(rx (or "def" "class" "module" "do")) ; Block start ,(rx (or "end")) ; Block end ,(rx (or "#" "=begin")) ; Comment start ruby-forward-sexp nil)) ...


1

projectile-rails is a nice all-around mode, especially for navigating between files within a project.


1

You should definitely check both rspec-mode and robe


Only top voted, non community-wiki answers of a minimum length are eligible