General refactor & cleanup, across the board

This commit is contained in:
Henrik Lissner 2019-09-13 21:59:03 -04:00
parent 4ddc5c194b
commit 2d365619cd
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
35 changed files with 141 additions and 155 deletions

View file

@ -56,9 +56,10 @@
"b" #'omnisharp-unit-test-buffer)))
;;;###package shader-mode
(when (featurep! +unity)
;; `shader-mode' --- unity shaders
(add-to-list 'auto-mode-alist '("\\.shader$" . shader-mode))
;; Unity shaders
(add-to-list 'auto-mode-alist '("\\.shader\\'" . shader-mode))
(def-project-mode! +csharp-unity-mode
:modes '(csharp-mode shader-mode)

View file

@ -32,18 +32,6 @@
(when (featurep! +lsp)
(add-hook 'elixir-mode-local-vars-hook #'lsp!))
(use-package! alchemist-company
:when (featurep! :completion company)
:commands alchemist-company
:init
(set-company-backend! 'elixir-mode '(alchemist-company company-yasnippet))
:config
;; Alchemist doesn't use hook symbols to add these backends, so we have to
;; use the entire closure to get rid of it.
(let ((fn (byte-compile (lambda () (add-to-list (make-local-variable 'company-backends) 'alchemist-company)))))
(remove-hook 'alchemist-mode-hook fn)
(remove-hook 'alchemist-iex-mode-hook fn)))
(use-package! flycheck-credo
:when (featurep! :tools flycheck)
:config (flycheck-credo-setup)))
@ -51,9 +39,24 @@
(use-package! alchemist
:hook (elixir-mode . alchemist-mode)
:init
(after! elixir-mode
(set-lookup-handlers! 'elixir-mode
:definition #'alchemist-goto-definition-at-point
:documentation #'alchemist-help-search-at-point)
(set-eval-handler! 'elixir-mode #'alchemist-eval-region)
(set-repl-handler! 'elixir-mode #'alchemist-iex-project-run)))
(use-package! alchemist-company
:when (featurep! :completion company)
:commands alchemist-company
:init
(after! elixir-mode
(set-company-backend! 'elixir-mode '(alchemist-company company-yasnippet)))
:config
(set-lookup-handlers! 'elixir-mode
:definition #'alchemist-goto-definition-at-point
:documentation #'alchemist-help-search-at-point)
(set-eval-handler! 'elixir-mode #'alchemist-eval-region)
(set-repl-handler! 'elixir-mode #'alchemist-iex-project-run))
;; Alchemist doesn't use hook symbols to add these backends, so we have to use
;; the entire closure to get rid of it.
(let ((fn (byte-compile (lambda () (add-to-list (make-local-variable 'company-backends) 'alchemist-company)))))
(remove-hook 'alchemist-mode-hook fn)
(remove-hook 'alchemist-iex-mode-hook fn)))

View file

@ -1,8 +1,5 @@
;;; lang/elm/config.el -*- lexical-binding: t; -*-
;; `elm-mode'
(setq elm-format-on-save t)
(after! elm-mode
(add-hook 'elm-mode-hook #'rainbow-delimiters-mode)

View file

@ -1,9 +1,9 @@
;;; lang/erlang/config.el -*- lexical-binding: t; -*-
(use-package! erlang
:mode ("\\.erlang$" . erlang-mode)
:mode ("/rebar\\.config\\(?:\\.script\\)?$" . erlang-mode)
:mode ("/\\(?:app\\|sys\\)\\.config$" . erlang-mode))
:mode ("\\.erlang\\'" . erlang-mode)
:mode ("/rebar\\.config\\(?:\\.script\\)?\\'" . erlang-mode)
:mode ("/\\(?:app\\|sys\\)\\.config\\'" . erlang-mode))
(use-package! flycheck-rebar3

View file

@ -1,7 +1,7 @@
;;; lang/go/config.el -*- lexical-binding: t; -*-
;;
;; Packages
;;; Packages
(after! go-mode
(set-docsets! 'go-mode "Go")
@ -59,8 +59,8 @@
(use-package! company-go
:when (and (featurep! :completion company)
(not (featurep! +lsp)))
:when (featurep! :completion company)
:unless (featurep! +lsp)
:after go-mode
:config
(set-company-backend! 'go-mode 'company-go)

View file

@ -1,6 +1,6 @@
;;; lang/julia/config.el -*- lexical-binding: t; -*-
(use-package julia-mode
(use-package! julia-mode
:interpreter "julia"
:config
(set-repl-handler! 'julia-mode #'+julia/repl)

View file

@ -10,7 +10,7 @@
:desc "gradlew build" "b" (λ! (+kotlin/run-gradlew "build"))
:desc "gradlew test" "t" (λ! (+kotlin/run-gradlew "test"))))
(use-package! flycheck-kotlin
:when (featurep! :tools flycheck)
:after kotlin-mode
:config (add-hook 'kotlin-mode-hook #'flycheck-kotlin-setup))
:hook (kotlin-mode . flycheck-kotlin-setup))

View file

@ -1,14 +1,14 @@
;;; lang/ledger/config.el -*- lexical-binding: t; -*-
;; `ledger-mode'
;;;###package ledger-mode
(setq ledger-clear-whole-transactions 1)
(defun +ledger*check-version (orig-fn)
(defadvice! +ledger--check-version-a (orig-fn)
"Fail gracefully if ledger binary isn't available."
:around #'ledger-check-version
(if (executable-find ledger-binary-path)
(funcall orig-fn)
(message "Couldn't find '%s' executable" ledger-binary-path)))
(advice-add #'ledger-check-version :around #'+ledger*check-version)
;; Restore leader key in ledger reports
(map! :after ledger-mode
@ -51,7 +51,8 @@
(:prefix "g"
"s" #'ledger-display-ledger-stats
"b" #'ledger-display-balance-at-point))
;; Fix inaccurate keybind message
(defun +ledger*fix-key-help (&rest _)
(message "q to quit; gr to redo; RET to edit; C-c C-s to save"))
(advice-add #'ledger-report :after #'+ledger*fix-key-help))
(defadvice! +ledger--fix-key-help-a (&rest _)
"Fix inaccurate keybind message."
:after #'ledger-report
(message "q to quit; gr to redo; RET to edit; C-c C-s to save")))

View file

@ -1,14 +1,14 @@
;;; lang/nim/config.el -*- lexical-binding: t; -*-
(after! nim-mode
(defun +nim|init-nimsuggest-mode ()
"Conditionally load `nimsuggest-mode', instead of clumsily erroring out if
(add-hook! 'nim-mode-hook
(defun +nim-init-nimsuggest-mode-h ()
"Conditionally load `nimsuggest-mode', instead of clumsily erroring out if
nimsuggest isn't installed."
(unless (stringp nimsuggest-path)
(setq nimsuggest-path (executable-find "nimsuggest")))
(when (and nimsuggest-path (file-executable-p nimsuggest-path))
(nimsuggest-mode)))
(add-hook 'nim-mode-hook #'+nim|init-nimsuggest-mode)
(unless (stringp nimsuggest-path)
(setq nimsuggest-path (executable-find "nimsuggest")))
(when (and nimsuggest-path (file-executable-p nimsuggest-path))
(nimsuggest-mode))))
(when IS-WINDOWS
;; TODO File PR/report upstream (https://github.com/nim-lang/nim-mode)

View file

@ -28,20 +28,20 @@
(use-package! utop
:when (featurep! :tools eval)
:hook (tuareg-mode . +ocaml|init-utop)
:hook (tuareg-mode . +ocaml-init-utop-h)
:init
(set-repl-handler! 'tuareg-mode #'utop)
(set-eval-handler! 'tuareg-mode #'utop-eval-region)
(defun +ocaml|init-utop ()
(defun +ocaml-init-utop-h ()
(when (executable-find "utop")
(utop-minor-mode)))))
(use-package! merlin
:unless (featurep! +lsp)
:hook (tuareg-mode . +ocaml|init-merlin)
:hook (tuareg-mode . +ocaml-init-merlin-h)
:init
(defun +ocaml|init-merlin ()
(defun +ocaml-init-merlin-h ()
"Activate `merlin-mode' if the ocamlmerlin executable exists."
(when (executable-find "ocamlmerlin")
(merlin-mode)))
@ -62,9 +62,9 @@
(use-package! flycheck-ocaml
:when (featurep! :tools flycheck)
:hook (merlin-mode . +ocaml|init-flycheck)
:hook (merlin-mode . +ocaml-init-flycheck-h)
:config
(defun +ocaml|init-flycheck ()
(defun +ocaml-init-flycheck-h ()
"Activate `flycheck-ocaml` if the current project possesses a .merlin file."
(when (projectile-locate-dominating-file default-directory ".merlin")
;; Disable Merlin's own error checking
@ -90,9 +90,9 @@
(use-package! ocp-indent
;; must be careful to always defer this, it has autoloads that adds hooks
;; which we do not want if the executable can't be found
:hook (tuareg-mode . +ocaml|init-ocp-indent)
:hook (tuareg-mode . +ocaml-init-ocp-indent-h)
:config
(defun +ocaml|init-ocp-indent ()
(defun +ocaml-init-ocp-indent-h ()
"Run `ocp-setup-indent', so long as the ocp-indent binary exists."
(when (executable-find "ocp-indent")
(ocp-setup-indent))))
@ -101,12 +101,12 @@
(use-package! ocamlformat
:when (featurep! :editor format)
:commands ocamlformat
:hook (tuareg-mode . +ocaml|init-ocamlformat)
:hook (tuareg-mode . +ocaml-init-ocamlformat-h)
:config
(set-formatter! 'ocamlformat #'ocamlformat
:modes '(caml-mode tuareg-mode))
;; TODO Fix region-based formatting support
(defun +ocaml|init-ocamlformat ()
(defun +ocaml-init-ocamlformat-h ()
(setq +format-with 'ocp-indent)
(when (and (executable-find "ocamlformat")
(locate-dominating-file default-directory ".ocamlformat"))

View file

@ -31,7 +31,7 @@
(+org-present--make-invisible (match-beginning 1) (match-end 1)))))
;;;###autoload
(defun +org-present|remove-overlays ()
(defun +org-present-remove-overlays-h ()
(mapc #'delete-overlay +org-present--overlays)
(remove-from-invisibility-spec '(+org-present)))
@ -66,7 +66,7 @@
(text-scale-set 0)
(org-remove-latex-fragment-image-overlays)
(set-face-attribute 'org-level-2 nil :height 1.0)
(+org-present|remove-overlays)
(+org-present-remove-overlays-h)
(org-remove-inline-images)))))

View file

@ -24,14 +24,3 @@ ignore the cache."
(require 'json)
(json-read-file package-file)))
(puthash project-root data +php-composer-conf))))))
;;;###autoload
(defun +php|init-ac-php-core-eldoc ()
"Initialize eldoc support for `php-mode' with `ac-php-core'. Fails gracefully
if phpctags isn't installed."
(require 'ac-php-core)
(cond ((not ac-php-ctags-executable))
((not (file-exists-p ac-php-ctags-executable))
(message "Could not find phpctags executable, eldoc support is disabled")
(message "To disable these warnings, set ac-php-ctags-executable to nil"))
((ac-php-core-eldoc-setup))))

View file

@ -14,17 +14,12 @@
:after plantuml-mode
:config (flycheck-plantuml-setup))
;;
;; 1. Add `:cmdline -charset utf-8' to org-src-block:plantuml
;;
;; 2. Fix `@start' prefix execute error
;; When `C-c C-c' is executed in org-src-block:plantuml, if the code starts with
;; `@', execution will go wrong. Must be preceded by `\' or `,' to execute
;; normally. This code is automatically added `\' before `@start' when `C-c C-c'
;; is executed, so that the execution can be carried out normally.
;;
(after! ob-plantuml
(defadvice! +plantuml--fix-atstart-in-org-src-blocks-a (args)
"Fix error when executing plantuml src blocks in org-mode for code that
begins with '@'. This character needs to be escaped with a backslash or comma
for the block to execute correctly, so we do it automatically."
:filter-args #'org-babel-execute:plantuml
(cl-destructuring-bind (body params) args
(let* ((origin-body body)
@ -34,5 +29,6 @@
"\\\\\\1"
origin-body)))
(list fix-body params))))
(add-to-list 'org-babel-default-header-args:plantuml
'(:cmdline . "-charset utf-8")))

View file

@ -19,7 +19,6 @@
(add-hook! 'racket-mode-hook
#'rainbow-delimiters-mode
#'highlight-quoted-mode)
(set-lookup-handlers! 'racket-mode :definition #'racket-visit-definition)
(map! :map (racket-mode-map racket-repl-mode-map)
:i "[" #'racket-smart-open-bracket)

View file

@ -11,12 +11,12 @@
(setq-hook! 'restclient-mode-hook
imenu-generic-expression '((nil "^[A-Z]+\s+.+" 0)))
;; Forces underlying SSL verification to prompt for self-signed or invalid
;; certs, rather than silently reject them.
(defun +rest*permit-self-signed-ssl (orig-fn &rest args)
(defadvice! +rest--permit-self-signed-ssl-a (orig-fn &rest args)
"Forces underlying SSL verification to prompt for self-signed or invalid
certs, rather than silently reject them."
:around #'restclient-http-do
(let (gnutls-verify-error tls-checktrust)
(apply orig-fn args)))
(advice-add #'restclient-http-do :around #'+rest*permit-self-signed-ssl)
(map! :map restclient-mode-map
:n [return] #'+rest/dwim-at-point

View file

@ -1,16 +1,16 @@
;;; lang/ruby/config.el -*- lexical-binding: t; -*-
;;
;; Packages
;;; Packages
(use-package! enh-ruby-mode
:mode ("\\.\\(?:pry\\|irb\\)rc\\'" . +ruby|init)
:mode ("\\.\\(?:rb\\|rake\\|rabl\\|ru\\|builder\\|gemspec\\|jbuilder\\|thor\\)\\'" . +ruby|init)
:mode ("/\\(?:Berks\\|Cap\\|Gem\\|Guard\\|Pod\\|Puppet\\|Rake\\|Thor\\|Vagrant\\)file\\'" . +ruby|init)
:mode ("\\.\\(?:pry\\|irb\\)rc\\'" . +ruby-init-h)
:mode ("\\.\\(?:rb\\|rake\\|rabl\\|ru\\|builder\\|gemspec\\|jbuilder\\|thor\\)\\'" . +ruby-init-h)
:mode ("/\\(?:Berks\\|Cap\\|Gem\\|Guard\\|Pod\\|Puppet\\|Rake\\|Thor\\|Vagrant\\)file\\'" . +ruby-init-h)
:preface
(after! ruby-mode
(require 'enh-ruby-mode))
(defun +ruby|init ()
(defun +ruby-init-h ()
"Enable `enh-ruby-mode' if ruby is available, otherwise `ruby-mode'."
(if (executable-find "ruby")
(enh-ruby-mode)
@ -33,11 +33,11 @@
(use-package! robe
:defer t
:init
(defun +ruby|init-robe-mode-maybe ()
"Start `robe-mode' if `lsp-mode' isn't active."
(unless (bound-and-true-p lsp-mode)
(robe-mode +1)))
(add-hook 'enh-ruby-mode-hook #'+ruby|init-robe-mode-maybe)
(add-hook! 'enh-ruby-mode-hook
(defun +ruby-init-robe-mode-maybe-h ()
"Start `robe-mode' if `lsp-mode' isn't active."
(unless (bound-and-true-p lsp-mode)
(robe-mode +1))))
:config
(set-repl-handler! 'enh-ruby-mode #'robe-start)
(set-company-backend! 'enh-ruby-mode 'company-robe)
@ -76,7 +76,7 @@
;;
;; Package & Ruby version management
;;; Package & Ruby version management
(use-package! rake
:defer t
@ -111,7 +111,7 @@
;;
;; Testing frameworks
;;; Testing frameworks
(use-package! rspec-mode
:mode ("/\\.rspec\\'" . text-mode)

View file

@ -5,7 +5,8 @@
;; indent block comments to first asterix, not second
scala-indent:use-javadoc-style t)
(setq-hook! 'scala-mode-hook comment-line-break-function #'+scala-comment-indent-new-line)
(setq-hook! 'scala-mode-hook
comment-line-break-function #'+scala-comment-indent-new-line)
(after! dtrt-indent
(add-to-list 'dtrt-indent-hook-mapping-list '(scala-mode c/c++/java scala-indent:step)))

View file

@ -3,7 +3,7 @@
;;
;; Packages
;; `solidity-mode'
;;;###package solidity-mode
(setq solidity-comment-style 'slash)
@ -22,5 +22,5 @@
:when (featurep! :completion company)
:after solidity-mode
:config
(setq company-backends (delq 'company-solidity company-backends))
(delq! 'company-solidity company-backends)
(set-company-backend! 'solidity-mode 'company-solidity))

View file

@ -5,15 +5,15 @@
(use-package! flycheck-swift
:when (and (featurep! :tools flycheck)
(not (featurep! +lsp)))
:when (featurep! :tools flycheck)
:unless (featurep! +lsp)
:after swift-mode
:config (flycheck-swift-setup))
(use-package! company-sourcekit
:when (and (featurep! :completion company)
(not (featurep! +lsp)))
:when (featurep! :completion company)
:unless (featurep! +lsp)
:after swift-mode
:config
(set-company-backend! 'swift-mode '(company-sourcekit company-yasnippet)))

View file

@ -1,12 +1,11 @@
;;; lang/lua/config.el -*- lexical-binding: t; -*-
;;
;; Major modes
;;; Major modes
(use-package! terra-mode
:defer t
:config
(set-lookup-handlers! 'terra-mode :documentation 'terra-search-documentation)
(after! terra-mode
(set-lookup-handlers! 'terra-mode
:documentation #'terra-search-documentation)
(set-electric! 'terra-mode :words '("else" "end"))
(set-repl-handler! 'terra-mode #'+terra/open-repl)
(set-company-backend! 'terra-mode '(company-lua company-yasnippet)))

View file

@ -1,7 +1,8 @@
;;; lang/web/+css.el -*- lexical-binding: t; -*-
;; An improved newline+continue comment function
(setq-hook! css-mode comment-indent-function #'+css/comment-indent-new-line)
(setq-hook! css-mode
comment-indent-function #'+css/comment-indent-new-line)
(map! :map (css-mode-map scss-mode-map less-css-mode-map)
:localleader

View file

@ -1,19 +1,19 @@
;;; lang/web/+html.el -*- lexical-binding: t; -*-
(use-package! web-mode
:mode "\\.p?html?$"
:mode "\\.\\(?:tpl\\|blade\\)\\(\\.php\\)?$"
:mode "\\.erb$"
:mode "\\.jsp$"
:mode "\\.as[cp]x$"
:mode "\\.hbs$"
:mode "\\.mustache$"
:mode "\\.tsx$"
:mode "\\.vue$"
:mode "\\.twig$"
:mode "\\.jinja$"
:mode "wp-content/themes/.+/.+\\.php$"
:mode "templates/.+\\.php$"
:mode "\\.p?html?\\'"
:mode "\\.\\(?:tpl\\|blade\\)\\(?:\\.php\\)?\\'"
:mode "\\.erb\\'"
:mode "\\.jsp\\'"
:mode "\\.as[cp]x\\'"
:mode "\\.hbs\\'"
:mode "\\.mustache\\'"
:mode "\\.tsx\\'"
:mode "\\.vue\\'"
:mode "\\.twig\\'"
:mode "\\.jinja\\'"
:mode "wp-content/themes/.+/.+\\.php\\'"
:mode "templates/.+\\.php\\'"
:config
(set-docsets! 'web-mode "HTML" "CSS" "Twig" "WordPress")

View file

@ -19,7 +19,7 @@
;;
;; Framework-based minor-modes
;;; Framework-based minor-modes
(def-project-mode! +web-jekyll-mode
:modes '(web-mode js-mode coffee-mode css-mode haml-mode pug-mode)