Search code examples
ruby-on-railsemacsruby-mode

Load Emacs Minor only for specific Major


I am pretty new to emacs and I have installed a 'starter kit' for Ruby on Rails, which works nicely. However, I am also developing in PHP and the starter brings about some problems.

I want to switch off some of the minor modes when editing all files other than ruby files.

in my .emacs file I have:

(add-to-list 'load-path "~/.emacs.d/plugins/ruby-block")
(require 'ruby-block)

If I comment this out then the minor disappears for all files so I tried adding a hook (although I am a complete beginner so this might be the wrong approach) like so:

(add-hook 'ruby-mode-hook (lambda () (add-to-list 'load-path "~/.emacs.d/plugins/ruby-block")))
(add-hook 'ruby-mode-hook (lambda () (require 'ruby-block)))

I also tried using the event hook to call a function and moving the lines above into a function but still couldn't get this to work.

I would really appreciate any help removing the ruby-block minor from all files other than .rb


Solution

  • I had used ruby-block-mode, but I had remove it.

    here is what I setting for ruby-block-mode, give it a try:

    (eval-after-load 'ruby-mode
      '(progn
        (require 'ruby-block)
        (ruby-block-mode t)
        (setq ruby-block-highlight-toggle t)))