0

Hey guys I need to see my ruby version and gemset name in emacs mode-line. Do you know how to do it?

squiter
  • 5,711
  • 4
  • 24
  • 24

2 Answers2

0

Take a look at rvm.el. I provides many features that make the use of RVM from Emacs more enjoyable.

Bozhidar Batsov
  • 55,802
  • 13
  • 100
  • 117
  • I already use `rvm.el` but it not give me that information :( – squiter Apr 08 '15 at 21:49
  • Ah, yes - I got confused with `rbenv.el`, which does this. Guess you can add logic similar to the one for `rbenv--modestring` in `rvm.el` - that should be pretty simple. – Bozhidar Batsov Apr 09 '15 at 06:20
  • Or you can borrow a page from Projectile's book - have a look [here](https://github.com/bbatsov/projectile/blob/master/projectile.el#L2567). – Bozhidar Batsov Apr 09 '15 at 06:45
0

I tried but I can't custom strings to mode-line so I customize all of it.

;; modeline
(defun branch-name ()
  (when vc-mode
    (concat "\ue0a0 " (substring vc-mode 5))
    ))

(defun current-ruby ()
  (when vc-mode
    (replace-regexp-in-string "\n$" "" (shell-command-to-string "~/.rvm/bin/rvm-prompt"))
))

(setq-default mode-line-format
      (list
       "[" mode-line-modified "]"
       "  "
       "%b"
       "  |  "
       'mode-name
       "  |  "
       '(:eval (projectile-project-name))
       " "
       '(:eval (branch-name))
       "  |  "
       '(:eval (current-ruby))
       "  |  "
       "%p (%l,%c)"
       ))
squiter
  • 5,711
  • 4
  • 24
  • 24