diff --git a/README.md b/README.md index a2ac6ce..06ae7fe 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,23 @@ Finally, `cd` to the root of your project and run `gtags`. You now have function Before programming Java, install `eclim`, and `eclipse`. +### Ruby + +Ruby makes using emacs a challenge. + +Flycheck likes to complain about `bundle exec` even on emacs 27.1+. There are a few things you need to do to make things work nicely: + +1. Use `lsp-mode` instead of robe and launch a ruby server with that. For some reason robe gets in the way of things like `.dir-locals.el`. +2. On a per-project basis, put a `.dir-locals.el` file with the following in it: + +``` +((ruby-mode . ((eval . (setq flycheck-command-wrapper-function + (lambda (command) + (append '("bundle" "exec") command))))))) +``` + +Which will allow bundle exec to work with flycheck. + ## Joe Editor Always build from source to get the latest features. You will need at least diff --git a/dotfiles/bash/bashrc b/dotfiles/bash/bashrc index 802e408..499336a 100644 --- a/dotfiles/bash/bashrc +++ b/dotfiles/bash/bashrc @@ -135,6 +135,10 @@ export HISTCONTROL=ignoredups # If go is installed, set the $GOPATH to the projects directory created above. if which go > /dev/null; then export GOPATH=$HOME/projects/go; fi +# For emacs 27.1+. This way no matter what config changes or version of emacs +# I find myself on it will always work the same. +export XDG_CONFIG_HOME="${HOME}/.emacs.d" + # ------------ END EXPORTS ------------# diff --git a/dotfiles/emacs.d/init.el b/dotfiles/emacs.d/init.el index c4f39b3..0bd92a2 100644 --- a/dotfiles/emacs.d/init.el +++ b/dotfiles/emacs.d/init.el @@ -19,7 +19,9 @@ There are two things you can do about this warning: (when (< emacs-major-version 24) ;; For important compatibility libraries like cl-lib (add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/"))))) -(package-initialize) + +(when (< emacs-major-version 27) + (package-initialize)) (add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t) @@ -45,6 +47,17 @@ There are two things you can do about this warning: (setq inhibit-startup-screen t) ;;-------------------------------------------------------------------------------------- +;; Emacs 27+ Configs +;;-------------------------------------------------------------------------------------- + +;; Set the directory to the home directory. This has the side effect of making +;; emacs load files from the home directory when called as emacs -nw xyz. +(when (>= emacs-major-version 27) + (setq default-directory "~/") + (setq command-line-default-directory "~/")) + + +;;-------------------------------------------------------------------------------------- ;; Display battery life in modeline ;;-------------------------------------------------------------------------------------- @@ -119,7 +132,7 @@ There are two things you can do about this warning: (name . "\*info\*"))) ("Dired" (mode . dired-mode)) ;; Dev has groups for all languages you program in - ("Dev" (or (mode . cc-mode) + ("Dev" (or (filename . ".c") (filename . ".cpp") (filename . ".hpp") @@ -313,13 +326,6 @@ There are two things you can do about this warning: (require 'rvm) (rvm-use-default) -(add-hook 'ruby-mode-hook 'robe-mode) - -(eval-after-load 'company - '(push 'company-robe company-backends)) - -(add-hook 'robe-mode-hook 'ac-robe-setup) - (advice-add 'inf-ruby-console-auto :before #'rvm-activate-corresponding-ruby) ;;;;;;;;;;; C/C++ @@ -402,10 +408,16 @@ There are two things you can do about this warning: ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. - '(lisp-indent-function (quote common-lisp-indent-function)) + '(lisp-indent-function 'common-lisp-indent-function) '(package-selected-packages - (quote - (arjen-grey-theme oceanic-theme company-lsp projectile smex grizzl flycheck-pos-tip flycheck material-theme expand-region wrap-region rainbow-delimiters powerline linum-relative golden-ratio fill-column-indicator autopair exec-path-from-shell ws-butler yaml-mode python-mode protobuf-mode paredit nasm-mode meson-mode markdown-mode magit gradle-mode gitignore-mode feature-mode counsel company-jedi jedi-core company-emacs-eclim company-irony company ag)))) + '(arjen-grey-theme oceanic-theme company-lsp projectile smex grizzl flycheck-pos-tip flycheck material-theme expand-region wrap-region rainbow-delimiters powerline linum-relative golden-ratio fill-column-indicator autopair exec-path-from-shell ws-butler yaml-mode python-mode protobuf-mode paredit nasm-mode meson-mode markdown-mode magit gradle-mode gitignore-mode feature-mode counsel company-jedi jedi-core company-emacs-eclim company-irony company ag)) + '(safe-local-variable-values + '((eval setq flycheck-command-wrapper-function + (lambda + (command) + (append + '("bundle" "exec") + command)))))) (custom-set-faces ;; custom-set-faces was added by Custom. diff --git a/dotfiles/emacs.d/package.el b/dotfiles/emacs.d/package.el index a7b91f2..335ea39 100644 --- a/dotfiles/emacs.d/package.el +++ b/dotfiles/emacs.d/package.el @@ -34,7 +34,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;; ;; Programming modes - cc-mode feature-mode gitignore-mode gradle-mode @@ -51,9 +50,6 @@ ;; Rails rinari - ;; Ruby autocomplete - robe - ;; RVM support rvm ;;;;;;;;;;;;;;;;;;;;