Adopt seagle0128/doom-modeline for :ui modeline
And remove obsolete :ui doom-modeline module. Relevant to: #136, #921
This commit is contained in:
parent
868bd15abe
commit
8832737671
17 changed files with 90 additions and 1944 deletions
|
@ -1,8 +1,5 @@
|
|||
;;; lang/ruby/autoload.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar +ruby-version-cache (make-hash-table :test 'equal)
|
||||
"TODO")
|
||||
|
||||
;;;###autoload
|
||||
(defun +ruby|cleanup-robe-servers ()
|
||||
"Clean up dangling inf robe processes if there are no more `enh-ruby-mode'
|
||||
|
@ -16,38 +13,3 @@ buffers open."
|
|||
(when (processp process)
|
||||
(kill-process (get-buffer-process inf-buffer))
|
||||
(kill-buffer inf-buffer)))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +ruby-version ()
|
||||
"Return the currently installed version of ruby on your system (the first
|
||||
ruby executable found in your PATH).
|
||||
|
||||
This is not necessarily aware of env management tools like virtualenv, pyenv or
|
||||
pipenv, unless those tools have modified the PATH that Emacs picked up when you
|
||||
started it."
|
||||
(condition-case _
|
||||
(let ((version-str (car (process-lines "ruby" "--version"))))
|
||||
(puthash (or (doom-project-root) default-directory)
|
||||
(format "Ruby %s" (cadr (split-string version-str " ")))
|
||||
+ruby-version-cache))
|
||||
(error "Ruby")))
|
||||
|
||||
|
||||
;;
|
||||
;; Hooks
|
||||
|
||||
;;;###autoload
|
||||
(defun +ruby|update-version (&rest _)
|
||||
"Update `+ruby--version' by consulting `+ruby-version' function."
|
||||
(setq +ruby--version
|
||||
(or (gethash (or (doom-project-root) default-directory)
|
||||
+ruby-version-cache)
|
||||
(+ruby-version))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +ruby|update-version-in-all-buffers (&rest _)
|
||||
"Update `+ruby--version' in all `enh-ruby-mode' buffers."
|
||||
(dolist (buffer (doom-buffers-in-mode 'enh-ruby-mode))
|
||||
(setq +ruby-version-cache (clrhash +ruby-version-cache))
|
||||
(with-current-buffer buffer
|
||||
(+ruby|update-version))))
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
;;; lang/ruby/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar +ruby-mode-line-indicator '("" +ruby--version)
|
||||
"Format for the ruby version/env indicator in the mode-line.")
|
||||
|
||||
(defvar-local +ruby--version nil
|
||||
"The ruby version in the current buffer.")
|
||||
|
||||
|
||||
;;
|
||||
;; Packages
|
||||
|
||||
|
@ -34,14 +27,7 @@
|
|||
(add-to-list 'company-dabbrev-code-modes 'ruby-mode nil #'eq))
|
||||
|
||||
;; so class and module pairs work
|
||||
(setq-hook! (ruby-mode enh-ruby-mode) sp-max-pair-length 6)
|
||||
|
||||
;; Add ruby version string to the major mode in the modeline
|
||||
(defun +ruby|init-mode-line ()
|
||||
(setq mode-name +ruby-mode-line-indicator))
|
||||
(add-hook 'enh-ruby-mode-hook #'+ruby|init-mode-line)
|
||||
|
||||
(add-hook 'enh-ruby-mode-hook #'+ruby|update-version))
|
||||
(setq-hook! (ruby-mode enh-ruby-mode) sp-max-pair-length 6))
|
||||
|
||||
|
||||
(def-package! robe
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue