ãã®è¨äºã¯ã¨ã ã¹ãªã¼ Advent Calendar 2018 ã®16æ¥ç®ã®è¨äºã§ãã
ããã«ã¡ã¯ãã¨ã³ã¸ãã¢ãªã³ã°ã°ã«ã¼ãæ°å1å¹´ç®ã®éæ¨ã§ããã¯ã©ã¦ãé»åã«ã«ããM3 DigiKarãã®éçºã«æºãã£ã¦ãã¾ããWe are hiring!!
ä»åã¯ç§ã®ãã¼ã ãéçºãã¦ããWebãµã¼ãã¹ãM3 DigiKarãã® Emacs ã§ã®éçºæ¹æ³ãç´¹ä»ãã¾ãã
- ã¯ããã«
- å ±éè¨å®
- JavaScript ã®è¨å®
- Ruby on Rails ã®è¨å®
- ãã®ä»ã®è¨å®
- ãããã«
- WE NEED YOU!
ã¯ããã«
ãM3 DigiKarã㯠JavaScript
ãRuby on Rails
çãç¨ãã¦éçºããã¦ãã¾ãããã®ããä»åã®è¨äºã§ã¯ããããã®è¨èªã«é¢ãã¦ãSyntax CheckãLinterãè£å®ãå®ç¾©åç
§ãSpell Checkãçã®æ©è½ã Emacs ã§ã©ã®ããã«è¨å®ãã¦ããããç´¹ä»ãããã¨ã¨ãã¾ãã
å ±éè¨å®
ã¾ãè¨èªã«ãããæç¨ã§ããã package ããã®è¨å®ãç´¹ä»ãã¾ãã
æ¤ç´¢ã»è£å®ã»å®ç¾©åç §
ãã¯ãæ¤ç´¢ãè£å®ãå®ç¾©åç §ãå¹ããªãã¨ä¸æµã®ã¨ãã£ã¿ã¨ã¯è¨ãã¾ãããï¼cf. Emacsã®è£å®&æ¤ç´¢ãè¶ å¼·åããï¼
company.el
ãããã¨ãããEmacsã®ã¤ã³ããªã»ã³ã¹ç¨ package ã®å¤§å¾¡æã§ãã3rd party 製㮠package éçºãçãã§ãLSPï¼Language Server Protocolï¼ãªã©ã¸ã®å¯¾å¿ãé²ãã§ãã¦ãã¾ãã ï¼cf. auto-complete.elï¼
;; 常㫠ON (global-company-mode)
ivy.el & counsel.el & swiper.el
ããããã¤ã³ã¯ãªã¡ã³ã¿ã«ãµã¼ããæ¯æ´ãã¦ããã package ã§ããM-x
ãç¨ããã³ãã³ãã®æ¤ç´¢ã ãã§ãªããC-s
ã«ããæååæ¤ç´¢ã find-file
ãªã©æ§ã
ãªé¨åãã«ãã¼ãã¦ãããè¶
æè½ãª package ãªã®ã§æ¯é使ã£ã¦ã¿ã¦ãã ããï¼
;; counsel: M-x ;; swiper: M-x swiper ;; find-file: C-x C-f (ivy-mode 1)
dumb-jump.el
ã©ã®è¨èªã§ã ããæãã« å®ç¾©ç®æã¾ã§ã³ãã³ãï¼ã¤ã§ã®ç§»åãå¯è½ã«ãã package ã§ããtag
çã®çæãä¸è¦ãªã®ã§ç°¡åã«æ±ãã¾ããéçºå¹çã30%以ä¸ã¯åä¸ããã¨æãã¾ãã
;; å®è¡: M-x dumb-jump-go (setq dumb-jump-mode t)
Syntax Check & Lint
ã³ã³ãã¤ã«ããã CI ã«ããã¦ãã Syntax Error
ã¨ã Lint Error
ã¨ãããæååã«è¾æããã®ã¯å¹çãæªãï¼ã¨ãããã¨ã§ãªã¢ã«ã¿ã¤ã ã® Syntax Cheker ã Linter ã¯å¿
é ã§ãã
flycheck.el
絶対ãããã»ããããã§ã ãåè¨èªãã¨ã«æ¨æºè£ åãããï¼ã¾ã㯠3rd party ãéçºããï¼Syntax Check Program ã Linter ã¨é£æºãã¦ãªã¢ã«ã¿ã¤ã 㧠Warning ã Error ãåãã¦ããã¾ãã
ããã§ã¯è¨å®ã®åºæ¬ã®ãã ãè¨è¼ãã¾ãããJS ã Rails ã§ã®è©³ç´°è¨å®ãå¾è¿°ãã¾ãã
;; èªåèµ·å (setq flycheck-check-syntax-automatically '(save idle-change mode-enabled)) ;; ã³ã¼ãå¤æ´å¾ã3ç§å¾ã«ãã§ãã¯ãã (setq flycheck-idle-change-delay 3)
Spell Check
ã¯ã©ã¦ãé»åã«ã«ãã®éçºä¸ã«ããç´é¢ããåé¡ã¯ ã¿ã¤ã ã§ããå»çå°éç¨èªãå¤ããããæã¡æ £ããªãæååï¼exemptionãredemptionçï¼ãå ¥åããå¿ è¦ãå¤ã ãããã¹ãã«ãã§ãã«ã¼ã«ã¯å¤§å¤ãä¸è©±ã«ãªãã¾ããã
flyspell.el
flycheck ã¨åæ§ã«ãªã¢ã«ã¿ã¤ã ã§ã¹ãã«ãã¹ãè¨æ£ãã¦ãããæè½ package ã§ããã¦ã¼ã¶å®ç¾©ã®è¾æ¸ãã¡ã¤ã«ã®ä½æãå¯è½ãªã®ã§ããããã¯ãç¹æã®åèªã§ãåé¡ãªããã§ãã¯ãã¦ããã¾ãã
;; prog-mode ãªã常㫠ON (add-hook 'prog-mode-hook 'flyspell-mode) ;; ispell ã®å¾ç¶ã§ãã aspell ã使ãã ;; CamelCase ã§ãããæãã« spellcheck ãã¦ãããè¨å®ã追å ;; See: https://stackoverflow.com/a/24878128/8888451 (setq-default ispell-program-name "aspell") (eval-after-load "ispell" '(add-to-list 'ispell-skip-region-alist '("[^\000-\377]+"))) (setq ispell-program-name "aspell" ispell-extra-args '("--sug-mode=ultra" "--lang=en_US" "--run-together" "--run-together-limit=5" "--run-together-min=2"))
Visualize
ã¨ãã£ã¿ãè¦ãã¨ãã«ããããå¤æ´ããã¦ãããããå¤æ°åããããããçã«å³åº§ã«æ°ä»ããã°ããã®åã¹ãã¬ã¹ããªã¼ã«éçºã§ãã¾ãã
git-gutter-plus.el
Git 管çä¸ã® project ã§å¤æ´ç®æã fringe ã§è¡¨ç¤ºãã¦ãããåªããã®ã
;; 常㫠ON (global-git-gutter+-mode 1) ;; modify ãããç®æã§å®è¡ããã¨ãdiff ã inline ã§è¦ããã¨ãã§ãã (global-set-key (kbd "C-x C-v") 'git-gutter+-show-hunk-inline-at-point)
color-identifiers-mode.el
å¤æ°ãã¨ã«è²åãã表示ãã¦ãããã®ã§ãç¹å®å¤æ°ã®ä½¿ç¨ç®æãªã©ãä¸ç®ã§ãããã¾ãã
;; èµ·åå¾ ON ã«ãã (add-hook 'after-init-hook 'global-color-identifiers-mode)
rainbow-delimiters.el
対å¿ããã«ãã³ããã®ã¹ã³ã¼ããã¨ã«è²åããã¦ããã¾ããä¸å¹¸ã«ãã«ãã³ãå¤ããªã£ã¦ãã¾ã£ãã¨ããªã©ã«ä¾¿å©ã
;; prog-mode ã®ã¨ã常㫠ON ã«ãã (add-hook 'prog-mode-hook 'rainbow-delimiters-mode)
JavaScript ã®è¨å®
JavaScriptï¼React ã AngularJSï¼éçºã§ã®ãããã package ããã®è¨å®ãç´¹ä»ãã¾ãã
Mode
React ã AngularJS ï¼ãã㦠Railsï¼ãæ··å¨ãã project ã§ã³ã¼ãã£ã³ã°ããéãé©å㪠mode ãé¸ã¹ã° Syntax Highlight ã Auto Indent ãªã©ã®æ©æµãåãããã¨ãã§ãã¾ããç¹ã« M3 DigiKar 㯠ããã3ã¤ãåæã«æ±ãå¿ è¦ããã ã®ã§ãå¿ é mode ã§ãã
web-mode.el
web-mode 㯠å¤ãã® web template engineï¼ERB, React/JSX, Angularjs, Go Template etcï¼ã«å¯¾å¿ãã¦ãã major mode ã§ããReact 㨠AngularJS ãæ··å¨ãã¦ãã¦ã Emacs å´ã§ããæãã«åãæ±ã£ã¦ãããã®ã§ããªãéå®ãã¾ãã
;; See: https://qiita.com/kwappa/items/6bde1fe2bbeedc85023e ;; .js, .jsx ã web-mode ã§éã (add-to-list 'auto-mode-alist '("\\.js[x]?$" . web-mode)) ;; .js ã§ã JSX ç·¨éã¢ã¼ãã« (defvar web-mode-content-types-alist '(("jsx" . "\\.js[x]?\\'"))) ;; ã³ã¡ã³ãã¢ã¦ãã®è¨å® (add-hook 'web-mode-hook '(lambda () (add-to-list 'web-mode-comment-formats '("jsx" . "//" ))))
Syntax Check & Lint
ã³ã³ãã¤ã«ããã CI ã«ããã¦ãã Syntax Error
ã¨ã Lint Error
ã¨ãããæååã«è¾æããã®ã¯å¹çãæªãï¼ã¨ãããã¨ã§ãªã¢ã«ã¿ã¤ã ã® Syntax Cheker ã Linter ã¯å¿
é ã§ããï¼æ¬æ¥äºåº¦ç®ï¼
flycheck.el
M3 DigiKar ã§ã¯ Linter ã¨ã㦠eslint
ããåãã§ãã¯ã¨ã㦠flowtype
ãå°å
¥ãã¦ããã®ã§ããããããªã¢ã«ã¿ã¤ã ã«ãã§ãã¯ãã¾ãã
;; eslint ç¨ã® linter ãç»é² (flycheck-add-mode 'javascript-eslint 'web-mode) ;; flowtype ç¨ã® linter ãç»é² (flycheck-add-mode 'javascript-eslint 'web-mode) ;; ä½æ¥ãã¦ãã project ã® node-module ãã¿ã¦ãé©åã« ;; linter ã®è¨å®ãèªã¿è¾¼ã (eval-after-load 'web-mode '(add-hook 'web-mode-hook #'add-node-modules-path))
Others
ãã®ä»ãéçºã§ã¡ãã£ã¨å½¹ç«ã¤ package ã§ãã
eslint-auto.el
éãã¦ãã buffer ã«å¯¾ã㦠eslint --fix
ï¼Lint Error ã®èªåä¿®æ£ï¼ãéåæã§å®è¡ãã¦ããã¾ãã
;; å®è¡: M-x eslint-fix-file (defun eslint-fix-file () (interactive) (call-process-shell-command (mapconcat 'shell-quote-argument (list "eslint" "--fix" (buffer-file-name)) " ") nil 0)) ;; å®è¡å¾ãbuffer ã revert ãã ;; å®è¡: M-x eslint-fix-file-and-revert (defun eslint-fix-file-and-revert () (interactive) (eslint-fix-file) (revert-buffer t t))
Ruby on Rails ã®è¨å®
Ruby on Rails éçºã§ã®ãããã package ããã®è¨å®ãç´¹ä»ãã¾ãã
Mode
ruby-mode
ã¯å½ç¶ã¨ãã¦ãrails
ç¹æã® Syntax Highlight ã Snippet ãå¹çããå©ç¨ãããã®ã§ãããæãã® Minor Mode ãè¨å®ãã¾ãã
rspec-mode.el & rinari.el
;; ruby-mode æã« rinari-minor-mode ãçºç«ããã (require 'rinari) (add-hook 'ruby-mode-hook 'rinari-minor-mode) ;; rspec-mode ç¨ã® snippet ãèªèããã (eval-after-load 'rspec-mode '(rspec-install-snippets))
Syntax Check & Lint
ã³ã³ãã¤ã«ããã CI ã«ããã¦ãã Syntax Error
ã¨ã Lint Error
ã¨ãããæååã«è¾æããã®ã¯å¹çãæªãï¼ã¨ãããã¨ã§ãªã¢ã«ã¿ã¤ã ã® Syntax Cheker ã Linter ã¯å¿
é ã§ããï¼æ¬æ¥ä¸åº¦ç®ï¼
flycheck.el
ruby ã® Syntax Checker & Linter ã ã£ãã rubocop
ä¸æã§ãã®ã§ãããã flycheck
ã¨é£æºããã¾ãã
;; flycheck 㨠rubocop ãé£æºããã (require 'rubocop) (add-hook 'ruby-mode-hook 'rubocop-mode) (add-hook 'ruby-mode-hook '(lambda () (setq flycheck-checker 'ruby-rubocop))) ;; See: https://qiita.com/watson1978/items/debafdfc49511fb173e9 ;; ç¬èªã« checker ãå®ç¾©ããï¼ã好ã¿ã§ï¼ (flycheck-define-checker ruby-rubocop "A Ruby syntax and style checker using the RuboCop tool." :command ("rubocop" "--format" "emacs" (config-file "--config" flycheck-rubocoprc) source) :error-patterns ((warning line-start (file-name) ":" line ":" column ": " (or "C" "W") ": " (message) line-end) (error line-start (file-name) ":" line ":" column ": " (or "E" "F") ": " (message) line-end)) :modes (ruby-mode motion-mode))
Others
ãã®ä»ãRails éçºã§ã¡ãã£ã¨å½¹ç«ã¤ package ã®ç´¹ä»ã§ãã
rubocop-fix-file.el
eslint-auto.elã® rubocop
çã§ããå¿
è¦ã«é§ããã¦ä½ãã¾ããã
;; M-x rubocop-fix-file (add-to-list 'load-path "/path/to/rubocop-fix-file") (require 'rubocop-fix-file)
inf-ruby.el
Ruby ã®ããã»ã¹ã¨æ¥ç¶ãã REPL buffer ãæä¾ãã packageããã£ã¨æ¸ãã¦ããã£ã¨å®è¡ããã®ã«ä¾¿å©ã
;; rubyãã® code-block ãç¯å²é¸æã㦠M-x ruby-send-block-and-go (add-hook 'ruby-mode-hook 'inf-ruby-minor-mode)
ãã®ä»ã®è¨å®
ãã®ä»ãä¸è¬çã§ã¯ãªãããããã¾ãããéçºã§ä½¿ç¨ãã¦ãã便å©ãª package ãè¨å®ãç´¹ä»ãã¾ããã
emacs-presentation-mode.el
æ®æ®µã® font-size 㯠10pt ããããªãã§ãããããã ã¨ååã¨ã³ã¼ããè¦ãªããç¸è«ããè¾ãã®ã§ãæåãµã¤ãºã大ãããã¦ããå¿ è¦ãããã¾ãããã® package ã¯ å ¨ã¦ã® buffer ã§æåãµã¤ãºãæ¡å¤§ ãã¦ãããã®ã§å¤§å¤ãããããã§ãã
;; M-x presentation-mode (add-to-list 'load-path "/path/to/emacs-presentation-mode") (require 'presentation)
gitlab-open-mr.el
è¤æ°äººã§éçºãã¦ããã¨ããã®ã³ã¼ããæ¸ãããçµç·¯ãç¥ããããã¨ããå ´é¢ã«å¤ã
åºä¼ãã¾ãããããã£ãã¨ãã«git blame
ã㦠MR ã¿ã¦ GitLab ãéãã¦..... ã¨ããã®ã¯é常ã«å¹çãæªãï¼ ã¨ãããã¨ã§å¿
è¦ã«é§ããã¦ä½ãã¾ãããï¼cf. GitLabã§ãCommit Hashãã該å½MRãè¦ã¤ãããï¼
;; vc-annotate å®è¡å¾ã«è©²å½è¡ã§ M-x gitlab-open-mr (defun gitlab-open-mr () (interactive) (let* ((rev-at-line (vc-annotate-extract-revision-at-line)) (rev (car rev-at-line))) (shell-command (mapconcat 'shell-quote-argument (list "gitlab-mr-from-commit" rev) " "))))
rspec-on-iterm.el & spec-jump.el
Rspec ãå®è¡ããã¨ãã«ãä¸ã æå®ãããã¡ã¤ã«åãæã£ã¦å®è¡ããè¡ãæ¸ãã¦......ã¨ããããModel ãã¡ã¤ã«ãã Spec ãã¡ã¤ã«ãæ¢ããã.....ã¨ããã®ã¯äºæ«ã§ããã¹ãã¬ã¹ã ã£ãã®ã§å¿ è¦ã«é§ããã¦ä½ãã¾ãããï¼cf. Emacsã§è©²å½ã®specã«ããã¨é£ã³ããï¼
;; M-x send-executable-text-to-iterm ;; M-x copy-executable-text (add-to-list 'load-path "/path/to/rspec-on-iterm") (require 'rspec-on-iterm) ;; M-x spec-jump (add-to-list 'load-path "/path/to/spec-jump") (require 'spec-jump)
ãããã«
ä»å㯠Emacs 㧠JS ã Rails ãå¹ççã«éçºããããã®è¨å®ãç´¹ä»ãã¾ããã ç´¹ä»ãã package ã®æ°ãå¤ããä¸ã¤ä¸ã¤ã®èª¬æãèããªã£ã¦ãã¾ã£ãã®ãæãã¾ãã¾ã.....ï¼
WE NEED YOU!
ã¨ã ã¹ãªã¼ã«ã¯è¨èªããã¬ã¼ã ã¯ã¼ã¯ãDevOps ã ãã§ãªã ã¨ãã£ã¿ã好ããªã¨ã³ã¸ã㢠ãå¤æ°æå±ãã¦ãã¾ãï¼ ãããªå¤ç¨®å¤æ§ãªã¨ã³ã¸ãã¢ãæã£ãç°å¢ã«èå³ãããæ¹ã¯ããã²ãæ°è»½ã«ãé£çµ¡ãã ããï¼