General cleanup + refactor

This commit is contained in:
Henrik Lissner 2016-05-11 05:36:49 -04:00
parent c427842a04
commit 91a87e7ee1
14 changed files with 74 additions and 76 deletions

View file

@ -7,7 +7,7 @@
(use-package toml-mode :mode "\\.toml$")
(use-package yaml-mode :mode "\\.ya?ml$"
:config (def-electric! yaml-mode :chars (?\n ?: ?-)))
:config (def-electric! yaml-mode :chars (?\n ?\: ?\-)))
(use-package json-mode :mode "\\.js\\(on\\|hintrc\\)$"
:config (def-electric! json-mode :chars (?\n ?: ?{ ?})))

View file

@ -30,38 +30,38 @@
;; Real go-to-definition for elisp
(map! :map emacs-lisp-mode-map :m "gd" 'narf/elisp-find-function-at-pt)
(font-lock-add-keywords
'emacs-lisp-mode `(("(\\(lambda\\)"
(1 (narf/show-as )))
;; Highlight narf macros (macros are fontified in emacs 25+)
(,(concat
"(\\(def-"
(regexp-opt '("electric" "project-type" "company-backend"
"builder" "repl" "textobj" "tmp-excmd" "rotate"
"repeat" "yas-mode" "env-command" "docset"))
"!\\)")
(1 font-lock-keyword-face append))
(,(concat
"(\\("
(regexp-opt '("λ" "in" "map" "after" "shut-up" "add-hook"
"associate" "open-with" "define-org-link"
"define-org-section"))
"!\\)")
(1 font-lock-keyword-face append))
;; Ert
(,(concat
"("
(regexp-opt '("ert-deftest") t)
" \\([^ ]+\\)")
(1 font-lock-keyword-face)
(2 font-lock-function-name-face))))
(remove-hook 'emacs-lisp-mode-hook 'narf/elisp-init))
(add-hook 'emacs-lisp-mode-hook 'narf/elisp-hook)
(defun narf/elisp-hook ()
(setq mode-name "Elisp") ; [pedantry intensifies]
(font-lock-add-keywords
nil `(("(\\(lambda\\)"
(1 (narf/show-as )))
;; Highlight narf macros (macros are fontified in emacs 25+)
(,(concat
"(\\(def-"
(regexp-opt '("electric" "project-type" "company-backend"
"builder" "repl" "textobj" "tmp-excmd" "rotate"
"repeat" "yas-mode" "env-command" "docset"))
"!\\)")
(1 font-lock-keyword-face append))
(,(concat
"(\\("
(regexp-opt '("λ" "in" "map" "after" "shut-up" "add-hook"
"associate" "open-with" "define-org-link"
"define-org-section"))
"!\\)")
(1 font-lock-keyword-face append))
;; Ert
(,(concat
"("
(regexp-opt '("ert-deftest") t)
" \\([^ ]+\\)")
(1 font-lock-keyword-face)
(2 font-lock-function-name-face))))
(add-hook 'before-save-hook 'delete-trailing-whitespace nil t)
(add-hook 'after-save-hook 'narf/elisp-auto-compile nil t)

View file

@ -67,8 +67,7 @@
(use-package nose
:commands nose-mode
:preface (defvar nose-mode-map (make-sparse-keymap))
:init
(associate! nose-mode :match "/test_.+\\.py$" :in (python-mode))
:init (associate! nose-mode :match "/test_.+\\.py$" :in (python-mode))
:config
(def-yas-mode! 'nose-mode)
(map! :map nose-mode-map

View file

@ -4,7 +4,7 @@
:mode ("\\.rb$" "\\.rake$" "\\.gemspec$" "\\.?pryrc$"
"/\\(Gem\\|Cap\\|Vagrant\\|Rake\\)file$")
:interpreter "ruby"
:init (add-hook! ruby-mode '(flycheck-mode yard-mode))
:init (add-hook 'ruby-mode-hook 'flycheck-mode)
:config
(def-builder! ruby-mode "rake %s" "Rakefile")
(def-company-backend! ruby-mode (dabbrev-code))
@ -42,7 +42,9 @@
(refactor-convert-post-conditional "convert post conditional" t))))
;; Highlight doc comments
(use-package yard-mode :commands yard-mode)
(use-package yard-mode
:commands yard-mode
:init (add-hook 'ruby-mode-hook 'yard-mode))
(use-package rspec-mode
:mode ("/\\.rspec$" . text-mode)

View file

@ -14,9 +14,8 @@
:preface
(setq racer-cmd (concat narf-ext-dir "/racer")
racer-rust-src-path (concat narf-ext-dir "/rust/src/"))
:when (file-exists-p racer-cmd)
:init
(add-hook! rust-mode '(racer-mode eldoc-mode flycheck-rust-setup))
:when (f-exists? racer-cmd)
:init (add-hook! rust-mode '(racer-mode eldoc-mode flycheck-rust-setup))
:config
;; TODO Unit test keybinds
(def-company-backend! rust-mode (racer))

View file

@ -55,6 +55,7 @@
:mode ("\\.p?html?$"
"\\.\\(tpl\\|blade\\)\\(\\.php\\)?$"
"\\.erb$"
"\\.jsp$"
"\\.as[cp]x$"
"\\.mustache$"
"wp-content/themes/.+/.+\\.php$")
@ -85,7 +86,11 @@
:nv "]T" 'web-mode-element-child
:nv "[T" 'web-mode-element-parent))
;;
;; Tools
;;
(use-package emmet-mode
:commands (emmet-mode)
:init
@ -98,7 +103,11 @@
:i "M-e" 'emmet-expand-yas
:i "M-E" 'emmet-expand-line))
;;
;; Project types
;;
(def-project-type! jekyll ":{"
:modes (web-mode scss-mode html-mode markdown-mode yaml-mode)
:match "/\\(\\(css\\|_\\(layouts\\|posts\\|sass\\)\\)/.+\\|.+.html\\)$"
@ -112,7 +121,5 @@
:match "/wp-\\(\\(content\\|admin\\|includes\\)/\\)?.+$"
:files ("wp-config.php" "wp-content/"))
;; TODO Add stylus-mode
(provide 'module-web)
;;; module-web.el ends here