diff options
author | Grant Shoshin Shangreaux <shoshin@cicadas.surf> | 2022-09-08 08:06:50 -0500 |
---|---|---|
committer | Grant Shoshin Shangreaux <shoshin@cicadas.surf> | 2022-09-08 08:06:50 -0500 |
commit | 956543ce60c32e2964f6a76a993a5f8161bed003 (patch) | |
tree | 46bcbda83930157f00c754bec81449e77dd434e7 | |
parent | 9b8b5ba34e37290a0d615881ba8792f414bb5079 (diff) |
Add: 💎 [ruby] linting, minitest, inf-ruby setup
-rw-r--r-- | shoshimacs.el | 20 | ||||
-rw-r--r-- | shoshimacs.org | 54 |
2 files changed, 74 insertions, 0 deletions
diff --git a/shoshimacs.el b/shoshimacs.el index 637d5b0..8a9731d 100644 --- a/shoshimacs.el +++ b/shoshimacs.el @@ -168,10 +168,30 @@ (package-install 'json-mode) +(add-hook 'ruby-mode-hook #'flymake-mode) + (package-install 'inf-ruby) +(when (executable-find "pry") + (setq inf-ruby-default-implementation "pry")) + +(defvar minitest-emacs-repo "https://github.com/arthurnn/minitest-emacs.git") +(defvar minitest-emacs-src-dir "~/src/minitest-emacs") + +(unless (file-directory-p minitest-emacs-src-dir) + (shell-command + (format "git clone %s %s" minitest-emacs-repo minitest-emacs-src-dir))) + +(add-to-list 'load-path minitest-emacs-src-dir) +(require 'minitest) + +(package-install 'haml-mode) + (package-install 'devdocs) +(define-key flymake-mode-map (kbd "M-n") 'flymake-goto-next-error) +(define-key flymake-mode-map (kbd "M-p") 'flymake-goto-prev-error) + ;;; Projects (package-install 'magit) diff --git a/shoshimacs.org b/shoshimacs.org index 02722b7..feb1214 100644 --- a/shoshimacs.org +++ b/shoshimacs.org @@ -627,6 +627,21 @@ from them in various Emacs menus. [[*\[\[info:consult#Top\]\[consult\]\] - Consu #+end_src *** Ruby +**** Linting + +The Emacs ~ruby-mode~ defines a backend for flymake, which use rubocop by default +if it is available. If it isn't, it will try ~ruby -wc~ which will check syntax +and warnings in the file. If a project is NOT using rubocop, or if it is say... +running in a container, the flymake backend function will need to be hacked on +a bit. A few config variables are available, primarily for rubocop. + + ruby-flymake-use-rubocop-if-available t + ruby-rubocop-config ".rubocop.yml" + +#+begin_src emacs-lisp + (add-hook 'ruby-mode-hook #'flymake-mode) +#+end_src + **** inf-ruby inf-ruby provides an interface to the various REPLs available in the Ruby-verse @@ -636,10 +651,49 @@ its currently provided by non-gnu ELPA: (package-install 'inf-ruby) #+end_src +I prefer pry when its available, and it generally is on my system: + +#+begin_src emacs-lisp + (when (executable-find "pry") + (setq inf-ruby-default-implementation "pry")) +#+end_src + +**** TODO minitest-emacs + +this is a package i happen to maintain, and i would like to get it into non-gnu +elpa. however, at the moment i must install from source: + +#+begin_src emacs-lisp + (defvar minitest-emacs-repo "https://github.com/arthurnn/minitest-emacs.git") + (defvar minitest-emacs-src-dir "~/src/minitest-emacs") + + (unless (file-directory-p minitest-emacs-src-dir) + (shell-command + (format "git clone %s %s" minitest-emacs-repo minitest-emacs-src-dir))) + + (add-to-list 'load-path minitest-emacs-src-dir) + (require 'minitest) +#+end_src + +**** haml mode + +#+begin_src emacs-lisp + (package-install 'haml-mode) +#+end_src + + ** Dev Docs #+begin_src emacs-lisp (package-install 'devdocs) #+end_src + +** [[info:flymake#Top][Flymake]] + +#+begin_src emacs-lisp + (define-key flymake-mode-map (kbd "M-n") 'flymake-goto-next-error) + (define-key flymake-mode-map (kbd "M-p") 'flymake-goto-prev-error) +#+end_src + * Projects :PROPERTIES: :header-args:emacs-lisp: :noweb-ref projects :noweb-sep "\n\n" :results silent |