Merge branch 'develop' of https://github.com/hlissner/doom-emacs into develop

This commit is contained in:
Patrick Elliott 2018-06-26 02:19:25 +02:00
commit e5fc8b6c81
81 changed files with 1423 additions and 900 deletions

View file

@ -1,4 +1,4 @@
;;; lang/assembly/autoload.el -*- lexical-binding: t; -*-
;;;###autoload
(map-put auto-mode-alist "\\.hax\\'" 'haxor-mode)
(add-to-list 'auto-mode-alist '("\\.hax\\'" . haxor-mode))

View file

@ -83,35 +83,37 @@ compilation database is present in the project.")
+cc|fontify-constants))
;; Custom style, based off of linux
(map-put c-style-alist "doom"
`((c-basic-offset . ,tab-width)
(c-comment-only-line-offset . 0)
(c-hanging-braces-alist (brace-list-open)
(brace-entry-open)
(substatement-open after)
(block-close . c-snug-do-while)
(arglist-cont-nonempty))
(c-cleanup-list brace-else-brace)
(c-offsets-alist
(statement-block-intro . +)
(knr-argdecl-intro . 0)
(substatement-open . 0)
(substatement-label . 0)
(statement-cont . +)
(case-label . +)
;; align args with open brace OR don't indent at all (if open
;; brace is at eolp and close brace is after arg with no trailing
;; comma)
(arglist-intro . +)
(arglist-close +cc-lineup-arglist-close 0)
;; don't over-indent lambda blocks
(inline-open . 0)
(inlambda . 0)
;; indent access keywords +1 level, and properties beneath them
;; another level
(access-label . -)
(inclass +cc-c++-lineup-inclass +)
(label . 0))))
(unless (assoc "doom" c-style-alist)
(push '("doom"
(c-basic-offset . ,tab-width)
(c-comment-only-line-offset . 0)
(c-hanging-braces-alist (brace-list-open)
(brace-entry-open)
(substatement-open after)
(block-close . c-snug-do-while)
(arglist-cont-nonempty))
(c-cleanup-list brace-else-brace)
(c-offsets-alist
(statement-block-intro . +)
(knr-argdecl-intro . 0)
(substatement-open . 0)
(substatement-label . 0)
(statement-cont . +)
(case-label . +)
;; align args with open brace OR don't indent at all (if open
;; brace is at eolp and close brace is after arg with no trailing
;; comma)
(arglist-intro . +)
(arglist-close +cc-lineup-arglist-close 0)
;; don't over-indent lambda blocks
(inline-open . 0)
(inlambda . 0)
;; indent access keywords +1 level, and properties beneath them
;; another level
(access-label . -)
(inclass +cc-c++-lineup-inclass +)
(label . 0)))
c-style-alist))
;;; Keybindings
;; Disable electric keys because it interferes with smartparens and custom
@ -133,9 +135,6 @@ compilation database is present in the project.")
:when '(+cc-sp-point-is-template-p +cc-sp-point-after-include-p)
:post-handlers '(("| " "SPC"))))
(sp-with-modes '(c-mode c++-mode objc-mode java-mode)
(sp-local-pair "/*" "*/" :post-handlers '(("||\n[i]" "RET") ("| " "SPC")))
;; Doxygen blocks
(sp-local-pair "/**" "*/" :post-handlers '(("||\n[i]" "RET") ("||\n[i]" "SPC")))
(sp-local-pair "/*!" "*/" :post-handlers '(("||\n[i]" "RET") ("[d-1]< | " "SPC")))))

View file

@ -5,14 +5,7 @@
(def-package! clj-refactor
:after clojure-mode
:config
;; setup some extra namespace auto completion for great awesome
(dolist (ns '(("re-frame" . "re-frame.core")
("reagent" . "reagent.core")
("str" . "clojure.string")))
(map-put cljr-magic-require-namespaces (car ns) (cdr ns))))
:after clojure-mode)
(def-package! cider
;; NOTE: if you don't have an org directory set (the dir doesn't exist), cider
@ -23,13 +16,7 @@
(setq nrepl-hide-special-buffers t
cider-stacktrace-default-filters '(tooling dup)
cider-prompt-save-file-on-load nil
cider-repl-use-clojure-font-lock t
;; Setup cider for clojurescript / figwheel dev.
cider-cljs-lein-repl
"(do (require 'figwheel-sidecar.repl-api)
(figwheel-sidecar.repl-api/start-figwheel!)
(figwheel-sidecar.repl-api/cljs-repl))")
cider-repl-use-clojure-font-lock t)
(set-popup-rule! "^\\*cider-repl" :quit nil :select nil)
(set-repl-handler! 'clojure-mode #'+clojure/repl)
(set-eval-handler! 'clojure-mode #'cider-eval-region)

View file

@ -7,9 +7,9 @@
:definition #'crystal-def-jump
:references #'crystal-tool-imp)
(set-eval-handler! 'crystal-mode
'((:command . "crystal")
(:exec . "%c %s")
(:description . "Run Crystal script"))))
'((:command . "crystal")
(:exec . "%c %s")
(:description . "Run Crystal script"))))
(def-package! flycheck-crystal

View file

@ -1,6 +1,7 @@
;;; lang/csharp/config.el -*- lexical-binding: t; -*-
(map-put auto-mode-alist '"\\.shader$" 'dshader-mode) ; unity shaders
;; unity shaders
(add-to-list 'auto-mode-alist '("\\.shader$" . shader-mode))
(def-package! omnisharp

View file

@ -1,10 +1,10 @@
;;; lang/data/config.el -*- lexical-binding: t; -*-
;; Built in plugins
(dolist (spec '(("/sxhkdrc\\'" . conf-mode)
("\\.\\(?:hex\\|nes\\)\\'" . hexl-mode)
("\\.plist\\'" . nxml-mode)))
(map-put auto-mode-alist (car spec) (cdr spec)))
(unless after-init-time
(push '("/sxhkdrc\\'" . conf-mode) auto-mode-alist)
(push '("\\.\\(?:hex\\|nes\\)\\'" . hexl-mode) auto-mode-alist)
(push '("\\.plist\\'" . nxml-mode) auto-mode-alist))
(after! nxml-mode
(set-company-backend! 'nxml-mode '(company-nxml company-yasnippet)))

View file

@ -2,6 +2,9 @@
(def-package! elixir-mode
:defer t
:init
;; disable default smartparens config
(provide 'smartparens-elixir)
:config
;; ...and only complete the basics
(after! smartparens
@ -9,7 +12,6 @@
(sp-local-pair "do" "end"
:when '(("RET" "<evil-ret>"))
:unless '(sp-in-comment-p sp-in-string-p)
:skip-match 'sp-elixir-skip-def-p
:post-handlers '("||\n[i]"))
(sp-local-pair "do " " end" :unless '(sp-in-comment-p sp-in-string-p))
(sp-local-pair "fn " " end" :unless '(sp-in-comment-p sp-in-string-p))))

View file

@ -1,8 +1,8 @@
;;; lang/emacs-lisp/config.el -*- lexical-binding: t; -*-
(def-package! elisp-mode ; built-in
:mode ("/Cask$" . emacs-lisp-mode)
:config
(add-to-list 'auto-mode-alist '("\\.Cask\\'" . emacs-lisp-mode))
(defun +emacs-lisp|init ()
(set-repl-handler! 'emacs-lisp-mode #'+emacs-lisp/repl)
(set-eval-handler! 'emacs-lisp-mode #'+emacs-lisp-eval)
(set-lookup-handlers! 'emacs-lisp-mode :documentation 'info-lookup-symbol)
@ -61,6 +61,8 @@
return t))
(flycheck-mode -1))))
(add-transient-hook! 'emacs-lisp-mode (+emacs-lisp|init))
;;
;; Plugins
@ -74,21 +76,21 @@
;; `macrostep'
(map! :after macrostep
:map macrostep-keymap
:n "RET" #'macrostep-expand
:n "e" #'macrostep-expand
:n "u" #'macrostep-collapse
:n "c" #'macrostep-collapse
:n "RET" #'macrostep-expand
:n "e" #'macrostep-expand
:n "u" #'macrostep-collapse
:n "c" #'macrostep-collapse
:n "TAB" #'macrostep-next-macro
:n "n" #'macrostep-next-macro
:n "J" #'macrostep-next-macro
:n [tab] #'macrostep-next-macro
:n "C-n" #'macrostep-next-macro
:n "J" #'macrostep-next-macro
:n "S-TAB" #'macrostep-prev-macro
:n "K" #'macrostep-prev-macro
:n "p" #'macrostep-prev-macro
:n [backtab] #'macrostep-prev-macro
:n "K" #'macrostep-prev-macro
:n "C-p" #'macrostep-prev-macro
:n "q" #'macrostep-collapse-all
:n "C" #'macrostep-collapse-all)
:n "q" #'macrostep-collapse-all
:n "C" #'macrostep-collapse-all)
(after! evil
;; `evil-normalize-keymaps' seems to be required for macrostep or it won't

View file

@ -5,7 +5,7 @@
"/rebar\\.config\\(?:\\.script\\)?$"
;; erlang configs
"/\\(?:app\\|sys\\)\\.config$"))
(map-put auto-mode-alist regexp 'erlang-mode))
(add-to-list 'auto-mode-alist (cons regexp 'erlang-mode)))
(def-package! flycheck-rebar3

View file

@ -31,7 +31,7 @@
("\\.[Jj][Mm][Dd]\\'" . ess-jags-mode))
:init
(unless (featurep! :lang julia)
(map-put auto-mode-alist "\\.jl\'" 'ess-julia-mode))
(add-to-list 'auto-mode-alist '("\\.jl\\'" . ess-julia-mode)))
:config
(add-hook 'ess-mode-hook #'doom|enable-line-numbers)
(setq ess-offset-continued 'straight

View file

@ -2,17 +2,8 @@
;;;###if (featurep! +dante)
(def-package! dante
:after haskell-mode
:hook (haskell-mode . dante-mode)
:config
(add-hook 'haskell-mode-hook #'interactive-haskell-mode))
(def-package! company-ghc
:when (featurep! :completion company)
:after haskell-mode
:init
(add-hook 'haskell-mode-hook #'ghc-comp-init)
:config
(setq company-ghc-show-info 'oneline)
(set-company-backend! 'haskell-mode #'company-ghc))
(when (featurep! :feature syntax-checker)
(add-hook! 'dante-mode-hook
(flycheck-add-next-checker 'haskell-dante '(warning . haskell-hlint)))))

View file

@ -4,9 +4,8 @@
(when (featurep! +dante)
(unless (executable-find "cabal")
(warn! "Couldn't find cabal, haskell-mode may have issues"))
(unless (executable-find "ghc-mod")
(warn! "Couldn't find ghc-mod on PATH. Code completion will not work")))
(unless (executable-find "hlint")
(warn! "Couldn't find hlint. Flycheck may have issues in haskell-mode/")))
(when (featurep! +intero)
(unless (executable-find "stack")

View file

@ -5,9 +5,7 @@
;;
(cond ((featurep! +dante)
(package! dante)
(when (featurep! :completion company)
(package! company-ghc)))
(package! dante))
(t
(package! intero)
(package! hindent)))

View file

@ -17,11 +17,6 @@
;; Other
:yield "import"))
(after! smartparens
(sp-with-modes '(js2-mode typescript-mode rjsx-mode)
(sp-local-pair "/**" "" :post-handlers '(("| " "SPC") ("|\n*/[i][d-2]" "RET")))
(sp-local-pair "/*" "*/" :post-handlers '(("| " "SPC") ("|\n*/[i][d-2]" "RET")))))
;;
;; Major modes
@ -66,7 +61,7 @@
magic-mode-regexp-match-limit t)
(progn (goto-char (match-beginning 1))
(not (sp-point-in-string-or-comment)))))
(map-put magic-mode-alist #'+javascript-jsx-file-p 'rjsx-mode)
(add-to-list 'magic-mode-alist '(+javascript-jsx-file-p . rjsx-mode))
:config
(set-electric! 'rjsx-mode :chars '(?\} ?\) ?. ?>))
(add-hook! 'rjsx-mode-hook
@ -76,7 +71,7 @@
;; `rjsx-electric-gt' relies on js2's parser to tell it when the cursor is in
;; a self-closing tag, so that it can insert a matching ending tag at point.
;; However, the parser doesn't run immediately, so a fast typist can outrun
;; it, causing issues, so force it to parse.
;; it, causing tags to stay unclosed, so force it to parse.
(defun +javascript|reparse (n)
;; if n != 1, rjsx-electric-gt calls rjsx-maybe-reparse itself
(if (= n 1) (rjsx-maybe-reparse)))
@ -134,23 +129,19 @@
:config
(setq tide-completion-detailed t
tide-always-show-documentation t)
;; code completion
(after! company
;; tide affects the global `company-backends', undo this so doom can handle
;; it buffer-locally
(setq-default company-backends (delq 'company-tide (default-value 'company-backends))))
(set-company-backend! 'tide-mode 'company-tide)
;; navigation
(set-lookup-handlers! 'tide-mode
:definition #'tide-jump-to-definition
:references #'tide-references
:documentation #'tide-documentation-at-point)
;; resolve to `doom-project-root' if `tide-project-root' fails
(advice-add #'tide-project-root :override #'+javascript*tide-project-root)
;; cleanup tsserver when no tide buffers are left
(add-hook! 'tide-mode-hook
(add-hook 'kill-buffer-hook #'+javascript|cleanup-tide-processes nil t))

View file

@ -14,6 +14,9 @@
;; Plugins
;;
;; sp's default rules are obnoxious, so disable them
(provide 'smartparens-latex)
(after! tex
;; Set some varibles to fontify common LaTeX commands.
(load! "+fontification")
@ -75,33 +78,30 @@
(setcar (cdr (assoc "Check" TeX-command-list)) "chktex -v6 %s")
;; Set a custom item indentation
(dolist (env '("itemize" "enumerate" "description"))
(map-put LaTeX-indent-environment-list
env '(+latex/LaTeX-indent-item)))
(add-to-list 'LaTeX-indent-environment-list `(,env +latex/LaTeX-indent-item)))
;;
;; Use Okular if the user says so.
(when (featurep! +okular)
;; Configure Okular as viewer. Including a bug fix
;; (https://bugs.kde.org/show_bug.cgi?id=373855)
(map-put TeX-view-program-list
"Okular" '(("okular --unique file:%o" (mode-io-correlate "#src:%n%a"))))
(map-put TeX-view-program-list 'output-pdf '("Okular")))
(add-to-list 'TeX-view-program-list '("Okular" ("okular --unique file:%o" (mode-io-correlate "#src:%n%a"))))
(add-to-list 'TeX-view-program-selection '(output-pdf "Okular")))
;; Or Skim
(when (featurep! +skim)
(map-put TeX-view-program-list
"Skim" '("/Applications/Skim.app/Contents/SharedSupport/displayline -b -g %n %o %b"))
(map-put TeX-view-program-selection 'output-pdf '("Skim")))
(add-to-list 'TeX-view-program-list '("Skim" "/Applications/Skim.app/Contents/SharedSupport/displayline -b -g %n %o %b"))
(add-to-list 'TeX-view-program-selection 'output-pdf '("Skim")))
;; Or Zathura
(when (featurep! +zathura)
(map-put TeX-view-program-selection 'output-pdf '("Zathura")))
(add-to-list 'TeX-view-program-selection '(output-pdf "Zathura")))
;; Or PDF-tools, but only if the module is also loaded
(when (and (featurep! :tools pdf)
(featurep! +pdf-tools))
(map-put TeX-view-program-list "PDF Tools" '("TeX-pdf-tools-sync-view"))
(map-put TeX-view-program-selection 'output-pdf '("PDF Tools"))
(add-to-list 'TeX-view-program-list ("PDF Tools" "TeX-pdf-tools-sync-view"))
(add-to-list 'TeX-view-program-selection '(output-pdf "PDF Tools"))
;; Enable auto reverting the PDF document with PDF Tools
(add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer)))
@ -124,8 +124,8 @@
:init
(setq latex-preview-pane-multifile-mode 'auctex)
:config
(map-put TeX-view-program-list "preview-pane" '(latex-preview-pane-mode))
(map-put TeX-view-program-selection 'output-pdf '("preview-pane"))
(add-to-list 'TeX-view-program-list '("preview-pane" latex-preview-pane-mode))
(add-to-list 'TeX-view-program-selection '(output-pdf "preview-pane"))
(define-key! doc-view-mode-map
(kbd "ESC") #'delete-window
"q" #'delete-window

View file

@ -1,5 +1,8 @@
;;; lang/lua/config.el -*- lexical-binding: t; -*-
;; sp's default rules are obnoxious, so disable them
(provide 'smartparens-lua)
(after! lua-mode
(set-lookup-handlers! 'lua-mode :documentation 'lua-search-documentation)
(set-electric! 'lua-mode :words '("else" "end"))

View file

@ -3,6 +3,9 @@
(def-package! markdown-mode
:mode ("/README\\(?:\\.\\(?:markdown\\|md\\)\\)?\\'" . gfm-mode)
:init
(when (featurep! +pandoc)
(setq markdown-command "pandoc --from=markdown --to=html --standalone --mathjax --highlight-style=pygments"))
(setq markdown-enable-wiki-links t
markdown-italic-underscore t
markdown-asymmetric-header t
@ -47,3 +50,10 @@
:nv "t" #'markdown-toc-generate-toc
:nv "i" #'markdown-insert-image
:nv "l" #'markdown-insert-link)))
(def-package! pandoc-mode
:when (featurep! +pandoc)
:commands
pandoc-mode
:hook
(markdown-mode . conditionally-turn-on-pandoc))

View file

@ -0,0 +1,6 @@
;; -*- lexical-binding: t; no-byte-compile: t; -*-
;;; lang/markdown/doctor.el
(when (featurep! +pandoc)
(unless (executable-find "pandoc")
(warn! "Couldn't find pandoc, markdown-mode may have issues")))

View file

@ -4,3 +4,7 @@
(package! markdown-mode)
(package! markdown-toc)
(when (featurep! +pandoc)
(package! pandoc-mode))

View file

@ -36,7 +36,7 @@ string). Stops at the first function to return non-nil.")
(or (cdr (assq lang +org-babel-mode-alist))
lang)))
nil t)))
(map-put org-babel-load-languages lang t))
(add-to-list 'org-babel-load-languages (cons lang t)))
t)))
(advice-add #'org-babel-confirm-evaluate :around #'+org*babel-lazy-load-library)

View file

@ -25,17 +25,15 @@
:when (featurep! :feature evil +everywhere)
:hook (org-mode . evil-org-mode)
:init
(setq evil-org-key-theme '(navigation insert textobjects))
(defvar evil-org-key-theme '(navigation insert textobjects))
(add-hook 'org-load-hook #'+org|setup-evil)
(add-hook 'evil-org-mode-hook #'evil-normalize-keymaps)
:config
;; in case it is called later
(advice-add #'evil-org-set-key-theme :after #'+org|setup-evil))
(def-package! evil-org-agenda
:when (featurep! :feature evil +everywhere)
:after org-agenda
:config (evil-org-agenda-set-keys))
(advice-add #'evil-org-set-key-theme :after #'+org|setup-evil)
(def-package! evil-org-agenda
:after org-agenda
:config (evil-org-agenda-set-keys)))
;;
@ -266,8 +264,10 @@ between the two."
[remap doom/backward-to-bol-or-indent] #'org-beginning-of-line
[remap doom/forward-to-last-non-comment-or-eol] #'org-end-of-line))
(defun +org|setup-evil (&rest _)
(require 'evil-org)
(defun +org|setup-evil (&rest args)
;; In case this hook is used in an advice on `evil-org-set-key-theme', this
;; prevents recursive requires.
(unless args (require 'evil-org))
;; By default, TAB cycles the visibility of all children under the current
;; tree between three states. I want to toggle the tree between two states,
;; without affecting its children.
@ -341,7 +341,7 @@ between the two."
(defun +org|setup-hacks ()
"Getting org to behave."
;; Don't open separate windows
(map-put org-link-frame-setup 'file #'find-file)
(setf (alist-get 'file org-link-frame-setup) #'find-file)
;; Let OS decide what to do with files when opened
(setq org-file-apps
`(("pdf" . default)

View file

@ -22,9 +22,9 @@
(setq sh-indent-after-continuation 'always)
;; recognize function names with dashes in them
(map-put sh-imenu-generic-expression
'sh '((nil "^\\s-*function\\s-+\\([[:alpha:]_-][[:alnum:]_-]*\\)\\s-*\\(?:()\\)?" 1)
(nil "^\\s-*\\([[:alpha:]_-][[:alnum:]_-]*\\)\\s-*()" 1)))
(add-to-list 'sh-imenu-generic-expression
'(sh (nil "^\\s-*function\\s-+\\([[:alpha:]_-][[:alnum:]_-]*\\)\\s-*\\(?:()\\)?" 1)
(nil "^\\s-*\\([[:alpha:]_-][[:alnum:]_-]*\\)\\s-*()" 1)))
;; `sh-set-shell' is chatty about setting up indentation rules
(advice-add #'sh-set-shell :around #'doom*shut-up)

View file

@ -3,10 +3,6 @@
;; An improved newline+continue comment function
(setq-hook! css-mode comment-indent-function #'+css/comment-indent-new-line)
(after! smartparens
(sp-with-modes '(css-mode scss-mode less-css-mode stylus-mode)
(sp-local-pair "/*" "*/" :post-handlers '(("||\n[i]" "RET") ("| " "SPC")))))
(map! :map* (css-mode-map scss-mode-map less-css-mode-map)
:localleader
:n "rb" #'+css/toggle-inline-or-block)

View file

@ -16,7 +16,25 @@
:mode "templates/.+\\.php$"
:config
(setq web-mode-enable-html-entities-fontification t
web-mode-enable-auto-quoting nil)
web-mode-auto-close-style 2)
(after! smartparens
;; let smartparens handle these
(setq web-mode-enable-auto-quoting nil
web-mode-enable-auto-pairing t)
;; Remove web-mode auto pairs that end with >, because smartparens autopairs
;; them, causing duplicates. Also remove truncated autopairs, like <?p and
;; hp ?>.
(dolist (alist web-mode-engines-auto-pairs)
(setcdr alist (delq nil
(mapcar (lambda (pair)
(unless (string-match-p "^[a-z-]" (cdr pair))
(cons (car pair)
(if (equal (substring (cdr pair) -1) ">")
(substring (cdr pair) 0 -1)
(cdr pair)))))
(cdr alist)))))
(setf (alist-get nil web-mode-engines-auto-pairs) nil))
(map! :map web-mode-map
(:localleader